main
vue 53 lines 1.41 KB
Raw
1 <template>
2 <div>
3 <n-button-group :size>
4 <n-button :focusable="false" @click="showDetails = true">
5 <template #icon>
6 <Icon name="carbon:view" />
7 </template>
8 View Details
9 </n-button>
10 <n-button :focusable="false" @click="routeAlertDetails(alertId).navigate()">
11 <template #icon>
12 <Icon name="carbon:launch" />
13 </template>
14 </n-button>
15 </n-button-group>
16
17 <n-modal
18 v-model:show="showDetails"
19 title="Alert Details"
20 preset="card"
21 display-directive="show"
22 :style="{ maxWidth: 'min(800px, 90vw)', minHeight: 'min(540px, 90vh)', overflow: 'hidden' }"
23 >
24 <AlertDetails :alert-id @status-updated="handleStatusUpdated" />
25 </n-modal>
26 </div>
27 </template>
28
29 <script setup lang="ts">
30 import type { ButtonSize } from "naive-ui"
31 import type { AlertStatusUpdateSuccessPayload } from "./AlertStatusSelect.vue"
32 import { NButton, NButtonGroup, NModal } from "naive-ui"
33 import { ref } from "vue"
34 import Icon from "@/components/common/Icon.vue"
35 import { useNavigation } from "@/composables/common/useNavigation"
36 import AlertDetails from "./AlertDetails"
37
38 defineProps<{
39 alertId: number
40 size?: ButtonSize
41 }>()
42
43 const emit = defineEmits<{
44 (e: "statusUpdated", value: AlertStatusUpdateSuccessPayload): void
45 }>()
46
47 const { routeAlertDetails } = useNavigation()
48 const showDetails = ref(false)
49
50 function handleStatusUpdated(payload: AlertStatusUpdateSuccessPayload) {
51 emit("statusUpdated", payload)
52 }
53 </script>