Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions custom/JobInfoPopup.vue
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ import { getTimeAgoString, callAdminForthApi, getCustomComponent} from '@/utils'
import { useI18n } from 'vue-i18n';
import StateToIcon from './StateToIcon.vue';
import { useAdminforth } from '@/adminforth';
import { watch } from 'vue';


const { t } = useI18n();
Expand Down Expand Up @@ -133,6 +134,19 @@ async function getJobTasks(limit: number = 10, offset: number = 0): Promise<{sta
}
}

watch(
() => props.job.state?.error,
(error) => {
if (error) {
adminforth.alert({
message: error,
variant: 'danger',
});
}
},
{ immediate: true }
);



</script>
4 changes: 3 additions & 1 deletion index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,9 @@ export default class BackgroundJobsPlugin extends AdminForthPlugin {
await this.setLevelDbTaskStatusField(jobLevelDb, taskIndex.toString(), 'DONE');
this.adminforth.websocket.publish(`/background-jobs-task-update/${jobId}`, { taskIndex, status: "DONE" });
} catch (error) {
afLogger.error(`Error in handling task ${taskIndex} of job ${jobId}: ${error}`, );
const errorMessage = error?.message || 'Unknown error';
afLogger.error(`Error in handling task ${taskIndex} of job ${jobId}: ${errorMessage}`, );
await this.setJobField(jobId, 'error', errorMessage);
await this.setLevelDbTaskStatusField(jobLevelDb, taskIndex.toString(), 'FAILED');
this.adminforth.websocket.publish(`/background-jobs-task-update/${jobId}`, { taskIndex, status: "FAILED" });
failedTasks++;
Expand Down