mirror of
https://github.com/lukaszraczylo/gohoarder.git
synced 2026-11-26 06:37:07 +00:00
Install @perfect-design/ui 0.3.10 with the workbench style pack, IBM Plex faces and the inline theme boot script. The app shell uses AppHeader, AppShell and SidebarNav. Shared formatters, severity tones and icon data replace the per-view copies. A test checks that main.css scans only the library directories the app imports.
34 lines
932 B
TypeScript
34 lines
932 B
TypeScript
import type { VulnerabilityCounts } from '@/stores/packages'
|
|
|
|
export type SeverityTone = 'danger' | 'warning' | 'info' | 'neutral'
|
|
|
|
export const SEVERITY_TONES: Record<string, SeverityTone> = {
|
|
critical: 'danger',
|
|
high: 'warning',
|
|
moderate: 'info',
|
|
medium: 'info',
|
|
low: 'neutral',
|
|
}
|
|
|
|
export const SEVERITY_RANK: Record<string, number> = {
|
|
critical: 4,
|
|
high: 3,
|
|
moderate: 2,
|
|
medium: 2,
|
|
low: 1,
|
|
}
|
|
|
|
export const SEVERITY_LEVELS = ['critical', 'high', 'moderate', 'low'] as const
|
|
export type SeverityLevel = (typeof SEVERITY_LEVELS)[number]
|
|
|
|
export const NO_VULNERABILITIES: VulnerabilityCounts = { critical: 0, high: 0, moderate: 0, low: 0 }
|
|
|
|
export function severityRank(severity: string): number {
|
|
return SEVERITY_RANK[severity.toLowerCase()] ?? 0
|
|
}
|
|
|
|
export function formatSeverityName(severity: string): string {
|
|
const lower = severity.toLowerCase()
|
|
return lower.charAt(0).toUpperCase() + lower.slice(1)
|
|
}
|