main
vue 62 lines 1.78 KB
Raw
1 <template>
2 <CardEntity>
3 <template #headerMain>{{ job.id }}</template>
4 <template #headerExtra>
5 <n-tooltip placement="top-end">
6 <template #trigger>
7 <div class="flex items-center gap-2">
8 {{ formatDate(job.last_success, dFormats.datetimesec) }}
9 <Icon :name="TimeIcon" />
10 </div>
11 </template>
12 Last success time
13 </n-tooltip>
14 </template>
15
16 <template #default>
17 {{ job.description }}
18 </template>
19
20 <template #footerMain>
21 <div class="flex flex-wrap items-center gap-3">
22 <Badge type="splitted" color="primary">
23 <template #label>Interval</template>
24 <template #value>
25 {{ job.time_interval }} {{ job.time_interval === 1 ? "minute" : "minutes" }}
26 </template>
27 </Badge>
28 <Badge v-if="job.enabled" type="splitted" color="primary">
29 <template #label>Next run time</template>
30 <template #value>
31 <div class="hover:text-primary flex h-full cursor-help items-center">
32 <NextJobTimeTooltip :job-id="job.id" />
33 </div>
34 </template>
35 </Badge>
36 </div>
37 </template>
38 <template #footerExtra>
39 <div class="flex flex-row flex-wrap gap-3">
40 <JobActions :job size="small" />
41 </div>
42 </template>
43 </CardEntity>
44 </template>
45
46 <script setup lang="ts">
47 import type { Job } from "@/types/scheduler.d"
48 import { NTooltip } from "naive-ui"
49 import Badge from "@/components/common/Badge.vue"
50 import CardEntity from "@/components/common/cards/CardEntity.vue"
51 import Icon from "@/components/common/Icon.vue"
52 import { useSettingsStore } from "@/stores/settings"
53 import { formatDate } from "@/utils/format"
54 import JobActions from "./JobActions.vue"
55 import NextJobTimeTooltip from "./NextJobTimeTooltip.vue"
56
57 const { job } = defineProps<{ job: Job }>()
58
59 const TimeIcon = "carbon:time"
60
61 const dFormats = useSettingsStore().dateFormat
62 </script>