Skip to content

Commit 720c02f

Browse files
JustaCattthLinx
authored andcommitted
fix(frontend): redis容量变更及规格展示兼容 #10346
# Reviewed, transaction id: 41302
1 parent 3c0ccc2 commit 720c02f

File tree

3 files changed

+70
-14
lines changed

3 files changed

+70
-14
lines changed

dbm-ui/frontend/src/components/render-table/columns/spec-display/Index.vue

Lines changed: 67 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,22 @@
1515
<BkLoading :loading="isLoading">
1616
<div
1717
class="render-spec-box"
18-
:class="{ 'default-display': !data }">
18+
:class="{ 'default-display': !displayInfo }">
1919
<span
20-
v-if="!data"
20+
v-if="!displayInfo"
2121
style="color: #c4c6cc">
2222
{{ placeholder || t('输入主机后自动生成') }}
2323
</span>
2424
<span
2525
v-else
2626
class="content">
27-
{{ data?.name ? `${data.name} ${isIgnoreCounts ? '' : t('((n))台', { n: data?.count })}` : '' }}
27+
{{
28+
displayInfo?.name
29+
? `${displayInfo.name} ${isIgnoreCounts ? '' : t('((n))台', { n: displayInfo?.count })}`
30+
: ''
31+
}}
2832
<SpecPanel
29-
:data="data"
33+
:data="displayInfo"
3034
:hide-qps="hideQps">
3135
<DbIcon
3236
class="visible-icon ml-4"
@@ -44,21 +48,23 @@
4448
interface Props {
4549
data?: {
4650
count?: number;
47-
cpu: {
51+
cpu?: {
4852
max: number;
4953
min: number;
5054
};
51-
// id: number;
52-
mem: {
55+
id?: number;
56+
mem?: {
5357
max: number;
5458
min: number;
5559
};
56-
name: string;
57-
qps: {
60+
name?: string;
61+
qps?: {
5862
max: number;
5963
min: number;
6064
};
61-
storage_spec: {
65+
spec_id?: number;
66+
spec_name?: string;
67+
storage_spec?: {
6268
mount_point: string;
6369
size: number;
6470
type: string;
@@ -70,15 +76,64 @@
7076
placeholder?: string;
7177
}
7278
73-
withDefaults(defineProps<Props>(), {
74-
data: undefined,
79+
const props = withDefaults(defineProps<Props>(), {
80+
data: () => ({
81+
count: 0,
82+
cpu: {
83+
max: 1,
84+
min: 0,
85+
},
86+
id: 0,
87+
mem: {
88+
max: 1,
89+
min: 0,
90+
},
91+
name: '',
92+
qps: {
93+
max: 1,
94+
min: 0,
95+
},
96+
spec_id: 0,
97+
spec_name: '',
98+
storage_spec: [],
99+
}),
75100
hideQps: true,
76101
isIgnoreCounts: false,
77102
isLoading: false,
78103
placeholder: undefined,
79104
});
80105
81106
const { t } = useI18n();
107+
108+
const displayInfo = computed(() =>
109+
Object.assign(
110+
{
111+
count: 0,
112+
cpu: {
113+
max: 1,
114+
min: 0,
115+
},
116+
id: 0,
117+
mem: {
118+
max: 1,
119+
min: 0,
120+
},
121+
name: '',
122+
qps: {
123+
max: 1,
124+
min: 0,
125+
},
126+
spec_id: 0,
127+
spec_name: '',
128+
storage_spec: [],
129+
},
130+
props.data,
131+
{
132+
id: props.data?.id || (props.data?.spec_id as number),
133+
name: props.data?.name || (props.data?.spec_name as string),
134+
},
135+
),
136+
);
82137
</script>
83138
<style lang="less" scoped>
84139
.render-spec-box {

dbm-ui/frontend/src/views/db-manage/redis/REDIS_SCALE_UPDOWN/components/CurrentCapacityColumn.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
:label="t('当前容量')"
1818
:min-width="200">
1919
<div
20-
v-if="cluster?.cluster_stats?.total"
20+
v-if="cluster.id"
2121
class="capacity-box">
2222
<div class="display-content">
2323
<div class="item">
@@ -74,6 +74,7 @@
7474
cluster_spec: RedisModel['cluster_spec'];
7575
cluster_stats: RedisModel['cluster_stats'];
7676
group_num: number;
77+
id: number;
7778
shard_num: number;
7879
};
7980
}

dbm-ui/frontend/src/views/db-manage/redis/REDIS_SCALE_UPDOWN/components/target-capacity-column/ClusterDeployPlan.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@
6969
<div class="column-content">
7070
<RenderSpec
7171
:data="data.currentSepc"
72-
:hide-qps="!data.currentSepc.qps?.max"
72+
:hide-qps="!data.currentSepc?.qps?.max"
7373
is-ignore-counts />
7474
</div>
7575
</div>

0 commit comments

Comments
 (0)