| 1 | <template> |
| 2 | <Icon :name="getSeverityIcon(severity)" :size /> |
| 3 | </template> |
| 4 | |
| 5 | <script setup lang="ts"> |
| 6 | import Icon from "@/components/common/Icon.vue" |
| 7 | import { VulnerabilitySeverity } from "@/types/vulnerabilities.d" |
| 8 | |
| 9 | const { severity, size } = defineProps<{ severity: VulnerabilitySeverity; size?: number }>() |
| 10 | |
| 11 | function getSeverityIcon(severity: string): string { |
| 12 | const iconMap: Record<string, string> = { |
| 13 | [VulnerabilitySeverity.Critical]: "carbon:warning-hex-filled", |
| 14 | [VulnerabilitySeverity.High]: "carbon:warning-alt", |
| 15 | [VulnerabilitySeverity.Medium]: "carbon:warning", |
| 16 | [VulnerabilitySeverity.Low]: "carbon:information" |
| 17 | } |
| 18 | return iconMap[severity] || "carbon:help" |
| 19 | } |
| 20 | </script> |