Webapp: remove assumption from SocketIO job updates
Remove the assumption that a SocketIO job update without "previous state" set is always an indication that it's about a new job. Soon job priority will be changeable, and then this assumption will no longer hold.
This commit is contained in:
parent
4176f0e447
commit
0a7b7d9cf6
@ -150,19 +150,16 @@ export default {
|
||||
// updateData() will only overwrite properties that are actually set on
|
||||
// jobUpdate, and leave the rest as-is.
|
||||
if (this.tabulator.initialized) {
|
||||
this.tabulator.updateData([jobUpdate])
|
||||
.then(this.sortData)
|
||||
.then(() => { this.tabulator.redraw(); }) // Resize columns based on new data.
|
||||
}
|
||||
this._refreshAvailableStatuses();
|
||||
},
|
||||
processNewJob(jobUpdate) {
|
||||
if (this.tabulator.initialized) {
|
||||
this.tabulator.addData([jobUpdate])
|
||||
.then(this.sortData)
|
||||
.then(() => { this.tabulator.redraw(); }) // Resize columns based on new data.
|
||||
}
|
||||
const row = this.tabulator.rowManager.findRow(jobUpdate.id);
|
||||
|
||||
let promise = null;
|
||||
if (row) promise = this.tabulator.updateData([jobUpdate]);
|
||||
else promise = this.tabulator.addData([jobUpdate]);
|
||||
|
||||
promise
|
||||
.then(this.sortData)
|
||||
.then(() => { this.tabulator.redraw(); }) // Resize columns based on new data.
|
||||
}
|
||||
this._refreshAvailableStatuses();
|
||||
},
|
||||
|
||||
|
@ -146,10 +146,7 @@ export default {
|
||||
this.jobs.setIsJobless(false);
|
||||
|
||||
if (this.$refs.jobsTable) {
|
||||
if (jobUpdate.previous_status)
|
||||
this.$refs.jobsTable.processJobUpdate(jobUpdate);
|
||||
else
|
||||
this.$refs.jobsTable.processNewJob(jobUpdate);
|
||||
this.$refs.jobsTable.processJobUpdate(jobUpdate);
|
||||
}
|
||||
if (this.jobID != jobUpdate.id)
|
||||
return;
|
||||
|
Loading…
Reference in New Issue
Block a user