Skip to content

Commit

Permalink
fix(frontend): mongodb集群容量变更问题修复 #3427
Browse files Browse the repository at this point in the history
  • Loading branch information
3octaves authored and zhangzhw8 committed Mar 6, 2024
1 parent 0ac8e0f commit aeab65f
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@
MachineTypes,
} from '@common/const';

import MiniTag from '@components/mini-tag/index.vue';

import SpecTip from '@images/spec-tip.png';

type RedisClusterSpecRow = RedisClusterSpecModel & {
Expand All @@ -93,6 +95,7 @@
bizId: number | string,
cloudId: number | string,
shardNum?: number,
shardNodeCount?: number,
isApply?: boolean
originSpecId?: number | string
}
Expand All @@ -102,7 +105,8 @@
}

const props = withDefaults(defineProps<Props>(), {
shardNum: undefined,
shardNum: 0,
shardNodeCount: 0,
isApply: true,
originSpecId: undefined,
});
Expand Down Expand Up @@ -139,19 +143,17 @@
let tag;
if (props.originSpecId === data.spec_id) {
tag = (
<bk-tag
class='ml-2'
theme="info">
{ t('当前方案') }
</bk-tag>
<MiniTag
class='ml-2'
theme="info"
content={t('当前方案')} />
);
} else if (data.machine_num > data.count) {
tag = (
<bk-tag
<MiniTag
class='ml-2'
theme="danger">
{ t('资源不足') }
</bk-tag>
theme="danger"
content={t('资源不足')} />
);
}

Expand Down Expand Up @@ -262,11 +264,12 @@
} = useRequest(getFilterClusterSpec, {
manual: true,
onSuccess(res) {
const shardNodeNum = props.isApply ? 3 : props.shardNodeCount; // 节点数,部署时固定,容量变更取自集群信息
specList.value = res.map(item => Object.assign(item, {
shard_node_num: 3, // 节点数,固定值
shard_node_num: shardNodeNum,
shard_num: props.isApply ? item.shard_recommend.shard_num : props.shardNum,
shard_node_spec: '',
machine_num: item.machine_pair * 3, // 机组数 * 节点数
machine_num: item.machine_pair * shardNodeNum, // 机器组数 x 每个Shard节点数
count: 0,
} as RedisClusterSpecRow));
getSpecResourceCountRun({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
</div>
<DbForm
form-type="vertical"
model="specInfo">
:model="specInfo">
<MongoConfigSpec
v-model="specInfo"
:biz-id="data.bizId"
Expand All @@ -40,6 +40,7 @@
capacity: 'capacity',
specId: 'spec_id'
}"
:shard-node-count="data.shardNodeCount"
:shard-num="data.shardNum"
@current-change="handleMongoConfigSpecChange" />
</DbForm>
Expand Down Expand Up @@ -68,6 +69,7 @@
bizId: number,
cloudId: number,
shardNum: number;
shardNodeCount: number;
},
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,8 @@
specName: string
bizId: number,
cloudId: number,
shardNum: number
shardNum: number,
shardNodeCount: number,
}>();
const monitorPanelList = ref<{
label: string,
Expand All @@ -189,6 +190,7 @@
bk_biz_id: bizId,
bk_cloud_id: cloudId,
shard_num: shardNum,
shard_node_count: shardNodeCount,
mongodb,
} = result;
const {
Expand All @@ -204,6 +206,7 @@
bizId,
cloudId,
shardNum,
shardNodeCount,
};
},
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,8 @@
specName: string
bizId: number,
cloudId: number,
shardNum: number
shardNum: number,
shardNodeCount: number,
}>();
const clusterAuthorizeShow = ref(false);
const excelAuthorizeShow = ref(false);
Expand Down Expand Up @@ -455,6 +456,7 @@
bk_biz_id: bizId,
bk_cloud_id: cloudId,
shard_num: shardNum,
shard_node_count: shardNodeCount,
mongodb,
} = row;
const {
Expand All @@ -470,6 +472,7 @@
bizId,
cloudId,
shardNum,
shardNodeCount
};
capacityChangeShow.value = true;
};
Expand Down

0 comments on commit aeab65f

Please sign in to comment.