Skip to content

Commit

Permalink
fix(frontend): 大数据节点操作提单数据异常修复 #6321
Browse files Browse the repository at this point in the history
  • Loading branch information
jinquantianxia authored and iSecloud committed Aug 19, 2024
1 parent 8ccb4d1 commit 608d66a
Show file tree
Hide file tree
Showing 9 changed files with 55 additions and 42 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,11 @@
role: props.data.role,
},
],
onSuccess(recommendSpecList) {
if (recommendSpecList.length > 0) {
specId.value = recommendSpecList[0].spec_id;
}
},
});
const handleSpecChange = (value: number) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,12 @@
],
onSuccess(recommendSpecList) {
if (recommendSpecList.length > 0) {
modelValue.value.spec_id = recommendSpecList[0].spec_id;
const [currentSpec] = recommendSpecList;
modelValue.value = {
spec_id: currentSpec.spec_id,
count: props.data.nodeList.length,
instance_num: currentSpec.instance_num,
};
}
},
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,11 @@
role: props.data.role,
},
],
onSuccess(recommendSpecList) {
if (recommendSpecList.length > 0) {
specId.value = recommendSpecList[0].spec_id;
}
},
});
const triggerChange = () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,7 @@
setup
lang="ts"
generic="T extends EsNodeModel | HdfsNodeModel | KafkaNodeModel | PulsarNodeModel | InfluxdbInstanceModel">
import {
shallowRef,
} from 'vue';
import { shallowRef } from 'vue';
import { useI18n } from 'vue-i18n';
import { useRequest } from 'vue-request';
Expand All @@ -61,22 +59,19 @@
import type KafkaNodeModel from '@services/model/kafka/kafka-node';
import type PulsarNodeModel from '@services/model/pulsar/pulsar-node';
import { getSpecResourceCount } from '@services/source/dbresourceResource';
import {
fetchRecommendSpec,
getResourceSpecList,
} from '@services/source/dbresourceSpec';
import { fetchRecommendSpec, getResourceSpecList } from '@services/source/dbresourceSpec';
import SpecDetail from '@components/cluster-common/SpecDetailForPopover.vue';
import type { TReplaceNode } from '../Index.vue';
interface Props {
data: TReplaceNode<T>,
error: boolean,
data: TReplaceNode<T>;
error: boolean;
cloudInfo: {
id: number,
name: string
},
id: number;
name: string;
};
}
const props = defineProps<Props>();
Expand All @@ -89,19 +84,14 @@
const specCountMap = shallowRef<Record<number, number>>({});
const {
run: fetchSpecResourceCount,
} = useRequest(getSpecResourceCount, {
const { run: fetchSpecResourceCount } = useRequest(getSpecResourceCount, {
manual: true,
onSuccess(data) {
specCountMap.value = data;
},
});
const {
loading: isResourceSpecLoading,
data: resourceSpecList,
} = useRequest(getResourceSpecList, {
const { loading: isResourceSpecLoading, data: resourceSpecList } = useRequest(getResourceSpecList, {
defaultParams: [
{
spec_cluster_type: props.data.specClusterType,
Expand All @@ -113,18 +103,20 @@
fetchSpecResourceCount({
bk_biz_id: window.PROJECT_CONFIG.BIZ_ID,
bk_cloud_id: props.cloudInfo.id,
spec_ids: data.results.map(item => item.spec_id),
spec_ids: data.results.map((item) => item.spec_id),
});
},
});
const getDefaultParams = ():{
role: string,
instance_id: number,
}|{
role: string,
cluster_id: number,
} => {
const getDefaultParams = ():
| {
role: string;
instance_id: number;
}
| {
role: string;
cluster_id: number;
} => {
// influxdb 没有 cluster_id 需要通过 instance_id 查询
if (props.data.role === 'influxdb') {
// eslint-disable-next-line vue/no-setup-props-destructure
Expand All @@ -147,7 +139,10 @@
defaultParams: [getDefaultParams()],
onSuccess(recommendSpecList) {
if (recommendSpecList.length > 0) {
modelValue.value.spec_id = recommendSpecList[0].spec_id;
modelValue.value = {
spec_id: recommendSpecList[0].spec_id,
count: props.data.nodeList.length,
};
}
},
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@
</template>
</BkAlert>
<BkForm form-type="vertical">
<BkFormItem :label="$t('目标容量')">
<BkFormItem :label="t('目标容量')">
<div class="target-content-box">
<div class="content-label">
{{ $t('缩容至') }}
{{ t('缩容至') }}
</div>
<div class="content-value">
<div>
Expand All @@ -40,13 +40,13 @@
:max="data.totalDisk"
:min="1"
:model-value="localTargetDisk > 0 ? localTargetDisk : undefined"
:placeholder="$t('请输入')"
:placeholder="t('请输入')"
style="width: 156px; margin-right: 8px"
type="number"
@change="handleTargetDiskChange" />
<span>GB</span>
<template v-if="localTargetDisk > 0">
<span> , {{ $t('共缩容') }} </span>
<span> , {{ t('共缩容') }} </span>
<span
class="strong-num"
style="color: #2dcb56">
Expand All @@ -57,12 +57,12 @@
</div>
<div class="content-tips">
<span>
{{ $t('当前容量') }}:
{{ t('当前容量') }}:
<span class="strong-num">{{ data.totalDisk }}</span>
GB
</span>
<span style="margin-left: 65px">
<span>{{ $t('缩容后') }}:</span>
<span>{{ t('缩容后') }}:</span>
<span v-if="data.targetDisk">
<span class="strong-num">{{ localTargetDisk }}</span>
GB
Expand Down
3 changes: 3 additions & 0 deletions dbm-ui/frontend/src/views/es-manage/common/replace/Index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -382,6 +382,9 @@
},
...nodeData,
},
}).then(() => {
emits('change');
resolve('success');
});
},
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@
v-model="ipSource"
class="ip-srouce-box">
<BkRadioButton label="resource_pool">
{{ $t('资源池自动匹配') }}
{{ t('资源池自动匹配') }}
</BkRadioButton>
<BkRadioButton label="manual_input">
{{ $t('手动选择') }}
{{ t('手动选择') }}
</BkRadioButton>
</BkRadioGroup>
<div
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@
v-model="ipSource"
class="ip-srouce-box">
<BkRadioButton label="resource_pool">
{{ $t('资源池自动匹配') }}
{{ t('资源池自动匹配') }}
</BkRadioButton>
<BkRadioButton label="manual_input">
{{ $t('手动选择') }}
{{ t('手动选择') }}
</BkRadioButton>
</BkRadioGroup>
<div
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@
<BkAlert
class="mb16"
theme="warning"
:title="$t('Bookkeeper,Broker 至少扩容一种类型')" />
:title="t('Bookkeeper,Broker 至少扩容一种类型')" />
<BkRadioGroup
v-model="ipSource"
class="ip-srouce-box">
<BkRadioButton label="resource_pool">
{{ $t('资源池自动匹配') }}
{{ t('资源池自动匹配') }}
</BkRadioButton>
<BkRadioButton label="manual_input">
{{ $t('手动选择') }}
{{ t('手动选择') }}
</BkRadioButton>
</BkRadioGroup>
<div class="wrapper">
Expand Down

0 comments on commit 608d66a

Please sign in to comment.