refactor: 权限组简化为2组(readonly/write) + Transfer穿梭框选择数据库

- access_type 从3值(readonly/datachange/ddl)简化为2值(readonly/write)
- readonly=只读查看(关联只读/从库用于查询) write=写入变更(关联主库用于工单)
- 前端InstanceGroupPage重写: 2权限类型卡片+自定义Transfer穿梭框组件
- Transfer组件: 左侧可选数据库→右侧已授权数据库, 搜索/勾选/箭头移动
- role_permissions.py更新: 2值权限映射, get_accessible_instances按access_type过滤
- 后端schema/模型校验更新为readonly|write正则
- 15个测试全部通过
This commit is contained in:
logan committed 2026-05-24 19:27:04 +08:00
1 parent 8161bcf5b5
commit 4111e1eee8
6 files changed
+352 -316

No files matched your search

@@ -1,6 +1,7 @@
import { useState, useCallback, useEffect } from 'react';
import { X, Loader2 } from 'lucide-react';
import { instanceApi } from '@/api/instance';
import { instanceGroupApi } from '@/api/instanceGroup';
/* ------------------------------------------------------------------ */
/* Types */
@@ -15,6 +16,13 @@ interface InstanceData {
database: string;
env: string;
access_mode: string;
group_id?: number | null;
}
interface PermGroup {
id: number;
name: string;
access_type?: string;
}
interface Props {