| 1 | <template> |
| 2 | <div v-if="group" class="flex flex-col gap-4"> |
| 3 | <div class="flex flex-wrap gap-2"> |
| 4 | <Badge type="splitted" color="primary"> |
| 5 | <template #label>Rules</template> |
| 6 | <template #value>{{ group.rule_count }}</template> |
| 7 | </Badge> |
| 8 | <Badge type="splitted" :color="group.total_hits_30d > 0 ? 'warning' : undefined"> |
| 9 | <template #label>Hits 30d</template> |
| 10 | <template #value>{{ group.total_hits_30d.toLocaleString() }}</template> |
| 11 | </Badge> |
| 12 | <Badge type="splitted"> |
| 13 | <template #label>Hits 7d</template> |
| 14 | <template #value>{{ group.total_hits_7d.toLocaleString() }}</template> |
| 15 | </Badge> |
| 16 | </div> |
| 17 | |
| 18 | <CardEntity> |
| 19 | <template #headerMain> |
| 20 | <div class="flex items-center gap-2"> |
| 21 | <Icon name="carbon:list" :size="14" /> |
| 22 | <span class="text-sm font-semibold tracking-wide uppercase">Rule IDs</span> |
| 23 | </div> |
| 24 | </template> |
| 25 | <template #default> |
| 26 | <div class="flex flex-wrap gap-1.5"> |
| 27 | <n-tag |
| 28 | v-for="rid of group.rule_ids" |
| 29 | :key="rid" |
| 30 | size="small" |
| 31 | class="hover:bg-primary/10! cursor-pointer!" |
| 32 | @click="openRuleDetail(rid)" |
| 33 | > |
| 34 | {{ rid }} |
| 35 | </n-tag> |
| 36 | </div> |
| 37 | </template> |
| 38 | </CardEntity> |
| 39 | |
| 40 | <!-- Detail modal --> |
| 41 | <n-modal |
| 42 | v-model:show="showDetailModal" |
| 43 | preset="card" |
| 44 | :style="{ maxWidth: 'min(880px, 94vw)', minHeight: 'min(600px, 90vh)' }" |
| 45 | :title="modalTitle" |
| 46 | :bordered="false" |
| 47 | segmented |
| 48 | > |
| 49 | <WazuhRuleDetail v-if="modalRuleId !== null" :rule-id="modalRuleId" /> |
| 50 | </n-modal> |
| 51 | </div> |
| 52 | </template> |
| 53 | |
| 54 | <script setup lang="tsx"> |
| 55 | import type { CatalogComplianceGroupRow } from "@/types/detectionCatalog.d" |
| 56 | import { NModal, NTag } from "naive-ui" |
| 57 | import { ref } from "vue" |
| 58 | import Badge from "@/components/common/Badge.vue" |
| 59 | import CardEntity from "@/components/common/cards/CardEntity.vue" |
| 60 | import Icon from "@/components/common/Icon.vue" |
| 61 | import WazuhRuleDetail from "./WazuhRuleDetail.vue" |
| 62 | |
| 63 | defineProps<{ group: CatalogComplianceGroupRow }>() |
| 64 | |
| 65 | const showDetailModal = ref(false) |
| 66 | const modalTitle = ref("Compliance Control") |
| 67 | const modalRuleId = ref<number | null>(null) |
| 68 | |
| 69 | function openRuleDetail(rid: number) { |
| 70 | modalRuleId.value = rid |
| 71 | modalTitle.value = `Rule ${rid}` |
| 72 | showDetailModal.value = true |
| 73 | } |
| 74 | </script> |