feat(webui): Settings > History, and a resizable Settings sidebar
History replaces the Audit card on every settings page: one change log for all settings, filterable by section, actor and time window, with the filters in the query so each page's History link opens it filtered to that page. Rows show the old and new value as a diff and expand to the full value; Restore still puts a resource back to the version before a change. The sidebar's edge drags (or takes arrow keys) between 180 and 420px, resets on double-click and remembers its width per browser.
This commit is contained in:
1 parent
5b06f0b42a
commit
9639e7041e
20 files changed
+416
-166
No files matched your search
@@ -1,129 +0,0 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, ref, watch } from "vue";
|
||||
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
|
||||
import {
|
||||
Table,
|
||||
TableBody,
|
||||
TableCell,
|
||||
TableEmpty,
|
||||
TableHead,
|
||||
TableHeader,
|
||||
TableRow,
|
||||
} from "@/components/ui/table";
|
||||
import { ago } from "@/lib/format";
|
||||
import {
|
||||
useControlPlaneStore,
|
||||
type AuditEntry,
|
||||
type ResourceDescriptor,
|
||||
} from "@/stores/control-plane";
|
||||
|
||||
/**
|
||||
* The field-level audit of the settings a page shows: one row per changed
|
||||
* field, newest first. Restore puts a resource back to the version before a
|
||||
* change, as an ordinary replace, so the restore is audited like any edit.
|
||||
*/
|
||||
const props = defineProps<{ resources: ResourceDescriptor[] }>();
|
||||
|
||||
const store = useControlPlaneStore();
|
||||
const entries = ref<AuditEntry[]>([]);
|
||||
const error = ref("");
|
||||
|
||||
const kinds = computed(() => props.resources.map((r) => r.kind));
|
||||
const titles = computed(
|
||||
() => new Map(props.resources.map((r) => [r.kind, r.title])),
|
||||
);
|
||||
// Every stored version on the page: a save anywhere refreshes the list.
|
||||
const versions = computed(() =>
|
||||
kinds.value.map((kind) => store.stateFor(kind).resource?.version).join(","),
|
||||
);
|
||||
|
||||
async function load(): Promise<void> {
|
||||
if (!kinds.value.length) return;
|
||||
try {
|
||||
entries.value = await store.audit("resources", kinds.value);
|
||||
error.value = "";
|
||||
} catch (err) {
|
||||
error.value = String((err as Error).message || err);
|
||||
}
|
||||
}
|
||||
watch([kinds, versions], load, { immediate: true });
|
||||
|
||||
function show(value: unknown): string {
|
||||
return value === null || value === undefined ? "" : JSON.stringify(value);
|
||||
}
|
||||
|
||||
async function restoreBefore(entry: AuditEntry): Promise<void> {
|
||||
const previous = (await store.history(entry.record_key)).find(
|
||||
(revision) => revision.version === entry.version - 1,
|
||||
);
|
||||
if (previous) await store.replace(entry.record_key, previous.value);
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Card class="mb-4">
|
||||
<CardHeader><CardTitle>Audit</CardTitle></CardHeader>
|
||||
<CardContent>
|
||||
<p v-if="error" class="text-sm text-destructive" role="alert">
|
||||
{{ error }}
|
||||
</p>
|
||||
<Table v-else>
|
||||
<TableHeader>
|
||||
<TableRow>
|
||||
<TableHead>When</TableHead>
|
||||
<TableHead>Setting</TableHead>
|
||||
<TableHead>Field</TableHead>
|
||||
<TableHead>Old value</TableHead>
|
||||
<TableHead>New value</TableHead>
|
||||
<TableHead>Version</TableHead>
|
||||
<TableHead>Changed by</TableHead>
|
||||
<TableHead />
|
||||
</TableRow>
|
||||
</TableHeader>
|
||||
<TableBody>
|
||||
<TableRow v-for="entry in entries" :key="entry.id">
|
||||
<TableCell class="whitespace-nowrap" :title="entry.at">{{
|
||||
entry.at ? ago(entry.at) : ""
|
||||
}}</TableCell>
|
||||
<TableCell>{{
|
||||
titles.get(entry.record_key) || entry.record_key
|
||||
}}</TableCell>
|
||||
<TableCell class="font-mono text-xs">{{
|
||||
entry.field || "(whole value)"
|
||||
}}</TableCell>
|
||||
<TableCell
|
||||
class="max-w-64 truncate font-mono text-xs text-fg-muted"
|
||||
:title="show(entry.old_value)"
|
||||
>{{ show(entry.old_value) }}</TableCell
|
||||
>
|
||||
<TableCell
|
||||
class="max-w-64 truncate font-mono text-xs"
|
||||
:title="show(entry.new_value)"
|
||||
>{{ show(entry.new_value) }}</TableCell
|
||||
>
|
||||
<TableCell>{{ entry.version }}</TableCell>
|
||||
<TableCell class="whitespace-nowrap"
|
||||
>{{ entry.actor
|
||||
}}<span class="text-fg-muted"> · {{ entry.source }}</span></TableCell
|
||||
>
|
||||
<TableCell>
|
||||
<Button
|
||||
v-if="entry.version > 1"
|
||||
variant="ghost"
|
||||
size="sm"
|
||||
:disabled="store.stateFor(entry.record_key).saving"
|
||||
@click="restoreBefore(entry)"
|
||||
>Restore</Button
|
||||
>
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
<TableEmpty v-if="!entries.length" :colspan="8"
|
||||
>No changes recorded yet.</TableEmpty
|
||||
>
|
||||
</TableBody>
|
||||
</Table>
|
||||
</CardContent>
|
||||
</Card>
|
||||
</template>
|
||||
@@ -1,9 +1,9 @@
|
||||
<script setup lang="ts">
|
||||
import HistoryLink from "@/settings/HistoryLink.vue";
|
||||
import { computed, onMounted, reactive, ref } from "vue";
|
||||
import { storeToRefs } from "pinia";
|
||||
import { Globe, Mail, Send } from "@lucide/vue";
|
||||
|
||||
import AuditTable from "@/base/AuditTable.vue";
|
||||
import PageHeader from "@/base/PageHeader.vue";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { DurationInput } from "@/components/ui/duration-input";
|
||||
@@ -124,6 +124,7 @@ const replyModes = [
|
||||
<template>
|
||||
<div>
|
||||
<PageHeader title="Channels">
|
||||
<HistoryLink :kinds="resources.map((r) => r.kind)" />
|
||||
<StatusPill tone="warn">Applies after restart</StatusPill>
|
||||
</PageHeader>
|
||||
<p class="-mt-4 mb-8 text-sm text-fg-muted">Where people can talk to Archie, and how those chats run.</p>
|
||||
@@ -267,6 +268,5 @@ const replyModes = [
|
||||
</section>
|
||||
</template>
|
||||
|
||||
<AuditTable class="mt-10" :resources="resources" />
|
||||
</div>
|
||||
</template>
|
||||
@@ -35,7 +35,7 @@ export type NavSpec =
|
||||
| {
|
||||
kind: "group";
|
||||
label: string;
|
||||
sections: { label: string; paths: string[] }[];
|
||||
sections: { label?: string; paths: string[] }[];
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -75,7 +75,7 @@ export function buildNav(
|
||||
.filter(visible)
|
||||
.map(entryFor)
|
||||
.map((entry, i) =>
|
||||
i === 0 ? { ...entry, dividerBefore: section.label } : entry,
|
||||
i === 0 ? { ...entry, dividerBefore: section.label ?? "" } : entry,
|
||||
),
|
||||
);
|
||||
if (items.length > 0) tree.push({ kind: "group", label: spec.label, items });
|
||||
|
||||
@@ -48,6 +48,7 @@ const settings: NavSpec = {
|
||||
label: "Runtime",
|
||||
paths: ["/settings/task-execution", "/settings/status"],
|
||||
},
|
||||
{ paths: ["/settings/history"] },
|
||||
],
|
||||
};
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ import EventsPage from "@/events/EventsPage.vue";
|
||||
import LogsPage from "@/logs/LogsPage.vue";
|
||||
import SchedulingPolicyPage from "@/settings/SchedulingPolicyPage.vue";
|
||||
import ToolsPage from "@/settings/ToolsPage.vue";
|
||||
import HistoryPage from "@/settings/HistoryPage.vue";
|
||||
import SystemAdvancedPage from "@/settings/SystemAdvancedPage.vue";
|
||||
import SystemIdentitiesPage from "@/settings/SystemIdentitiesPage.vue";
|
||||
import SystemAppearancePage from "@/settings/SystemAppearancePage.vue";
|
||||
@@ -229,6 +230,19 @@ const routes = [
|
||||
section: "settings",
|
||||
},
|
||||
},
|
||||
{
|
||||
path: "/settings/history",
|
||||
name: "settings-history",
|
||||
component: HistoryPage,
|
||||
meta: {
|
||||
navPath: "/settings",
|
||||
settings: true,
|
||||
wide: true,
|
||||
label: "History",
|
||||
description: "Every settings change: who made it, when, and what it was before.",
|
||||
section: "settings",
|
||||
},
|
||||
},
|
||||
{
|
||||
path: "/settings",
|
||||
redirect: "/settings/models",
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
<script setup lang="ts">
|
||||
import { History } from "@lucide/vue";
|
||||
|
||||
import { Button } from "@/components/ui/button";
|
||||
|
||||
/** Opens Settings > History filtered to these resource kinds. */
|
||||
const props = defineProps<{ kinds: string[] }>();
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Button variant="ghost" size="sm" as-child>
|
||||
<RouterLink :to="{ path: '/settings/history', query: { section: props.kinds.join(',') } }">
|
||||
<History data-icon="inline-start" /> History
|
||||
</RouterLink>
|
||||
</Button>
|
||||
</template>
|
||||
@@ -0,0 +1,199 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, onMounted, ref, watch } from "vue";
|
||||
import { useRoute, useRouter } from "vue-router";
|
||||
import { storeToRefs } from "pinia";
|
||||
|
||||
import PageHeader from "@/base/PageHeader.vue";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import {
|
||||
Select,
|
||||
SelectContent,
|
||||
SelectItem,
|
||||
SelectTrigger,
|
||||
SelectValue,
|
||||
} from "@/components/ui/select";
|
||||
import { ago } from "@/lib/format";
|
||||
import { useControlPlaneStore, type AuditEntry } from "@/stores/control-plane";
|
||||
import { formatValue } from "./changes";
|
||||
import { filterHistory } from "./history";
|
||||
|
||||
/**
|
||||
* Every settings change, one row per changed field, newest first. Restore
|
||||
* puts a resource back to the version before a change, as an ordinary
|
||||
* replace, so the restore is itself recorded here.
|
||||
*/
|
||||
const store = useControlPlaneStore();
|
||||
const { catalog } = storeToRefs(store);
|
||||
const route = useRoute();
|
||||
const router = useRouter();
|
||||
|
||||
const entries = ref<AuditEntry[]>([]);
|
||||
const error = ref("");
|
||||
const expanded = ref<number | null>(null);
|
||||
|
||||
const titles = computed(() => new Map(catalog.value.map((r) => [r.kind, r.title])));
|
||||
const kinds = computed(() => catalog.value.map((r) => r.kind));
|
||||
|
||||
async function load(): Promise<void> {
|
||||
if (!kinds.value.length) return;
|
||||
try {
|
||||
entries.value = await store.audit("resources", kinds.value);
|
||||
error.value = "";
|
||||
} catch (err) {
|
||||
error.value = String((err as Error).message || err);
|
||||
}
|
||||
}
|
||||
onMounted(store.load);
|
||||
// Any stored version moving means a save happened somewhere: re-read.
|
||||
const versions = computed(() =>
|
||||
kinds.value.map((kind) => store.stateFor(kind).resource?.version).join(","),
|
||||
);
|
||||
watch([kinds, versions], load, { immediate: true });
|
||||
|
||||
// Filters live in the query, so every History link elsewhere is a deep link.
|
||||
const ALL = "all";
|
||||
const section = computed({
|
||||
get: () => (route.query.section as string) || ALL,
|
||||
set: (value: string) => setQuery({ section: value === ALL ? undefined : value }),
|
||||
});
|
||||
const actor = computed({
|
||||
get: () => (route.query.actor as string) || ALL,
|
||||
set: (value: string) => setQuery({ actor: value === ALL ? undefined : value }),
|
||||
});
|
||||
const since = computed({
|
||||
get: () => (route.query.since as string) || ALL,
|
||||
set: (value: string) => setQuery({ since: value === ALL ? undefined : value }),
|
||||
});
|
||||
function setQuery(patch: Record<string, string | undefined>) {
|
||||
void router.replace({ query: { ...route.query, ...patch } });
|
||||
}
|
||||
|
||||
const windows: Record<string, number> = { "24h": 86_400_000, "7d": 604_800_000, "30d": 2_592_000_000 };
|
||||
const actors = computed(() => [...new Set(entries.value.map((e) => e.actor))].sort());
|
||||
const sectionOptions = computed(() => {
|
||||
const options = catalog.value.map((r) => ({ value: r.kind, label: r.title }));
|
||||
// A deep link may name several kinds (a page that shows more than one).
|
||||
if (section.value !== ALL && !options.some((o) => o.value === section.value))
|
||||
options.unshift({
|
||||
value: section.value,
|
||||
label: section.value.split(",").map((k) => titles.value.get(k) ?? k).join(" + "),
|
||||
});
|
||||
return options;
|
||||
});
|
||||
|
||||
const rows = computed(() =>
|
||||
filterHistory(
|
||||
entries.value,
|
||||
{
|
||||
kinds: section.value === ALL ? [] : section.value.split(","),
|
||||
actor: actor.value === ALL ? undefined : actor.value,
|
||||
sinceMs: windows[since.value],
|
||||
},
|
||||
Date.now(),
|
||||
),
|
||||
);
|
||||
|
||||
async function restoreBefore(entry: AuditEntry): Promise<void> {
|
||||
const previous = (await store.history(entry.record_key)).find(
|
||||
(revision) => revision.version === entry.version - 1,
|
||||
);
|
||||
if (previous) await store.replace(entry.record_key, previous.value);
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div>
|
||||
<PageHeader title="History" />
|
||||
<p class="-mt-4 mb-6 text-sm text-fg-muted">Every settings change, newest first.</p>
|
||||
|
||||
<div class="mb-4 flex flex-wrap gap-2">
|
||||
<Select v-model="section">
|
||||
<SelectTrigger class="w-60" aria-label="Section"><SelectValue /></SelectTrigger>
|
||||
<SelectContent>
|
||||
<SelectItem :value="ALL">All sections</SelectItem>
|
||||
<SelectItem v-for="o in sectionOptions" :key="o.value" :value="o.value">{{ o.label }}</SelectItem>
|
||||
</SelectContent>
|
||||
</Select>
|
||||
<Select v-model="actor">
|
||||
<SelectTrigger class="w-48" aria-label="Changed by"><SelectValue /></SelectTrigger>
|
||||
<SelectContent>
|
||||
<SelectItem :value="ALL">Anyone</SelectItem>
|
||||
<SelectItem v-for="a in actors" :key="a" :value="a">{{ a }}</SelectItem>
|
||||
</SelectContent>
|
||||
</Select>
|
||||
<Select v-model="since">
|
||||
<SelectTrigger class="w-40" aria-label="When"><SelectValue /></SelectTrigger>
|
||||
<SelectContent>
|
||||
<SelectItem :value="ALL">Any time</SelectItem>
|
||||
<SelectItem value="24h">Last 24 hours</SelectItem>
|
||||
<SelectItem value="7d">Last 7 days</SelectItem>
|
||||
<SelectItem value="30d">Last 30 days</SelectItem>
|
||||
</SelectContent>
|
||||
</Select>
|
||||
</div>
|
||||
|
||||
<p v-if="error" class="text-sm text-danger" role="alert">{{ error }}</p>
|
||||
<div v-else class="scroll-fade-x overflow-x-auto rounded-lg border border-border bg-card [scrollbar-width:none]">
|
||||
<table class="w-full text-[13px]">
|
||||
<thead>
|
||||
<tr class="border-b border-border text-left text-[11px] tracking-[0.06em] text-fg-subtle uppercase">
|
||||
<th class="px-4 py-2.5 font-medium">When</th>
|
||||
<th class="px-4 py-2.5 font-medium">Section</th>
|
||||
<th class="px-4 py-2.5 font-medium">Field</th>
|
||||
<th class="px-4 py-2.5 font-medium">Change</th>
|
||||
<th class="px-4 py-2.5 font-medium">Version</th>
|
||||
<th class="px-4 py-2.5 font-medium">Changed by</th>
|
||||
<th class="px-4 py-2.5"><span class="sr-only">Actions</span></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr
|
||||
v-for="entry in rows"
|
||||
:key="entry.id"
|
||||
class="border-b border-border align-top last:border-0"
|
||||
>
|
||||
<td class="px-4 py-2.5 whitespace-nowrap text-fg-muted" :title="entry.at">
|
||||
{{ entry.at ? ago(entry.at) : "" }}
|
||||
</td>
|
||||
<td class="px-4 py-2.5 whitespace-nowrap">{{ titles.get(entry.record_key) ?? entry.record_key }}</td>
|
||||
<td class="px-4 py-2.5 font-mono text-xs">{{ entry.field || "whole value" }}</td>
|
||||
<td class="max-w-[22rem] px-4 py-2.5 font-mono text-xs">
|
||||
<button
|
||||
type="button"
|
||||
class="block w-full text-left"
|
||||
:aria-expanded="expanded === entry.id"
|
||||
@click="expanded = expanded === entry.id ? null : entry.id"
|
||||
>
|
||||
<span :class="expanded === entry.id ? 'break-all' : 'block truncate'" class="text-danger">
|
||||
− {{ formatValue(entry.old_value ?? undefined) }}
|
||||
</span>
|
||||
<span :class="expanded === entry.id ? 'break-all' : 'block truncate'" class="text-ok">
|
||||
+ {{ formatValue(entry.new_value ?? undefined) }}
|
||||
</span>
|
||||
</button>
|
||||
</td>
|
||||
<td class="px-4 py-2.5 font-mono text-xs">{{ entry.version }}</td>
|
||||
<td class="px-4 py-2.5 whitespace-nowrap">
|
||||
{{ entry.actor }}<span class="text-fg-subtle"> · {{ entry.source }}</span>
|
||||
</td>
|
||||
<td class="px-2 py-1.5 text-right">
|
||||
<Button
|
||||
v-if="entry.version > 1"
|
||||
variant="ghost"
|
||||
size="sm"
|
||||
:disabled="store.stateFor(entry.record_key).saving"
|
||||
@click="restoreBefore(entry)"
|
||||
>Restore</Button
|
||||
>
|
||||
</td>
|
||||
</tr>
|
||||
<tr v-if="!rows.length">
|
||||
<td colspan="7" class="px-4 py-8 text-center text-sm text-fg-muted">
|
||||
{{ entries.length ? "No changes match these filters." : "No changes recorded yet." }}
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -1,8 +1,8 @@
|
||||
<script setup lang="ts">
|
||||
import HistoryLink from "@/settings/HistoryLink.vue";
|
||||
import { computed, onMounted } from "vue";
|
||||
import { storeToRefs } from "pinia";
|
||||
|
||||
import AuditTable from "@/base/AuditTable.vue";
|
||||
import PageHeader from "@/base/PageHeader.vue";
|
||||
import { DurationInput, parseGoDuration } from "@/components/ui/duration-input";
|
||||
import { Input } from "@/components/ui/input";
|
||||
@@ -64,6 +64,7 @@ const labelMissing = computed(
|
||||
<template>
|
||||
<div>
|
||||
<PageHeader title="Scheduling policy">
|
||||
<HistoryLink :kinds="resources.map((r) => r.kind)" />
|
||||
<StatusPill tone="warn">Applies after restart</StatusPill>
|
||||
</PageHeader>
|
||||
<p class="-mt-4 mb-8 text-sm text-fg-muted">
|
||||
@@ -140,6 +141,5 @@ const labelMissing = computed(
|
||||
</SettingRow>
|
||||
</template>
|
||||
|
||||
<AuditTable class="mt-10" :resources="resources" />
|
||||
</div>
|
||||
</template>
|
||||
@@ -1,5 +1,5 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, onBeforeUnmount, onMounted } from "vue";
|
||||
import { computed, onBeforeUnmount, onMounted, ref, watch } from "vue";
|
||||
import { useRoute, useRouter } from "vue-router";
|
||||
|
||||
import { hidden } from "@/lib/capabilities";
|
||||
@@ -12,6 +12,45 @@ import SettingsSaveBar from "./SettingsSaveBar.vue";
|
||||
const route = useRoute();
|
||||
const items = computed(() => settingsNav(hidden.value));
|
||||
|
||||
// The sidebar's width, dragged or keyed on its edge, kept per browser.
|
||||
const MIN_WIDTH = 180;
|
||||
const MAX_WIDTH = 420;
|
||||
const DEFAULT_WIDTH = 240;
|
||||
const WIDTH_KEY = "archie.settingsSidebarWidth";
|
||||
const clampWidth = (w: number) => Math.min(MAX_WIDTH, Math.max(MIN_WIDTH, Math.round(w)));
|
||||
const width = ref(clampWidth(Number(localStorage.getItem(WIDTH_KEY)) || DEFAULT_WIDTH));
|
||||
watch(width, (w) => localStorage.setItem(WIDTH_KEY, String(w)));
|
||||
|
||||
function startResize(event: PointerEvent) {
|
||||
event.preventDefault();
|
||||
const handle = event.currentTarget as HTMLElement;
|
||||
const startX = event.clientX;
|
||||
const startWidth = width.value;
|
||||
handle.setPointerCapture(event.pointerId);
|
||||
const move = (e: PointerEvent) => (width.value = clampWidth(startWidth + e.clientX - startX));
|
||||
const stop = () => {
|
||||
handle.removeEventListener("pointermove", move);
|
||||
handle.removeEventListener("pointerup", stop);
|
||||
handle.removeEventListener("pointercancel", stop);
|
||||
};
|
||||
handle.addEventListener("pointermove", move);
|
||||
handle.addEventListener("pointerup", stop);
|
||||
handle.addEventListener("pointercancel", stop);
|
||||
}
|
||||
|
||||
function keyResize(event: KeyboardEvent) {
|
||||
const step = event.shiftKey ? 48 : 16;
|
||||
const next: Record<string, number> = {
|
||||
ArrowLeft: width.value - step,
|
||||
ArrowRight: width.value + step,
|
||||
Home: MIN_WIDTH,
|
||||
End: MAX_WIDTH,
|
||||
};
|
||||
if (!(event.key in next)) return;
|
||||
event.preventDefault();
|
||||
width.value = clampWidth(next[event.key]!);
|
||||
}
|
||||
|
||||
// Drafts live in the store, so moving between Settings pages keeps them;
|
||||
// leaving Settings, or the page, with edits unsaved asks first.
|
||||
const store = useControlPlaneStore();
|
||||
@@ -31,15 +70,17 @@ onBeforeUnmount(() => {
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="flex gap-10 max-lg:flex-col max-lg:gap-4">
|
||||
<div class="flex max-lg:flex-col max-lg:gap-4" :style="{ '--sidebar-w': `${width}px` }">
|
||||
<nav
|
||||
id="settings-sidebar"
|
||||
aria-label="Settings"
|
||||
class="w-60 shrink-0 max-lg:-mx-4 max-lg:w-auto max-lg:scroll-fade-x max-lg:overflow-x-auto max-lg:[scrollbar-width:none] max-lg:border-b max-lg:px-4"
|
||||
class="shrink-0 lg:w-[var(--sidebar-w)] max-lg:-mx-4 max-lg:w-auto max-lg:scroll-fade-x max-lg:overflow-x-auto max-lg:[scrollbar-width:none] max-lg:border-b max-lg:px-4"
|
||||
>
|
||||
<ul class="flex flex-col gap-0.5 lg:sticky lg:top-20 max-lg:flex-row max-lg:gap-1">
|
||||
<li v-for="(item, index) in items" :key="item.path" class="contents">
|
||||
<hr v-if="item.dividerBefore === ''" class="my-4 border-border max-lg:hidden" />
|
||||
<p
|
||||
v-if="item.dividerBefore"
|
||||
v-else-if="item.dividerBefore"
|
||||
:class="cn('mb-1.5 px-3 text-[11px] font-medium tracking-[0.06em] text-fg-subtle uppercase max-lg:hidden', index > 0 && 'mt-5')"
|
||||
>
|
||||
{{ item.dividerBefore }}
|
||||
@@ -60,7 +101,26 @@ onBeforeUnmount(() => {
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
<div class="min-w-0 max-w-[960px] flex-1">
|
||||
<div
|
||||
role="separator"
|
||||
aria-orientation="vertical"
|
||||
aria-label="Resize settings sidebar"
|
||||
aria-controls="settings-sidebar"
|
||||
:aria-valuenow="width"
|
||||
:aria-valuemin="MIN_WIDTH"
|
||||
:aria-valuemax="MAX_WIDTH"
|
||||
tabindex="0"
|
||||
class="group relative w-10 shrink-0 cursor-col-resize touch-none outline-none max-lg:hidden"
|
||||
@pointerdown="startResize"
|
||||
@keydown="keyResize"
|
||||
@dblclick="width = DEFAULT_WIDTH"
|
||||
>
|
||||
<span
|
||||
class="absolute inset-y-0 left-1/2 w-px -translate-x-1/2 bg-transparent transition-colors group-hover:bg-border-strong group-focus-visible:bg-primary group-active:bg-primary"
|
||||
aria-hidden="true"
|
||||
/>
|
||||
</div>
|
||||
<div class="min-w-0 flex-1" :class="route.meta.wide ? '' : 'max-w-[960px]'">
|
||||
<RestartPendingBanner />
|
||||
<!-- Room below the last setting, so it can be scrolled up to eye level. -->
|
||||
<div class="pb-[40vh]">
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<script setup lang="ts">
|
||||
import AuditTable from "@/base/AuditTable.vue";
|
||||
import HistoryLink from "@/settings/HistoryLink.vue";
|
||||
import { computed, onMounted } from "vue";
|
||||
import { storeToRefs } from "pinia";
|
||||
|
||||
@@ -23,7 +23,9 @@ onMounted(load);
|
||||
|
||||
<template>
|
||||
<div>
|
||||
<PageHeader title="Advanced" />
|
||||
<PageHeader title="Advanced">
|
||||
<HistoryLink :kinds="resources.map((r) => r.kind)" />
|
||||
</PageHeader>
|
||||
|
||||
<p v-if="catalogError" class="text-sm text-destructive" role="alert">
|
||||
{{ catalogError }}
|
||||
@@ -33,7 +35,6 @@ onMounted(load);
|
||||
:key="descriptor.kind"
|
||||
:descriptor="descriptor"
|
||||
/>
|
||||
<AuditTable :resources="resources" />
|
||||
<ConfigCard title="Managed elsewhere">
|
||||
<div class="flex flex-wrap gap-2">
|
||||
<Button as-child variant="outline"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<script setup lang="ts">
|
||||
import AuditTable from "@/base/AuditTable.vue";
|
||||
import HistoryLink from "@/settings/HistoryLink.vue";
|
||||
import { computed, onMounted } from "vue";
|
||||
import { storeToRefs } from "pinia";
|
||||
|
||||
@@ -15,7 +15,9 @@ onMounted(controlPlane.load);
|
||||
|
||||
<template>
|
||||
<div>
|
||||
<PageHeader title="Models" />
|
||||
<PageHeader title="Models">
|
||||
<HistoryLink :kinds="resources.map((r) => r.kind)" />
|
||||
</PageHeader>
|
||||
|
||||
<p v-if="catalogError" class="text-sm text-destructive" role="alert">
|
||||
{{ catalogError }}
|
||||
@@ -28,6 +30,5 @@ onMounted(controlPlane.load);
|
||||
descriptor.kind === 'provider-settings' ? 'providers' : 'roles'
|
||||
"
|
||||
/>
|
||||
<AuditTable :resources="resources" />
|
||||
</div>
|
||||
</template>
|
||||
@@ -1,5 +1,5 @@
|
||||
<script setup lang="ts">
|
||||
import AuditTable from "@/base/AuditTable.vue";
|
||||
import HistoryLink from "@/settings/HistoryLink.vue";
|
||||
import { computed, onMounted } from "vue";
|
||||
import { storeToRefs } from "pinia";
|
||||
|
||||
@@ -17,7 +17,9 @@ onMounted(controlPlane.load);
|
||||
|
||||
<template>
|
||||
<div>
|
||||
<PageHeader title="Repositories" />
|
||||
<PageHeader title="Repositories">
|
||||
<HistoryLink :kinds="resources.map((r) => r.kind)" />
|
||||
</PageHeader>
|
||||
|
||||
<p v-if="catalogError" class="text-sm text-destructive" role="alert">
|
||||
{{ catalogError }}
|
||||
@@ -28,6 +30,5 @@ onMounted(controlPlane.load);
|
||||
:descriptor="descriptor"
|
||||
root-path="repositories"
|
||||
/>
|
||||
<AuditTable :resources="resources" />
|
||||
</div>
|
||||
</template>
|
||||
@@ -1,5 +1,5 @@
|
||||
<script setup lang="ts">
|
||||
import AuditTable from "@/base/AuditTable.vue";
|
||||
import HistoryLink from "@/settings/HistoryLink.vue";
|
||||
import { computed, onMounted } from "vue";
|
||||
import { storeToRefs } from "pinia";
|
||||
|
||||
@@ -16,7 +16,9 @@ onMounted(controlPlane.load);
|
||||
|
||||
<template>
|
||||
<div>
|
||||
<PageHeader title="Task execution" />
|
||||
<PageHeader title="Task execution">
|
||||
<HistoryLink :kinds="resources.map((r) => r.kind)" />
|
||||
</PageHeader>
|
||||
|
||||
<p v-if="catalogError" class="text-sm text-destructive" role="alert">
|
||||
{{ catalogError }}
|
||||
@@ -26,6 +28,5 @@ onMounted(controlPlane.load);
|
||||
:key="descriptor.kind"
|
||||
:descriptor="descriptor"
|
||||
/>
|
||||
<AuditTable :resources="resources" />
|
||||
</div>
|
||||
</template>
|
||||
@@ -1,9 +1,9 @@
|
||||
<script setup lang="ts">
|
||||
import HistoryLink from "@/settings/HistoryLink.vue";
|
||||
import { computed, onMounted } from "vue";
|
||||
import { storeToRefs } from "pinia";
|
||||
import { Plus } from "@lucide/vue";
|
||||
|
||||
import AuditTable from "@/base/AuditTable.vue";
|
||||
import PageHeader from "@/base/PageHeader.vue";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { ByteSizeInput } from "@/components/ui/byte-size-input";
|
||||
@@ -62,6 +62,7 @@ const eyebrow = "mb-1 text-[11px] font-medium tracking-[0.06em] text-fg-subtle u
|
||||
<template>
|
||||
<div>
|
||||
<PageHeader title="Tools & MCP">
|
||||
<HistoryLink :kinds="resources.map((r) => r.kind)" />
|
||||
<StatusPill tone="warn">Applies after restart</StatusPill>
|
||||
</PageHeader>
|
||||
<p class="-mt-4 mb-8 text-sm text-fg-muted">
|
||||
@@ -146,6 +147,5 @@ const eyebrow = "mb-1 text-[11px] font-medium tracking-[0.06em] text-fg-subtle u
|
||||
</SettingRow>
|
||||
</template>
|
||||
|
||||
<AuditTable class="mt-10" :resources="resources" />
|
||||
</div>
|
||||
</template>
|
||||
@@ -0,0 +1,30 @@
|
||||
interface HistoryEntry {
|
||||
record_key: string;
|
||||
actor: string;
|
||||
at?: string;
|
||||
}
|
||||
|
||||
export interface HistoryFilter {
|
||||
/** Resource kinds to keep; empty or absent keeps every kind. */
|
||||
kinds?: string[];
|
||||
actor?: string;
|
||||
/** Keep entries newer than this many milliseconds before now. */
|
||||
sinceMs?: number;
|
||||
}
|
||||
|
||||
/** filterHistory keeps the audit entries that match every filter set. */
|
||||
export function filterHistory<T extends HistoryEntry>(
|
||||
entries: T[],
|
||||
filter: HistoryFilter,
|
||||
now: number,
|
||||
): T[] {
|
||||
return entries.filter((entry) => {
|
||||
if (filter.kinds?.length && !filter.kinds.includes(entry.record_key)) return false;
|
||||
if (filter.actor && entry.actor !== filter.actor) return false;
|
||||
if (filter.sinceMs !== undefined) {
|
||||
if (!entry.at) return false;
|
||||
if (now - Date.parse(entry.at) > filter.sinceMs) return false;
|
||||
}
|
||||
return true;
|
||||
});
|
||||
}
|
||||
Reference in new issue
Block a user