@adminforth/background-jobs 1.2.4 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build.log +2 -2
- package/custom/JobInfoPopup.vue +16 -4
- package/custom/NavbarJobs.vue +3 -0
- package/dist/custom/JobInfoPopup.vue +16 -4
- package/dist/custom/NavbarJobs.vue +3 -0
- package/dist/index.js +1 -1
- package/index.ts +1 -1
- package/package.json +1 -1
package/build.log
CHANGED
|
@@ -11,5 +11,5 @@ custom/StateToIcon.vue
|
|
|
11
11
|
custom/tsconfig.json
|
|
12
12
|
custom/utils.ts
|
|
13
13
|
|
|
14
|
-
sent
|
|
15
|
-
total size is 11,
|
|
14
|
+
sent 12,276 bytes received 134 bytes 24,820.00 bytes/sec
|
|
15
|
+
total size is 11,791 speedup is 0.95
|
package/custom/JobInfoPopup.vue
CHANGED
|
@@ -1,14 +1,26 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="flex flex-col w-full min-w-96">
|
|
3
3
|
<div class="flex items-center mb-1">
|
|
4
|
-
<
|
|
5
|
-
|
|
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>
|
|
6
13
|
<div class="ml-auto flex flex-col items-start">
|
|
7
14
|
<div class="flex items-center">
|
|
8
15
|
<p class=" text-gray-800 dark:text-white h-full"> {{ t('Progress:') }} <span class="font-semibold" >{{ job.progress }}%</span></p>
|
|
9
16
|
<StateToIcon :job="job" />
|
|
10
17
|
</div>
|
|
11
|
-
<
|
|
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>
|
|
12
24
|
</div>
|
|
13
25
|
</div>
|
|
14
26
|
<div class="flex items-center gap-4 w-full">
|
|
@@ -40,7 +52,7 @@
|
|
|
40
52
|
|
|
41
53
|
<script setup lang="ts">
|
|
42
54
|
import type { IJob } from './utils';
|
|
43
|
-
import { ProgressBar, Button } from '@/afcl';
|
|
55
|
+
import { ProgressBar, Button, Tooltip } from '@/afcl';
|
|
44
56
|
import { getTimeAgoString, callAdminForthApi, getCustomComponent} from '@/utils';
|
|
45
57
|
import { useI18n } from 'vue-i18n';
|
|
46
58
|
import StateToIcon from './StateToIcon.vue';
|
package/custom/NavbarJobs.vue
CHANGED
|
@@ -1,14 +1,26 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="flex flex-col w-full min-w-96">
|
|
3
3
|
<div class="flex items-center mb-1">
|
|
4
|
-
<
|
|
5
|
-
|
|
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>
|
|
6
13
|
<div class="ml-auto flex flex-col items-start">
|
|
7
14
|
<div class="flex items-center">
|
|
8
15
|
<p class=" text-gray-800 dark:text-white h-full"> {{ t('Progress:') }} <span class="font-semibold" >{{ job.progress }}%</span></p>
|
|
9
16
|
<StateToIcon :job="job" />
|
|
10
17
|
</div>
|
|
11
|
-
<
|
|
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>
|
|
12
24
|
</div>
|
|
13
25
|
</div>
|
|
14
26
|
<div class="flex items-center gap-4 w-full">
|
|
@@ -40,7 +52,7 @@
|
|
|
40
52
|
|
|
41
53
|
<script setup lang="ts">
|
|
42
54
|
import type { IJob } from './utils';
|
|
43
|
-
import { ProgressBar, Button } from '@/afcl';
|
|
55
|
+
import { ProgressBar, Button, Tooltip } from '@/afcl';
|
|
44
56
|
import { getTimeAgoString, callAdminForthApi, getCustomComponent} from '@/utils';
|
|
45
57
|
import { useI18n } from 'vue-i18n';
|
|
46
58
|
import StateToIcon from './StateToIcon.vue';
|
package/dist/index.js
CHANGED
|
@@ -242,7 +242,7 @@ export default class BackgroundJobsPlugin extends AdminForthPlugin {
|
|
|
242
242
|
[this.options.statusField]: 'DONE',
|
|
243
243
|
[this.options.finishedAtField]: (new Date()).toISOString(),
|
|
244
244
|
});
|
|
245
|
-
this.adminforth.websocket.publish('/background-jobs', { jobId, status: 'DONE' });
|
|
245
|
+
this.adminforth.websocket.publish('/background-jobs', { jobId, status: 'DONE', finishedAt: (new Date()).toISOString() });
|
|
246
246
|
}
|
|
247
247
|
else if (failedTasks > 0) {
|
|
248
248
|
yield this.adminforth.resource(this.getResourceId()).update(jobId, {
|
package/index.ts
CHANGED
|
@@ -273,7 +273,7 @@ export default class BackgroundJobsPlugin extends AdminForthPlugin {
|
|
|
273
273
|
[this.options.statusField]: 'DONE',
|
|
274
274
|
[this.options.finishedAtField]: (new Date()).toISOString(),
|
|
275
275
|
})
|
|
276
|
-
this.adminforth.websocket.publish('/background-jobs', { jobId, status: 'DONE' });
|
|
276
|
+
this.adminforth.websocket.publish('/background-jobs', { jobId, status: 'DONE', finishedAt: (new Date()).toISOString() });
|
|
277
277
|
} else if (failedTasks > 0) {
|
|
278
278
|
await this.adminforth.resource(this.getResourceId()).update(jobId, {
|
|
279
279
|
[this.options.statusField]: 'DONE_WITH_ERRORS',
|