Skip to content
This repository was archived by the owner on Feb 27, 2022. It is now read-only.

Commit 5a36d83

Browse files
author
Reto Lehmann
committed
Host charts
1 parent 2429460 commit 5a36d83

File tree

8 files changed

+98
-27
lines changed

8 files changed

+98
-27
lines changed

ui/src/main.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,11 @@ Vue.use(VueNativeSock, 'ws://localhost:8089/ws', {store: store, format: 'json'})
1010
import Navbar from './shared/Nav.vue';
1111
import LineChart from './shared/LineChart.vue';
1212
import BarChart from './shared/BarChart.vue';
13-
import DognutChart from './shared/DougnutChart.vue';
1413
import Dashboard from './shared/Dashboard.vue';
1514
Vue.component('navbar', Navbar);
1615
Vue.component('dashboard', Dashboard);
1716
Vue.component('line-chart', LineChart);
1817
Vue.component('bar-chart', BarChart);
19-
Vue.component('dognut-chart', DognutChart);
2018

2119
new Vue({
2220
el: '#app',

ui/src/parts/Host.vue

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
<template>
2+
<div class="panel">
3+
<div class="panel-container flex25">
4+
<line-chart :chart-data="connections" :height="200"></line-chart>
5+
</div>
6+
<div class="panel-container flex25">
7+
<line-chart :chart-data="activeConnections" :height="200"></line-chart>
8+
</div>
9+
<div class="panel-container flex25">
10+
<line-chart :chart-data="refusedConnections" :height="200"></line-chart>
11+
</div>
12+
</div>
13+
</template>
14+
15+
<script>
16+
export default {
17+
name: 'host',
18+
props: ['host'],
19+
computed: {
20+
connections() {
21+
return {
22+
labels: this.$store.state.stats.ticks,
23+
datasets: [
24+
{
25+
label: `Total Conn: ${this.host.clusterKey}-${this.host.hostIP}`,
26+
backgroundColor: '#e3a108',
27+
data: this.host.stats.map(s => s.totalConnections)
28+
}
29+
]
30+
}
31+
},
32+
activeConnections() {
33+
return {
34+
labels: this.$store.state.stats.ticks,
35+
datasets: [
36+
{
37+
label: `Active Conn: ${this.host.clusterKey}-${this.host.hostIP}`,
38+
backgroundColor: '#5b9c1c',
39+
data: this.host.stats.map(s => s.activeConnections)
40+
}
41+
]
42+
}
43+
},
44+
refusedConnections() {
45+
return {
46+
labels: this.$store.state.stats.ticks,
47+
datasets: [
48+
{
49+
label: `Refused Conn: ${this.host.clusterKey}-${this.host.hostIP}`,
50+
backgroundColor: '#df171b',
51+
data: this.host.stats.map(s => s.refusedConnections)
52+
}
53+
]
54+
}
55+
}
56+
}
57+
}
58+
</script>
59+
60+
<style>
61+
.flex25 {
62+
flex: 25%
63+
}
64+
</style>
65+
66+

ui/src/parts/HostOverview.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<template>
22
<bar-chart :chart-data="hosts"
3+
:height="300"
34
:chart-options="options"></bar-chart>
45
</template>
56

ui/src/parts/Overall.vue

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<template>
2-
<line-chart :chart-data="connections"></line-chart>
2+
<line-chart
3+
:height="300"
4+
:chart-data="connections"></line-chart>
35
</template>
46

57
<script>

ui/src/shared/BarChart.vue

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414
opts = this.chartOptions;
1515
}
1616
17+
opts.animation = {
18+
duration: 400
19+
};
1720
opts.responsive = true;
1821
opts.maintainAspectRatio = false;
1922
return opts;

ui/src/shared/Dashboard.vue

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,38 @@
11
<template>
2-
<div class="panel">
3-
<div class="panel-container flex50">
4-
<overall></overall>
2+
<div>
3+
<div class="panel">
4+
<div class="panel-container flex50">
5+
<overall></overall>
6+
</div>
7+
<div class="panel-container flex50">
8+
<host-overview></host-overview>
9+
</div>
510
</div>
6-
<div class="panel-container flex50">
7-
<host-overview></host-overview>
11+
12+
<!--Repeat a row for each host-->
13+
<div v-for="host in hosts">
14+
<host :host="host"></host>
815
</div>
916
</div>
1017
</template>
1118

1219
<script>
1320
import Overall from "../parts/Overall.vue";
1421
import HostOverview from "../parts/HostOverview.vue";
22+
import Host from "../parts/Host.vue";
1523
1624
export default {
1725
components: {
1826
Overall,
19-
HostOverview
27+
HostOverview,
28+
Host
2029
},
21-
name: 'dashboard'
30+
name: 'dashboard',
31+
computed: {
32+
hosts() {
33+
return this.$store.state.stats.hosts;
34+
}
35+
}
2236
}
2337
</script>
2438

@@ -33,15 +47,13 @@
3347
}
3448
3549
.panel-container {
36-
min-height: 250px;
50+
min-height: 150px;
3751
3852
background-color: #1f1d1d;
3953
position: relative;
4054
border: 1px solid #292929;
4155
}
4256
43-
44-
4557
div {
4658
display: block;
4759
}

ui/src/shared/DougnutChart.vue

Lines changed: 0 additions & 14 deletions
This file was deleted.

ui/src/shared/LineChart.vue

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414
opts = this.chartOptions;
1515
}
1616
17+
opts.animation = {
18+
duration: 400
19+
};
1720
opts.responsive = true;
1821
opts.maintainAspectRatio = false;
1922
return opts;

0 commit comments

Comments
 (0)