Skip to content

Commit 036ddec

Browse files
committed
feat: enhance job information display with tooltips for created and finished times
1 parent ce8dd3e commit 036ddec

File tree

3 files changed

+20
-5
lines changed

3 files changed

+20
-5
lines changed

custom/JobInfoPopup.vue

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,26 @@
11
<template>
22
<div class="flex flex-col w-full min-w-96">
33
<div class="flex items-center mb-1">
4-
<h2 class="text-lg font-semibold dark:text-white">{{ job.name }}</h2>
5-
<p class="ml-2 text-xs text-gray-600 dark:text-gray-200 h-full">{{ t('Created:') }} {{ getTimeAgoString(new Date(job.createdAt)) }}</p>
4+
<div class="flex flex-col items-start">
5+
<h2 class="text-lg font-semibold dark:text-white">{{ job.name }}</h2>
6+
<Tooltip>
7+
<p class="text-xs text-gray-600 dark:text-gray-200 h-full">{{ t('Created:') }} {{ getTimeAgoString(new Date(job.createdAt)) }}</p>
8+
<template #tooltip>
9+
{{ t('Created at:') }} {{ new Date(job.createdAt).toLocaleString() }}
10+
</template>
11+
</Tooltip>
12+
</div>
613
<div class="ml-auto flex flex-col items-start">
714
<div class="flex items-center">
815
<p class=" text-gray-800 dark:text-white h-full"> {{ t('Progress:') }} <span class="font-semibold" >{{ job.progress }}%</span></p>
916
<StateToIcon :job="job" />
1017
</div>
11-
<p class="text-xs text-gray-600 dark:text-gray-200 h-full" v-if="job.finishedAt"> {{ t('Finished:') }} {{ getTimeAgoString(new Date(job.finishedAt)) }}</p>
18+
<Tooltip v-if="job.finishedAt">
19+
<p class="text-xs text-gray-600 dark:text-gray-200 h-full"> {{ t('Finished:') }} {{ getTimeAgoString(new Date(job.finishedAt)) }}</p>
20+
<template #tooltip>
21+
{{ t('Finished at:') }} {{ new Date(job.finishedAt).toLocaleString() }}
22+
</template>
23+
</Tooltip>
1224
</div>
1325
</div>
1426
<div class="flex items-center gap-4 w-full">
@@ -40,7 +52,7 @@
4052

4153
<script setup lang="ts">
4254
import type { IJob } from './utils';
43-
import { ProgressBar, Button } from '@/afcl';
55+
import { ProgressBar, Button, Tooltip } from '@/afcl';
4456
import { getTimeAgoString, callAdminForthApi, getCustomComponent} from '@/utils';
4557
import { useI18n } from 'vue-i18n';
4658
import StateToIcon from './StateToIcon.vue';

custom/NavbarJobs.vue

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,9 @@
9494
if (data.progress !== undefined) {
9595
jobs.value[jobIndex].progress = data.progress;
9696
}
97+
if (data.finishedAt) {
98+
jobs.value[jobIndex].finishedAt = data.finishedAt;
99+
}
97100
} else {
98101
jobs.value.unshift({
99102
id: data.jobId,

index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ export default class BackgroundJobsPlugin extends AdminForthPlugin {
273273
[this.options.statusField]: 'DONE',
274274
[this.options.finishedAtField]: (new Date()).toISOString(),
275275
})
276-
this.adminforth.websocket.publish('/background-jobs', { jobId, status: 'DONE' });
276+
this.adminforth.websocket.publish('/background-jobs', { jobId, status: 'DONE', finishedAt: (new Date()).toISOString() });
277277
} else if (failedTasks > 0) {
278278
await this.adminforth.resource(this.getResourceId()).update(jobId, {
279279
[this.options.statusField]: 'DONE_WITH_ERRORS',

0 commit comments

Comments
 (0)