Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(frontend): 修复mongo扩缩容shard单据详情显示问题 #8847 #8873

Merged
merged 1 commit into from
Jan 2, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,12 @@ import type { DetailBase, DetailClusters } from '../common';
export interface ReduceShardNodes extends DetailBase {
clusters: DetailClusters;
infos: {
cluster_id: number;
cluster_ids: number[];
current_shard_nodes_num: number;
reduce_shard_nodes: number;
shard_num: number;
machine_instance_num: number;
}[];
is_safe: boolean;
ip_source: string;
// ip_source: string;
}
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@
const tableData = infos.map((item) => ({
immute_domain: clusters[item.cluster_ids[0]].immute_domain,
cluster_type: clusters[item.cluster_ids[0]].cluster_type_name,
add_shard_nodes_num: item.add_shard_nodes_num,
current_nodes: item.add_shard_nodes_num - item.resource_spec.shard_nodes.count,
current_nodes: item.current_shard_nodes_num,
add_shard_nodes_num: item.current_shard_nodes_num + item.add_shard_nodes_num,
}));
</script>
<style lang="less" scoped>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,10 @@
-->

<template>
<BkLoading :loading="loading">
<DbOriginalTable
class="details-backup__table"
:columns="columns"
:data="tableData" />
</BkLoading>
<DbOriginalTable
class="details-backup__table"
:columns="columns"
:data="tableData" />
<div class="ticket-details-list">
<div class="ticket-details-item">
<span class="ticket-details-item-label">{{ t('忽略业务连接') }}:</span>
Expand All @@ -30,10 +28,8 @@

<script setup lang="tsx">
import { useI18n } from 'vue-i18n';
import { useRequest } from 'vue-request';

import TicketModel, { type Mongodb } from '@services/model/ticket/ticket';
import { getMongoList } from '@services/source/mongodb';

import { TicketTypes } from '@common/const';

Expand Down Expand Up @@ -84,28 +80,13 @@
},
];

const { loading, run: fetchMongoList } = useRequest(getMongoList, {
manual: true,
onSuccess(result) {
const shardNumMap = result.results.reduce(
(results, item) => {
Object.assign(results, {
[item.id]: item.shard_node_count,
});
return results;
},
{} as Record<number, number>,
);
tableData.value = infos.map((item) => ({
immute_domain: clusters[item.cluster_id].immute_domain,
cluster_type: clusters[item.cluster_id].cluster_type_name,
reduce_shard_nodes: shardNumMap[item.cluster_id] - item.reduce_shard_nodes,
current_nodes: shardNumMap[item.cluster_id],
}));
},
});

fetchMongoList({
domains: props.ticketDetails.details.infos.map((item) => clusters[item.cluster_id].immute_domain).join(','),
tableData.value = infos.map((item) => {
const cluster = clusters[item.cluster_ids[0]];
return {
immute_domain: cluster.immute_domain,
cluster_type: cluster.cluster_type_name,
current_nodes: item.current_shard_nodes_num,
reduce_shard_nodes: item.current_shard_nodes_num - item.reduce_shard_nodes,
};
});
</script>
Loading