All files / apps/developer-portal/layers/audits/app/components AuditsRow.vue

100% Statements 12/12
100% Branches 1/1
100% Functions 4/4
100% Lines 8/8

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  2x       2x 1x           1x                                 2x   2x 2x   2x          
<template>
    <NuxtLink
        :to="`/audits/${report.id}`"
        class="flex items-center gap-3 px-4 py-2.5 transition-colors hover:bg-elevated/50"
    >
        <span class="shrink-0 font-mono text-xs text-dimmed">{{ report.date }}</span>
        <span class="flex-1 truncate text-sm">{{ report.title }}</span>
        <code v-if="report.scope" class="hidden shrink-0 font-mono text-xs text-dimmed md:inline">{{
            report.scope
        }}</code>
 
        <UProgress :model-value="settled" :max="scale" size="sm" class="w-24 shrink-0" />
        <span class="w-14 shrink-0 text-right text-xs text-muted tabular-nums">
            {{ settled }}/{{ report.findings.length }}
        </span>
 
        <StatusPill :label="state.label" :tone="state.tone" />
    </NuxtLink>
</template>
 
<script setup lang="ts">
import type { AuditReport } from "#layers/audits/shared/auditReports.ts";
 
interface Props {
    report: AuditReport;
}
 
const { report } = defineProps<Props>();
 
const settled = computed(() => report.findings.length - report.counts.open);
// An audit with no findings still draws an empty bar rather than dividing by zero.
const scale = computed(() => Math.max(report.findings.length, 1));
const { t } = useI18n();
 
const state = computed(() => ({
    label: t(`audits.state.${report.state}`),
    tone: auditStateTone(report.state),
}));
</script>