Skip to content

Commit

Permalink
fix(frontend): sqlserver目标集群回显问题修复 TencentBlueKing#8324
Browse files Browse the repository at this point in the history
  • Loading branch information
jinquantianxia authored and iSecloud committed Dec 2, 2024
1 parent 8113030 commit 3a857db
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,8 @@
};

const handelClusterChange = (selected: { [key: string]: Array<SqlServerSingleModel | SqlServerHaModel> }) => {
const [clusterData] = Object.values(selected)[0];
const list = Object.values(selected).filter((item) => item.length > 0);
const [clusterData] = list[0];
modelValue.value = {
id: clusterData.id,
cloudId: clusterData.bk_cloud_id,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,9 @@
};

const handelClusterChange = (selected: { [key: string]: Array<SqlServerSingleModel | SqlServerHaModel> }) => {
const list = Object.values(selected).filter((item) => item.length > 0);
selectedClusters.value = selected;
const [clusterData] = Object.values(selected)[0];
const [clusterData] = list[0];
modelValue.value = {
id: clusterData.id,
cloudId: clusterData.bk_cloud_id,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@
render-directive="if"
:title="t('执行SQL变更_内容详情')"
:width="960"
:z-index="99999"
@closed="handleClose">
<template
v-if="currentExecuteObject"
Expand Down Expand Up @@ -162,18 +161,20 @@
ticketDetails: TicketModel<MySQLImportSQLFileDetails>
}

const props = defineProps<Props>();

type backupDBItem = {
backup_on: string,
db_patterns: [],
table_patterns: [],
}

type RowData = MySQLImportSQLFileDetails['execute_objects'][number];

const props = defineProps<Props>();

const { t } = useI18n();

const selectFileName = ref('');
const currentExecuteObject = ref<MySQLImportSQLFileDetails['execute_objects'][number]>();
const currentExecuteObject = ref<RowData>();
const fileContentMap = shallowRef<Record<string, string>>({});
const isShow = ref(false);

Expand Down Expand Up @@ -232,8 +233,13 @@
{
label: t('变更的DB'),
field: 'dbnames',
showOverflowTooltip: false,
render: ({ data }: { data: MySQLImportSQLFileDetails['execute_objects'][number] }) => (
showOverflowTooltip: {
content: (_: unknown, rowData: RowData) => rowData.ignore_dbnames.join(', '),
popoverOption: {
maxWidth: 1000,
}
},
render: ({ data }: { data: RowData }) => (
<>
{data.dbnames.map(item => (
<bk-tag key={item}>
Expand All @@ -246,8 +252,13 @@
{
label: t('忽略的DB'),
field: 'ignore_dbnames',
showOverflowTooltip: false,
render: ({ data }: { data: MySQLImportSQLFileDetails['execute_objects'][number] }) => data.ignore_dbnames.length > 0 ? (
showOverflowTooltip: {
content: (_: unknown, rowData: RowData) => rowData.ignore_dbnames.join(', '),
popoverOption: {
maxWidth: 1000,
}
},
render: ({ data }: { data: RowData }) => data.ignore_dbnames.length > 0 ? (
<>
{data.ignore_dbnames.map(item => (
<bk-tag key={item}>
Expand All @@ -260,8 +271,8 @@
{
label: t('执行的 SQL'),
field: 'sql_files',
showOverflowTooltip: false,
render: ({ data }: { data: MySQLImportSQLFileDetails['execute_objects'][number] }) => {
showOverflowTooltip: true,
render: ({ data }: { data: RowData }) => {
const firstFileName = data.sql_files[0];
const fileTotal = data.sql_files.length;

Expand Down Expand Up @@ -374,7 +385,7 @@
}, {});
}
})
const handleSelectFile = (filename: string, executeObject: MySQLImportSQLFileDetails['execute_objects'][number]) => {
const handleSelectFile = (filename: string, executeObject: RowData) => {
if (_.isEmpty(fileContentMap.value)){
runBatchFetchFile();
}
Expand Down

0 comments on commit 3a857db

Please sign in to comment.