refactor(ui): build settings, org, task, workflow and dashboard pages from the shared components
This commit is contained in:
77 files changed
+505
-744
No files matched your search
@@ -4,7 +4,7 @@ import { computed, onMounted, ref } from "vue";
|
||||
|
||||
import { Badge } from "@/components/ui/badge";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Card, CardAction, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
|
||||
import { Section } from "@/components/ui/section";
|
||||
import { Input } from "@/components/ui/input";
|
||||
import {
|
||||
Select,
|
||||
@@ -105,13 +105,9 @@ onMounted(load);
|
||||
|
||||
<div v-if="error" role="alert" class="mb-4 text-sm text-danger"><p>{{ error }}</p><Button variant="outline" size="sm" @click="load">Retry</Button></div>
|
||||
|
||||
<Card class="mb-4">
|
||||
<CardHeader>
|
||||
<CardAction>
|
||||
<Button size="sm" @click="editing = true">New policy</Button>
|
||||
</CardAction>
|
||||
</CardHeader>
|
||||
<CardContent class="flex flex-col gap-3">
|
||||
<Section>
|
||||
<template #action><Button size="sm" @click="editing = true">New policy</Button></template>
|
||||
<div class="flex flex-col gap-3">
|
||||
<p v-if="loading" role="status" class="text-sm text-fg-muted">Loading policies…</p>
|
||||
<p v-else-if="!error && !policies.length" class="text-sm text-fg-subtle">No policies yet.</p>
|
||||
<div
|
||||
@@ -133,14 +129,11 @@ onMounted(load);
|
||||
<Button size="sm" variant="outline" @click="remove(p)">Delete</Button>
|
||||
</div>
|
||||
</div>
|
||||
</CardContent>
|
||||
</Card>
|
||||
</div>
|
||||
</Section>
|
||||
|
||||
<Card v-if="editing">
|
||||
<CardHeader>
|
||||
<CardTitle>{{ draft.id ? draft.id : "New policy" }}</CardTitle>
|
||||
</CardHeader>
|
||||
<CardContent class="flex flex-col gap-3">
|
||||
<Section v-if="editing" :title="draft.id ? draft.id : 'New policy'">
|
||||
<div class="flex flex-col gap-3">
|
||||
<div class="flex flex-wrap gap-2">
|
||||
<Input v-model="draft.id" placeholder="policy id" class="w-56" />
|
||||
<Select v-model="draft.level">
|
||||
@@ -172,7 +165,7 @@ onMounted(load);
|
||||
<Button :disabled="!canSave || saving" @click="save">Save</Button>
|
||||
<Button variant="outline" @click="(editing = false), (draft = blank())">Cancel</Button>
|
||||
</div>
|
||||
</CardContent>
|
||||
</Card>
|
||||
</div>
|
||||
</Section>
|
||||
</div>
|
||||
</template>
|
||||
@@ -26,6 +26,7 @@ import {
|
||||
SelectValue,
|
||||
} from "@/components/ui/select";
|
||||
import { Badge } from "@/components/ui/badge";
|
||||
import { Section } from "@/components/ui/section";
|
||||
import { api } from "@/lib/api";
|
||||
import { useOrgStore, type Identity } from "@/stores/org";
|
||||
|
||||
@@ -133,8 +134,9 @@ const isAgent = (value: Identity) =>
|
||||
<Button type="submit" size="sm" :disabled="!name.trim() || !!store.identityBusy"><Plus data-icon="inline-start" />Create</Button>
|
||||
</form>
|
||||
|
||||
<ul class="divide-y divide-border rounded-lg border border-border bg-card" aria-label="Agents">
|
||||
<li v-for="value in store.identities" :key="value.id" class="flex flex-wrap items-center gap-3 px-4 py-3">
|
||||
<Section>
|
||||
<ul class="divide-y divide-border" aria-label="Agents">
|
||||
<li v-for="value in store.identities" :key="value.id" class="flex flex-wrap items-center gap-3 py-3 first:pt-0 last:pb-0">
|
||||
<span class="grid size-8 shrink-0 place-items-center rounded-md bg-secondary text-fg-muted">
|
||||
<component :is="icons[value.kind]" class="size-4" aria-hidden="true" />
|
||||
</span>
|
||||
@@ -181,7 +183,7 @@ const isAgent = (value: Identity) =>
|
||||
<Button variant="ghost" size="sm" class="text-danger" :disabled="!!store.identityBusy" @click="retiring = value">Retire</Button>
|
||||
</div>
|
||||
</li>
|
||||
<li v-if="!store.identitiesLoaded" class="px-4 py-3 text-sm text-fg-muted" role="status">Loading agents…</li>
|
||||
<li v-if="!store.identitiesLoaded" class="py-3 text-sm text-fg-muted" role="status">Loading agents…</li>
|
||||
<li v-else-if="!store.identities.length && !store.identityError">
|
||||
<Empty class="py-6">
|
||||
<EmptyHeader>
|
||||
@@ -190,10 +192,9 @@ const isAgent = (value: Identity) =>
|
||||
</Empty>
|
||||
</li>
|
||||
</ul>
|
||||
</Section>
|
||||
|
||||
<div class="mt-8">
|
||||
<IdentityGrantsCard />
|
||||
</div>
|
||||
<IdentityGrantsCard />
|
||||
|
||||
<AlertDialog :open="!!retiring" @update:open="(open) => !open && (retiring = null)">
|
||||
<AlertDialogContent>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<script setup lang="ts">
|
||||
import PageHeader from "@/base/PageHeader.vue";
|
||||
import CreateAccount from "@/accounts/CreateAccount.vue";
|
||||
import { Card, CardContent } from "@/components/ui/card";
|
||||
import { Section } from "@/components/ui/section";
|
||||
import { storeToRefs } from "pinia";
|
||||
import { computed, onMounted, ref } from "vue";
|
||||
import { Plus, Trash2 } from "@lucide/vue";
|
||||
@@ -138,8 +138,7 @@ const remove = (member: Member) =>
|
||||
|
||||
<p v-if="error" role="alert" class="mb-4 text-sm text-danger">{{ error }}</p>
|
||||
|
||||
<Card>
|
||||
<CardContent>
|
||||
<Section>
|
||||
<Table>
|
||||
<TableHeader>
|
||||
<TableRow>
|
||||
@@ -191,13 +190,11 @@ const remove = (member: Member) =>
|
||||
</TableRow>
|
||||
</TableBody>
|
||||
</Table>
|
||||
</CardContent>
|
||||
</Card>
|
||||
</Section>
|
||||
|
||||
<CreateAccount v-if="org?.id===identities.homeOrg" @created="load" />
|
||||
<section class="mt-8 grid gap-6 lg:grid-cols-2" aria-label="Add people">
|
||||
<div>
|
||||
<h2 class="mb-3 text-sm font-medium">Add an identity</h2>
|
||||
<div class="grid gap-4 lg:grid-cols-2">
|
||||
<Section title="Add an identity" class="mb-0">
|
||||
<form class="flex flex-wrap items-center gap-2" @submit.prevent="add">
|
||||
<Select v-model="picked">
|
||||
<SelectTrigger class="w-64" aria-label="Identity">
|
||||
@@ -220,10 +217,9 @@ const remove = (member: Member) =>
|
||||
<Button type="submit" size="sm" :disabled="!picked || busy !== ''">
|
||||
<Plus data-icon="inline-start" /> Add member</Button>
|
||||
</form>
|
||||
</div>
|
||||
</Section>
|
||||
|
||||
<div>
|
||||
<h2 class="mb-3 text-sm font-medium">Invite a person</h2>
|
||||
<Section title="Invite a person" class="mb-0">
|
||||
<form class="flex flex-wrap items-center gap-2" @submit.prevent="addPerson">
|
||||
<Input
|
||||
v-model="person"
|
||||
@@ -242,7 +238,7 @@ const remove = (member: Member) =>
|
||||
<Button type="submit" size="sm" :disabled="!person.trim() || busy !== ''">
|
||||
<Plus data-icon="inline-start" /> Invite person</Button>
|
||||
</form>
|
||||
</div>
|
||||
</section>
|
||||
</Section>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -4,6 +4,7 @@ import { computed, onMounted, ref } from "vue";
|
||||
import { Plus, Trash2 } from "@lucide/vue";
|
||||
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Section } from "@/components/ui/section";
|
||||
import { Input } from "@/components/ui/input";
|
||||
import { useSettingsStore } from "@/stores/settings";
|
||||
import DraftHint from "@/settings/DraftHint.vue";
|
||||
@@ -46,7 +47,6 @@ function addProvider() {
|
||||
newProvider.value = "";
|
||||
}
|
||||
const bound = computed(() => new Set(((store.drafts["credential-bindings"]?.value as { service: string }[] | null) ?? []).map((b) => b.service)));
|
||||
const eyebrow = "mb-2 text-caption font-medium tracking-[0.06em] text-fg-subtle uppercase";
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -55,9 +55,8 @@ const eyebrow = "mb-2 text-caption font-medium tracking-[0.06em] text-fg-subtle
|
||||
<p v-for="e in errors" :key="String(e)" class="mb-4 text-sm text-danger" role="alert">{{ e }}</p>
|
||||
|
||||
<template v-if="aliases">
|
||||
<h2 :class="eyebrow">Aliases</h2>
|
||||
<div class="rounded-lg border border-border bg-card">
|
||||
<div v-for="(model, alias) in aliases" :key="alias" class="flex flex-wrap items-center gap-3 border-b border-border px-4 py-2.5 last-of-type:border-b-0">
|
||||
<Section title="Aliases">
|
||||
<div v-for="(model, alias) in aliases" :key="alias" class="flex flex-wrap items-center gap-3 border-b border-border py-2.5 last-of-type:border-b-0">
|
||||
<label :for="`org-alias-${alias}`" class="w-28 font-mono text-sm font-medium">{{ alias }}</label>
|
||||
<Input
|
||||
:id="`org-alias-${alias}`"
|
||||
@@ -71,28 +70,27 @@ const eyebrow = "mb-2 text-caption font-medium tracking-[0.06em] text-fg-subtle
|
||||
<span v-if="issue(String(alias))" class="text-xs text-danger">{{ issue(String(alias))?.message }}</span>
|
||||
<Button variant="ghost" size="icon" class="ml-auto" :aria-label="`Remove alias ${alias}`" @click="delete aliases[alias]"><Trash2 /></Button>
|
||||
</div>
|
||||
<form class="flex gap-2 border-t border-border px-4 py-3" @submit.prevent="addAlias">
|
||||
<form class="flex gap-2 border-t border-border pt-3" @submit.prevent="addAlias">
|
||||
<Input v-model="newAlias" class="max-w-56 font-mono" placeholder="alias, e.g. default" aria-label="New alias" />
|
||||
<Button type="submit" variant="outline" size="sm" :disabled="!newAlias.trim()"><Plus data-icon="inline-start" />Add alias</Button>
|
||||
</form>
|
||||
</div>
|
||||
</Section>
|
||||
</template>
|
||||
|
||||
<template v-if="providers">
|
||||
<h2 :class="[eyebrow, 'mt-10']">Providers</h2>
|
||||
<div class="rounded-lg border border-border bg-card">
|
||||
<div v-for="(provider, name) in providers" :key="name" class="flex flex-wrap items-center gap-3 border-b border-border px-4 py-2.5 last-of-type:border-b-0">
|
||||
<Section title="Providers">
|
||||
<div v-for="(provider, name) in providers" :key="name" class="flex flex-wrap items-center gap-3 border-b border-border py-2.5 last-of-type:border-b-0">
|
||||
<span class="w-28 font-mono text-sm font-medium">{{ name }}</span>
|
||||
<Input v-model="provider.class" class="w-36 font-mono" :aria-label="`Class for ${name}`" />
|
||||
<Input v-model="provider.base_url" class="max-w-md flex-1 font-mono max-sm:basis-full" placeholder="base URL (empty: class default)" :aria-label="`Base URL for ${name}`" />
|
||||
<RouterLink v-if="!bound.has(String(name))" to="/org/credential-bindings" class="text-xs text-warn hover:underline">Add a credential binding named "{{ name }}"</RouterLink>
|
||||
<Button variant="ghost" size="icon" class="ml-auto" :aria-label="`Remove provider ${name}`" @click="delete providers[name]"><Trash2 /></Button>
|
||||
</div>
|
||||
<form class="flex gap-2 border-t border-border px-4 py-3" @submit.prevent="addProvider">
|
||||
<form class="flex gap-2 border-t border-border pt-3" @submit.prevent="addProvider">
|
||||
<Input v-model="newProvider" class="max-w-56 font-mono" placeholder="provider name" aria-label="New provider" />
|
||||
<Button type="submit" variant="outline" size="sm" :disabled="!newProvider.trim()"><Plus data-icon="inline-start" />Add provider</Button>
|
||||
</form>
|
||||
</div>
|
||||
</Section>
|
||||
</template>
|
||||
</div>
|
||||
</template>
|
||||
@@ -1,6 +1,6 @@
|
||||
<script setup lang="ts">
|
||||
import PageHeader from "@/base/PageHeader.vue";
|
||||
import { Card, CardContent } from "@/components/ui/card";
|
||||
import { Section } from "@/components/ui/section";
|
||||
import { storeToRefs } from "pinia";
|
||||
import { onMounted, ref } from "vue";
|
||||
import { Plus } from "@lucide/vue";
|
||||
@@ -84,8 +84,7 @@ async function create(): Promise<void> {
|
||||
|
||||
<p v-if="error" role="alert" class="mb-4 text-sm text-danger">{{ error }}</p>
|
||||
|
||||
<Card>
|
||||
<CardContent>
|
||||
<Section>
|
||||
<Table>
|
||||
<TableHeader>
|
||||
<TableRow>
|
||||
@@ -114,11 +113,9 @@ async function create(): Promise<void> {
|
||||
</TableRow>
|
||||
</TableBody>
|
||||
</Table>
|
||||
</CardContent>
|
||||
</Card>
|
||||
</Section>
|
||||
|
||||
<section class="mt-8" aria-labelledby="new-workspace">
|
||||
<h2 id="new-workspace" class="mb-3 text-sm font-medium">New workspace</h2>
|
||||
<Section title="New workspace">
|
||||
<form class="flex flex-wrap items-center gap-2" @submit.prevent="create">
|
||||
<Input v-model="id" class="w-40 font-mono" placeholder="id" aria-label="Workspace id" required />
|
||||
<Input v-model="name" class="w-56" placeholder="Name" aria-label="Workspace name" required />
|
||||
@@ -126,6 +123,6 @@ async function create(): Promise<void> {
|
||||
<Button type="submit" size="sm" :disabled="!id.trim() || !name.trim() || busy">
|
||||
<Plus data-icon="inline-start" /> Create</Button>
|
||||
</form>
|
||||
</section>
|
||||
</Section>
|
||||
</div>
|
||||
</template>
|
||||
Reference in new issue
Block a user