feat(connectors): group extensions as platform, integration or agent (#2084)
This commit is contained in:
6 files changed
+176
-26
No files matched your search
@@ -1,33 +1,47 @@
|
||||
<script setup lang="ts">
|
||||
import { computed } from "vue";
|
||||
import { computed, onMounted } from "vue";
|
||||
import { useRoute, useRouter } from "vue-router";
|
||||
|
||||
import PageHeader from "@/base/PageHeader.vue";
|
||||
import { ReadError } from "@/components/ui/read-error";
|
||||
import { Tabs, TabsList, TabsTrigger } from "@/components/ui/tabs";
|
||||
import type { ExtensionKind } from "@/lib/api";
|
||||
import { api, type ExtensionGroup } from "@/lib/api";
|
||||
import { useRead } from "@/lib/use-read";
|
||||
import ExtensionList from "./ExtensionList.vue";
|
||||
|
||||
/** Connectors, guards and MCP servers: the packages Archie acts and judges
|
||||
* through. The open tab is `?kind=`. */
|
||||
const KINDS: { kind: ExtensionKind; label: string; noun: string }[] = [
|
||||
{ kind: "connectors", label: "Connectors", noun: "connector" },
|
||||
{ kind: "guards", label: "Guards", noun: "guard" },
|
||||
{ kind: "mcp-servers", label: "MCP servers", noun: "MCP server" },
|
||||
{ kind: "secret-engines", label: "Secret engines", noun: "secret engine" },
|
||||
/** The packages Archie runs, listed by group. The open tab is `?kind=`. */
|
||||
const GROUPS: { id: ExtensionGroup; label: string }[] = [
|
||||
{ id: "platform", label: "Platform extensions" },
|
||||
{ id: "integration", label: "Integration extensions" },
|
||||
{ id: "agent", label: "Agent extensions" },
|
||||
];
|
||||
const route = useRoute();
|
||||
const router = useRouter();
|
||||
const active = computed(() => KINDS.find((k) => k.kind === route.query.kind) ?? KINDS[0]);
|
||||
const { data: kinds, error, reload } = useRead(() => api.extensionKinds());
|
||||
onMounted(reload);
|
||||
|
||||
const groups = computed(() =>
|
||||
GROUPS.map((group) => ({ ...group, kinds: (kinds.value ?? []).filter((k) => k.group === group.id) })).filter((group) => group.kinds.length),
|
||||
);
|
||||
const active = computed(() => kinds.value?.find((k) => k.kind === route.query.kind) ?? kinds.value?.[0]);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div>
|
||||
<PageHeader title="Extensions" />
|
||||
<Tabs :model-value="active.kind" class="mb-4" @update:model-value="(k) => router.replace({ query: { kind: String(k) } })">
|
||||
<TabsList variant="line" class="w-full justify-start">
|
||||
<TabsTrigger v-for="k in KINDS" :key="k.kind" :value="k.kind" class="flex-none px-3">{{ k.label }}</TabsTrigger>
|
||||
</TabsList>
|
||||
</Tabs>
|
||||
<ExtensionList :key="active.kind" :kind="active.kind" :noun="active.noun" />
|
||||
<ReadError v-if="error" :message="error" retry-label="Retry" @retry="reload" />
|
||||
<template v-else-if="active">
|
||||
<Tabs :model-value="active.kind" class="mb-4" @update:model-value="(k) => router.replace({ query: { kind: String(k) } })">
|
||||
<div class="flex flex-wrap gap-x-6 gap-y-3">
|
||||
<div v-for="group in groups" :key="group.id">
|
||||
<h2 class="mb-1 text-caption text-fg-subtle">{{ group.label }}</h2>
|
||||
<TabsList variant="line" class="justify-start">
|
||||
<TabsTrigger v-for="k in group.kinds" :key="k.kind" :value="k.kind" class="flex-none px-3">{{ k.label }}</TabsTrigger>
|
||||
</TabsList>
|
||||
</div>
|
||||
</div>
|
||||
</Tabs>
|
||||
<ExtensionList :key="active.kind" :kind="active.kind" :noun="active.singular" />
|
||||
</template>
|
||||
</div>
|
||||
</template>
|
||||
Reference in new issue
Block a user