Webapp: only emit 'activeJobDeleted' event when the active job was deleted

Only emit the `activeJobDeleted` event when the active job was deleted.
Previously this was emitted on _any_ job deletion, which would make working
with the web interface quite confusing when mass deletion was happening,
as it would always deselect the job, even when showing an unrelated job.
This commit is contained in:
Sybren A. Stüvel 2024-06-06 16:46:51 +02:00
parent 8b01012539
commit 7c8a700187

@ -28,7 +28,7 @@ import StatusFilterBar from '@/components/StatusFilterBar.vue';
export default {
name: 'JobsTable',
props: ['activeJobID'],
emits: ['tableRowClicked', 'activeJobDeleted'],
emits: ['tableRowClicked', 'activeJobDeleted', 'jobDeleted'],
components: {
JobActionsBar,
StatusFilterBar,
@ -166,7 +166,10 @@ export default {
if (row) promise = row.delete();
else promise = Promise.resolve();
promise.finally(() => {
this.$emit('activeJobDeleted', jobUpdate.id);
this.$emit('jobDeleted', jobUpdate.id);
if (jobUpdate.id == this.activeJobID) {
this.$emit('activeJobDeleted', jobUpdate.id);
}
});
} else {
if (row) promise = this.tabulator.updateData([jobUpdate]);