Skip to content

Commit

Permalink
fix(frontend): 数据导出入口控制逻辑修复 #6696
Browse files Browse the repository at this point in the history
  • Loading branch information
jinquantianxia committed Sep 6, 2024
1 parent ef8b642 commit d2dfef5
Show file tree
Hide file tree
Showing 7 changed files with 58 additions and 84 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@

<script setup lang="tsx">
import { InfoBox } from 'bkui-vue';
import type { ISearchItem } from 'bkui-vue/lib/search-select/utils';
import _ from 'lodash';
import type { Emitter } from 'mitt';
import { useI18n } from 'vue-i18n';
Expand Down Expand Up @@ -183,8 +184,6 @@

import ClusterReplace from './components/Replace.vue';

import type { SearchSelectItem } from '@/types/bkui-vue';

const route = useRoute();
const router = useRouter();
const ticketMessage = useTicketMessage();
Expand Down Expand Up @@ -569,7 +568,7 @@
resumeFetchTableData();
});

const getMenuList = async (item: SearchSelectItem | undefined, keyword: string) => {
const getMenuList = async (item: ISearchItem | undefined, keyword: string) => {
if (item?.id !== 'creator' && keyword) {
return getMenuListSearch(item, keyword, searchSelectData.value, searchValue.value);
}
Expand Down
37 changes: 15 additions & 22 deletions dbm-ui/frontend/src/views/mysql/ha-cluster-list/components/List.vue
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@

<script setup lang="tsx">
import { InfoBox, Message } from 'bkui-vue';
import type { ISearchItem } from 'bkui-vue/lib/search-select/utils';
import { useI18n } from 'vue-i18n';

import type { MySQLFunctions } from '@services/model/function-controller/functionController';
Expand Down Expand Up @@ -175,11 +176,6 @@
isRecentDays,
} from '@utils';

import type {
SearchSelectData,
SearchSelectItem,
} from '@types/bkui-vue';

interface ColumnData {
cell: string,
data: TendbhaModel
Expand Down Expand Up @@ -327,7 +323,7 @@
multiple: true,
children: searchAttrs.value.time_zone,
},
] as SearchSelectData);
]);

