| 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="routeAgentDetails(agentId.toString()).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="Agent Details" |
| 20 | preset="card" |
| 21 | display-directive="show" |
| 22 | :style="{ maxWidth: 'min(800px, 90vw)', minHeight: 'min(540px, 90vh)', overflow: 'hidden' }" |
| 23 | > |
| 24 | <AgentDetails :agent-id @critical-asset-updated="handleCriticalAssetUpdated" /> |
| 25 | </n-modal> |
| 26 | </div> |
| 27 | </template> |
| 28 | |
| 29 | <script setup lang="ts"> |
| 30 | import type { ButtonSize } from "naive-ui" |
| 31 | import type { AgentCriticalUpdateSuccessPayload } from "./AgentCriticalSelect.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 AgentDetails from "./AgentDetails/AgentDetails.vue" |
| 37 | |
| 38 | defineProps<{ |
| 39 | agentId: string | number |
| 40 | size?: ButtonSize |
| 41 | }>() |
| 42 | |
| 43 | const emit = defineEmits<{ |
| 44 | (e: "criticalAssetUpdated", value: AgentCriticalUpdateSuccessPayload): void |
| 45 | }>() |
| 46 | |
| 47 | const { routeAgentDetails } = useNavigation() |
| 48 | const showDetails = ref(false) |
| 49 | |
| 50 | function handleCriticalAssetUpdated(payload: AgentCriticalUpdateSuccessPayload) { |
| 51 | emit("criticalAssetUpdated", payload) |
| 52 | } |
| 53 | </script> |