diff --git a/dbm-ui/frontend/src/components/instance-selector/components/tendb-cluster-host/table/Index.vue b/dbm-ui/frontend/src/components/instance-selector/components/tendb-cluster-host/table/Index.vue index 28f125de2e..4dc1d0f3d6 100644 --- a/dbm-ui/frontend/src/components/instance-selector/components/tendb-cluster-host/table/Index.vue +++ b/dbm-ui/frontend/src/components/instance-selector/components/tendb-cluster-host/table/Index.vue @@ -186,7 +186,7 @@ field: props.firsrColumn?.field ? props.firsrColumn.field : 'instance_address', }, { - label: t('关联的从库实例'), + label: t('关联实例'), field: 'related_instances', showOverflowTooltip: true, width: 200, diff --git a/dbm-ui/frontend/src/locales/zh-cn.json b/dbm-ui/frontend/src/locales/zh-cn.json index 8dbbbbb676..06a40ca3c8 100644 --- a/dbm-ui/frontend/src/locales/zh-cn.json +++ b/dbm-ui/frontend/src/locales/zh-cn.json @@ -3606,5 +3606,6 @@ "无只读主机": "无只读主机", "批量录入:按行录入,快速批量输入多个单元格的值": "批量录入:按行录入,快速批量输入多个单元格的值", "高可用": "高可用", + "关联实例": "关联实例", "这行勿动!新增翻译请在上一行添加!": "" } diff --git a/dbm-ui/frontend/src/views/db-manage/tendb-cluster/master-slave-clone/pages/page1/Index.vue b/dbm-ui/frontend/src/views/db-manage/tendb-cluster/master-slave-clone/pages/page1/Index.vue index a9087af5d3..7bd482cd91 100644 --- a/dbm-ui/frontend/src/views/db-manage/tendb-cluster/master-slave-clone/pages/page1/Index.vue +++ b/dbm-ui/frontend/src/views/db-manage/tendb-cluster/master-slave-clone/pages/page1/Index.vue @@ -26,6 +26,7 @@ :key="item.rowKey" ref="rowRefs" :data="item" + :inputed-ips="inputedIps" :removeable="tableData.length < 2" @add="(payload: Array) => handleAppend(index, payload)" @clone="(payload: IDataRow) => handleClone(index, payload)" @@ -129,6 +130,7 @@ const selected = shallowRef({ TendbClusterHost: [] } as InstanceSelectorValues); + const inputedIps = computed(() => tableData.value.map((item) => item.clusterData.ip)); const totalNum = computed(() => tableData.value.filter((item) => Boolean(item.clusterData.ip)).length); // ip 是否已存在表格的映射表 @@ -222,6 +224,11 @@ masterInstanceList: spiderMachineItem.related_instances, }); ipMemo[ip] = true; + Object.keys(ipMemo).forEach((ip) => { + if (ipMemo[ip]) { + selected.value.TendbClusterHost.push({ ip } as IValue); + } + }); }; // 追加一个集群 @@ -264,7 +271,7 @@ const handleSubmit = async () => { try { isSubmitting.value = true; - const rowDataList = await Promise.all(rowRefs.value!.map((item) => item.getValue())); + const infos = await Promise.all(rowRefs.value!.map((item) => item.getValue())); const params = { bk_biz_id: currentBizId, ticket_type: TicketTypes.TENDBCLUSTER_MIGRATE_CLUSTER, @@ -272,24 +279,9 @@ details: { ...formData, ip_source: 'manual_input', - infos: rowDataList.map((rowItem, rowIndex) => { - const { clusterData } = tableData.value[rowIndex]; - return { - cluster_id: clusterData.clusterId, - new_master: rowItem.newInstaceList[0], - new_slave: rowItem.newInstaceList[1], - old_master: { - ip: clusterData.ip, - bk_cloud_id: clusterData.cloudId, - bk_host_id: clusterData.hostId, - bk_biz_id: currentBizId, - }, - old_slave: rowItem.old_master, - }; - }), + infos, }, }; - await createTicket(params).then((data) => { window.changeConfirm = false; router.push({ diff --git a/dbm-ui/frontend/src/views/db-manage/tendb-cluster/master-slave-clone/pages/page1/components/RenderMasterHost.vue b/dbm-ui/frontend/src/views/db-manage/tendb-cluster/master-slave-clone/pages/page1/components/RenderMasterHost.vue index a3faf5d7f8..3a30a7c5dd 100644 --- a/dbm-ui/frontend/src/views/db-manage/tendb-cluster/master-slave-clone/pages/page1/components/RenderMasterHost.vue +++ b/dbm-ui/frontend/src/views/db-manage/tendb-cluster/master-slave-clone/pages/page1/components/RenderMasterHost.vue @@ -22,9 +22,6 @@ - diff --git a/dbm-ui/frontend/src/views/db-manage/tendb-cluster/master-slave-clone/pages/page1/components/RenderNewInstace.vue b/dbm-ui/frontend/src/views/db-manage/tendb-cluster/master-slave-clone/pages/page1/components/RenderNewInstace.vue index 7f2f2a8305..cf7709657e 100644 --- a/dbm-ui/frontend/src/views/db-manage/tendb-cluster/master-slave-clone/pages/page1/components/RenderNewInstace.vue +++ b/dbm-ui/frontend/src/views/db-manage/tendb-cluster/master-slave-clone/pages/page1/components/RenderNewInstace.vue @@ -96,7 +96,6 @@ }" :data="localHostList" :disable-dialog-submit-method="disableDialogSubmitMethod" - :disable-host-method="disableHostMethod" :os-types="[OSTypes.Linux]" service-mode="idle_only" :show-view="false" @@ -123,7 +122,26 @@ diff --git a/dbm-ui/frontend/src/views/db-manage/tendb-cluster/master-slave-clone/pages/page1/components/RenderSlaveHost.vue b/dbm-ui/frontend/src/views/db-manage/tendb-cluster/master-slave-clone/pages/page1/components/RenderSlaveHost.vue index 54206e1b9e..d09c518049 100644 --- a/dbm-ui/frontend/src/views/db-manage/tendb-cluster/master-slave-clone/pages/page1/components/RenderSlaveHost.vue +++ b/dbm-ui/frontend/src/views/db-manage/tendb-cluster/master-slave-clone/pages/page1/components/RenderSlaveHost.vue @@ -40,12 +40,14 @@ (e: 'change', value: string): void; } - interface Expose { + interface Exposes { getValue: () => Promise<{ - ip: string; - bk_cloud_id: number; - bk_host_id: number; - bk_biz_id: number; + old_slave: { + bk_biz_id: number; + bk_cloud_id: number; + bk_host_id: number; + ip: string; + }; }>; } @@ -94,18 +96,16 @@ }, ); - defineExpose({ + defineExpose({ getValue() { - const slave = slaveInfo.value; - if (slave) { - return Promise.resolve({ - ip: slave.ip, - bk_cloud_id: slave.bk_cloud_id, - bk_host_id: slave.bk_host_id, - bk_biz_id: slave.bk_biz_id, - }); - } - return textRef.value!.getValue(); + return textRef.value!.getValue().then(() => ({ + old_slave: { + ip: slaveInfo.value?.ip, + bk_cloud_id: slaveInfo.value?.bk_cloud_id, + bk_host_id: slaveInfo.value?.bk_host_id, + bk_biz_id: slaveInfo.value?.bk_biz_id, + }, + })); }, }); diff --git a/dbm-ui/frontend/src/views/db-manage/tendb-cluster/master-slave-clone/pages/page1/components/Row.vue b/dbm-ui/frontend/src/views/db-manage/tendb-cluster/master-slave-clone/pages/page1/components/Row.vue index 111ca8262c..66ed82292d 100644 --- a/dbm-ui/frontend/src/views/db-manage/tendb-cluster/master-slave-clone/pages/page1/components/Row.vue +++ b/dbm-ui/frontend/src/views/db-manage/tendb-cluster/master-slave-clone/pages/page1/components/Row.vue @@ -15,7 +15,8 @@ @@ -26,7 +27,7 @@ - + diff --git a/dbm-ui/frontend/src/views/tickets/common/components/demand-factory/spider/MigrateCluster.vue b/dbm-ui/frontend/src/views/tickets/common/components/demand-factory/spider/MigrateCluster.vue index ccfa60a5bc..0554aa575a 100644 --- a/dbm-ui/frontend/src/views/tickets/common/components/demand-factory/spider/MigrateCluster.vue +++ b/dbm-ui/frontend/src/views/tickets/common/components/demand-factory/spider/MigrateCluster.vue @@ -13,12 +13,14 @@