feat: add database, role & privilege management
Add Admin sidebar tab with database/role management panels, role manager workspace tab, and privilege dialogs. Backend provides 10 new Tauri commands for CRUD on databases, roles, and privileges with read-only mode enforcement. Context menus on schema tree nodes allow dropping databases and viewing/granting table privileges. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -8,6 +8,14 @@ import type {
|
||||
ConstraintInfo,
|
||||
IndexInfo,
|
||||
HistoryEntry,
|
||||
DatabaseInfo,
|
||||
CreateDatabaseParams,
|
||||
RoleInfo,
|
||||
CreateRoleParams,
|
||||
AlterRoleParams,
|
||||
TablePrivilege,
|
||||
GrantRevokeParams,
|
||||
RoleMembershipParams,
|
||||
} from "@/types";
|
||||
|
||||
// Connections
|
||||
@@ -162,3 +170,34 @@ export const exportJson = (
|
||||
columns: string[],
|
||||
rows: unknown[][]
|
||||
) => invoke<void>("export_json", { path, columns, rows });
|
||||
|
||||
// Management
|
||||
export const getDatabaseInfo = (connectionId: string) =>
|
||||
invoke<DatabaseInfo[]>("get_database_info", { connectionId });
|
||||
|
||||
export const createDatabase = (connectionId: string, params: CreateDatabaseParams) =>
|
||||
invoke<void>("create_database", { connectionId, params });
|
||||
|
||||
export const dropDatabase = (connectionId: string, name: string) =>
|
||||
invoke<void>("drop_database", { connectionId, name });
|
||||
|
||||
export const listRoles = (connectionId: string) =>
|
||||
invoke<RoleInfo[]>("list_roles", { connectionId });
|
||||
|
||||
export const createRole = (connectionId: string, params: CreateRoleParams) =>
|
||||
invoke<void>("create_role", { connectionId, params });
|
||||
|
||||
export const alterRole = (connectionId: string, params: AlterRoleParams) =>
|
||||
invoke<void>("alter_role", { connectionId, params });
|
||||
|
||||
export const dropRole = (connectionId: string, name: string) =>
|
||||
invoke<void>("drop_role", { connectionId, name });
|
||||
|
||||
export const getTablePrivileges = (connectionId: string, schema: string, table: string) =>
|
||||
invoke<TablePrivilege[]>("get_table_privileges", { connectionId, schema, table });
|
||||
|
||||
export const grantRevoke = (connectionId: string, params: GrantRevokeParams) =>
|
||||
invoke<void>("grant_revoke", { connectionId, params });
|
||||
|
||||
export const manageRoleMembership = (connectionId: string, params: RoleMembershipParams) =>
|
||||
invoke<void>("manage_role_membership", { connectionId, params });
|
||||
|
||||
Reference in New Issue
Block a user