diff --git a/web/app/src/stores/notifications.js b/web/app/src/stores/notifications.js index e6f41196..c8f4045c 100644 --- a/web/app/src/stores/notifications.js +++ b/web/app/src/stores/notifications.js @@ -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; diff --git a/web/app/src/views/JobsView.vue b/web/app/src/views/JobsView.vue index 3bd93af2..67bfd4fc 100644 --- a/web/app/src/views/JobsView.vue +++ b/web/app/src/views/JobsView.vue @@ -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); }, /**