main
vue 68 lines 1.92 KB
Raw
1 <template>
2 <div class="h-full">
3 <CardEntity
4 hoverable
5 clickable
6 :embedded
7 class="@container h-full"
8 main-box-class="grow"
9 card-entity-wrapper-class="h-full"
10 header-box-class="flex-nowrap! items-start"
11 @click.stop="showDetails = true"
12 >
13 <template #headerMain>
14 <div class="flex flex-wrap items-center gap-2">
15 <Badge type="splitted" size="small">
16 <template #label>CIS</template>
17 <template #value>{{ policy.cis_version }}</template>
18 </Badge>
19 <PlatformBadge :platform="policy.platform" />
20 </div>
21 </template>
22 <template #headerExtra>
23 <Badge size="small" color="primary">
24 <template #value>{{ policy.app_version }}</template>
25 </Badge>
26 </template>
27 <template #default>
28 <div class="flex flex-col gap-2">
29 <div class="font-semibold">{{ policy.name }}</div>
30 <p class="line-clamp-3 text-sm">{{ policy.description }}</p>
31 </div>
32 </template>
33 <template #mainExtra>
34 <div class="flex flex-wrap items-center gap-2">
35 <Badge type="splitted" size="small">
36 <template #label>App</template>
37 <template #value>{{ policy.application }}</template>
38 </Badge>
39 </div>
40 </template>
41 </CardEntity>
42
43 <n-modal
44 v-model:show="showDetails"
45 preset="card"
46 :style="{ maxWidth: 'min(800px, 90vw)', minHeight: 'min(600px, 90vh)', overflow: 'hidden' }"
47 :title="policy.name"
48 :bordered="false"
49 segmented
50 >
51 <PolicyCardContent :policy />
52 </n-modal>
53 </div>
54 </template>
55
56 <script setup lang="ts">
57 import type { ScaPolicyItem } from "@/types/sca.d"
58 import { NModal } from "naive-ui"
59 import { ref } from "vue"
60 import Badge from "@/components/common/Badge.vue"
61 import CardEntity from "@/components/common/cards/CardEntity.vue"
62 import PlatformBadge from "@/components/common/PlatformBadge.vue"
63 import PolicyCardContent from "./PolicyCardContent.vue"
64
65 defineProps<{ policy: ScaPolicyItem; embedded?: boolean }>()
66
67 const showDetails = ref(false)
68 </script>