Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ and listed with their assets on the
the lane runs (ADR-0033, noted 2026-10-21).
- `devstack node run-lane` waits for the lane's services past their
infrastructure, and stops on a Compose group that failed.
- Dashboard: the overview's state filters are small badges above the list
instead of a row of tiles; the detail pane shows the lane's CPU, memory and
disk as the usage page does, with a link to it.

### Added

Expand Down
154 changes: 154 additions & 0 deletions ui/src/components/LaneUsage.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@
<script setup lang="ts">
// What one lane costs now: CPU and memory with the last 10 minutes, and its
// disk. The usage page shows one per lane, the overview the one it shows.
import type { LaneDisk, LaneUsage as Lane } from '@/api/types';
import { bytes, percent } from '@/lib/format';
import { useStack } from '@/stores/stack';
import Sparkline from '@/components/Sparkline.vue';
import Icon from '@/components/icons/Icon.vue';

defineProps<{ lane: Lane; link?: boolean }>();

const stack = useStack();

function cpuSeries(key: string) {
return (stack.history.get(key) ?? []).map((p) => p.cpu);
}
function memSeries(key: string) {
return (stack.history.get(key) ?? []).map((p) => p.memory);
}

const diskParts = (d: LaneDisk) =>
[
{ k: 'snapshot', label: 'Snapshots', v: d.snapshot, color: 'var(--accent)' },
{ k: 'artifacts', label: 'Artifacts', v: d.artifacts, color: 'var(--info)' },
{ k: 'logs', label: 'Logs', v: d.logs, color: 'var(--warn)' },
{ k: 'volumes', label: 'Volumes', v: d.volumes ?? 0, color: 'var(--ok)', na: d.volumes === null },
] as { k: string; label: string; v: number; color: string; na?: boolean }[];

function diskTotal(d: LaneDisk) {
return d.snapshot + d.artifacts + d.logs + (d.volumes ?? 0);
}
</script>

<template>
<section class="card lane" :data-testid="`lane-${lane.name}`">
<header class="card-header">
<Icon name="gitBranch" :size="16" class="muted" />
<h2>Lane {{ lane.name }}</h2>
<template v-if="link">
<span class="grow" />
<RouterLink class="more" :to="{ name: 'usage', params: { stack: stack.id ?? '' } }" title="Every service, container and build job" data-testid="usage-link">
Usage <Icon name="chevronRight" :size="14" />
</RouterLink>
</template>
</header>
<div class="card-body lane-body">
<div class="metric">
<span class="ml">CPU</span>
<span class="mv tabular">{{ percent(lane.cpu) }}</span>
<Sparkline :values="cpuSeries(`lane:${lane.name}`)" :width="240" :height="40" :min-max="10" fluid :label="`Lane ${lane.name} CPU`" />
</div>
<div class="metric">
<span class="ml">Memory</span>
<span class="mv tabular">{{ bytes(lane.memory) }}</span>
<Sparkline :values="memSeries(`lane:${lane.name}`)" :width="240" :height="40" :min-max="16 * 1024 * 1024" :zero-based="false" fluid color="var(--ok)" :label="`Lane ${lane.name} memory`" />
</div>
<div v-if="lane.disk" class="metric disk">
<span class="ml">Disk</span>
<span class="mv tabular">{{ bytes(diskTotal(lane.disk)) }}</span>
<div class="bar" role="img" :aria-label="`Disk use of lane ${lane.name}`">
<span v-for="p in diskParts(lane.disk)" :key="p.k" :style="{ width: `${(p.v / Math.max(1, diskTotal(lane.disk))) * 100}%`, background: p.color }" />
</div>
<ul class="legend">
<li v-for="p in diskParts(lane.disk)" :key="p.k">
<span class="sw" :style="{ background: p.color }" />{{ p.label }}
<span class="tabular lv">{{ p.na ? 'n/a' : bytes(p.v) }}</span>
</li>
</ul>
</div>
</div>
</section>
</template>

<style scoped>
.lane-body {
display: grid;
grid-template-columns: 1fr 1fr 1.3fr;
gap: 24px;
}
@media (max-width: 860px) {
.lane-body {
grid-template-columns: 1fr 1fr;
}
.disk {
grid-column: 1 / -1;
}
}
@media (max-width: 480px) {
.lane-body {
grid-template-columns: 1fr;
}
}
.more {
display: inline-flex;
align-items: center;
gap: 2px;
font-size: 13px;
}
.metric {
display: flex;
flex-direction: column;
gap: 4px;
min-width: 0;
}
.ml {
font-size: 11px;
font-weight: 600;
text-transform: uppercase;
letter-spacing: 0.06em;
color: var(--text-muted);
}
.mv {
font-size: 22px;
font-weight: 650;
line-height: 1.2;
margin-bottom: 4px;
}
.bar {
display: flex;
height: 10px;
border-radius: 999px;
overflow: hidden;
background: var(--surface-3);
gap: 2px;
}
.bar span {
display: block;
min-width: 2px;
}
.legend {
list-style: none;
padding: 0;
margin: 8px 0 0;
display: grid;
grid-template-columns: 1fr 1fr;
gap: 4px 16px;
font-size: 12.5px;
}
.legend li {
display: flex;
align-items: center;
gap: 6px;
}
.sw {
width: 9px;
height: 9px;
border-radius: 3px;
flex: none;
}
.lv {
margin-left: auto;
color: var(--text-muted);
}
</style>
8 changes: 7 additions & 1 deletion ui/src/views/OverviewHome.vue
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
<script setup lang="ts">
// The detail pane of the overview when nothing is picked: what needs
// attention (held or failed candidates, Compose errors, containers Docker
// lost the port forward of), changes on their way, else a hint.
// lost the port forward of), changes on their way, what the shown lane
// costs, else a hint.
import { computed, ref } from 'vue';
import { useStack } from '@/stores/stack';
import CandidatePanel from '@/components/CandidatePanel.vue';
import BuildLogModal from '@/components/BuildLogModal.vue';
import ErrorLine from '@/components/ErrorLine.vue';
import LaneUsage from '@/components/LaneUsage.vue';
import Icon from '@/components/icons/Icon.vue';

const stack = useStack();
Expand All @@ -15,6 +17,8 @@ const repairing = ref(false);

const attention = computed(() => stack.pending.filter((s) => s.candidate && (s.candidate.state === 'held' || s.candidate.state === 'failed')));
const inFlight = computed(() => stack.pending.length - attention.value.length);
/** The shown lane in total: its services, containers and builds. */
const lane = computed(() => stack.usage?.lanes.find((l) => l.name === (stack.lane ?? 'main')) ?? stack.usage?.lanes[0] ?? null);
const infraErrors = computed(() => stack.view?.infra.filter((g) => g.error) ?? []);
/** Running containers this machine cannot reach (Docker Desktop lost the forward). */
const unreachable = computed(() =>
Expand Down Expand Up @@ -59,6 +63,8 @@ async function repairAll() {
</section>
<p v-if="inFlight" class="inflight muted"><span class="spinner" /> {{ inFlight }} change{{ inFlight === 1 ? '' : 's' }} on the way; the running instances keep serving until the new builds are healthy.</p>

<LaneUsage v-if="lane" class="stale-dim" :lane="lane" link />

<div v-if="!attention.length && !infraErrors.length && !unreachable.length" class="card">
<div class="empty">
<Icon name="layers" :size="32" />
Expand Down
Loading