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 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 | 32x 32x 10x 10x 10x 10x 10x 10x 10x 10x 10x 10x 10x 10x 10x 10x 10x | import { countAll } from "#layers/audits/shared/auditReports.ts";
import { countByStatus } from "#layers/decisions/shared/decisionReports.ts";
import { worstSeverity } from "#layers/snapshot/shared/deps.ts";
import { isFailing, scriptRows, sumDays } from "#layers/telemetry/shared/usageView.ts";
import type { HealthLine } from "~/types/HealthLine";
const FULL = 100;
/** Home's Health panel: one figure per area, each with the split behind it. */
export const useHealthLines = () => {
const { t } = useI18n();
const coverage = coverageArtifact();
const deps = depsArtifact();
const usage = usageArtifact();
const docs = docsArtifact();
const decisions = useDecisionReports();
const audits = useAuditReports();
return computed((): HealthLine[] => {
const lines = coverage?.totals?.lines ?? null;
const counts = deps?.vulnerabilities ?? null;
const worst = worstSeverity(counts);
const runs = sumDays(usage ? scriptRows(usage) : []);
const decided = countByStatus(decisions.value);
const { findings } = countAll(audits.value);
return [
{
label: t("healthLines.lines.coverage"),
value: dash(lines, "%"),
tone: coverageTone(lines),
to: "/coverage",
legend: false,
parts: [
{ label: t("healthLines.parts.covered"), value: lines ?? 0, tone: "ink" },
{
label: t("healthLines.parts.uncovered"),
value: FULL - (lines ?? 0),
tone: "soft",
},
],
},
{
label: t("healthLines.lines.advisories"),
value: counts ? String(deps?.advisories.length ?? 0) : "—",
tone: worst ? severityTone(worst) : "neutral",
to: "/deps",
legend: true,
parts: [
{
label: t("healthLines.parts.critical"),
value: counts?.critical ?? 0,
tone: "bad",
},
{ label: t("healthLines.parts.high"), value: counts?.high ?? 0, tone: "bad" },
{
label: t("healthLines.parts.moderate"),
value: counts?.moderate ?? 0,
tone: "warn",
},
{ label: t("healthLines.parts.low"), value: counts?.low ?? 0, tone: "soft" },
],
},
{
label: t("healthLines.lines.tooling"),
value: runs.runs ? `${percentOf(runs.failures, runs.runs)}%` : "—",
tone: runs.runs && isFailing(runs) ? "bad" : "neutral",
to: "/telemetry",
legend: true,
parts: [
{
label: t("healthLines.parts.passed"),
value: runs.runs - runs.failures,
tone: "ink",
},
{ label: t("healthLines.parts.failed"), value: runs.failures, tone: "bad" },
],
},
{
label: t("healthLines.lines.decisions"),
value: String(decided.implemented),
tone: "neutral",
to: "/decisions",
legend: true,
parts: [
{
label: t("healthLines.parts.implemented"),
value: decided.implemented,
tone: "ink",
},
{
label: t("healthLines.parts.toImplement"),
value: decided["to-implement"],
tone: "soft",
},
],
},
{
label: t("healthLines.lines.audits"),
value: String(findings.open),
tone: "neutral",
to: "/audits",
legend: false,
parts: [
{ label: t("healthLines.parts.open"), value: findings.open, tone: "warn" },
{
label: t("healthLines.parts.fixed"),
value: findings.fixed ?? 0,
tone: "soft",
},
],
},
{
label: t("healthLines.lines.docs"),
value: docs ? String(docs.pages.length) : "—",
tone: docs?.brokenLinkCount ? "bad" : "neutral",
to: "/wiki",
legend: false,
parts: [],
note: t("healthLines.brokenLinks", docs?.brokenLinkCount ?? 0),
},
];
});
};
|