feat(webui): park model credential failures with a recovery link, add Model setup step, readiness badges, and move audit to the organisation
This commit is contained in:
1 parent
2fb0084d2c
commit
1a8b442acd
28 files changed
+131
-61
No files matched your search
@@ -17,7 +17,7 @@ export type CapabilitySections = Record<string, boolean>;
|
||||
*/
|
||||
export interface SectionedRoute {
|
||||
path: string;
|
||||
meta?: { section?: string; settings?: boolean; instance?: boolean };
|
||||
meta?: { section?: string; settings?: boolean };
|
||||
}
|
||||
|
||||
// hiddenRoutes returns the paths whose section the server reported it cannot
|
||||
@@ -27,9 +27,6 @@ export interface SectionedRoute {
|
||||
// read shows everything.
|
||||
//
|
||||
// The Instance settings area belongs to the system org (`sections.settings`).
|
||||
// Two of its pages are not the instance's: appearance is the caller's own
|
||||
// preference and audit reads only the caller's org, so they opt out with
|
||||
// `instance: false`.
|
||||
export function hiddenRoutes(
|
||||
sections: CapabilitySections | null | undefined,
|
||||
table: SectionedRoute[],
|
||||
@@ -41,7 +38,6 @@ export function hiddenRoutes(
|
||||
(typeof r.meta?.section === "string" &&
|
||||
sections[r.meta.section] === false) ||
|
||||
(r.meta?.settings === true &&
|
||||
r.meta.instance !== false &&
|
||||
sections.settings === false),
|
||||
)
|
||||
.map((r) => r.path);
|
||||
|
||||
+2
-2
@@ -33,7 +33,7 @@ const orgSpecs: NavSpec[] = [
|
||||
sections: [
|
||||
{
|
||||
label: "People & access",
|
||||
paths: ["/org/members", "/org/agents", "/org/workspaces", "/org/policies"],
|
||||
paths: ["/org/members", "/org/agents", "/org/workspaces", "/org/policies", "/org/audit"],
|
||||
},
|
||||
{
|
||||
label: "Connections & models",
|
||||
@@ -80,7 +80,7 @@ const settings: NavSpec = {
|
||||
"/settings/status",
|
||||
],
|
||||
},
|
||||
{ paths: ["/settings/authentication", "/settings/audit"] },
|
||||
{ paths: ["/settings/authentication"] },
|
||||
],
|
||||
};
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ const error = ref("");
|
||||
|
||||
// Policies and models act on the caller's own org server-side, so an instance
|
||||
// admin looking at another org is sent back rather than editing the wrong one.
|
||||
const OWN_ORG_ONLY = ["/org/policies", "/org/models", "/org/connections", "/org/repositories"];
|
||||
const OWN_ORG_ONLY = ["/org/audit", "/org/policies", "/org/models", "/org/connections", "/org/repositories"];
|
||||
const away = computed(() => !!org.value && org.value.id !== homeOrg.value);
|
||||
const route = useRoute();
|
||||
const router = useRouter();
|
||||
|
||||
+13
-14
@@ -205,6 +205,17 @@ const routes = [
|
||||
component: OrgAgentsPage,
|
||||
meta: { section: "org_agents", label: "Agents", navPath: "/org" },
|
||||
},
|
||||
{
|
||||
path: "audit",
|
||||
name: "audit",
|
||||
component: AuditPage,
|
||||
meta: {
|
||||
section: "org_audit",
|
||||
label: "Audit",
|
||||
navPath: "/org",
|
||||
description: "Settings, access, identity and runtime events.",
|
||||
},
|
||||
},
|
||||
{
|
||||
path: "workspaces",
|
||||
name: "org-workspaces",
|
||||
@@ -380,20 +391,8 @@ const routes = [
|
||||
section: "settings",
|
||||
},
|
||||
},
|
||||
{
|
||||
path: "/settings/audit",
|
||||
name: "audit",
|
||||
component: AuditPage,
|
||||
meta: {
|
||||
navPath: "/settings",
|
||||
settings: true,
|
||||
// Reads only the caller's own org, so any org may open it.
|
||||
instance: false,
|
||||
label: "Audit",
|
||||
description: "Settings, access, identity and runtime events.",
|
||||
},
|
||||
},
|
||||
{ path: "/settings/history", redirect: (to: RouteLocationGeneric) => ({ path: "/settings/audit", query: to.query, hash: to.hash }), meta: { nav: false } },
|
||||
{ path: "/settings/history", redirect: (to: RouteLocationGeneric) => ({ path: "/org/audit", query: to.query, hash: to.hash }), meta: { nav: false } },
|
||||
{ path: "/settings/audit", redirect: (to: RouteLocationGeneric) => ({ path: "/org/audit", query: to.query, hash: to.hash }), meta: { nav: false } },
|
||||
{
|
||||
path: "/settings",
|
||||
redirect: "/settings/status",
|
||||
|
||||
@@ -7,8 +7,10 @@ import { storeToRefs } from "pinia";
|
||||
import { Plus } from "@lucide/vue";
|
||||
|
||||
import PageHeader from "@/base/PageHeader.vue";
|
||||
import { Badge } from "@/components/ui/badge";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { resourcesForPage, useSettingsStore } from "@/stores/settings";
|
||||
import { useExtensionsStore } from "@/stores/extensions";
|
||||
import { useOrgStore } from "@/stores/org";
|
||||
import CardAccordion from "./CardAccordion.vue";
|
||||
import ConnectionCard from "./ConnectionCard.vue";
|
||||
@@ -20,8 +22,10 @@ const KIND = "forge-connections";
|
||||
const store = useSettingsStore();
|
||||
const orgStore = useOrgStore();
|
||||
const { catalog, catalogError } = storeToRefs(store);
|
||||
const extensions = useExtensionsStore();
|
||||
onMounted(() => {
|
||||
void store.load();
|
||||
void extensions.loadInstalled();
|
||||
orgStore.watchIdentities();
|
||||
});
|
||||
|
||||
@@ -30,6 +34,14 @@ const form = computed(() => store.formFor(KIND));
|
||||
const connections = computed(() => (store.draftValue(KIND) ?? []) as Connection[]);
|
||||
const error = computed(() => store.pageErrorFor(KIND));
|
||||
const open = ref("0");
|
||||
|
||||
// What stops a connection serving a repository, from what the page already
|
||||
// holds. Nothing is claimed while the installed forges could not be read.
|
||||
function connectionIssue(item: Connection): string {
|
||||
if (item.type && !extensions.error && !extensions.forges.some((e) => e.name === item.type)) return "Forge not enabled";
|
||||
if (!item.token?.key) return "No credential";
|
||||
return "";
|
||||
}
|
||||
const unsaved = computed(() => store.changesFor(KIND).length > 0);
|
||||
|
||||
// Each edit writes a new array: the document is a root list, and the draft
|
||||
@@ -102,6 +114,9 @@ function addConnection() {
|
||||
mono
|
||||
@remove="removeConnection"
|
||||
>
|
||||
<template #aside="{ item }">
|
||||
<Badge v-if="connectionIssue(item as Connection)" variant="warn">{{ connectionIssue(item as Connection) }}</Badge>
|
||||
</template>
|
||||
<template #default="slot">
|
||||
<ConnectionCard
|
||||
:model-value="slot.item"
|
||||
|
||||
@@ -9,7 +9,7 @@ const props = defineProps<{ kinds: string[] }>();
|
||||
|
||||
<template>
|
||||
<Button variant="ghost" size="sm" as-child>
|
||||
<RouterLink :to="{ path: '/settings/audit', query: { section: props.kinds.join(',') } }">
|
||||
<RouterLink :to="{ path: '/org/audit', query: { section: props.kinds.join(',') } }">
|
||||
<History data-icon="inline-start" /> Audit</RouterLink>
|
||||
</Button>
|
||||
</template>
|
||||
@@ -7,6 +7,7 @@ import { Plus } from "@lucide/vue";
|
||||
|
||||
|
||||
import PageHeader from "@/base/PageHeader.vue";
|
||||
import { Badge } from "@/components/ui/badge";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Field, FieldContent, FieldDescription, FieldGroup, FieldLabel } from "@/components/ui/field";
|
||||
import { Input } from "@/components/ui/input";
|
||||
@@ -111,6 +112,14 @@ const checkAgent=ref("");
|
||||
const checking=ref("");
|
||||
const results=ref<Record<string,AccessCheck>>({});
|
||||
watch([checkAgent,()=>JSON.stringify(repos.value)],()=>{results.value={}});
|
||||
// Where a repository stands: a missing connection is known from the draft, the
|
||||
// rest only after an access check.
|
||||
function readiness(repo: Repo): { variant: "ok" | "warn" | "danger"; label: string } | null {
|
||||
if (!repo.connection || !connections.value.some((connection) => connection.id === repo.connection)) return { variant: "warn", label: "No connection" };
|
||||
const result = results.value[`${repo.owner}/${repo.name}`];
|
||||
if (!result) return null;
|
||||
return result.verified ? { variant: "ok", label: "Verified" } : { variant: "danger", label: "Check failed" };
|
||||
}
|
||||
async function checkAccess(repo:Repo):Promise<void>{
|
||||
if(unsaved.value || !checkAgent.value || checking.value)return;
|
||||
const key=`${repo.owner}/${repo.name}`;
|
||||
@@ -138,6 +147,9 @@ async function checkAccess(repo:Repo):Promise<void>{
|
||||
|
||||
<template v-if="form">
|
||||
<CardAccordion v-model:open="open" :items="repos" :title="(r) => `${r.owner}/${r.name}`" remove-label="Remove" mono @remove="removeRepo">
|
||||
<template #aside="{ item }">
|
||||
<Badge v-if="readiness(item as Repo)" :variant="readiness(item as Repo)!.variant">{{ readiness(item as Repo)!.label }}</Badge>
|
||||
</template>
|
||||
<template #default="{ item: repo, index: i }">
|
||||
<FieldGroup class="@container/field-group">
|
||||
<Field orientation="responsive">
|
||||
|
||||
@@ -10,6 +10,7 @@ import {
|
||||
EmptyTitle,
|
||||
} from "@/components/ui/empty";
|
||||
import { Badge } from "@/components/ui/badge";
|
||||
import { Button } from "@/components/ui/button";
|
||||
|
||||
import PanelError from "./PanelError.vue";
|
||||
import PanelLoading from "./PanelLoading.vue";
|
||||
@@ -46,6 +47,13 @@ const attempt = computed(() =>
|
||||
const meta = computed(() => stageStatusMeta(attempt.value?.status));
|
||||
const stages = computed(() => attempt.value?.stages || []);
|
||||
|
||||
// The fix applies to the attempt that parked, not to the ones before it.
|
||||
const recovery = computed(() =>
|
||||
run.task?.status === "parked" && Number(attempt.value?.attempt) === Math.max(...attempts.value.map((a) => Number(a.attempt)))
|
||||
? props.state?.recovery
|
||||
: undefined,
|
||||
);
|
||||
|
||||
/**
|
||||
* Master-detail selection (docs/prds/task-run-master-detail.md): clicking a
|
||||
* stage commands the inspector to the log tab with this stage's filter set.
|
||||
@@ -118,6 +126,9 @@ const timeLimit = computed(() => {
|
||||
<span v-if="timeLimit" class="text-xs text-fg-muted">{{
|
||||
timeLimit
|
||||
}}</span>
|
||||
<Button v-if="recovery" as-child size="sm" variant="outline">
|
||||
<RouterLink :to="recovery.link">{{ recovery.label }}</RouterLink>
|
||||
</Button>
|
||||
</div>
|
||||
<Alert v-if="ownError" variant="destructive" class="mb-3 whitespace-pre-wrap break-words"><AlertDescription>{{ ownError }}</AlertDescription></Alert>
|
||||
<ol
|
||||
|
||||
Reference in new issue
Block a user