Skip to content

Commit 6ec684a

Browse files
fix(frontend): redis主从多集群部署端口计算逻辑问题修复 #8801
1 parent d54c10a commit 6ec684a

File tree

3 files changed

+30
-3
lines changed
  • dbm-ui/frontend/src/views

3 files changed

+30
-3
lines changed

dbm-ui/frontend/src/views/db-manage/redis/apply-ha/Index.vue

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,7 @@
170170
:is-append="isAppend"
171171
:max-memory="maxMemory"
172172
:port="formData.details.port"
173+
:port-type="portType"
173174
@host-change="handleHostChange" />
174175
</BkFormItem>
175176
<BkFormItem :label="t('备注')">
@@ -315,6 +316,26 @@
315316
316317
const isAppend = computed(() => formData.details.appendApply === 'append');
317318
const machineCount = computed(() => formData.details.cluster_count / formData.details.group_count);
319+
const portType = computed(() => {
320+
if (formData.details.cluster_count % formData.details.group_count !== 0) {
321+
return '';
322+
}
323+
if (formData.details.cluster_count === formData.details.group_count) {
324+
return 'increment'; // 递增端口号
325+
}
326+
if (formData.details.group_count === 1) {
327+
return 'same'; // 端口号相同
328+
}
329+
const ports = Array(formData.details.group_count)
330+
.fill(0)
331+
.map((_, index) => formData.details.port + index);
332+
const groups = formData.details.cluster_count / formData.details.group_count;
333+
return _.flatMap(
334+
Array(groups)
335+
.fill(0)
336+
.map(() => ports),
337+
);
338+
});
318339
319340
watch(
320341
() => formData.details.city_code,

dbm-ui/frontend/src/views/db-manage/redis/apply-ha/components/domain-table/Index.vue

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@
7575
cityCode: string,
7676
cityName: string
7777
}
78+
portType: string | number[];
7879
}
7980
8081
interface Emits {
@@ -156,7 +157,7 @@
156157
const columns = computed(() => {
157158
const baseColums: Column[] = [
158159
{
159-
type: 'index',
160+
type: 'seq',
160161
label: t('序号'),
161162
width: 60,
162163
},
@@ -194,7 +195,12 @@
194195
onChange={(value: string) => handleChangeCellValue(value, index, 'cluster_name')}
195196
/>
196197
</bk-form-item>
197-
<div class="ml-4">.{ props.appAbbr }.db{props.isAppend ? '' : `#${props.port + index}`}</div>
198+
{
199+
typeof props.portType === 'string' ?
200+
<div class="ml-4">.{ props.appAbbr }.db{props.isAppend ? '' : `#${props.portType === 'increment' ? props.port + index : props.port }`}</div>
201+
:
202+
<div class="ml-4">.{ props.appAbbr }.db{props.isAppend ? '' : `#${props.portType.length === tableData.value.length ? props.portType[index] : ''}`}</div>
203+
}
198204
</div>
199205
),
200206
},

dbm-ui/frontend/src/views/ticket-center/common/ticket-detail/components/task-info/com-factory/redis/ClusterApply.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
<div class="ticket-details-info-title mt-20">{{ t('地域要求') }}</div>
3232
<InfoList>
3333
<InfoItem :label="t('数据库部署地域')">
34-
{{ ticketDetails?.details.city_name || '--' }}
34+
{{ ticketDetails?.details.city_code || '--' }}
3535
</InfoItem>
3636
</InfoList>
3737
<div class="ticket-details-info-title mt-20">{{ t('数据库部署信息') }}</div>

0 commit comments

Comments
 (0)