Skip to content

Commit

Permalink
fix(frontend): 修复mysql迁移升级新只读主机提单时的顺序问题 #8321
Browse files Browse the repository at this point in the history
  • Loading branch information
3octaves authored and hLinx committed Dec 3, 2024
1 parent 3290685 commit 3a46afd
Showing 1 changed file with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -124,10 +124,16 @@
// IP 有效
singleHostSelectMemo[instanceKey] = {};
slaveHostMemo = [];
data.hosts_topo_info.forEach((item) => {
if (ipList.includes(item.ip) && item.bk_cloud_id === props.cloudId) {
slaveHostMemo.push(item);
singleHostSelectMemo[instanceKey][genHostKey(item)] = true;
// 新只读主机和旧只读主机是对应关系,需要按输入的顺序提单
const topoHostMap = data.hosts_topo_info.reduce<Record<string, (typeof data.hosts_topo_info)[number]>>(
(prev, item) => Object.assign({}, prev, { [item.ip]: item }),
{},
);
ipList.forEach((inputIpItem) => {
const topoHostItem = topoHostMap[inputIpItem];
if (topoHostItem) {
slaveHostMemo.push(topoHostItem);
singleHostSelectMemo[instanceKey][genHostKey(topoHostItem)] = true;
}
});
return true;
Expand Down

0 comments on commit 3a46afd

Please sign in to comment.