Skip to content

Commit

Permalink
fix(frontend): 权限问题修复 #3682
Browse files Browse the repository at this point in the history
# Reviewed, transaction id: 8290
  • Loading branch information
hLinx authored and iSecloud committed May 21, 2024
1 parent f352e6c commit b7cb282
Show file tree
Hide file tree
Showing 11 changed files with 48 additions and 49 deletions.
2 changes: 1 addition & 1 deletion dbm-ui/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"@blueking/bkflow.js": "0.1.10",
"@blueking/date-picker": "0.0.72",
"@blueking/ip-selector": "0.0.1-beta.138",
"@blueking/notice-component": "2.0.0",
"@blueking/notice-component": "2.0.4",
"@blueking/sub-saas": "^0.0.0-beta.6",
"@icon-cool/bk-icon-bk-biz-components": "0.0.4",
"@vueuse/core": "10.9.0",
Expand Down
1 change: 1 addition & 0 deletions dbm-ui/frontend/src/services/model/redis/redis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ export default class Redis {
title: string;
}[];
permission: {
redis_access_entry_view: boolean;
redis_backup: boolean;
redis_destroy: boolean;
redis_keys_delete: boolean;
Expand Down
22 changes: 11 additions & 11 deletions dbm-ui/frontend/src/services/source/redis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,16 +116,16 @@ export function getRedisTableFields() {
* 获取集群实例列表
*/
export function getRedisInstances(params: {
limit?: number,
offset?: number,
instance_address?: string,
ip?: string,
port?: number,
domain?: string,
status?: string,
role?: string,
cluster_id?: number,
cluster_type?: string
limit?: number;
offset?: number;
instance_address?: string;
ip?: string;
port?: number;
domain?: string;
status?: string;
role?: string;
cluster_id?: number;
cluster_type?: string;
}) {
return http.get<ListBase<RedisInstanceModel[]>>(`${getRootPath()}/list_instances/`, params).then((data) => ({
...data,
Expand Down Expand Up @@ -182,7 +182,7 @@ export function getRedisTopoGraph(params: { cluster_id: number }) {
* 获取业务拓扑树
*/
export function getRedisResourceTree(params: { cluster_type: string }) {
return http.get<BizConfTopoTreeModel[]>(`${getRootPath()}/resource_tree/`, params);
return http.get<BizConfTopoTreeModel[]>(`/apis/redis/bizs/${window.PROJECT_CONFIG.BIZ_ID}/resource_tree/`, params);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion dbm-ui/frontend/src/views/db-configure/platform/List.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<template>
<div class="platform-db-configure-page">
<TopTab @change="handleChangeTab" />
<ApplyPermissionCatch>
<ApplyPermissionCatch :key="state.clusterType">
<div class="configure-content">
<BkTab
v-show="showTabs"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@
headerAlign: 'center',
contentAlign: 'center',
footerAlign: 'center',
onClosed: () => reject(),
onCancel: () => reject(),
onConfirm: () => {
const nodeData = {};
if (ipSource.value === 'manual_input') {
Expand Down
32 changes: 13 additions & 19 deletions dbm-ui/frontend/src/views/monitor-alarm-db/alarm-group/Index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -191,13 +191,6 @@
label: t('操作'),
width: 180,
render: ({ data }: TableRenderData) => {
const tipDisabled = !data.is_built_in;
const btnDisabled = data.is_built_in || data.used_count > 0;
const tips = {
disabled: tipDisabled,
content: t('内置告警不支持删除'),
};

const editBtnPermissionInfo = {
actionId: data.is_built_in ? 'global_notify_group_update' : 'notify_group_update',
permission: data.is_built_in ? 'global_notify_group_update' : data.permission.global_notify_group_update
Expand All @@ -223,18 +216,19 @@
onClick={ () => handleOpenDetail('copy', data) }>
{ t('克隆') }
</auth-button>
<span v-bk-tooltips={ tips }>
<auth-button
action-id="notify_group_delete"
resource={data.id}
permission={data.permission.notify_group_delete}
text
disabled={ btnDisabled }
theme="primary"
onClick={ () => handleDelete(data.id) }>
{ t('删除') }
</auth-button>
</span>
{
!data.is_built_in && (
<auth-button
action-id="notify_group_delete"
resource={data.id}
permission={data.permission.notify_group_delete}
text
theme="primary"
onClick={ () => handleDelete(data.id) }>
{ t('删除') }
</auth-button>
)
}
</>
);
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,7 @@
action-id="monitor_policy_delete"
results={data.permission.monitor_policy_delete}
permission={data.permission.monitor_policy_delete}
resource={data.id}
onClick={() => handleClickDelete(data)}>
{t('删除')}
</auth-button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@
<span>
<auth-button
action-id="tbinlogdumper_enable_disable"
resource={data.source_cluster?.id}
resource={data.cluster_id}
permission={data.permission.tbinlogdumper_enable_disable}
text
disabled={data.isOperating}
Expand All @@ -391,7 +391,7 @@
<span>
<auth-button
action-id="tbinlogdumper_reduce_nodes"
resource={data.id}
resource={data.cluster_id}
permission={data.permission.tbinlogdumper_reduce_nodes}
text
disabled={data.isOperating}
Expand Down
26 changes: 14 additions & 12 deletions dbm-ui/frontend/src/views/mysql/openarea/template/Index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -96,20 +96,22 @@
}}>
{ t('编辑') }
</auth-router-link>
<db-popconfirm
title={t('确认删除该模板?')}
content={t('删除操作无法撤回,请谨慎操作!')}
confirmHandler={() => handleRemove(data)}>
<auth-button
<auth-template
action-id="mysql_openarea_config_destroy"
resource={data.id}
permission={data.permission.mysql_openarea_config_destroy}
class="ml-16"
text
theme="primary">
{ t('删除') }
</auth-button>
</db-popconfirm>
permission={data.permission.mysql_openarea_config_destroy}>
<db-popconfirm
title={t('确认删除该模板?')}
content={t('删除操作无法撤回,请谨慎操作!')}
confirmHandler={() => handleRemove(data)}>
<auth-button
class="ml-16"
text
theme="primary">
{ t('删除') }
</auth-button>
</db-popconfirm>
</auth-template>
</>
),
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -808,9 +808,9 @@
data={data}
disabled={!data.isOffline}>
<auth-button
action-id="access_entry_edit"
action-id="redis_access_entry_view"
resource={data.id}
permission={data.permission.access_entry_edit}
permission={data.permission.redis_access_entry_view}
style="width: 100%;height: 32px;"
disabled={data.isOffline}
text
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -693,6 +693,7 @@
permission={data.permission.tendbcluster_node_rebalance}
v-db-console="tendbCluster.clusterManage.clusterCapacityChange"
disabled={data.operationDisabled}
resource={data.id}
onClick={() => handleShowCapacityChange(data)}>
{ t('集群容量变更') }
</auth-button>
Expand Down

0 comments on commit b7cb282

Please sign in to comment.