Web: show job updates in the notifications popover
This commit is contained in:
parent
cc62cab1d6
commit
0242f2d217
@ -33,17 +33,14 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
_handleJobActionPromise(promise, description) {
|
_handleJobActionPromise(promise, description) {
|
||||||
// const numJobs = this.jobs.numSelected;
|
|
||||||
const numJobs = 1;
|
|
||||||
return promise
|
return promise
|
||||||
.then(() => {
|
.then(() => {
|
||||||
let message;
|
// There used to be a call to `this.notifs.add(message)` here, but now
|
||||||
if (numJobs == 1) {
|
// that job status changes are logged in the notifications anyway,
|
||||||
message = `Job ${description}`;
|
// it's no longer necessary.
|
||||||
} else {
|
// This function is still kept, in case we want to bring back the
|
||||||
message = `${numJobs} jobs ${description}`;
|
// notifications when multiple jobs can be selected. Then a summary
|
||||||
}
|
// ("N jobs requeued") could be logged here.
|
||||||
this.notifs.add(message);
|
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
const errorMsg = JSON.stringify(error); // TODO: handle API errors better.
|
const errorMsg = JSON.stringify(error); // TODO: handle API errors better.
|
||||||
|
@ -40,7 +40,19 @@ export const useNotifs = defineStore('notifications', {
|
|||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {API.SioTaskUpdate} taskUpdate Task update received via SocketIO.
|
* @param {API.SocketIOJobUpdate} jobUpdate Job update received via SocketIO.
|
||||||
|
*/
|
||||||
|
addJobUpdate(jobUpdate) {
|
||||||
|
console.log('Received job update:', jobUpdate);
|
||||||
|
let msg = `Job ${jobUpdate.name}`;
|
||||||
|
if (jobUpdate.previous_status && jobUpdate.previous_status != jobUpdate.status) {
|
||||||
|
msg += ` changed status ${jobUpdate.previous_status} ➜ ${jobUpdate.status}`;
|
||||||
|
}
|
||||||
|
this.add(msg)
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {API.SocketIOTaskUpdate} taskUpdate Task update received via SocketIO.
|
||||||
*/
|
*/
|
||||||
addTaskUpdate(taskUpdate) {
|
addTaskUpdate(taskUpdate) {
|
||||||
console.log('Received task update:', taskUpdate);
|
console.log('Received task update:', taskUpdate);
|
||||||
|
@ -104,6 +104,7 @@ export default {
|
|||||||
|
|
||||||
// SocketIO data event handlers:
|
// SocketIO data event handlers:
|
||||||
onSioJobUpdate(jobUpdate) {
|
onSioJobUpdate(jobUpdate) {
|
||||||
|
this.notifs.addJobUpdate(jobUpdate);
|
||||||
|
|
||||||
if (this.$refs.jobsTable) {
|
if (this.$refs.jobsTable) {
|
||||||
if (jobUpdate.previous_status)
|
if (jobUpdate.previous_status)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user