查看消费端成员

This commit is contained in:
许晓东
2021-09-26 21:06:50 +08:00
parent 99438887e5
commit 9deb37e9dc
9 changed files with 249 additions and 6 deletions

View File

@@ -80,4 +80,8 @@ export const KafkaConsumerApi = {
url: "/consumer/group",
method: "delete",
},
getConsumerMembers: {
url: "/consumer/member",
method: "get",
},
};

View File

@@ -69,8 +69,10 @@
bordered
row-key="groupId"
>
<div slot="members" slot-scope="text">
<a href="#">{{ text }} </a>
<div slot="members" slot-scope="text, record">
<a href="#" @click="openConsumerMemberDialog(record.groupId)"
>{{ text }}
</a>
</div>
<div slot="state" slot-scope="text">
@@ -91,6 +93,11 @@
</a-popconfirm>
</div>
</a-table>
<Member
:visible="showConsumerGroupDialog"
:group="selectDetail.resourceName"
@closeConsumerMemberDialog="closeConsumerDialog"
></Member>
</div>
</a-spin>
</div>
@@ -100,10 +107,11 @@
import request from "@/utils/request";
import { KafkaConsumerApi } from "@/utils/api";
import notification from "ant-design-vue/es/notification";
import Member from "@/views/group/Member";
export default {
name: "ConsumerGroup",
components: {},
components: { Member },
data() {
return {
queryParam: {},
@@ -121,6 +129,7 @@ export default {
username: "",
},
loading: false,
showConsumerGroupDialog: false,
};
},
methods: {
@@ -163,6 +172,13 @@ export default {
}
});
},
openConsumerMemberDialog(groupId) {
this.showConsumerGroupDialog = true;
this.selectDetail.resourceName = groupId;
},
closeConsumerDialog() {
this.showConsumerGroupDialog = false;
},
},
created() {
this.getConsumerGroupList();

View File

@@ -0,0 +1,124 @@
<template>
<a-modal
title="消费端成员"
:visible="show"
:width="1800"
:mask="false"
:destroyOnClose="true"
:footer="null"
:maskClosable="false"
@cancel="handleCancel"
>
<div>
<a-spin :spinning="loading">
<a-table
:columns="columns"
:data-source="data"
bordered
:rowKey="(record) => record.memberId"
>
<ul slot="partitions" slot-scope="text">
<ol v-for="i in text" :key="i.topic + i.partition">
{{
i.topic
}}:
{{
i.partition
}}
</ol>
</ul>
</a-table>
</a-spin>
</div>
</a-modal>
</template>
<script>
import request from "@/utils/request";
import { KafkaConsumerApi } from "@/utils/api";
import notification from "ant-design-vue/es/notification";
export default {
name: "Member",
props: {
group: {
type: String,
default: "",
},
visible: {
type: Boolean,
default: false,
},
},
data() {
return {
columns: columns,
show: this.visible,
data: [],
loading: false,
};
},
watch: {
visible(v) {
this.show = v;
if (this.show) {
this.getPartitionInfo();
}
},
},
methods: {
getPartitionInfo() {
this.loading = true;
request({
url: KafkaConsumerApi.getConsumerMembers.url + "?groupId=" + this.group,
method: KafkaConsumerApi.getConsumerMembers.method,
}).then((res) => {
this.loading = false;
if (res.code != 0) {
notification.error({
message: "error",
description: res.msg,
});
} else {
this.data = res.data;
}
});
},
handleCancel() {
this.data = [];
this.$emit("closeConsumerMemberDialog", {});
},
},
};
const columns = [
{
title: "成员ID",
dataIndex: "memberId",
key: "memberId",
},
{
title: "客户端ID",
dataIndex: "clientId",
key: "clientId",
},
{
title: "实例ID",
dataIndex: "groupInstanceId",
key: "groupInstanceId",
},
{
title: "主机",
dataIndex: "host",
key: "host",
},
{
title: "分区信息",
dataIndex: "partitions",
key: "partitions",
scopedSlots: { customRender: "partitions" },
},
];
</script>
<style scoped></style>