Skip to content

Commit 9597bb3

Browse files
committed
dashboard echart
1 parent 2659606 commit 9597bb3

File tree

4 files changed

+21
-17
lines changed

4 files changed

+21
-17
lines changed

.tool-versions

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
golang 1.23.7

internal/driver/bredis/ui.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,17 +62,17 @@ func (t *UITool) QueueMessage(ctx context.Context) error {
6262
}
6363
total += t.client.XLen(ctx, streamkey).Val()
6464
}
65+
if total <= 0 {
66+
continue
67+
}
6568
if pending < 0 {
6669
pending = 0
6770
}
68-
if total < 0 {
69-
total = 0
70-
}
7171
ready = total - pending
7272

7373
now := time.Now()
7474

75-
sliceData = append(sliceData, ready, pending, total, now.Format(time.DateTime))
75+
sliceData = append(sliceData, total, pending, ready, now.Format(time.DateTime))
7676

7777
bt, err := json.Marshal(sliceData)
7878
sliceData = sliceData[:0]

ui/src/pages/home.vue

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ function resize(){
105105
})
106106
}
107107
108-
const queues = ref([]);
108+
const [queues,queuesCount] = [ref([]),ref(0)];
109109
watch(()=>execTime.value,(n,o)=>{
110110
execTime.value = n;
111111
queues.value = [];
@@ -130,12 +130,13 @@ function sseConnect(){
130130
return;
131131
}
132132
if(code === "1111" && msg === "DONE"){
133+
queuesCount.value = data;
133134
sse.value.close();
134135
}
135136
if (typeof data !== "object"){
136137
137-
queuedMessagesOption.value = dashboardApi.QueueLine(queues.value,execTime.value,data);
138-
messageRatesOption.value = dashboardApi.MessageRateLine(queues.value,execTime.value);
138+
queuedMessagesOption.value = dashboardApi.QueueLine(queues.value,execTime.value,queuesCount.value);
139+
messageRatesOption.value = dashboardApi.MessageRateLine(queues.value,execTime.value,queuesCount.value);
139140
}else{
140141
queues.value.push(...data);
141142
}

ui/static/apis/dashboard.js

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,14 @@ const dashboardApi = {
2222
let series = [
2323
{
2424
data: queues,
25+
large: true,
2526
type: 'scatter',
2627
symbolSize: function (data) {
2728
let size = Math.sqrt(data[2]) / 2.5;
28-
if (size > 15) {
29-
size = 15;
30-
}
31-
if (size < 5) {
32-
size = 5;
29+
if(size >= 8){
30+
size = 8
31+
}else{
32+
size = 4
3333
}
3434
return size;
3535
},
@@ -41,9 +41,9 @@ const dashboardApi = {
4141
}
4242
},
4343
itemStyle: {
44-
shadowBlur: 10,
44+
shadowBlur: 3,
4545
shadowColor: 'rgba(120, 36, 50, 0.5)',
46-
shadowOffsetY: 5,
46+
//shadowOffsetY: 2,
4747
color: new echarts.graphic.RadialGradient(0.4, 0.3, 1, [
4848
{
4949
offset: 0,
@@ -101,19 +101,21 @@ const dashboardApi = {
101101
type: 'dashed'
102102
}
103103
},
104-
scale: true
104+
scale: true,
105+
min:0,
106+
max:5000
105107
};
106108
lineOpt.dataZoom = [
107109
{
108110
type: 'inside',
109111
start: 0,
110-
end: 10
112+
end: 100
111113
},
112114
];
113115
lineOpt.series = series;
114116
return lineOpt;
115117
},
116-
MessageRateLine(values,execTime){
118+
MessageRateLine(values,execTime,count){
117119

118120
let xdata = [];
119121
let publish = [],confirm = [],deliver = [],redelivered = [],ack = [],get = [],nget = [];

0 commit comments

Comments
 (0)