Web: show task status changes in the notifications
This of course only shows notifications about tasks of the active job, as otherwise things would get messy.
This commit is contained in:
parent
3c622264a4
commit
4602ef2523
@ -39,6 +39,21 @@ export const useNotifs = defineStore('notifications', {
|
||||
this._restartHideTimer();
|
||||
},
|
||||
|
||||
/**
|
||||
* @param {API.SioTaskUpdate} taskUpdate Task update received via SocketIO.
|
||||
*/
|
||||
addTaskUpdate(taskUpdate) {
|
||||
console.log('Received task update:', taskUpdate);
|
||||
let msg = `Task ${taskUpdate.name}`;
|
||||
if (taskUpdate.previous_status && taskUpdate.previous_status != taskUpdate.status) {
|
||||
msg += ` changed status ${taskUpdate.previous_status} ➜ ${taskUpdate.status}`;
|
||||
}
|
||||
if (taskUpdate.activity) {
|
||||
msg += `: ${taskUpdate.activity}`;
|
||||
}
|
||||
this.add(msg)
|
||||
},
|
||||
|
||||
/* Ensure there is only 1000 items in the history. */
|
||||
_prune() {
|
||||
if (this.history.length <= 1000) return;
|
||||
|
@ -23,6 +23,7 @@ import * as urls from '@/urls'
|
||||
import * as API from '@/manager-api';
|
||||
import { useJobs } from '@/stores/jobs';
|
||||
import { useTasks } from '@/stores/tasks';
|
||||
import { useNotifs } from '@/stores/notifications'
|
||||
import { apiClient } from '@/stores/api-query-count';
|
||||
|
||||
import FooterPopup from '@/components/FooterPopup.vue'
|
||||
@ -51,6 +52,7 @@ export default {
|
||||
|
||||
jobs: useJobs(),
|
||||
tasks: useTasks(),
|
||||
notifs: useNotifs(),
|
||||
showFooterPopup: false,
|
||||
}),
|
||||
mounted() {
|
||||
@ -127,6 +129,7 @@ export default {
|
||||
this.$refs.tasksTable.processTaskUpdate(taskUpdate);
|
||||
if (this.taskID == taskUpdate.id)
|
||||
this._fetchTask(this.taskID);
|
||||
this.notifs.addTaskUpdate(taskUpdate);
|
||||
},
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user