Skip to content

Commit

Permalink
Connection status charts now use different color to distinguish stati…
Browse files Browse the repository at this point in the history
…stics of current connection from past ones
  • Loading branch information
NI committed Oct 2, 2019
1 parent e77ad35 commit f2f2c43
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 8 deletions.
11 changes: 10 additions & 1 deletion ui/history.js
Expand Up @@ -32,7 +32,16 @@ export class Records {
*/
update(newData) {
this.data.shift();
this.data.push(newData);
this.data.push({ data: newData, class: "" });
}

/**
* Set all existing data as expired
*/
expire() {
for (let i = 0; i < this.data.length; i++) {
this.data[i].class = "expired";
}
}

/**
Expand Down
5 changes: 4 additions & 1 deletion ui/home_socketctl.js
Expand Up @@ -31,7 +31,7 @@ export function build(ctx) {
let r = [];

for (let i = 0; i < 32; i++) {
r.push(0);
r.push({ data: 0, class: "" });
}

return r;
Expand Down Expand Up @@ -165,6 +165,9 @@ export function build(ctx) {
},
close(e) {
isClosed = true;
delayHistory.expire();
inboundHistory.expire();
outboundHistory.expire();

ctx.connector.inputting = false;

Expand Down
12 changes: 6 additions & 6 deletions ui/widgets/chart.vue
Expand Up @@ -44,11 +44,11 @@ class Data {
let max = 0;
for (let i in data) {
if (data[i] <= max) {
if (data[i].data <= max) {
continue;
}
max = data[i];
max = data[i].data;
}
return max;
Expand Down Expand Up @@ -121,7 +121,7 @@ class BarDrawer extends BaseDrawer {
cellHeight = rootDim.height - this.topBottomPadding;
for (let i in data.data) {
let h = this.toCellHeight(cellHeight, data, data.data[i]);
let h = this.toCellHeight(cellHeight, data, data.data[i].data);
this.createEl(parent, "path", {
d:
Expand All @@ -133,7 +133,7 @@ class BarDrawer extends BaseDrawer {
currentWidth +
"," +
cellHalfHeight,
class: h > 0 ? "" : "zero"
class: h === 0 ? "zero" : data.data[i].class
});
currentWidth += cellWidth;
Expand All @@ -149,7 +149,7 @@ class UpsideDownBarDrawer extends BarDrawer {
cellHeight = rootDim.height - this.topBottomPadding;
for (let i in data.data) {
let h = this.toCellHeight(cellHeight, data, data.data[i]);
let h = this.toCellHeight(cellHeight, data, data.data[i].data);
this.createEl(parent, "path", {
d:
Expand All @@ -161,7 +161,7 @@ class UpsideDownBarDrawer extends BarDrawer {
currentWidth +
"," +
(Math.round(h) + padHalfHeight),
class: h > 0 ? "" : "zero"
class: h === 0 ? "zero" : data.data[i].class
});
currentWidth += cellWidth;
Expand Down
4 changes: 4 additions & 0 deletions ui/widgets/status.css
Expand Up @@ -167,6 +167,10 @@
stroke-width: 3px;
}

.conn-status-chart > .chart .expired {
stroke: #3a3a3a;
}

#conn-status-delay {
padding: 15px 0;
background: #292929;
Expand Down

0 comments on commit f2f2c43

Please sign in to comment.