| 1 | <template> |
| 2 | <div :id="`event-${event.id}`"> |
| 3 | <CardEntity :highlighted="!!highlight" hoverable clickable @click.stop="showDetails = true"> |
| 4 | <template #headerMain> |
| 5 | <div class="flex items-center gap-3"> |
| 6 | <n-tooltip trigger="hover"> |
| 7 | <template #trigger> |
| 8 | <div class="priority cursor-help"> |
| 9 | {{ event.priority }} |
| 10 | </div> |
| 11 | </template> |
| 12 | Priority |
| 13 | </n-tooltip> |
| 14 | <span>#{{ event.id }}</span> |
| 15 | </div> |
| 16 | </template> |
| 17 | <template #headerExtra> |
| 18 | Notifications: |
| 19 | <strong>{{ event.notifications.length }}</strong> |
| 20 | </template> |
| 21 | <template #default> |
| 22 | <div class="flex flex-col gap-1"> |
| 23 | <div> |
| 24 | {{ event.title }} |
| 25 | </div> |
| 26 | <p> |
| 27 | {{ event.description }} |
| 28 | </p> |
| 29 | </div> |
| 30 | </template> |
| 31 | </CardEntity> |
| 32 | |
| 33 | <n-modal |
| 34 | v-model:show="showDetails" |
| 35 | preset="card" |
| 36 | content-class="p-0!" |
| 37 | :style="{ maxWidth: 'min(600px, 90vw)', overflow: 'hidden' }" |
| 38 | :title="event.title" |
| 39 | :bordered="false" |
| 40 | segmented |
| 41 | > |
| 42 | <n-tabs type="line" animated :tabs-padding="24"> |
| 43 | <n-tab-pane name="query" tab="Query" display-directive="show"> |
| 44 | <div class="p-6 pt-3"> |
| 45 | <n-input |
| 46 | :value="event?.config?.query" |
| 47 | type="textarea" |
| 48 | readonly |
| 49 | size="large" |
| 50 | placeholder="Empty" |
| 51 | :autosize="{ |
| 52 | minRows: 3, |
| 53 | maxRows: 10 |
| 54 | }" |
| 55 | /> |
| 56 | </div> |
| 57 | </n-tab-pane> |
| 58 | <n-tab-pane name="fieldSpec" tab="Field Spec" display-directive="show:lazy"> |
| 59 | <div class="p-6 pt-3"> |
| 60 | <SimpleJsonViewer |
| 61 | class="vuesjv-override" |
| 62 | :model-value="event.field_spec" |
| 63 | :initial-expanded-depth="1" |
| 64 | /> |
| 65 | </div> |
| 66 | </n-tab-pane> |
| 67 | </n-tabs> |
| 68 | </n-modal> |
| 69 | </div> |
| 70 | </template> |
| 71 | |
| 72 | <script setup lang="ts"> |
| 73 | import type { EventDefinition } from "@/types/graylog/event-definition.d" |
| 74 | import { NInput, NModal, NTabPane, NTabs, NTooltip } from "naive-ui" |
| 75 | import { ref, toRefs } from "vue" |
| 76 | import { SimpleJsonViewer } from "vue-sjv" |
| 77 | import CardEntity from "@/components/common/cards/CardEntity.vue" |
| 78 | import "@/assets/scss/overrides/vuesjv-override.scss" |
| 79 | |
| 80 | const props = defineProps<{ event: EventDefinition; highlight: boolean | null | undefined }>() |
| 81 | const { event, highlight } = toRefs(props) |
| 82 | |
| 83 | const showDetails = ref(false) |
| 84 | </script> |
| 85 | |
| 86 | <style lang="scss" scoped> |
| 87 | .priority { |
| 88 | background-color: rgba(var(--hover-color-rgb) / 0.05); |
| 89 | border: 1px solid var(--border-color); |
| 90 | width: 20px; |
| 91 | height: 20px; |
| 92 | border-radius: 99999px; |
| 93 | text-align: center; |
| 94 | line-height: 19px; |
| 95 | font-size: 11px; |
| 96 | } |
| 97 | </style> |