1
0
mirror of https://github.com/ohwgiles/laminar.git synced 2024-09-28 06:20:47 +00:00

calculate all duration in the client

This cleans up some inconsistency where sometimes 'completed-started' happened
on the client side and sometimes on the server. Also should fix the 'cumulative
time' issue mentioned in #8
This commit is contained in:
Oliver Giles 2017-11-06 19:08:14 +02:00
parent 7a7c5bc5aa
commit 116dfaa3d0
3 changed files with 4 additions and 6 deletions

View File

@ -177,7 +177,6 @@ void Laminar::sendStatus(LaminarClient* client) {
j.set("queued", started-queued);
j.set("started", started);
j.set("completed", completed);
j.set("duration", completed-started);
j.set("result", to_string(RunState(result)));
j.set("reason", reason);
});
@ -203,7 +202,7 @@ void Laminar::sendStatus(LaminarClient* client) {
.fetch<int,time_t,time_t,int,str>([&](int build,time_t started,time_t completed,int result,str reason){
j.StartObject();
j.set("number", build)
.set("duration", completed - started)
.set("completed", completed)
.set("started", started)
.set("result", to_string(RunState(result)))
.set("reason", reason)
@ -268,8 +267,8 @@ void Laminar::sendStatus(LaminarClient* client) {
j.set("name", name)
.set("number", build)
.set("node", node)
.set("duration", completed - started)
.set("started", started)
.set("completed", completed)
.set("result", to_string(RunState(result)))
.EndObject();
});
@ -706,7 +705,6 @@ void Laminar::runFinished(Run * r) {
.set("number", r->build)
.set("queued", r->startedAt - r->queuedAt)
.set("completed", completedAt)
.set("duration", completedAt - r->startedAt)
.set("started", r->startedAt)
.set("result", to_string(r->result))
.set("reason", r->reason());

View File

@ -54,7 +54,7 @@
</td>
</tr>
<tr v-for="job in jobsRecent">
<td><span v-html="runIcon(job.result)"></span> <router-link :to="'/jobs/'+job.name">{{job.name}}</router-link> <router-link :to="'/jobs/'+job.name+'/'+job.number">#{{job.number}}</router-link><br><small>Took {{job.duration}}s at {{formatDate(job.started)}}</small></td>
<td><span v-html="runIcon(job.result)"></span> <router-link :to="'/jobs/'+job.name">{{job.name}}</router-link> <router-link :to="'/jobs/'+job.name+'/'+job.number">#{{job.number}}</router-link><br><small>Took {{formatDuration(job.started, job.completed)}} at {{formatDate(job.started)}}</small></td>
</tr>
</table>
</div>

View File

@ -330,7 +330,7 @@ var Job = function() {
fillColor: "darkseagreen",
strokeColor: "forestgreen",
data: msg.recent.map(function(e) {
return e.duration;
return e.completed - e.started;
}).reverse()
}]
}, {