Skip to content

Commit

Permalink
fix(frontend): 修复redis整机替换问题 TencentBlueKing#7596
Browse files Browse the repository at this point in the history
# Reviewed, transaction id: 22878
  • Loading branch information
JustaCattt authored and hLinx committed Nov 5, 2024
1 parent 562fcd4 commit f7cf590
Show file tree
Hide file tree
Showing 7 changed files with 239 additions and 268 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,47 +19,22 @@ import { random } from '@utils';
export function generateRedisClusterCutoffCloneData(ticketData: TicketModel<RedisDBReplaceDetails>) {
const { clusters, infos, specs } = ticketData.details;
return Promise.resolve({
tableDataList: infos.reduce(
(dataList, item) => {
const roleList = ['proxy', 'redis_master', 'redis_slave'] as ['proxy', 'redis_master', 'redis_slave'];
const roleMap = {
redis_master: 'master',
redis_slave: 'slave',
proxy: 'proxy',
};
roleList.forEach((role) => {
if (item[role].length > 0) {
item[role].forEach((info) => {
dataList.push({
rowKey: random(),
isLoading: false,
ip: info.ip,
role: roleMap[role],
clusterIds: item.cluster_ids,
bkCloudId: item.bk_cloud_id,
cluster: {
domain: item.cluster_ids.map((id) => clusters[id].immute_domain).join(','),
isStart: false,
isGeneral: true,
rowSpan: 1,
},
spec: specs[info.spec_id],
});
});
}
});
return dataList;
},
[] as {
rowKey: string;
isLoading: boolean;
ip: string;
role: string;
clusterIds: number[];
bkCloudId: number;
cluster: any;
spec: any;
}[],
tableDataList: infos.flatMap((info) =>
info.display_info.data.map((curr) => ({
rowKey: random(),
isLoading: false,
ip: curr.ip,
role: curr.role,
clusterIds: info.cluster_ids,
bkCloudId: info.bk_cloud_id,
cluster: {
domain: info.cluster_ids.map((id) => clusters[id].immute_domain).join(','),
isStart: false,
isGeneral: true,
rowSpan: 1,
},
spec: specs[curr.spec_id],
})),
),
remark: ticketData.remark,
});
Expand Down
9 changes: 9 additions & 0 deletions dbm-ui/frontend/src/services/model/ticket/details/redis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,15 @@ export interface RedisDBReplaceDetails extends DetailBase {
ip: string;
spec_id: number;
}[];
display_info: {
data: {
ip: string;
role: string;
cluster_domain: string;
spec_id: number;
spec_name: string;
}[];
};
}[];
specs: DetailSpecs;
}
Expand Down
1 change: 1 addition & 0 deletions dbm-ui/frontend/src/services/source/redis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ export const getRedisClusterList = async (params: { bk_biz_id: number; domain?:
export function getRedisMachineList(params: {
limit?: number;
offset?: number;
extra?: number;
bk_host_id?: number;
ip?: string;
cluster_ids?: string;
Expand Down
Loading

0 comments on commit f7cf590

Please sign in to comment.