|
1 | 1 | <template> |
2 | 2 | <div class="w-1vw md:w-64 bg-white border border-gray-200 rounded-md"> |
3 | | - <div v-for="job in props.jobs" :key="job.id" class="flex items-center px-4 py-3 border-b border-gray-200 hover:bg-gray-50 transition-colors"> |
4 | | - <div class="flex flex-col w-full max-w-48"> |
5 | | - <p class="flex gap-2 items-end justify-between text-nowrap"> |
6 | | - <span class="text-sm h-full text truncate">{{ job.name }}</span> |
7 | | - <span class="text-xs text-gray-600">{{ getTimeAgoString(new Date(job.createdAt)) }}</span> |
8 | | - </p> |
9 | | - <ProgressBar |
10 | | - class="mt-1" |
11 | | - :current-value="job.progress" |
12 | | - :max-value="100" |
13 | | - :min-value="0" |
14 | | - :showAnimation="job.status === 'IN_PROGRESS'" |
15 | | - :showLabels="false" |
16 | | - :showValues="false" |
17 | | - :show-progress="false" |
18 | | - /> |
| 3 | + <Modal v-for="job in props.jobs" :key="job.id" :beforeOpenFunction="props.closeDropdown"> |
| 4 | + <template #trigger> |
| 5 | + <div class="flex items-center w-full px-4 py-3 border-b border-gray-200 hover:bg-gray-50 transition-colors"> |
| 6 | + <div class="flex flex-col w-full max-w-48"> |
| 7 | + <p class="flex gap-2 items-end justify-between text-nowrap"> |
| 8 | + <span class="text-sm h-full text truncate">{{ job.name }}</span> |
| 9 | + <span class="text-xs text-gray-600">{{ getTimeAgoString(new Date(job.createdAt)) }}</span> |
| 10 | + </p> |
| 11 | + <ProgressBar |
| 12 | + class="mt-1" |
| 13 | + :current-value="job.progress" |
| 14 | + :max-value="100" |
| 15 | + :min-value="0" |
| 16 | + :showAnimation="job.status === 'IN_PROGRESS'" |
| 17 | + :showLabels="false" |
| 18 | + :showValues="false" |
| 19 | + :show-progress="false" |
| 20 | + /> |
| 21 | + </div> |
| 22 | + <StateToIcon :job="job" /> |
| 23 | + </div> |
| 24 | + </template> |
| 25 | + <div> |
| 26 | + <JobInfoPopup :job="job" /> |
19 | 27 | </div> |
20 | | - <Tooltip v-if="job.status === 'IN_PROGRESS'"> |
21 | | - <Spinner class="w-4 h-4 ml-2" /> |
22 | | - <template #tooltip> |
23 | | - {{ t('In progress') }} |
24 | | - </template> |
25 | | - </Tooltip> |
26 | | - <Tooltip v-else-if="job.status === 'DONE'"> |
27 | | - <IconCheckCircleOutline class="w-5 h-5 ml-2 text-green-500" /> |
28 | | - <template #tooltip> |
29 | | - {{ t('Done') }} |
30 | | - </template> |
31 | | - </Tooltip> |
32 | | - <Tooltip v-else-if="job.status === 'CANCELED'"> |
33 | | - <IconCloseCircleOutline class="w-5 h-5 ml-2 text-red-500" /> |
34 | | - <template #tooltip> |
35 | | - {{ t('Canceled') }} |
36 | | - </template> |
37 | | - </Tooltip> |
38 | | - <Tooltip v-else-if="job.status === 'DONE_WITH_ERRORS'"> |
39 | | - <IconExclamationCircleOutline class="w-5 h-5 ml-2 text-yellow-500" /> |
40 | | - <template #tooltip> |
41 | | - {{ t('Done with errors') }} |
42 | | - </template> |
43 | | - </Tooltip> |
44 | | - </div> |
| 28 | + </Modal> |
| 29 | + |
45 | 30 | </div> |
46 | 31 | </template> |
47 | 32 |
|
48 | 33 |
|
49 | 34 | <script setup lang="ts"> |
50 | 35 | import type { IJob } from './utils'; |
51 | 36 | import { getTimeAgoString } from '@/utils'; |
52 | | -import { ProgressBar, Spinner, Tooltip } from '@/afcl'; |
53 | | -import { IconCheckCircleOutline, IconCloseCircleOutline, IconExclamationCircleOutline } from '@iconify-prerendered/vue-flowbite'; |
| 37 | +import { ProgressBar, Modal } from '@/afcl'; |
54 | 38 | import { useI18n } from 'vue-i18n'; |
| 39 | +import JobInfoPopup from './JobInfoPopup.vue'; |
| 40 | +import StateToIcon from './StateToIcon.vue'; |
55 | 41 |
|
56 | 42 | const { t } = useI18n(); |
57 | 43 |
|
58 | 44 | const props = defineProps<{ |
59 | 45 | jobs: IJob[]; |
| 46 | + closeDropdown: () => void; |
60 | 47 | }>(); |
61 | 48 |
|
62 | 49 | |
|
0 commit comments