fix(ui): one error presentation with Retry across the dashboard (#1744)
New components/ui ReadError (destructive Alert + message + optional Retry) is now the single read-error presentation, used by Versions, Services, Canary, OrgAccess, Denials, Tokens, Audit, Extensions, Harness and the Status page (one page-level error instead of one per card). PanelError is the same alert for task panels, and TasksState's error kind, the attempts panel and the task-log pane all offer Retry. Org policy save errors sit beside the Save button instead of at the page top.
This commit is contained in:
17 files changed
+76
-38
No files matched your search
@@ -1,5 +1,6 @@
|
||||
<script setup lang="ts">
|
||||
import { Item, ItemGroup } from "@/components/ui/item";
|
||||
import { ReadError } from "@/components/ui/read-error";
|
||||
import { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle } from "@/components/ui/alert-dialog";
|
||||
import { onMounted, ref } from "vue";
|
||||
import { Copy, Plus, X } from "@lucide/vue";
|
||||
@@ -89,7 +90,7 @@ onMounted(load);
|
||||
</form>
|
||||
</template>
|
||||
<p v-if="!available && !busy && !error" class="text-fg-subtle">Personal tokens need a signed-in person.</p>
|
||||
<p v-if="error" role="alert" class="mb-3 text-danger">{{ error }}</p>
|
||||
<ReadError v-if="error" :message="error" retry-label="Retry" class="mb-3" @retry="load" />
|
||||
<Card v-if="created" size="sm" class="mb-3">
|
||||
<p class="text-caption text-fg-subtle">Copy this token now. It cannot be shown again.</p>
|
||||
<div class="mt-2 flex gap-2">
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<script setup lang="ts">
|
||||
import { Alert, AlertDescription } from "@/components/ui/alert";
|
||||
import { ReadError } from "@/components/ui/read-error";
|
||||
import { computed, nextTick, onMounted, onUnmounted, ref, watch } from "vue";
|
||||
import { useRoute, useRouter } from "vue-router";
|
||||
import { storeToRefs } from "pinia";
|
||||
@@ -409,10 +410,7 @@ async function saveRetention(): Promise<void> {
|
||||
<div v-if="loading" class="space-y-2" role="status" aria-label="Loading audit">
|
||||
<Skeleton v-for="n in 6" :key="n" class="h-10 w-full" />
|
||||
</div>
|
||||
<div v-else-if="error" class="rounded-xl border border-border bg-card p-6" role="alert">
|
||||
<p class="text-label text-danger">{{ error }}</p>
|
||||
<Button class="mt-3" variant="outline" size="sm" @click="reload">Retry</Button>
|
||||
</div>
|
||||
<ReadError v-else-if="error" :message="error" retry-label="Retry" @retry="reload" />
|
||||
<Section v-else>
|
||||
<DataTable :key="queryKey" :columns="columns" :rows="records" :row-key="recordKey" storage-key="audit">
|
||||
<template #cell-event="{ row }">
|
||||
|
||||
@@ -4,6 +4,7 @@ import { onMounted } from "vue";
|
||||
|
||||
import PageHeader from "@/base/PageHeader.vue";
|
||||
import { Badge } from "@/components/ui/badge";
|
||||
import { ReadError } from "@/components/ui/read-error";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { DataTable, type DataTableColumn } from "@/components/ui/data-table";
|
||||
import { Empty, EmptyHeader, EmptyTitle } from "@/components/ui/empty";
|
||||
@@ -35,10 +36,7 @@ onMounted(() => void store.load());
|
||||
<Button variant="outline" size="sm" :disabled="loading" @click="store.load()">Refresh</Button>
|
||||
</PageHeader>
|
||||
|
||||
<div v-if="error" role="alert" class="mb-4 text-label text-danger">
|
||||
<p>{{ error }}</p>
|
||||
<Button variant="outline" size="sm" @click="store.load()">Retry</Button>
|
||||
</div>
|
||||
<ReadError v-if="error" :message="error" retry-label="Retry" class="mb-4" @retry="store.load()" />
|
||||
|
||||
<Section>
|
||||
<div class="flex flex-col gap-3">
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
<script setup lang="ts">
|
||||
import { Alert, AlertDescription } from "../alert";
|
||||
import { Button } from "../button";
|
||||
|
||||
/**
|
||||
* The one read-error presentation: a destructive Alert where the data would
|
||||
* be, with a Retry when a reload exists. Emits retry when the button is used.
|
||||
*/
|
||||
defineProps<{ message: string; retryLabel?: string }>();
|
||||
const emit = defineEmits<{ retry: [] }>();
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Alert variant="destructive">
|
||||
<AlertDescription class="flex flex-wrap items-center gap-2">
|
||||
<span class="min-w-0 flex-1">{{ message }}</span>
|
||||
<Button v-if="retryLabel" variant="link" size="xs" class="shrink-0 px-0" @click="emit('retry')">{{ retryLabel }}</Button>
|
||||
</AlertDescription>
|
||||
</Alert>
|
||||
</template>
|
||||
@@ -0,0 +1 @@
|
||||
export { default as ReadError } from "./ReadError.vue";
|
||||
@@ -11,6 +11,7 @@ import { onMounted, ref } from "vue";
|
||||
|
||||
import PageHeader from "@/base/PageHeader.vue";
|
||||
import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert";
|
||||
import { ReadError } from "@/components/ui/read-error";
|
||||
import { Badge } from "@/components/ui/badge";
|
||||
import type { BadgeVariants } from "@/components/ui/badge";
|
||||
import { Button } from "@/components/ui/button";
|
||||
@@ -110,10 +111,7 @@ function scopes(binding: HarnessBinding): string {
|
||||
<div>
|
||||
<PageHeader title="Harness" />
|
||||
|
||||
<Alert v-if="failure" variant="destructive" class="mb-4">
|
||||
<AlertTitle>Could not load the harness</AlertTitle>
|
||||
<AlertDescription>{{ failure }} <Button variant="link" size="xs" class="px-0" @click="load">Retry</Button></AlertDescription>
|
||||
</Alert>
|
||||
<ReadError v-if="failure" :message="`Could not load the harness: ${failure}`" retry-label="Retry" class="mb-4" @retry="load" />
|
||||
|
||||
<div v-if="loading" class="flex flex-col gap-2">
|
||||
<Skeleton class="h-24 w-full" />
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<script setup lang="ts">
|
||||
import { Spinner } from "@/components/ui/spinner";
|
||||
import { ReadError } from "@/components/ui/read-error";
|
||||
import { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle } from "@/components/ui/alert-dialog";
|
||||
import { Empty, EmptyHeader, EmptyTitle } from "@/components/ui/empty";
|
||||
import PageHeader from "@/base/PageHeader.vue";
|
||||
@@ -76,7 +77,9 @@ function edit(p: Policy): void {
|
||||
editing.value = true;
|
||||
}
|
||||
|
||||
const saveError = ref("");
|
||||
async function save(): Promise<void> {
|
||||
saveError.value = "";
|
||||
saving.value = true;
|
||||
try {
|
||||
await api.putPolicy(draft.value);
|
||||
@@ -84,7 +87,7 @@ async function save(): Promise<void> {
|
||||
editing.value = false;
|
||||
await load();
|
||||
} catch (err) {
|
||||
error.value = (err as Error).message;
|
||||
saveError.value = (err as Error).message;
|
||||
} finally {
|
||||
saving.value = false;
|
||||
}
|
||||
@@ -107,7 +110,7 @@ onMounted(load);
|
||||
<div>
|
||||
<PageHeader title="Policies" />
|
||||
|
||||
<div v-if="error" role="alert" class="mb-4 text-label text-danger"><p>{{ error }}</p><Button variant="outline" size="sm" @click="load">Retry</Button></div>
|
||||
<ReadError v-if="error" :message="error" retry-label="Retry" class="mb-4" @retry="load" />
|
||||
|
||||
<Section>
|
||||
<template #action><Button size="sm" @click="editing = true">New policy</Button></template>
|
||||
@@ -167,6 +170,7 @@ onMounted(load);
|
||||
aria-label="Cedar policy"
|
||||
placeholder='permit(principal, action == Archie::Action::"read", resource);'
|
||||
/>
|
||||
<ReadError v-if="saveError" :message="saveError" class="mb-2" />
|
||||
<div class="flex gap-2">
|
||||
<Button :disabled="!canSave || saving" @click="save">Save</Button>
|
||||
<Button variant="outline" @click="(editing = false), (draft = blank())">Cancel</Button>
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
import { computed, onMounted, onUnmounted, ref } from "vue";
|
||||
|
||||
import { Badge } from "@/components/ui/badge";
|
||||
import { ReadError } from "@/components/ui/read-error";
|
||||
import { MetadataList } from "@/components/ui/metadata-list";
|
||||
import { Progress } from "@/components/ui/progress";
|
||||
import { Section } from "@/components/ui/section";
|
||||
@@ -157,7 +158,7 @@ onUnmounted(() => {
|
||||
<Section title="Release canary">
|
||||
<p v-if="notConfigured" class="text-label text-fg-muted">Update checks not configured.</p>
|
||||
<template v-else>
|
||||
<p v-if="error" class="text-label text-danger">{{ error }}</p>
|
||||
<ReadError v-if="error" :message="error" retry-label="Retry" @retry="load" />
|
||||
<p v-else-if="loading && !update" class="text-label text-fg-muted">Checking…</p>
|
||||
<template v-else>
|
||||
<MetadataList :rows="rows">
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<script setup lang="ts">
|
||||
import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip";
|
||||
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 } from "vue";
|
||||
@@ -183,7 +184,7 @@ const tones = {
|
||||
<ApplyStatusRows :kind="KIND" class="mt-6 border-t border-border py-4" />
|
||||
</TabsContent>
|
||||
<TabsContent value="marketplace">
|
||||
<p v-if="store.catalogueError" class="text-label text-fg-muted">{{ store.catalogueError }}</p>
|
||||
<ReadError v-if="store.catalogueError" :message="store.catalogueError" retry-label="Retry" @retry="store.load()" />
|
||||
<ExtensionsMarketplace v-else :updates="updates" />
|
||||
<Collapsible class="mt-3">
|
||||
<CollapsibleTrigger class="cursor-pointer text-caption text-fg-muted">Install by reference</CollapsibleTrigger>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<script setup lang="ts">
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { ReadError } from "@/components/ui/read-error";
|
||||
import { computed, onMounted, onUnmounted, ref } from "vue";
|
||||
import { ChevronDown } from "@lucide/vue";
|
||||
|
||||
@@ -112,7 +113,7 @@ onUnmounted(() => clearInterval(timer));
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<p v-if="error" class="mb-4 text-label text-danger">{{ error }}</p>
|
||||
<ReadError v-if="error" :message="error" retry-label="Retry" class="mb-4" @retry="load" />
|
||||
<Section v-for="table in tables" v-else :key="table.key" :title="table.title">
|
||||
<DataTable :columns="columns(table.agent)" :rows="table.rows" :row-key="rowKey" :storage-key="`status.${table.key}`">
|
||||
<template #cell-name="{ row }">
|
||||
|
||||
@@ -4,6 +4,7 @@ import { computed, onMounted, onUnmounted } from "vue";
|
||||
|
||||
import PageHeader from "@/base/PageHeader.vue";
|
||||
import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert";
|
||||
import { ReadError } from "@/components/ui/read-error";
|
||||
import { MetadataList } from "@/components/ui/metadata-list";
|
||||
import { Section } from "@/components/ui/section";
|
||||
import CanaryStatusCard from "./CanaryStatusCard.vue";
|
||||
@@ -13,7 +14,7 @@ import VersionsCard from "./VersionsCard.vue";
|
||||
import { useSettingsStore } from "@/stores/settings";
|
||||
|
||||
const store = useSettingsStore();
|
||||
const { config } = storeToRefs(store);
|
||||
const { config, catalogError } = storeToRefs(store);
|
||||
const bootstrapRows = computed(() =>
|
||||
Object.entries(config.value?.bootstrap ?? {}).map(([label, value]) => ({ label, value, mono: true })),
|
||||
);
|
||||
@@ -29,6 +30,7 @@ onUnmounted(() => clearInterval(timer));
|
||||
<template>
|
||||
<PageHeader title="Status" />
|
||||
<div>
|
||||
<ReadError v-if="catalogError" :message="catalogError" retry-label="Retry" class="mb-4" @retry="store.load()" />
|
||||
<Alert v-if="config?.reload?.last_error" variant="destructive" class="mb-4">
|
||||
<AlertTitle>Configuration reload failed</AlertTitle>
|
||||
<AlertDescription>{{ config.reload.last_error }}</AlertDescription>
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
import { computed, onMounted, ref } from "vue";
|
||||
|
||||
import { Badge } from "@/components/ui/badge";
|
||||
import { ReadError } from "@/components/ui/read-error";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import CodeView from "@/base/CodeView.vue";
|
||||
import { Section } from "@/components/ui/section";
|
||||
@@ -168,7 +169,7 @@ useLiveResource("updates", () => void loadOutcome());
|
||||
<template>
|
||||
<p v-if="notConfigured" class="text-label text-fg-muted">Update checks not configured.</p>
|
||||
<Section v-else title="Versions">
|
||||
<p v-if="loadError" class="text-label text-danger">{{ loadError }}</p>
|
||||
<ReadError v-if="loadError" :message="loadError" retry-label="Retry" class="mb-3" @retry="load" />
|
||||
<p v-else-if="loading" class="text-label text-fg-muted">Checking…</p>
|
||||
<template v-else>
|
||||
<Table>
|
||||
@@ -205,10 +206,8 @@ useLiveResource("updates", () => void loadOutcome());
|
||||
<p v-if="outcome" class="mt-2 text-label" :class="outcome.failed ? 'text-danger' : 'text-ok'">
|
||||
<Timestamp :at="outcome.at" /> {{ outcome.summary }}
|
||||
</p>
|
||||
<p v-if="outcomeError" class="mt-2 text-label text-danger">{{ outcomeError }}</p>
|
||||
<p v-if="installError" class="mt-2 text-label text-danger">
|
||||
{{ installError }}
|
||||
</p>
|
||||
<ReadError v-if="outcomeError" :message="outcomeError" class="mt-2" />
|
||||
<ReadError v-if="installError" :message="installError" class="mt-2" />
|
||||
</template>
|
||||
</Section>
|
||||
</template>
|
||||
@@ -1,15 +1,21 @@
|
||||
<script setup lang="ts">
|
||||
import { Alert, AlertDescription } from "@/components/ui/alert";
|
||||
import { Button } from "@/components/ui/button";
|
||||
|
||||
/**
|
||||
* A panel whose read failed. A failed read is reported as a failed read: it is
|
||||
* never dressed up as an empty result, which would be a claim about the run
|
||||
* that nothing here can make.
|
||||
* that nothing here can make. Retry appears when a reload exists.
|
||||
*/
|
||||
defineProps<{ title: string; detail: string }>();
|
||||
defineProps<{ title: string; detail: string; retryLabel?: string }>();
|
||||
const emit = defineEmits<{ retry: [] }>();
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="flex flex-col items-start gap-2 py-3">
|
||||
<p class="font-medium">{{ title }}</p>
|
||||
<p class="max-w-[60ch] text-label text-fg-muted">{{ detail }}</p>
|
||||
</div>
|
||||
<Alert variant="destructive" class="my-3">
|
||||
<AlertDescription class="flex flex-wrap items-center gap-2">
|
||||
<span class="min-w-0 flex-1"><span class="font-medium">{{ title }}</span> {{ detail }}</span>
|
||||
<Button v-if="retryLabel" variant="link" size="xs" class="shrink-0 px-0" @click="emit('retry')">{{ retryLabel }}</Button>
|
||||
</AlertDescription>
|
||||
</Alert>
|
||||
</template>
|
||||
@@ -13,6 +13,7 @@ import {
|
||||
import { api } from "@/lib/api";
|
||||
|
||||
import PanelLoading from "./PanelLoading.vue";
|
||||
import PanelError from "./PanelError.vue";
|
||||
import TaskLogFilters from "./TaskLogFilters.vue";
|
||||
import { EMPTY_LOG_FILTERS, type LogFilters, type LogState } from "./task-run";
|
||||
|
||||
@@ -52,7 +53,7 @@ const props = withDefaults(
|
||||
},
|
||||
);
|
||||
|
||||
defineEmits<{ filter: [next: LogFilters] }>();
|
||||
const emit = defineEmits<{ filter: [next: LogFilters]; retry: [] }>();
|
||||
|
||||
const resolvedAttempt = computed(
|
||||
() => Number(props.attempt) || Number(props.state?.attempt) || 0,
|
||||
@@ -230,12 +231,13 @@ const rowKey = (entry: LogEntry) => String(entry.id ?? `${entry.time}|${entry.me
|
||||
|
||||
<PanelLoading v-if="view.kind === 'loading'" label="Loading attempt log…" />
|
||||
|
||||
<div
|
||||
<PanelError
|
||||
v-else-if="view.kind === 'failed'"
|
||||
class="flex flex-col items-start gap-2 py-3"
|
||||
>
|
||||
<p class="text-label text-fg-muted">Could not load this attempt's log. Archie did not answer.</p>
|
||||
</div>
|
||||
title="Could not load this attempt's log."
|
||||
detail="Archie did not answer."
|
||||
retry-label="Retry"
|
||||
@retry="emit('retry')"
|
||||
/>
|
||||
|
||||
<Empty v-else-if="view.kind === 'nolog'">
|
||||
<EmptyHeader>
|
||||
|
||||
@@ -37,6 +37,8 @@ const run = useTaskRun();
|
||||
v-else-if="run.attempts === null"
|
||||
title="Could not load this task's attempts"
|
||||
detail="Archie did not answer."
|
||||
retry-label="Retry"
|
||||
@retry="run.refreshAll()"
|
||||
/>
|
||||
|
||||
<Empty v-else-if="run.attemptNumber == null">
|
||||
@@ -48,6 +50,7 @@ const run = useTaskRun();
|
||||
v-else-if="tab.id === 'log'"
|
||||
:state="run.logState"
|
||||
:attempt="run.attemptNumber"
|
||||
@retry="run.refreshAll()"
|
||||
:stages="run.stageNames"
|
||||
:filters="run.filters"
|
||||
:task-id="props.id"
|
||||
|
||||
@@ -223,7 +223,7 @@ async function reveal(id: number) {
|
||||
-->
|
||||
<TaskTable :tasks="visible" :show-repo="showRepo" :show-issue="showIssue" @done="load">
|
||||
<template #state>
|
||||
<TasksState :kind="state" :detail="search.trim() && next ? 'Search covers the loaded rows only; more pages are not loaded yet.' : null" @clear="clearFilters" />
|
||||
<TasksState :kind="state" @retry="load" :detail="search.trim() && next ? 'Search covers the loaded rows only; more pages are not loaded yet.' : null" @clear="clearFilters" />
|
||||
</template>
|
||||
</TaskTable>
|
||||
<Button v-if="next" variant="outline" class="self-center" :disabled="loadingMore" @click="loadMore">Load more</Button>
|
||||
|
||||
@@ -20,7 +20,7 @@ type StateKind = "loading" | "error" | "empty" | "no-match";
|
||||
|
||||
const props = defineProps<{ kind: StateKind; detail?: string | null }>();
|
||||
|
||||
const emit = defineEmits<{ clear: [] }>();
|
||||
const emit = defineEmits<{ clear: []; retry: [] }>();
|
||||
|
||||
const copy = computed(() => {
|
||||
if (props.kind === "error") {
|
||||
@@ -57,5 +57,8 @@ const copy = computed(() => {
|
||||
>Clear filters</Button
|
||||
>
|
||||
</EmptyContent>
|
||||
<EmptyContent v-else-if="props.kind === 'error'">
|
||||
<Button variant="outline" size="sm" @click="emit('retry')">Retry</Button>
|
||||
</EmptyContent>
|
||||
</Empty>
|
||||
</template>
|
||||
Reference in new issue
Block a user