main
vue 76 lines 2.21 KB
Raw
1 <template>
2 <CardEntity :loading :loading-description="loadingDelete ? 'Deleting' : 'Invoking'" :embedded class="min-h-24">
3 <template #header>#{{ alert.id }}</template>
4 <template #default>
5 {{ alert.alert_id }}
6 </template>
7 <template #mainExtra>
8 <div class="flex flex-wrap items-center gap-3">
9 <Badge type="active" class="cursor-pointer" @click.stop="routeIndex(alert.alert_index).navigate()">
10 <template #iconRight>
11 <Icon :name="LinkIcon" :size="14" />
12 </template>
13 <template #label>Index / {{ alert.alert_index }}</template>
14 </Badge>
15
16 <Badge
17 type="active"
18 class="cursor-pointer"
19 @click.stop="routeCustomer({ code: alert.customer_code }).navigate()"
20 >
21 <template #iconRight>
22 <Icon :name="LinkIcon" :size="14" />
23 </template>
24 <template #label>Customer #{{ alert.customer_code }}</template>
25 </Badge>
26
27 <Badge type="splitted" color="primary">
28 <template #label>Source</template>
29 <template #value>
30 {{ alert.alert_source }}
31 </template>
32 </Badge>
33 </div>
34 </template>
35 <template #footerExtra>
36 <AlertActions
37 class="flex flex-wrap gap-3"
38 :alert
39 size="small"
40 @deleted="emit('deleted')"
41 @invoked="emit('invoked')"
42 @start-deleting="loadingDelete = true"
43 @stop-deleting="loadingDelete = false"
44 @start-invoking="loadingInvoke = true"
45 @stop-invoking="loadingInvoke = false"
46 />
47 </template>
48 </CardEntity>
49 </template>
50
51 <script setup lang="ts">
52 import type { MonitoringAlert } from "@/types/monitoringAlerts.d"
53 import { computed, ref } from "vue"
54 import Badge from "@/components/common/Badge.vue"
55 import CardEntity from "@/components/common/cards/CardEntity.vue"
56 import Icon from "@/components/common/Icon.vue"
57 import { useNavigation } from "@/composables/useNavigation"
58 import AlertActions from "./ItemActions.vue"
59
60 const { alert, embedded } = defineProps<{
61 alert: MonitoringAlert
62 embedded?: boolean
63 }>()
64
65 const emit = defineEmits<{
66 (e: "deleted"): void
67 (e: "invoked"): void
68 }>()
69
70 const LinkIcon = "carbon:launch"
71
72 const { routeCustomer, routeIndex } = useNavigation()
73 const loadingDelete = ref(false)
74 const loadingInvoke = ref(false)
75 const loading = computed(() => loadingDelete.value || loadingInvoke.value)
76 </script>