1
0
mirror of https://github.com/ohwgiles/laminar.git synced 2024-10-27 20:34:20 +00:00

build time graph: simplify success/failed color logic

This commit is contained in:
Oliver Giles 2020-09-04 13:15:30 +12:00
parent a793a97424
commit e74332595e

View File

@ -539,8 +539,7 @@ var Job = function() {
pointHoverRadius: 0, pointHoverRadius: 0,
},{ },{
label: 'Build time', label: 'Build time',
backgroundColor: (new Array(msg.recent.length)).fill('darkseagreen'), backgroundColor: msg.recent.map(e => e.result == 'success' ? '#74af77': '#883d3d'),
borderColor: (new Array(msg.recent.length)).fill('forestgreen'),
data: msg.recent.map(function(e) { data: msg.recent.map(function(e) {
return e.completed - e.started; return e.completed - e.started;
}).reverse() }).reverse()
@ -570,14 +569,6 @@ var Job = function() {
}}} }}}
} }
}); });
for (var i = 0, n = msg.recent.length; i < n; ++i) {
if (msg.recent[i].result != "success") {
chtBt.data.datasets[0].backgroundColor[n - i - 1] = "darksalmon";
chtBt.data.datasets[0].borderColor[n - i - 1] = "crimson";
}
}
chtBt.update();
}, },
job_queued: function() { job_queued: function() {
state.nQueued++; state.nQueued++;