From 30707e84a77f5af581689b89d430e2870e9399f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=AE=B8=E6=99=93=E4=B8=9C?= <763795151@qq.com> Date: Tue, 11 Jun 2024 20:00:23 +0800 Subject: [PATCH] =?UTF-8?q?brokerId=E4=B8=8D=E6=98=AF=E4=BB=8E0=E5=BC=80?= =?UTF-8?q?=E5=A7=8B=EF=BC=8Ctopic=E7=AE=A1=E7=90=86->=E5=8F=98=E6=9B=B4?= =?UTF-8?q?=E5=89=AF=E6=9C=AC=E5=A4=B1=E8=B4=A5fixed.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ui/src/views/topic/UpdateReplica.vue | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/ui/src/views/topic/UpdateReplica.vue b/ui/src/views/topic/UpdateReplica.vue index 3a3240f..aa4b42d 100644 --- a/ui/src/views/topic/UpdateReplica.vue +++ b/ui/src/views/topic/UpdateReplica.vue @@ -91,6 +91,7 @@ export default { loading: false, form: this.$form.createForm(this, { name: "coordinated" }), brokerSize: 0, + brokerIdList: [], replicaNums: 0, defaultReplicaNums: 0, }; @@ -136,6 +137,8 @@ export default { method: KafkaClusterApi.getClusterInfo.method, }).then((res) => { this.brokerSize = res.data.nodes.length; + this.brokerIdList = res.data.nodes.map((o) => o.id); + this.brokerIdList.sort((a, b) => a - b); }); }, handleCancel() { @@ -149,9 +152,16 @@ export default { if (this.data.partitions.length > 0) { this.data.partitions.forEach((p) => { if (value > p.replicas.length) { + let min = this.brokerIdList[0]; + let max = this.brokerIdList[this.brokerSize - 1] + 1; let num = p.replicas[p.replicas.length - 1]; for (let i = p.replicas.length; i < value; i++) { - p.replicas.push(++num % this.brokerSize); + ++num; + if (num < max) { + p.replicas.push(num); + } else { + p.replicas.push((num % max) + min); + } } } if (value < p.replicas.length) {