@adminforth/background-jobs 1.6.1 → 1.7.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 CHANGED
@@ -11,5 +11,5 @@ custom/StateToIcon.vue
11
11
  custom/tsconfig.json
12
12
  custom/utils.ts
13
13
 
14
- sent 13,128 bytes received 134 bytes 26,524.00 bytes/sec
15
- total size is 12,650 speedup is 0.95
14
+ sent 14,434 bytes received 134 bytes 29,136.00 bytes/sec
15
+ total size is 13,949 speedup is 0.96
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <div class="flex flex-col w-full min-w-96">
2
+ <div class="flex flex-col w-full min-w-96 mt-2">
3
3
  <div class="flex items-center mb-1">
4
4
  <div class="flex flex-col items-start justify-end h-12">
5
5
  <h2 class="text-lg font-semibold dark:text-white">{{ job.name }}</h2>
@@ -11,9 +11,19 @@
11
11
  </Tooltip>
12
12
  </div>
13
13
  <div class="ml-auto flex flex-col items-start justify-end h-12">
14
- <div class="flex items-center">
14
+ <div class="flex items-center mr-6">
15
15
  <p class=" text-gray-800 dark:text-white h-full"> {{ t('Progress:') }} <span class="font-semibold" >{{ job.progress }}%</span></p>
16
16
  <StateToIcon :job="job" />
17
+ <button
18
+ @click="closeModal()"
19
+ type="button"
20
+ class="absolute top-2 right-2 text-lightDialogCloseButton bg-transparent hover:bg-lightDialogCloseButtonHoverBackground hover:text-lightDialogCloseButtonHover rounded-lg text-sm w-8 h-8 ms-auto inline-flex justify-center items-center dark:text-darkDialogCloseButton dark:hover:bg-darkDialogCloseButtonHoverBackground dark:hover:text-darkDialogCloseButtonHover"
21
+ >
22
+ <svg class="w-3 h-3" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 14 14">
23
+ <path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m1 1 6 6m0 0 6 6M7 7l6-6M7 7l-6 6"/>
24
+ </svg>
25
+ <span class="sr-only">{{ t('Close Modal') }}</span>
26
+ </button>
17
27
  </div>
18
28
  <Tooltip v-if="job.finishedAt">
19
29
  <p class="text-xs text-gray-600 dark:text-gray-200 h-full"> {{ t('Finished:') }} {{ getTimeAgoString(new Date(job.finishedAt)) }}</p>
@@ -68,6 +78,7 @@ const props = defineProps<{
68
78
  meta: {
69
79
  pluginInstanceId: string;
70
80
  };
81
+ closeModal: () => void;
71
82
  }>();
72
83
 
