集群信息

This commit is contained in:
许晓东
2021-10-08 15:40:21 +08:00
parent 73d44fe009
commit d4fdb739b9
11 changed files with 345 additions and 1 deletions

View File

@@ -0,0 +1,92 @@
<template>
<div class="content">
<a-spin :spinning="loading">
<div class="body-c">
<div class="cluster-id">
<h3>集群ID{{ clusterId }}</h3>
</div>
<a-table :columns="columns" :data-source="data" bordered row-key="name">
<div slot="addr" slot-scope="text, record">
{{ record.host }}:{{ record.port }}
</div>
<div slot="controller" slot-scope="text">
<span v-if="text" style="color: red"></span><span v-else></span>
</div>
</a-table>
</div>
</a-spin>
</div>
</template>
<script>
import request from "@/utils/request";
import { KafkaClusterApi } from "@/utils/api";
export default {
name: "Topic",
data() {
return {
data: [],
columns,
loading: false,
clusterId: "",
};
},
methods: {
getClusterInfo() {
this.loading = true;
request({
url: KafkaClusterApi.getClusterInfo.url,
method: KafkaClusterApi.getClusterInfo.method,
}).then((res) => {
this.loading = false;
this.data = res.data.nodes;
this.clusterId = res.data.clusterId;
});
},
},
created() {
this.getClusterInfo();
},
};
const columns = [
{
title: "id",
dataIndex: "id",
key: "id",
},
{
title: "地址",
key: "addr",
scopedSlots: { customRender: "addr" },
},
{
title: "控制器",
key: "controller",
dataIndex: "controller",
scopedSlots: { customRender: "controller" },
},
];
</script>
<style scoped>
.body-c {
width: 100%;
height: 100%;
}
.cluster-id {
text-align: left;
}
.operation-row-button {
height: 4%;
text-align: left;
}
.operation-btn {
margin-right: 3%;
}
</style>