mirror of
https://github.com/ohwgiles/laminar.git
synced 2024-10-27 20:34:20 +00:00
show first run of a job on all jobs page
This commit is contained in:
parent
75a2041fdb
commit
2214bef262
@ -286,6 +286,11 @@ const Jobs = function() {
|
|||||||
var idx = state.jobs.findIndex(job => job.name === msg.running[i].name);
|
var idx = state.jobs.findIndex(job => job.name === msg.running[i].name);
|
||||||
if (idx > -1)
|
if (idx > -1)
|
||||||
state.jobs[idx] = msg.running[i];
|
state.jobs[idx] = msg.running[i];
|
||||||
|
else {
|
||||||
|
// special case: first run of a job.
|
||||||
|
state.jobs.unshift(msg.running[i]);
|
||||||
|
state.jobs.sort(function(a, b){return a.name < b.name ? -1 : a.name > b.name ? 1 : 0;});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
var tags = {};
|
var tags = {};
|
||||||
for (var i in state.jobs) {
|
for (var i in state.jobs) {
|
||||||
@ -308,13 +313,21 @@ const Jobs = function() {
|
|||||||
} else {
|
} else {
|
||||||
state.jobsRunning[updAt] = data;
|
state.jobsRunning[updAt] = data;
|
||||||
}
|
}
|
||||||
|
updAt = null;
|
||||||
for (var i in state.jobs) {
|
for (var i in state.jobs) {
|
||||||
if (state.jobs[i].name === data.name) {
|
if (state.jobs[i].name === data.name) {
|
||||||
state.jobs[i] = data;
|
updAt = i;
|
||||||
this.$forceUpdate();
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (updAt === null) {
|
||||||
|
// first execution of new job. TODO insert without resort
|
||||||
|
state.jobs.unshift(data);
|
||||||
|
state.jobs.sort(function(a, b){return a.name < b.name ? -1 : a.name > b.name ? 1 : 0;});
|
||||||
|
} else {
|
||||||
|
state.jobs[updAt] = data;
|
||||||
|
}
|
||||||
|
this.$forceUpdate();
|
||||||
},
|
},
|
||||||
job_completed: function(data) {
|
job_completed: function(data) {
|
||||||
for (var i in state.jobs) {
|
for (var i in state.jobs) {
|
||||||
|
Loading…
Reference in New Issue
Block a user