73
84
  async function cancelJob() {
@@ -1,6 +1,8 @@
1
1
  <template>
2
2
  <div class="w-1vw md:w-64 bg-white border border-gray-200 dark:bg-gray-800 dark:border-gray-600 rounded-md">
3
3
  <Modal
4
+ ref="modalRef"
5
+ class="p-4"
4
6
  v-for="job in props.jobs" :key="job.id"
5
7
  :beforeCloseFunction="onBeforeOpen"
6
8
  :beforeOpenFunction="onBeforeClose"
@@ -30,6 +32,7 @@
30
32
  <JobInfoPopup
31
33
  :job="job"
32
34
  :meta="meta"
35
+ :closeModal="closeModal"
33
36
  />
34
37
  </Modal>
35
38
 
@@ -45,6 +48,26 @@ import JobInfoPopup from './JobInfoPopup.vue';
45
48
  import StateToIcon from './StateToIcon.vue';
46
49
  import { ref } from 'vue';
47
50
 
51
+ const modalRef = ref<any>(null);
52
+
53
+ function closeModal() {
54
+ const m = modalRef.value;
55
+ if (!m) return;
56
+
57
+ if (typeof m.close === 'function') {
58
+ m.close();
59
+ return;
60
+ }
61
+
62
+ if (Array.isArray(m)) {
63
+ m.forEach((inst: any) => {
64
+ if (inst?.close && typeof inst.close === 'function') {
65
+ inst.close();
66
+ }
67
+ });
68
+ }
69
+ }
70
+
48
71
  const props = defineProps<{
49
72
  jobs: IJob[];
50
73
  closeDropdown: () => void;
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <div class="flex flex-col w-full min-w-96">
2
+ <div class="flex flex-col w-full min-w-96 mt-2">
3
3
  <div class="flex items-center mb-1">
4
4
  <div class="flex flex-col items-start justify-end h-12">
5
5
  <h2 class="text-lg font-semibold dark:text-white">{{ job.name }}</h2>
@@ -11,9 +11,19 @@
11
11
  </Tooltip>
12
12
  </div>
13
13
  <div class="ml-auto flex flex-col items-start justify-end h-12">
14
- <div class="flex items-center">
14
+ <div class="flex items-center mr-6">
15
15
  <p class=" text-gray-800 dark:text-white h-full"> {{ t('Progress:') }} <span class="font-semibold" >{{ job.progress }}%</span></p>
16
16
  <StateToIcon :job="job" />
17
+ <button
18
+ @click="closeModal()"
19
+ type="button"
20
+ class="absolute top-2 right-2 text-lightDialogCloseButton bg-transparent hover:bg-lightDialogCloseButtonHoverBackground hover:text-lightDialogCloseButtonHover rounded-lg text-sm w-8 h-8 ms-auto inline-flex justify-center items-center dark:text-darkDialogCloseButton dark:hover:bg-darkDialogCloseButtonHoverBackground dark:hover:text-darkDialogCloseButtonHover"
21
+ >
22
+ <svg class="w-3 h-3" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 14 14">
23
+ <path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m1 1 6 6m0 0 6 6M7 7l6-6M7 7l-6 6"/>
24
+ </svg>
25
+ <span class="sr-only">{{ t('Close Modal') }}</span>
26
+ </button>
17
27
  </div>
18
28
  <Tooltip v-if="job.finishedAt">
19
29
  <p class="text-xs text-gray-600 dark:text-gray-200 h-full"> {{ t('Finished:') }} {{ getTimeAgoString(new Date(job.finishedAt)) }}</p>
@@ -68,6 +78,7 @@ const props = defineProps<{
68
78
  meta: {
69
79
  pluginInstanceId: string;
70
80
  };
81
+ closeModal: () => void;
71
82
  }>();
72
83
 
73
84
  async function cancelJob() {
@@ -1,6 +1,8 @@
1
1
  <template>
2
2
  <div class="w-1vw md:w-64 bg-white border border-gray-200 dark:bg-gray-800 dark:border-gray-600 rounded-md">
3
3
  <Modal
4
+ ref="modalRef"
5
+ class="p-4"
4
6
  v-for="job in props.jobs" :key="job.id"
5
7
  :beforeCloseFunction="onBeforeOpen"
6
8
  :beforeOpenFunction="onBeforeClose"
@@ -30,6 +32,7 @@
30
32
  <JobInfoPopup
31
33
  :job="job"
32
34
  :meta="meta"
35
+ :closeModal="closeModal"
33
36
  />
34
37
  </Modal>
35
38
 
@@ -45,6 +48,26 @@ import JobInfoPopup from './JobInfoPopup.vue';
45
48
  import StateToIcon from './StateToIcon.vue';
46
49
  import { ref } from 'vue';
47
50
 
51
+ const modalRef = ref<any>(null);
52
+
53
+ function closeModal() {
54
+ const m = modalRef.value;
55
+ if (!m) return;
56
+
57
+ if (typeof m.close === 'function') {
58
+ m.close();
59
+ return;
60
+ }
61
+
62
+ if (Array.isArray(m)) {
63
+ m.forEach((inst: any) => {
64
+ if (inst?.close && typeof inst.close === 'function') {
65
+ inst.close();
66
+ }
67
+ });
68
+ }
69
+ }
70
+
48
71
  const props = defineProps<{
49
72
  jobs: IJob[];
50
73
  closeDropdown: () => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adminforth/background-jobs",
3
- "version": "1.6.1",
3
+ "version": "1.7.0",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "type": "module",