Skip to content

Commit

Permalink
feat(frontend): 规则变更 #6224
Browse files Browse the repository at this point in the history
# Reviewed, transaction id: 23646
  • Loading branch information
JustaCattt authored and hLinx committed Nov 13, 2024
1 parent 8cb6577 commit 145d4db
Show file tree
Hide file tree
Showing 22 changed files with 679 additions and 167 deletions.
2 changes: 2 additions & 0 deletions dbm-ui/frontend/src/common/const/ticketTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ export enum TicketTypes {
MYSQL_LOCAL_UPGRADE = 'MYSQL_LOCAL_UPGRADE', // MySQL 原地升级
MYSQL_MIGRATE_UPGRADE = 'MYSQL_MIGRATE_UPGRADE', // MySQL 迁移升级
MYSQL_SLAVE_MIGRATE_UPGRADE = 'MYSQL_SLAVE_MIGRATE_UPGRADE', // MySQL 从库迁移升级
MYSQL_ACCOUNT_RULE_CHANGE = 'MYSQL_ACCOUNT_RULE_CHANGE', // MySQL 权限变更
}
export enum TicketTypes {
REDIS_CLUSTER_APPLY = 'REDIS_CLUSTER_APPLY',
Expand Down Expand Up @@ -114,6 +115,7 @@ export enum TicketTypes {
TENDBCLUSTER_RESTORE_SLAVE = 'TENDBCLUSTER_RESTORE_SLAVE', // spider 重建从库-新机重建
TENDBCLUSTER_DUMP_DATA = 'TENDBCLUSTER_DUMP_DATA', // spider 数据导出
TENDBCLUSTER_SEMANTIC_CHECK = 'TENDBCLUSTER_SEMANTIC_CHECK', // spider 模拟执行
TENDBCLUSTER_ACCOUNT_RULE_CHANGE = 'TENDBCLUSTER_ACCOUNT_RULE_CHANGE', // spider 权限变更
}
export enum TicketTypes {
MONGODB_DISABLE = 'MONGODB_DISABLE', // mongodb禁用
Expand Down
7 changes: 7 additions & 0 deletions dbm-ui/frontend/src/components/empty-status/EmptyStatus.vue
Original file line number Diff line number Diff line change
Expand Up @@ -72,3 +72,10 @@
const handleRefresh = () => emits('refresh');
const handleClearSearch = () => emits('clearSearch');
</script>

<style lang="less" scoped>
.bk-exception.bk-exception-part {
height: 260px;
padding-top: 48px;
}
</style>
28 changes: 27 additions & 1 deletion dbm-ui/frontend/src/locales/zh-cn.json
Original file line number Diff line number Diff line change
Expand Up @@ -3607,5 +3607,31 @@
"批量录入:按行录入,快速批量输入多个单元格的值": "批量录入:按行录入,快速批量输入多个单元格的值",
"高可用": "高可用",
"关联实例": "关联实例",
"变更类型": "变更类型",
"删除规则": "删除规则",
"账户名称": "账户名称",
"编辑中": "编辑中",
"权限规则_t_任务正在进行中": "权限规则{t}任务正在进行中",
"删除操作将发起单据,单据获得审批后才会执行删除": "删除操作将发起单据,单据获得审批后才会执行删除",
"修改": "修改",
"变更规则": "变更规则",
"修改成功后,不会影响已授权的实例,新增的授权将会按照最新的配置生效": "修改成功后,不会影响已授权的实例,新增的授权将会按照最新的配置生效",
"差异确认": "差异确认",
"请确认以下差异变化:": "请确认以下差异变化 :",
"变更前": "变更前",
"变更后": "变更后",
"不变": "不变",
"权限:新增n个,删除m个": "权限 : 新增 {0} 个,删除 {1} 个",
"权限类型": "权限类型",
"提交失败": "提交失败",
"编辑时只能单个,且不能有分隔符": "编辑时只能单个,且不能有分隔符",
"权限变更前后对比:新增n个,删除m个": "权限变更前后对比 : 新增 {0} 个,删除 {1} 个",
"预览权限": "预览权限",
"权限名称": "权限名称",
"访问的DB": "访问的DB",
"权限预览": "权限预览",
"账号下已存在该规则": "账号下已存在该规则",
"访问DB变更前后对比": "访问DB变更前后对比",
"DB名称支持通配符_如Data_区分大小写_多个使用英文逗号_分号或换行分隔": "DB名称支持通配符_如Data_区分大小写_多个使用英文逗号_分号或换行分隔",
"这行勿动!新增翻译请在上一行添加!": ""
}
}
18 changes: 17 additions & 1 deletion dbm-ui/frontend/src/services/model/ticket/details/mysql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for
* the specific language governing permissions and limitations under the License.
*/
import type { AuthorizePreCheckData } from '@services/types/permission';
import type { AccountRule, AccountRulePrivilege, AuthorizePreCheckData } from '@services/types/permission';

import type { DetailBase, DetailClusters, SpecInfo } from './common';

Expand Down Expand Up @@ -615,3 +615,19 @@ export interface MySQLMigrateUpgradeDetails extends DetailBase {
}[];
force: boolean;
}

/**
* MySQL 权限规则变更
*/
export interface MySQLAccountRuleChangeDetails extends DetailBase {
last_account_rules: AccountRule & {
userName: string;
};
action: 'change' | 'delete';
account_id: number;
access_db: string;
privilege: AccountRulePrivilege;
bk_biz_id: number;
account_type: string;
rule_id: number;
}
11 changes: 10 additions & 1 deletion dbm-ui/frontend/src/services/types/permission.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ export interface PermissionRuleInfo {
bk_biz_id: number;
create_time: string;
creator: string;
priv_ticket: {
action: 'delete' | 'change';
ticket_id: number;
};
privilege: string;
rule_id: number;
}
Expand Down Expand Up @@ -118,7 +122,7 @@ export interface PasswordPolicyIncludeRule {
*/
export interface AccountRule {
access_db: string;
privilege: AccountRulePrivilege;
privilege: AccountRulePrivilege | string;
account_id: number | null;
account_type?: AccountTypesValues;
}
Expand Down Expand Up @@ -149,6 +153,11 @@ export interface AuthorizePreCheckData {
user: string;
cluster_type: string;
cluster_ids?: number[];
privileges?: {
priv: string;
user: string;
access_db: string;
}[];
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@
appendTo: () => document.body,
theme: 'light',
maxWidth: 'none',
trigger: 'manual',
interactive: true,
arrow: true,
offset: [0, 8],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,6 @@
[ClusterTypes.SQLSERVER_SINGLE]: [],
[ClusterTypes.MONGO_REPLICA_SET]: [],
[ClusterTypes.MONGO_SHARED_CLUSTER]: [],
[ClusterTypes.MONGODB]: []
} as ClusterSelectorResult,
isShow: false,
tableProps: {
Expand Down
Loading

0 comments on commit 145d4db

Please sign in to comment.