| 1 | <template> |
| 2 | <div> |
| 3 | <CardEntity :embedded hoverable> |
| 4 | <template #headerMain>#{{ data.id }}</template> |
| 5 | <template #headerExtra> |
| 6 | <n-button size="small" @click.stop="showDetails = true"> |
| 7 | <template #icon> |
| 8 | <Icon :name="DetailsIcon" /> |
| 9 | </template> |
| 10 | Details |
| 11 | </n-button> |
| 12 | </template> |
| 13 | <template #default> |
| 14 | <div class="flex flex-col gap-1"> |
| 15 | <div>{{ data.title }}</div> |
| 16 | <p class="text-sm">$ {{ data.command }}</p> |
| 17 | </div> |
| 18 | </template> |
| 19 | <template #mainExtra> |
| 20 | <div class="flex flex-wrap items-center gap-3"> |
| 21 | <Badge |
| 22 | type="splitted" |
| 23 | :color=" |
| 24 | data.result === 'failed' |
| 25 | ? 'danger' |
| 26 | : data.result === 'not applicable' |
| 27 | ? 'warning' |
| 28 | : 'success' |
| 29 | " |
| 30 | class="uppercase" |
| 31 | > |
| 32 | <template #label> |
| 33 | {{ data.result }} |
| 34 | </template> |
| 35 | </Badge> |
| 36 | |
| 37 | <Badge type="splitted" color="primary"> |
| 38 | <template #label>Compliance</template> |
| 39 | <template #value> |
| 40 | {{ data.compliance?.length || "-" }} |
| 41 | </template> |
| 42 | </Badge> |
| 43 | |
| 44 | <Badge type="splitted" color="primary"> |
| 45 | <template #label>Condition</template> |
| 46 | <template #value> |
| 47 | {{ data.condition || "-" }} |
| 48 | </template> |
| 49 | </Badge> |
| 50 | |
| 51 | <Badge type="splitted" color="primary"> |
| 52 | <template #label>Rules</template> |
| 53 | <template #value> |
| 54 | {{ data.rules?.length || "-" }} |
| 55 | </template> |
| 56 | </Badge> |
| 57 | </div> |
| 58 | </template> |
| 59 | </CardEntity> |
| 60 | <n-modal |
| 61 | v-model:show="showDetails" |
| 62 | preset="card" |
| 63 | content-class="p-0!" |
| 64 | :style="{ maxWidth: 'min(900px, 90vw)', minHeight: 'min(600px, 90vh)', overflow: 'hidden' }" |
| 65 | :title="data?.title" |
| 66 | :bordered="false" |
| 67 | segmented |
| 68 | > |
| 69 | <ScaResultItemDetails :data /> |
| 70 | </n-modal> |
| 71 | </div> |
| 72 | </template> |
| 73 | |
| 74 | <script setup lang="ts"> |
| 75 | import type { ScaPolicyResult } from "@/types/agents.d" |
| 76 | import { NButton, NModal } from "naive-ui" |
| 77 | import { ref } from "vue" |
| 78 | import Badge from "@/components/common/Badge.vue" |
| 79 | import CardEntity from "@/components/common/cards/CardEntity.vue" |
| 80 | import Icon from "@/components/common/Icon.vue" |
| 81 | import ScaResultItemDetails from "./ScaResultItemDetails.vue" |
| 82 | |
| 83 | const { data, embedded } = defineProps<{ |
| 84 | data: ScaPolicyResult |
| 85 | embedded?: boolean |
| 86 | }>() |
| 87 | |
| 88 | const DetailsIcon = "carbon:settings-adjust" |
| 89 | const showDetails = ref(false) |
| 90 | </script> |