Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 | 8x 2x 8x 4x 2x 2x 2x 2x 4x 2x 2x 2x 8x 8x 4x 8x | <template>
<WidgetPanel
:title="$t('healthAdvisories.title')"
:meta="$t('healthAdvisories.meta')"
:count="advisories.length"
>
<div class="border-b border-default px-4 py-3">
<SplitBar :parts legend />
</div>
<EmptyState v-if="advisories.length === 0">
{{ counts ? $t("healthAdvisories.none") : $t("healthAdvisories.notCollected") }}
</EmptyState>
<div v-else data-scroll-x class="overflow-x-auto">
<table class="data-table">
<thead>
<tr>
<th>{{ $t("healthAdvisories.columns.severity") }}</th>
<th>{{ $t("healthAdvisories.columns.package") }}</th>
<th class="hidden md:table-cell">
{{ $t("healthAdvisories.columns.advisory") }}
</th>
<th class="numeric">{{ $t("healthAdvisories.columns.patched") }}</th>
<th class="hidden lg:table-cell">
{{ $t("healthAdvisories.columns.via") }}
</th>
</tr>
</thead>
<tbody>
<tr v-for="item in rows" :key="item.id">
<td class="font-mono text-xs" :class="item.tone">
{{ item.severityLabel }}
</td>
<td>
<span class="block font-mono">{{ item.moduleName }}</span>
<a
:href="item.url"
target="_blank"
rel="noopener"
class="block text-xs text-muted hover:underline md:hidden"
>
{{ item.title }}
</a>
</td>
<td class="hidden md:table-cell">
<a
:href="item.url"
target="_blank"
rel="noopener"
class="hover:underline"
>
{{ item.title }}
</a>
</td>
<td class="numeric font-mono">{{ item.patchedVersions }}</td>
<td
class="hidden max-w-64 truncate font-mono text-xs text-muted lg:table-cell"
:title="item.via"
>
{{ item.via }}
</td>
</tr>
</tbody>
</table>
</div>
</WidgetPanel>
</template>
<script setup lang="ts">
import type { DepsArtifact } from "#layers/snapshot/shared/types/DepsArtifact.ts";
import type { VulnerabilityAdvisory } from "#layers/snapshot/shared/types/VulnerabilityAdvisory.ts";
import type { SplitPart } from "~/types/SplitPart";
interface Props {
advisories: VulnerabilityAdvisory[];
/** Null when the audit never ran, which is not the same as it finding nothing. */
counts: DepsArtifact["vulnerabilities"];
}
const { advisories, counts } = defineProps<Props>();
const { t } = useI18n();
const rows = computed(() =>
advisories.map((item) => ({
...item,
severityLabel: t(`common.severity.${item.severity}`),
tone: toneClass(severityTone(item.severity)),
via: item.paths.join(", "),
})),
);
const parts = computed((): SplitPart[] => [
{ label: t("common.severity.critical"), value: counts?.critical ?? 0, tone: "bad" },
{ label: t("common.severity.high"), value: counts?.high ?? 0, tone: "bad" },
{ label: t("common.severity.moderate"), value: counts?.moderate ?? 0, tone: "warn" },
{ label: t("common.severity.low"), value: counts?.low ?? 0, tone: "soft" },
]);
</script>
|