From 1dd64662617c77afbb6a525d432401f7ac2e1de9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=AE=B8=E6=99=93=E4=B8=9C?= <763795151@qq.com> Date: Wed, 16 Feb 2022 19:50:35 +0800 Subject: [PATCH] =?UTF-8?q?=E5=89=AF=E6=9C=AC=E9=87=8D=E5=88=86=E9=85=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ui/src/views/op/ReplicaReassign.vue | 49 ++++++++++++++++++++++++++--- 1 file changed, 44 insertions(+), 5 deletions(-) diff --git a/ui/src/views/op/ReplicaReassign.vue b/ui/src/views/op/ReplicaReassign.vue index f29684e..8469175 100644 --- a/ui/src/views/op/ReplicaReassign.vue +++ b/ui/src/views/op/ReplicaReassign.vue @@ -81,8 +81,21 @@ " > - 更新分配 + 更新分配 +
+

注意

+ @@ -216,10 +229,9 @@ export default { description: res.msg, }); } else { - this.proposedAssignment = res.data; - this.proposedAssignmentShow = Object.assign( - [], - this.proposedAssignment + this.proposedAssignmentShow = res.data; + this.proposedAssignment = JSON.parse( + JSON.stringify(this.proposedAssignmentShow) ); this.proposedAssignmentShow.forEach( (e) => (e.replicas = e.replicas.join(",")) @@ -236,6 +248,33 @@ export default { this.data = []; this.$emit("closeReplicaReassignDialog", { refresh: false }); }, + updateAssignment() { + this.form.validateFields((err, values) => { + if (!err) { + if (this.proposedAssignment.length == 0) { + this.$message.warn("请先生成分配计划!"); + return; + } + this.loading = true; + request({ + url: KafkaTopicApi.updateReplicaAssignment.url, + method: KafkaTopicApi.updateReplicaAssignment.method, + data: { partitions: this.proposedAssignment }, + }).then((res) => { + this.loading = false; + if (res.code == 0) { + this.$message.success(res.msg); + this.handleTopicChange(values.topic); + } else { + notification.error({ + message: "error", + description: res.msg, + }); + } + }); + } + }); + }, }, };