Skip to content

Commit

Permalink
fix(frontend): po环境sql执行有关的非法请求新增开关控制 TencentBlueKing#6625
Browse files Browse the repository at this point in the history
  • Loading branch information
jinquantianxia committed Sep 3, 2024
1 parent 07b8b9d commit faee40e
Show file tree
Hide file tree
Showing 7 changed files with 44 additions and 183 deletions.
7 changes: 4 additions & 3 deletions dbm-ui/frontend/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,16 @@
import { useSQLTaskNotify } from '@hooks';
import { useFunController, useUserProfile } from '@stores';
import { useUserProfile } from '@stores';
import DbRouterView from '@components/db-router-view/Index.vue';
import LocaleSwitch from '@components/locale-switch/Index.vue';
import RouterBack from '@components/router-back/Index.vue';
import SystemSearch from '@components/system-search/Index.vue';
import SystemVersionLog from '@components/system-version-log/Index.vue';
import { checkDbConsole } from '@utils';
import NoticeComponent from '@blueking/notice-component';
import Layout from './layout/Index.vue';
Expand All @@ -81,7 +83,6 @@
const userProfileStore = useUserProfile();
userProfileStore.fetchProfile();
const { t, locale } = useI18n();
const { funControllerData } = useFunController();
const documentTitles: Record<string, string> = {
en: 'DBM | Tencent BlueKing',
Expand Down Expand Up @@ -123,7 +124,7 @@
};
onMounted(() => {
if (funControllerData.getFlatData('mysql').toolbox) {
if (checkDbConsole('mysql.toolbox.sqlExecute') || checkDbConsole('tendbCluster.toolbox.sqlExecute')) {
useSQLTaskNotify();
}
});
Expand Down
28 changes: 16 additions & 12 deletions dbm-ui/frontend/src/views/mysql/common/hooks/useTaskCount.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ import { deleteUserSemanticTasks, getUserSemanticTasks } from '@services/source/

import { useSQLTaskCount } from '@stores';

import { checkDbConsole } from '@utils';

import { useTimeoutPoll } from '@vueuse/core';

export const useTaskCount = (clusterType: string) => {
Expand Down Expand Up @@ -60,19 +62,21 @@ export const useTaskCount = (clusterType: string) => {
};

const fetchData = () => {
getUserSemanticTasks({
cluster_type: clusterType,
}).then((data) => {
if (taskCountStore.isPolling === false) {
resume();
taskCountStore.isPolling = true;
}

taskCountStore.taskList = data;
nextTick(() => {
initPopover();
if (checkDbConsole('mysql.toolbox.sqlExecute') || checkDbConsole('tendbCluster.toolbox.sqlExecute')) {
getUserSemanticTasks({
cluster_type: clusterType,
}).then((data) => {
if (taskCountStore.isPolling === false) {
resume();
taskCountStore.isPolling = true;
}

taskCountStore.taskList = data;
nextTick(() => {
initPopover();
});
});
});
}
};

fetchData();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -765,7 +765,7 @@
action-id="mysql_webconsole"
resource={data.id}
permission={data.permission.mysql_webconsole}
disabled={data.operationDisabled}
disabled={data.isOffline}
text
theme="primary"
class="mr-8"
Expand Down
26 changes: 11 additions & 15 deletions dbm-ui/frontend/src/views/redis/list/components/list/Index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -854,21 +854,17 @@
render: ({ data }: ColumnRenderData) => {
const getOperations = (theme = 'primary') => {
const baseOperations = [
<OperationBtnStatusTips
v-db-console="redis.clusterManage.webconsole"
data={data}>
<auth-button
action-id="redis_webconsole"
resource={data.id}
permission={data.permission.redis_webconsole}
disabled={data.operationDisabled}
text
theme="primary"
class="mr-8"
onClick={() => handleGoWebconsole(data.id)}>
Webconsole
</auth-button>
</OperationBtnStatusTips>,
<auth-button
action-id="redis_webconsole"
resource={data.id}
permission={data.permission.redis_webconsole}
disabled={data.isOffline}
text
theme="primary"
class="mr-8"
onClick={() => handleGoWebconsole(data.id)}>
Webconsole
</auth-button>,
<OperationBtnStatusTips
v-db-console="redis.clusterManage.backup"
data={data}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,6 @@
class="text-overflow">
{{ item.name }}
</span>
<TaskCount
v-if="item.id === 'MySQLExecute'"
class="count" />
</div>
<DbIcon
v-bk-tooltips="favorMap[item.id] ? t('从导航移除') : t('收藏至导航')"
Expand Down Expand Up @@ -68,8 +65,6 @@
import { encodeRegexp, messageSuccess } from '@utils';
import TaskCount from './TaskCount.vue';
interface Props {
id: string;
draggable: boolean;
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -903,20 +903,18 @@
onClick={() => handleShowAuthorize([data])}>
{ t('授权') }
</bk-button>,
<OperationBtnStatusTips data={data}>
<auth-button
v-db-console="tendbCluster.clusterManage.webconsole"
action-id="tendbcluster_webconsole"
resource={data.id}
permission={data.permission.tendbcluster_webconsole}
disabled={data.operationDisabled}
text
theme="primary"
class="mr-8"
onClick={() => handleGoWebconsole(data.id)}>
Webconsole
</auth-button>
</OperationBtnStatusTips>,
<auth-button
v-db-console="tendbCluster.clusterManage.webconsole"
action-id="tendbcluster_webconsole"
resource={data.id}
permission={data.permission.tendbcluster_webconsole}
disabled={data.isOffline}
text
theme="primary"
class="mr-8"
onClick={() => handleGoWebconsole(data.id)}>
Webconsole
</auth-button>,
<OperationBtnStatusTips
data={data}
v-db-console="tendbCluster.clusterManage.exportData">
Expand Down

0 comments on commit faee40e

Please sign in to comment.