const tableOperationWidth = computed(() => {
if (!isStretchLayoutOpen.value) {
Expand Down Expand Up @@ -773,21 +769,18 @@
onClick={() => handleGoWebconsole(data.id)}>
Webconsole
</auth-button>
<OperationBtnStatusTips
data={data}
v-db-console="mysql.haClusterList.exportData">
<auth-button
action-id="mysql_dump_data"
resource={data.id}
permission={data.permission.mysql_dump_data}
disabled={data.operationDisabled}
text
theme="primary"
class="mr-16"
onClick={() => handleShowDataExportSlider(data)}>
{ t('导出数据') }
</auth-button>
</OperationBtnStatusTips>
<auth-button
v-db-console="mysql.haClusterList.exportData"
action-id="mysql_dump_data"
resource={data.id}
permission={data.permission.mysql_dump_data}
disabled={data.isOffline}
text
theme="primary"
class="mr-16"
onClick={() => handleShowDataExportSlider(data)}>
{ t('导出数据') }
</auth-button>
<MoreActionExtend v-db-console="mysql.haClusterList.moreOperation">
{{
default: () => <>
Expand Down Expand Up @@ -886,7 +879,7 @@
updateTableSettings,
} = useTableSettings(UserPersonalSettings.TENDBHA_TABLE_SETTINGS, defaultSettings);

const getMenuList = async (item: SearchSelectItem | undefined, keyword: string) => {
const getMenuList = async (item: ISearchItem | undefined, keyword: string) => {
if (item?.id !== 'creator' && keyword) {
return getMenuListSearch(item, keyword, searchSelectData.value, searchValue.value);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@

<script setup lang="tsx">
import { InfoBox, Message } from 'bkui-vue';
import type { ISearchItem } from 'bkui-vue/lib/search-select/utils';
import { useI18n } from 'vue-i18n';
import {
useRoute,
Expand Down Expand Up @@ -158,11 +159,6 @@
isRecentDays,
} from '@utils';

import type {
SearchSelectData,
SearchSelectItem,
} from '@types/bkui-vue';

interface ColumnData {
cell: string,
data: TendbsingleModel
Expand Down Expand Up @@ -594,21 +590,18 @@
onClick={() => handleGoWebconsole(data.id)}>
Webconsole
</auth-button>
<OperationBtnStatusTips
data={data}
v-db-console="mysql.singleClusterList.exportData">
<auth-button
action-id="mysql_dump_data"
permission={data.permission.mysql_dump_data}
resource={data.id}
disabled={data.operationDisabled}
text
theme="primary"
class="mr-16"
onClick={() => handleShowDataExportSlider(data)}>
{ t('导出数据') }
</auth-button>
</OperationBtnStatusTips>
<auth-button
v-db-console="mysql.singleClusterList.exportData"
action-id="mysql_dump_data"
permission={data.permission.mysql_dump_data}
resource={data.id}
disabled={data.isOffline}
text
theme="primary"
class="mr-16"
onClick={() => handleShowDataExportSlider(data)}>
{ t('导出数据') }
</auth-button>
<MoreActionExtend v-db-console="mysql.singleClusterList.moreOperation">
{{
default: () => <>
Expand Down Expand Up @@ -692,9 +685,9 @@
updateTableSettings,
} = useTableSettings(UserPersonalSettings.TENDBSINGLE_TABLE_SETTINGS, defaultSettings);

const getMenuList = async (item: SearchSelectItem | undefined, keyword: string) => {
const getMenuList = async (item: ISearchItem | undefined, keyword: string) => {
if (item?.id !== 'creator' && keyword) {
return getMenuListSearch(item, keyword, searchSelectData.value as SearchSelectData, searchValue.value);
return getMenuListSearch(item, keyword, searchSelectData.value, searchValue.value);
}

// 没有选中过滤标签
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@
<script setup lang="tsx">
import { Message } from 'bkui-vue';
import InfoBox from 'bkui-vue/lib/info-box';
import type { ISearchItem } from 'bkui-vue/lib/search-select/utils';
import _ from 'lodash'
import { useI18n } from 'vue-i18n';

Expand Down Expand Up @@ -193,11 +194,6 @@
messageWarn,
} from '@utils';

import type {
SearchSelectData,
SearchSelectItem,
} from '@/types/bkui-vue';

const clusterId = defineModel<number>('clusterId');

const { t, locale } = useI18n();
Expand Down Expand Up @@ -379,7 +375,7 @@
multiple: true,
children: searchAttrs.value.time_zone,
},
] as SearchSelectData);
]);

const paginationExtra = computed(() => {
if (isStretchLayoutOpen.value) {
Expand Down Expand Up @@ -1012,7 +1008,7 @@
updateTableSettings,
} = useTableSettings(UserPersonalSettings.REDIS_HA_TABLE_SETTINGS, defaultSettings);

const getMenuList = async (item: SearchSelectItem | undefined, keyword: string) => {
const getMenuList = async (item: ISearchItem | undefined, keyword: string) => {
if (item?.id !== 'creator' && keyword) {
return getMenuListSearch(item, keyword, searchSelectData.value, searchValue.value);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@
</template>
<script setup lang="tsx">
import { InfoBox } from 'bkui-vue';
import type { ISearchItem } from 'bkui-vue/lib/search-select/utils';
import {
onMounted,
ref,
Expand Down Expand Up @@ -109,8 +110,6 @@
messageSuccess,
} from '@utils';
import type { SearchSelectItem } from '@/types/bkui-vue';
const router = useRouter();
const copy = useCopy();
const { t } = useI18n();
Expand Down Expand Up @@ -340,7 +339,7 @@
});
};
const getMenuList = async (item: SearchSelectItem | undefined, keyword: string) => {
const getMenuList = async (item: ISearchItem | undefined, keyword: string) => {
if (item?.id !== 'operator' && keyword) {
return getMenuListSearch(item, keyword, searchSelectData.value, searchValue.value);
}
Expand Down
10 changes: 4 additions & 6 deletions dbm-ui/frontend/src/views/resource-manage/record/Index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
v-model="operationDateTime"
append-to-body
clearable
:placeholder="$t('请选择操作时间')"
:placeholder="t('请选择操作时间')"
type="datetimerange"
@change="handleDateChange" />
<DbSearchSelect
Expand All @@ -30,6 +30,7 @@
</div>
</template>
<script setup lang="tsx">
import type { ISearchItem } from 'bkui-vue/lib/search-select/utils';
import dayjs from 'dayjs';
import { useI18n } from 'vue-i18n';
import { useRequest } from 'vue-request';
Expand All @@ -46,9 +47,6 @@
import HostDetail from './components/HostDetail.vue';
// const router = useRouter();
import type { SearchSelectItem } from '@/types/bkui-vue';
const route = useRoute();
const { t } = useI18n();
Expand Down Expand Up @@ -141,7 +139,7 @@
name: t('操作人'),
id: 'operator',
},
]);
] as ISearchItem[]);
const tableColumn = computed(() => [
{
Expand Down Expand Up @@ -299,7 +297,7 @@
},
});
const getMenuList = async (item: SearchSelectItem | undefined, keyword: string) => {
const getMenuList = async (item: ISearchItem | undefined, keyword: string) => {
if (item?.id !== 'operator' && keyword) {
return getMenuListSearch(item, keyword, searchSelectData.value, searchValue.value);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,10 @@
<script setup lang="tsx">
import { Checkbox, Message } from 'bkui-vue';
import InfoBox from 'bkui-vue/lib/info-box';
// import CapacityChange from './components/CapacityChange.vue';
// import ScaleUp from './components/ScaleUp.vue';
// import Shrink from './components/Shrink.vue';
import type { ISearchItem } from 'bkui-vue/lib/search-select/utils';
import { useI18n } from 'vue-i18n';
import {
useRoute,
Expand Down Expand Up @@ -196,11 +200,6 @@
messageWarn,
} from '@utils';

// import CapacityChange from './components/CapacityChange.vue';
// import ScaleUp from './components/ScaleUp.vue';
// import Shrink from './components/Shrink.vue';
import type { SearchSelectItem } from '@/types/bkui-vue';

interface IColumn {
data: TendbClusterModel
}
Expand Down Expand Up @@ -915,21 +914,18 @@
onClick={() => handleGoWebconsole(data.id)}>
Webconsole
</auth-button>,
<OperationBtnStatusTips
data={data}
v-db-console="tendbCluster.clusterManage.exportData">
<auth-button
action-id="tendbcluster_dump_data"
permission={data.permission.tendbcluster_dump_data}
resource={data.id}
disabled={data.operationDisabled}
text
theme="primary"
class="mr-16"
onClick={() => handleShowDataExportSlider(data)}>
{ t('导出数据') }
</auth-button>
</OperationBtnStatusTips>
<auth-button
v-db-console="tendbCluster.clusterManage.exportData"
action-id="tendbcluster_dump_data"
permission={data.permission.tendbcluster_dump_data}
resource={data.id}
disabled={data.isOffline}
text
theme="primary"
class="mr-16"
onClick={() => handleShowDataExportSlider(data)}>
{ t('导出数据') }
</auth-button>
];
return operations;
};
Expand Down Expand Up @@ -1034,7 +1030,7 @@
},
]);

const getMenuList = async (item: SearchSelectItem | undefined, keyword: string) => {
const getMenuList = async (item: ISearchItem | undefined, keyword: string) => {
if (item?.id !== 'creator' && keyword) {
return getMenuListSearch(item, keyword, searchSelectData.value, searchValue.value);
}
Expand Down

0 comments on commit d2dfef5

Please sign in to comment.