The settings page now reads apply status beside each resource: every known process with the version it applied, its error if it rejected the edit, and whether it is still reporting at all. It re-reads after each save, so the page reflects what the processes did with an edit rather than what was stored. The server derives liveness only, because it knows whether a record went stale but not which version the page is showing. The client compares against the resource it is rendering, which is what turns a live record on an older version into a pending restart. A process that stopped re-stamping and one that never reported are separate rows with separate wording, and neither is an error: the setting may be fine and the process simply absent, which an operator acts on differently. A failed apply-status read leaves the previous rows rather than taking the settings page down with it. state-store-contract.md gains the pair in its inventory and its count moves from 45 to 47, with the note that this read is a list rather than the config-snapshot pair's found=false singleton. Closes archie-core-pskb.
44 lines
1.5 KiB
Vue
44 lines
1.5 KiB
Vue
<script setup lang="ts">
|
|
import { computed } from "vue";
|
|
|
|
import { Badge } from "@/components/ui/badge";
|
|
import { useControlPlaneStore, type ApplyState } from "@/stores/control-plane";
|
|
|
|
const props = defineProps<{ kind: string }>();
|
|
const store = useControlPlaneStore();
|
|
const rows = computed(() => store.applyStatusFor(props.kind));
|
|
|
|
// A process that stopped reporting or never reported is never shown as an
|
|
// error: the setting may be fine and the process simply absent, which is a
|
|
// different thing an operator acts on differently.
|
|
const variants: Record<ApplyState, "ok" | "warn" | "danger" | "idle"> = {
|
|
running: "ok",
|
|
"pending-restart": "warn",
|
|
failed: "danger",
|
|
unknown: "warn",
|
|
"not-reporting": "idle",
|
|
};
|
|
|
|
const labels: Record<ApplyState, string> = {
|
|
running: "Running",
|
|
"pending-restart": "Restart pending",
|
|
failed: "Failed",
|
|
unknown: "Not reporting",
|
|
"not-reporting": "Never reported",
|
|
};
|
|
</script>
|
|
|
|
<template>
|
|
<div v-if="rows.length" class="flex flex-col gap-2">
|
|
<p class="text-xs font-medium text-muted-foreground">Applied by</p>
|
|
<div v-for="row in rows" :key="row.process" class="flex flex-col gap-1">
|
|
<div class="flex items-center gap-2 text-xs">
|
|
<Badge :variant="variants[row.state]">{{ labels[row.state] }}</Badge>
|
|
<span class="font-mono">{{ row.process }}</span>
|
|
<span v-if="row.state !== 'not-reporting'" class="text-muted-foreground">version {{ row.version }}</span>
|
|
</div>
|
|
<p v-if="row.error" class="text-xs text-destructive">{{ row.error }}</p>
|
|
</div>
|
|
</div>
|
|
</template>
|