mirror of
https://github.com/ohwgiles/laminar.git
synced 2024-10-27 20:34:20 +00:00
resolves #62: add average line to build time graphs
This commit is contained in:
parent
010af57ed4
commit
a2d30ad2ea
@ -229,9 +229,10 @@ void Laminar::sendStatus(LaminarClient* client) {
|
|||||||
.EndObject();
|
.EndObject();
|
||||||
});
|
});
|
||||||
j.EndArray();
|
j.EndArray();
|
||||||
db->stmt("SELECT COUNT(*) FROM builds WHERE name = ?")
|
db->stmt("SELECT COUNT(*),AVG(completedAt-startedAt) FROM builds WHERE name = ?")
|
||||||
.bind(client->scope.job)
|
.bind(client->scope.job)
|
||||||
.fetch<uint>([&](uint nRuns){
|
.fetch<uint,uint>([&](uint nRuns, uint averageRuntime){
|
||||||
|
j.set("averageRuntime", averageRuntime);
|
||||||
j.set("pages", (nRuns-1) / runsPerPage + 1);
|
j.set("pages", (nRuns-1) / runsPerPage + 1);
|
||||||
j.startObject("sort");
|
j.startObject("sort");
|
||||||
j.set("page", client->scope.page)
|
j.set("page", client->scope.page)
|
||||||
|
@ -501,6 +501,16 @@ var Job = function() {
|
|||||||
return '#' + e.number;
|
return '#' + e.number;
|
||||||
}).reverse(),
|
}).reverse(),
|
||||||
datasets: [{
|
datasets: [{
|
||||||
|
label: 'Average',
|
||||||
|
type: 'line',
|
||||||
|
data: [{x:0,y:msg.averageRuntime},{x:1,y:msg.averageRuntime}],
|
||||||
|
borderColor: 'steelblue',
|
||||||
|
backgroundColor: 'transparent',
|
||||||
|
xAxisID: 'avg',
|
||||||
|
pointRadius: 0,
|
||||||
|
pointHitRadius: 0,
|
||||||
|
pointHoverRadius: 0,
|
||||||
|
},{
|
||||||
label: 'Build time',
|
label: 'Build time',
|
||||||
backgroundColor: (new Array(msg.recent.length)).fill('darkseagreen'),
|
backgroundColor: (new Array(msg.recent.length)).fill('darkseagreen'),
|
||||||
borderColor: (new Array(msg.recent.length)).fill('forestgreen'),
|
borderColor: (new Array(msg.recent.length)).fill('forestgreen'),
|
||||||
@ -508,6 +518,21 @@ var Job = function() {
|
|||||||
return e.completed - e.started;
|
return e.completed - e.started;
|
||||||
}).reverse()
|
}).reverse()
|
||||||
}]
|
}]
|
||||||
|
},
|
||||||
|
options: {
|
||||||
|
scales:{
|
||||||
|
xAxes:[{},{
|
||||||
|
id: 'avg',
|
||||||
|
type: 'linear',
|
||||||
|
ticks: {
|
||||||
|
display: false
|
||||||
|
},
|
||||||
|
gridLines: {
|
||||||
|
display: false,
|
||||||
|
drawBorder: false
|
||||||
|
}
|
||||||
|
}]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user