feat(ui,judgement,system): unify nav, surface built-in guards, readiness and decision reasoning
This commit is contained in:
34 files changed
+548
-103
No files matched your search
@@ -4,6 +4,7 @@ import { ReadError } from "@/components/ui/read-error";
|
||||
import { Item, ItemGroup } from "@/components/ui/item";
|
||||
import { Alert, AlertDescription } from "@/components/ui/alert";
|
||||
import { computed, onMounted, ref, watch } from "vue";
|
||||
import { RouterLink, useRoute, useRouter } from "vue-router";
|
||||
import { ChevronRight, Pencil, Plus, Settings2, Trash2 } from "@lucide/vue";
|
||||
|
||||
import PageHeader from "@/base/PageHeader.vue";
|
||||
@@ -43,12 +44,31 @@ import ExtensionsMarketplace from "./ExtensionsMarketplace.vue";
|
||||
import CatalogueInstallDialog from "./CatalogueInstallDialog.vue";
|
||||
import PackageVersionsDialog from "./PackageVersionsDialog.vue";
|
||||
|
||||
const route = useRoute();
|
||||
const router = useRouter();
|
||||
const VALID_TABS = new Set(["installations", "packages", "marketplace"]);
|
||||
const activeTab = computed(() => {
|
||||
const t = String(route.query.tab ?? "");
|
||||
if (VALID_TABS.has(t)) return t;
|
||||
return route.query.kind ? "packages" : "installations";
|
||||
});
|
||||
function selectTab(next: unknown): void {
|
||||
const value = String(next);
|
||||
if (!VALID_TABS.has(value)) return;
|
||||
void router.replace({ query: { ...route.query, tab: value === "installations" ? undefined : value } });
|
||||
}
|
||||
|
||||
const store = useExtensionsStore();
|
||||
const org = useOrgStore();
|
||||
const loading = ref(true);
|
||||
onMounted(async () => {
|
||||
await Promise.all([store.load(), org.loadOrg()]);
|
||||
loading.value = false;
|
||||
const configureId = String(route.query.configure ?? "");
|
||||
if (configureId) {
|
||||
const target = store.extensions.find((ext) => ext.id === configureId);
|
||||
if (target?.editable) openSettings(target);
|
||||
}
|
||||
});
|
||||
|
||||
// A new installation may be owned by the instance when the caller administers
|
||||
@@ -168,7 +188,13 @@ const pathGroups = computed(() => {
|
||||
}
|
||||
return [...byGroup.values()];
|
||||
});
|
||||
const activeKind = ref("");
|
||||
const activeKind = ref(String(route.query.kind ?? ""));
|
||||
watch(
|
||||
() => route.query.kind,
|
||||
(kind) => {
|
||||
if (typeof kind === "string") activeKind.value = kind;
|
||||
},
|
||||
);
|
||||
const active = computed(() => (kinds.data.value ?? []).find((kind) => kind.kind === activeKind.value) ?? kinds.data.value?.[0]);
|
||||
</script>
|
||||
|
||||
@@ -178,7 +204,7 @@ const active = computed(() => (kinds.data.value ?? []).find((kind) => kind.kind
|
||||
|
||||
<Alert v-if="store.error" variant="destructive" class="mb-4"><AlertDescription>{{ store.error }}</AlertDescription></Alert>
|
||||
|
||||
<Tabs default-value="installations" class="space-y-4">
|
||||
<Tabs :model-value="activeTab" class="space-y-4" @update:model-value="selectTab">
|
||||
<TabsList>
|
||||
<TabsTrigger value="installations">Installations</TabsTrigger>
|
||||
<TabsTrigger value="packages">Packages</TabsTrigger>
|
||||
@@ -321,8 +347,10 @@ const active = computed(() => (kinds.data.value ?? []).find((kind) => kind.kind
|
||||
</TabsContent>
|
||||
|
||||
<TabsContent value="marketplace">
|
||||
<Collapsible class="mb-3" default-open>
|
||||
<CollapsibleTrigger class="cursor-pointer text-caption text-fg-muted">Catalogue source</CollapsibleTrigger>
|
||||
<Collapsible class="mb-3" :default-open="!store.source.configured && !!store.catalogueError">
|
||||
<CollapsibleTrigger class="cursor-pointer text-caption text-fg-muted">
|
||||
Catalogue source<span v-if="store.source.source?.location" class="ml-1.5 font-mono text-fg-subtle">({{ store.source.source.location }})</span>
|
||||
</CollapsibleTrigger>
|
||||
<CollapsibleContent>
|
||||
<form class="mt-2 flex flex-wrap items-end gap-2" @submit.prevent="saveSource">
|
||||
<Input v-model="sourceLocation" class="max-w-96 font-mono" placeholder="https://… or /path/to/catalogue.json" aria-label="Catalogue location" />
|
||||
@@ -354,6 +382,9 @@ const active = computed(() => (kinds.data.value ?? []).find((kind) => kind.kind
|
||||
</SettingRow>
|
||||
<SettingRow label="Other settings" for="ext-settings" hint="key=value, one per line. A key ending in _ref takes engine:key.">
|
||||
<Textarea id="ext-settings" v-model="other" class="font-mono" rows="3" />
|
||||
<p class="mt-1 text-caption text-fg-muted">
|
||||
Manage <RouterLink to="/settings/secret-engines" class="underline">secret engines</RouterLink> or <RouterLink to="/settings/credentials" class="underline">credentials</RouterLink>.
|
||||
</p>
|
||||
</SettingRow>
|
||||
</form>
|
||||
<DialogFooter><Button type="submit" form="extension-settings" :disabled="!!store.busy">Save and restart</Button></DialogFooter>
|
||||
|
||||
@@ -18,7 +18,11 @@ useIntervalFn(store.load, 15_000);
|
||||
<PageHeader title="Secret engines">
|
||||
<Button variant="outline" size="sm" @click="store.load">Refresh</Button>
|
||||
</PageHeader>
|
||||
<p class="mb-4 text-label text-fg-muted">Extension engines: <RouterLink to="/settings/extensions" class="underline">Extensions</RouterLink></p>
|
||||
<p class="mb-4 text-label text-fg-muted">
|
||||
<RouterLink :to="{ path: '/settings/extensions', query: { tab: 'packages', kind: 'secret-engines' } }" class="underline">Manage secret engines</RouterLink>
|
||||
·
|
||||
<RouterLink :to="{ path: '/settings/extensions', query: { tab: 'marketplace', kind: 'secret-engines' } }" class="underline">Browse secret engines</RouterLink>
|
||||
</p>
|
||||
<Alert v-if="store.error" variant="destructive"><AlertDescription>{{ store.error }}</AlertDescription></Alert>
|
||||
<Empty v-else-if="store.engines && !store.engines.length"><EmptyHeader><EmptyTitle>No secret engines installed</EmptyTitle></EmptyHeader></Empty>
|
||||
<Table v-else-if="store.engines">
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<script setup lang="ts">
|
||||
import { Separator } from "@/components/ui/separator";
|
||||
import { computed } from "vue";
|
||||
import { useRoute } from "vue-router";
|
||||
|
||||
@@ -26,21 +25,14 @@ const items = computed(() =>
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="flex gap-8 @max-3xl:flex-col @max-3xl:gap-4">
|
||||
<div class="flex flex-col gap-4">
|
||||
<nav
|
||||
id="config-sidebar"
|
||||
:aria-label="props.scope === 'org' ? 'Organisation' : 'Instance'"
|
||||
class="shrink-0 @3xl:w-48 @max-3xl:-mx-4 @max-3xl:w-auto @max-3xl:scroll-fade-x @max-3xl:overflow-x-auto @max-3xl:[scrollbar-width:none] @max-3xl:border-b @max-3xl:px-4"
|
||||
class="-mx-4 scroll-fade-x overflow-x-auto border-b px-4 pb-2 [scrollbar-width:none]"
|
||||
>
|
||||
<ul class="flex flex-col gap-0.5 @3xl:sticky @3xl:top-20 @max-3xl:flex-row @max-3xl:gap-1">
|
||||
<li v-for="(item, index) in items" :key="item.path" class="contents">
|
||||
<Separator v-if="item.dividerBefore === ''" class="my-4 @max-3xl:hidden" />
|
||||
<p
|
||||
v-else-if="item.dividerBefore"
|
||||
:class="cn('mb-1 px-3 text-caption font-medium tracking-[0.06em] text-fg-subtle uppercase @max-3xl:hidden', index > 0 && 'mt-4')"
|
||||
>
|
||||
{{ item.dividerBefore }}
|
||||
</p>
|
||||
<ul class="flex flex-row flex-wrap gap-1">
|
||||
<li v-for="item in items" :key="item.path" class="contents">
|
||||
<RouterLink
|
||||
:to="item.path"
|
||||
:aria-current="route.path === item.path ? 'page' : undefined"
|
||||
|
||||
Reference in new issue
Block a user