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 | 3x 3x 32x 6x 32x 32x 2x 32x 32x 3x 3x 3x 3x 2x 2x 6x 2x 6x 2x | <template>
<WidgetPanel
:title="$t('telemetryUsagePanel.title')"
:meta="$t('telemetryUsagePanel.meta', { days: WINDOW_DAYS })"
to="/telemetry"
>
<EmptyState v-if="!totals">{{ $t("telemetryUsagePanel.notCollected") }}</EmptyState>
<template v-else>
<dl class="grid grid-cols-3 gap-3 border-b border-default px-4 py-3">
<div v-for="figure in totals.figures" :key="figure.label">
<dt class="text-xs text-muted">{{ figure.label }}</dt>
<dd data-figure class="text-2xl leading-none" :class="figure.class">
{{ figure.value }}{{ figure.unit }}
</dd>
</div>
</dl>
<ul class="divide-y divide-default">
<li
v-for="script in totals.failing"
:key="script.name"
class="flex items-baseline gap-3 px-4 py-2"
>
<span class="min-w-0 flex-1 truncate font-mono text-sm">{{ script.name }}</span>
<span class="tone-bad shrink-0 font-mono text-xs">
{{ $t("telemetryUsagePanel.failed", { percent: script.failed }) }}
</span>
</li>
<li v-if="totals.failing.length === 0" class="px-4 py-2 text-xs text-muted">
{{ $t("telemetryUsagePanel.noneFailing") }}
</li>
<li v-if="totals.idle" class="px-4 py-2 text-xs text-muted">{{ totals.idle }}</li>
</ul>
</template>
</WidgetPanel>
</template>
<script setup lang="ts">
import { WINDOW_DAYS } from "#layers/telemetry/shared/usage.ts";
import { isFailing, scriptRows, sumDays } from "#layers/telemetry/shared/usageView.ts";
const { t } = useI18n();
const usage = usageArtifact();
const totals = computed(() => {
if (!usage) return null;
const rows = scriptRows(usage);
const sum = sumDays(rows);
const idle = rows.filter((row) => row.runs === 0).length;
return {
figures: [
{
label: t("telemetryUsagePanel.figures.runs"),
value: sum.runs,
unit: "",
class: "text-highlighted",
},
{
label: t("telemetryUsagePanel.figures.agent"),
value: percentOf(sum.agent, sum.runs),
unit: "%",
class: "text-highlighted",
},
{
label: t("telemetryUsagePanel.figures.failed"),
value: percentOf(sum.failures, sum.runs),
unit: "%",
class: isFailing(sum) ? toneClass("bad") : "text-highlighted",
},
],
failing: rows
.filter((row) => row.failing)
.map((row) => ({ name: row.name, failed: percentOf(row.failures, row.runs) })),
idle: idle ? t("telemetryUsagePanel.idle", idle) : "",
};
});
</script>
|