QueueView.vue
7.0 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
<template>
<el-container>
<el-main>
<el-card style="background-color: #F5F7FA">
<!-- 搜素区域 -->
<div>
<el-row>
<!-- <el-col :span="4">-->
<!-- <el-input v-model="queueView_queryInfo.serverName" prefix-icon="el-icon-search" size="medium"-->
<!-- placeholder="服务器名称" clearable></el-input>-->
<!-- </el-col>-->
<!-- <el-col :span="4">-->
<!-- <el-input v-model="queueView_queryInfo.virtualHostName" prefix-icon="el-icon-search" size="medium"-->
<!-- placeholder="虚拟主机名称" clearable></el-input>-->
<!-- </el-col>-->
<el-col :span="8">
<el-button type="success" style="width:150px" size="medium" @click="timerStatus==='start'?timerEnd():timerStart()">
{{timergMap[timerStatus]}}
</el-button>
</el-col>
</el-row>
</div>
<!-- 列表区域 -->
<div style="margin-top: 20px;">
<el-table :data="queueView_page.queueViewList" border size="small"
:default-sort = "{prop: 'lag', order: 'descending'}"
v-loading="queueView_loading.listLoading" element-loading-text="获取队列监控信息,拼命加载中">
<el-table-column type="index" align="center"></el-table-column>
<el-table-column label="消费组" prop="groupName" align="center" width="150"></el-table-column>
<el-table-column label="TOPIC" prop="topic" align="center" width="150"></el-table-column>
<el-table-column label="partition" prop="partition" align="center" width="230">
</el-table-column>
<el-table-column label="积压消息" prop="lag" align="center" width="120" sortable>
<!-- <template slot-scope="scope">-->
<!-- <span v-if="scope.row.queueInfo.messages_ready !== null" style="color: #eb2f06">-->
<!-- {{scope.row.queueInfo.messages_ready}}-->
<!-- </span>-->
<!-- </template>-->
</el-table-column>
<el-table-column label="消息总数" prop="endoffset" align="center" width="120"></el-table-column>
<!-- <el-table-column label="持久化" prop="queueInfo.durable" align="center" width="120">-->
<!-- <template slot-scope="scope">-->
<!-- <span v-if="scope.row.queueInfo.durable ===false">否</span>-->
<!-- <span v-if="scope.row.queueInfo.durable ===true">是</span>-->
<!-- </template>-->
<!-- </el-table-column>-->
<!-- <el-table-column label="自动删除" prop="queueInfo.auto_delete" align="center" width="120">-->
<!-- <template slot-scope="scope">-->
<!-- <span v-if="scope.row.queueInfo.auto_delete ===false">否</span>-->
<!-- <span v-if="scope.row.queueInfo.auto_delete ===true">是</span>-->
<!-- </template>-->
<!-- </el-table-column>-->
</el-table>
</div>
</el-card>
</el-main>
</el-container>
</template>
<script>
import {selectQueueViewList} from "../../../api/message_bus";
export default {
name: "QueueView",
data() {
return {
timergMap: {
start: '监控中',
end: '已停止',
},
timerStatus: "start",
timer:{},
queueView_queryInfo: {
GroupName: '',
topic: '',
partition: 1,
Lag: 10
},
queueView_page: {
queueViewList: [],
total: 0,
},
queueView_loading: {
listLoading: false,
},
/**
* Boolean属性,选择列表
*/
booleanList: [
{
value: true,
label: '是'
},
{
value: false,
label: '否'
},
],
}
},
methods: {
/**
* 分页查询,监听 pageSize 改变的事件
*/
queueView_handleSizeChange(newSize) {
this.queueView_queryInfo.pageSize = newSize;
this.getQueueViewList();
},
timerStart(){
this.timerStatus= "start";
this.getQueueViewList();
this.timer = setInterval(this.getQueueViewList, 10000);
},
timerEnd(){
this.timerStatus= "end";
clearInterval(this.timer);
},
/**
* 分页查询,监听 pageNum 改变的事件
*/
queueView_handleCurrentChange(newPage) {
this.queueView_queryInfo.pageNum = newPage;
this.getQueueViewList();
},
getQueueViewList() {
this.queueView_loading.listLoading = true;
selectQueueViewList(this.queueView_queryInfo).then((response) => {
let res = response.data;
if (res.code !== '200') {
this.queueView_loading.listLoading = false;
return this.$message.error(res.msg);
}
this.queueView_page.queueViewList = res.data;
// this.queueView_page.total = res.total;
this.queueView_loading.listLoading = false;
}).catch(error => {
this.queueView_loading.listLoading = false;
this.$message.error(error.toString());
});
}
},
created() {
},
mounted() {
this.timerStart();
},
beforeDestroy() {
clearInterval(this.timer);
},
computed: {},
}
</script>
<style scoped>
.demo-table-expand {
font-size: 0;
}
.demo-table-expand label {
width: 90px;
color: #99a9bf;
}
.demo-table-expand .el-form-item {
margin-right: 0;
margin-bottom: 0;
width: 50%;
}
</style>