Skip to content

Commit

Permalink
fix(frontend): 修复mysql添加proxy重复校验未标红提示问题 TencentBlueKing#8206
Browse files Browse the repository at this point in the history
# Reviewed, transaction id: 25106
  • Loading branch information
JustaCattt authored and iSecloud committed Nov 28, 2024
1 parent f810393 commit 23a4205
Show file tree
Hide file tree
Showing 10 changed files with 77 additions and 14 deletions.
1 change: 1 addition & 0 deletions dbm-ui/frontend/src/locales/zh-cn.json
Original file line number Diff line number Diff line change
Expand Up @@ -3654,5 +3654,6 @@
"每个分类最多显示 10 条记录,点击搜索可查看全部记录。": "每个分类最多显示 10 条记录,点击搜索可查看全部记录。",
"全站搜索,支持多对象,Shift + Enter 换行,Enter键开启搜索": "全站搜索,支持多对象,Shift + Enter 换行,Enter键开启搜索",
"全站搜索,支持多对象,Enter开启搜索": "全站搜索,支持多对象,Enter开启搜索",
"同主机关联的其他集群,勾选后一并添加": "同主机关联的其他集群,勾选后一并添加",
"这行勿动!新增翻译请在上一行添加!": ""
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
v-model="localDomain"
:placeholder="t('请输入集群域名或从表头批量选择')"
:rules="rules"
@blur="handleEditBlur"
@clear="handleEditClear"
@submit="handleEditSubmit" />
<div v-show="!isShowEdit">
<div
Expand Down Expand Up @@ -121,7 +123,9 @@
}

interface Exposes {
getValue: () => Array<number>;
getValue: () => {
cluster_ids: number[];
};
}

interface IClusterData {
Expand Down Expand Up @@ -333,16 +337,28 @@
});
};

const handleEditBlur = () => {
editRef.value.getValue().then(() => {
isShowEdit.value = false;
nextTick(() => {
initRelateClusterPopover();
});
});
};

const handleEditClear = () => {
clusterIdMemo[instanceKey] = {};
realateCheckedMap.value = {};
selectRelateClusterList.value = [];
};

// 提交编辑
const handleEditSubmit = (value: string) => {
if (!value) {
handleEditClear();
return;
}

isShowEdit.value = false;
nextTick(() => {
initRelateClusterPopover();
});
handleEditBlur();
};

// 显示管理集群列表
Expand Down Expand Up @@ -380,6 +396,8 @@
};
// 用户输入未完成验证
if (editRef.value) {
// 先切回编辑态才能正常校验
handleShowEdit();
return editRef.value.getValue().then(() => result);
}
// 用户输入错误
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,6 @@
bk_biz_id: currentBizId,
}).then((data) => {
window.changeConfirm = false;

router.push({
name: 'MySQLProxyAdd',
params: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,14 @@
}

interface Exposes {
getValue: () => Promise<Array<string>>;
getValue: () => Promise<{
new_proxy: {
bk_biz_id: number;
bk_host_id: number;
bk_cloud_id: number;
ip: string;
};
}>;
}

const props = defineProps<Props>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,15 @@
}

interface Exposes {
getValue: () => Promise<any>;
getValue: () => Promise<{
cluster_ids: number[];
new_proxy: {
bk_biz_id: number;
bk_host_id: number;
bk_cloud_id: number;
ip: string;
};
}>;
}

const props = defineProps<Props>();
Expand Down Expand Up @@ -128,7 +136,7 @@
emits('remove');
};

const getRowData = () => [clusterRef.value.getValue(), proxyRef.value.getValue()];
const getRowData = () => [clusterRef.value!.getValue(), proxyRef.value!.getValue()];

const handleClone = () => {
Promise.allSettled(getRowData()).then((rowData) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,18 @@
import RenderDataRow, { createRowData, type IDataRow } from './components/RenderData/Row.vue';

interface Exposes {
getValue(): Promise<any>;
getValue(): Promise<
{
cluster_ids: number[];
origin_proxy: IDataRow['originProxy'];
target_proxy: IDataRow['targetProxy'];
display_info: {
type: string;
related_instances: string[];
related_clusters: string[];
};
}[]
>;
reset(): void;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,11 @@
cluster_ids: number[];
origin_proxy: IDataRow['originProxy'];
target_proxy: IDataRow['targetProxy'];
display_info: {
type: string;
related_instances: string[];
related_clusters: string[];
};
}>;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,17 @@
import RenderRow, { createRowData, type IDataRow } from './components/RenderData/Row.vue';

interface Exposes {
getValue(): Promise<any>;
getValue(): Promise<
{
cluster_ids: number[];
origin_proxy: IDataRow['originProxy'];
target_proxy: IDataRow['targetProxy'];
display_info: {
type: string;
related_clusters: string[];
};
}[]
>;
reset(): void;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,10 @@
cluster_ids: number[];
origin_proxy: IDataRow['originProxy'];
target_proxy: IDataRow['targetProxy'];
display_info: {
type: string;
related_clusters: string[];
};
}>;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
width: 220,
},
{
label: t('同机关联集群'),
label: t('关联集群'),
field: 'relatedClusters',
width: 220,
render: ({ data }: { data: RowData }) => data.relatedClusters.map((item) => <p>{item}</p>),
Expand All @@ -64,7 +64,7 @@
() => props.ticketDetails.details,
() => {
tableData.value = props.ticketDetails.details.infos.map(item => ({
originProxy: item.origin_proxy.ip,
originProxy: `${item.origin_proxy.ip}:${item.origin_proxy.port}`,
relatedClusters: item.display_info.related_clusters as string[],
targetProxy: item.target_proxy.ip,
}));
Expand Down

0 comments on commit 23a4205

Please sign in to comment.