fix(ui): failed reads show an error with Retry, not an empty view (#1733)
Chat: a failed conversation load sets sessionError, shown in the transcript with Retry instead of the empty invitation (it no longer goes to statusText in the settings popover). Command palette: failed task or workflow reads render a "Couldn't load … — Retry" item in that group. Denials: the table no longer shows "No denials recorded" under an error. Mapping form: failed captures/event-types reads show an error row with Retry instead of "No captured events yet." or a silently empty select. Channels: a failed status read keeps the last badges and shows an error with Retry. Sources: read failures are separate from write failures, shown with Retry, and a loaded-but-empty list gets an empty state.
This commit is contained in:
9 files changed
+85
-14
No files matched your search
@@ -49,7 +49,7 @@ onMounted(() => void store.load());
|
|||||||
<EmptyHeader><EmptyTitle>No denials recorded</EmptyTitle></EmptyHeader>
|
<EmptyHeader><EmptyTitle>No denials recorded</EmptyTitle></EmptyHeader>
|
||||||
</Empty>
|
</Empty>
|
||||||
<DataTable
|
<DataTable
|
||||||
v-else
|
v-else-if="!error || denials.length"
|
||||||
:columns="columns"
|
:columns="columns"
|
||||||
:rows="denials"
|
:rows="denials"
|
||||||
:row-key="(d) => `${d.at}:${d.principal}:${d.action}:${d.kind}:${d.resource}`"
|
:row-key="(d) => `${d.at}:${d.principal}:${d.action}:${d.kind}:${d.resource}`"
|
||||||
|
|||||||
@@ -90,11 +90,15 @@ const agentOptions = computed(() => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const statuses = ref<ChannelStatus[]>([]);
|
const statuses = ref<ChannelStatus[]>([]);
|
||||||
|
// A failed status read keeps the last known badges and flags the error, so a
|
||||||
|
// transient failure neither clears every badge nor passes as "all idle".
|
||||||
|
const statusError = ref(false);
|
||||||
async function loadStatus() {
|
async function loadStatus() {
|
||||||
try {
|
try {
|
||||||
statuses.value = (await api.channels<{ channels?: ChannelStatus[] }>())?.channels ?? [];
|
statuses.value = (await api.channels<{ channels?: ChannelStatus[] }>())?.channels ?? [];
|
||||||
|
statusError.value = false;
|
||||||
} catch {
|
} catch {
|
||||||
statuses.value = [];
|
statusError.value = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
useLiveResource(null, () => void loadStatus());
|
useLiveResource(null, () => void loadStatus());
|
||||||
@@ -147,6 +151,11 @@ function setModels(list: string[]) {
|
|||||||
{{ catalogError || error }}
|
{{ catalogError || error }}
|
||||||
</AlertDescription></Alert>
|
</AlertDescription></Alert>
|
||||||
|
|
||||||
|
<Alert v-if="statusError" variant="destructive" class="mb-4"><AlertDescription>
|
||||||
|
Couldn't load channel status
|
||||||
|
<Button variant="link" size="xs" @click="loadStatus">Retry</Button>
|
||||||
|
</AlertDescription></Alert>
|
||||||
|
|
||||||
<template v-if="chat">
|
<template v-if="chat">
|
||||||
<Section v-for="channel in channels" :key="channel.id" :title="channel.title" :class="!shown(channel.id) && 'gap-0'">
|
<Section v-for="channel in channels" :key="channel.id" :title="channel.title" :class="!shown(channel.id) && 'gap-0'">
|
||||||
<template #action>
|
<template #action>
|
||||||
|
|||||||
@@ -16,11 +16,15 @@ import ChatBubble from "./ChatBubble.vue";
|
|||||||
import ChatChooseCard from "./ChatChooseCard.vue";
|
import ChatChooseCard from "./ChatChooseCard.vue";
|
||||||
import ChatUpdateCard from "./ChatUpdateCard.vue";
|
import ChatUpdateCard from "./ChatUpdateCard.vue";
|
||||||
import ChatEmptyState from "./ChatEmptyState.vue";
|
import ChatEmptyState from "./ChatEmptyState.vue";
|
||||||
|
import { Alert, AlertDescription } from "@/components/ui/alert";
|
||||||
import { Skeleton } from "@/components/ui/skeleton";
|
import { Skeleton } from "@/components/ui/skeleton";
|
||||||
import {
|
import {
|
||||||
|
currentSession,
|
||||||
isLoadingSession,
|
isLoadingSession,
|
||||||
messages,
|
messages,
|
||||||
|
selectSession,
|
||||||
sendMessage,
|
sendMessage,
|
||||||
|
sessionError,
|
||||||
streamingTurn,
|
streamingTurn,
|
||||||
type ChatMessage,
|
type ChatMessage,
|
||||||
reloadTranscript,
|
reloadTranscript,
|
||||||
@@ -90,6 +94,14 @@ useLiveResource("chat", () => void reloadTranscript());
|
|||||||
<Skeleton class="h-10 w-2/5 self-end rounded-xl" />
|
<Skeleton class="h-10 w-2/5 self-end rounded-xl" />
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
<div
|
||||||
|
v-else-if="sessionError && !bubbles.length"
|
||||||
|
class="flex flex-col items-center gap-3 p-4"
|
||||||
|
>
|
||||||
|
<Alert variant="destructive" class="max-w-md"><AlertDescription>{{ sessionError }}</AlertDescription></Alert>
|
||||||
|
<Button variant="outline" size="sm" @click="selectSession(currentSession)">Retry</Button>
|
||||||
|
</div>
|
||||||
|
|
||||||
<ChatEmptyState
|
<ChatEmptyState
|
||||||
v-else-if="!bubbles.length && !streamingTurn"
|
v-else-if="!bubbles.length && !streamingTurn"
|
||||||
@prompt="emit('prompt', $event)"
|
@prompt="emit('prompt', $event)"
|
||||||
|
|||||||
@@ -183,6 +183,9 @@ export const composerText = ref("");
|
|||||||
export const statusText = ref("Ready");
|
export const statusText = ref("Ready");
|
||||||
export const isSending = ref(false);
|
export const isSending = ref(false);
|
||||||
export const isLoadingSession = ref(false);
|
export const isLoadingSession = ref(false);
|
||||||
|
// A failed conversation load: shown in the transcript itself, with a Retry,
|
||||||
|
// rather than in the settings popover where statusText renders.
|
||||||
|
export const sessionError = ref("");
|
||||||
export const streamingTurn = ref<StreamingTurn | null>(null);
|
export const streamingTurn = ref<StreamingTurn | null>(null);
|
||||||
|
|
||||||
export const selectorData = ref<ChatSelectorData>({});
|
export const selectorData = ref<ChatSelectorData>({});
|
||||||
@@ -255,7 +258,7 @@ export async function selectSession(id: string): Promise<void> {
|
|||||||
streamingTurn.value = null;
|
streamingTurn.value = null;
|
||||||
queuedMessages.value = [];
|
queuedMessages.value = [];
|
||||||
isLoadingSession.value = true;
|
isLoadingSession.value = true;
|
||||||
|
sessionError.value = "";
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// Resuming is the server's own command, so the transcript read below is of
|
// Resuming is the server's own command, so the transcript read below is of
|
||||||
@@ -263,8 +266,9 @@ export async function selectSession(id: string): Promise<void> {
|
|||||||
await api.chatMessage(channelID(), `/resume ${id}`);
|
await api.chatMessage(channelID(), `/resume ${id}`);
|
||||||
messages.value = await readTranscript(id);
|
messages.value = await readTranscript(id);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
statusText.value =
|
if (isCurrentSession(id))
|
||||||
(err as Error).message || "Could not load session messages";
|
sessionError.value =
|
||||||
|
(err as Error).message || "Could not load session messages";
|
||||||
} finally {
|
} finally {
|
||||||
if (isCurrentSession(id)) isLoadingSession.value = false;
|
if (isCurrentSession(id)) isLoadingSession.value = false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,8 +46,10 @@ const workflows = ref<string[]>([]);
|
|||||||
const shortcut = navigator.platform.startsWith("Mac") ? "⌘K" : "Ctrl K";
|
const shortcut = navigator.platform.startsWith("Mac") ? "⌘K" : "Ctrl K";
|
||||||
const showWorkflows = computed(() => !props.hidden.includes("/workflows"));
|
const showWorkflows = computed(() => !props.hidden.includes("/workflows"));
|
||||||
|
|
||||||
// A failed read leaves that group empty: the pages still work, and the
|
// A failed read shows as an error item with Retry in that group, not as a
|
||||||
// palette is not the place to report a broken task list.
|
// missing group: the pages still work either way.
|
||||||
|
const tasksError = ref(false);
|
||||||
|
const workflowsError = ref(false);
|
||||||
async function loadEntries(): Promise<void> {
|
async function loadEntries(): Promise<void> {
|
||||||
const [taskPage, workflowList] = await Promise.all([
|
const [taskPage, workflowList] = await Promise.all([
|
||||||
api.taskPage<TaskEntry>({ limit: 100 }).catch(() => null),
|
api.taskPage<TaskEntry>({ limit: 100 }).catch(() => null),
|
||||||
@@ -55,7 +57,9 @@ async function loadEntries(): Promise<void> {
|
|||||||
? api.workflows<{ definitions?: { id: string }[] }>().catch(() => null)
|
? api.workflows<{ definitions?: { id: string }[] }>().catch(() => null)
|
||||||
: null,
|
: null,
|
||||||
]);
|
]);
|
||||||
|
tasksError.value = taskPage === null;
|
||||||
tasks.value = taskPage?.tasks ?? [];
|
tasks.value = taskPage?.tasks ?? [];
|
||||||
|
workflowsError.value = showWorkflows.value && workflowList === null;
|
||||||
workflows.value = (workflowList?.definitions ?? []).map(({ id }) => id);
|
workflows.value = (workflowList?.definitions ?? []).map(({ id }) => id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -129,7 +133,10 @@ onUnmounted(() => document.removeEventListener("keydown", onGlobalKeydown));
|
|||||||
{{ entry.label }}
|
{{ entry.label }}
|
||||||
</CommandItem>
|
</CommandItem>
|
||||||
</CommandGroup>
|
</CommandGroup>
|
||||||
<CommandGroup v-if="workflows.length" heading="Workflows">
|
<CommandGroup v-if="workflowsError" heading="Workflows">
|
||||||
|
<CommandItem value="workflows-error" @select="loadEntries">Couldn't load workflows — Retry</CommandItem>
|
||||||
|
</CommandGroup>
|
||||||
|
<CommandGroup v-else-if="workflows.length" heading="Workflows">
|
||||||
<CommandItem
|
<CommandItem
|
||||||
v-for="id in workflows"
|
v-for="id in workflows"
|
||||||
:key="id"
|
:key="id"
|
||||||
@@ -139,7 +146,10 @@ onUnmounted(() => document.removeEventListener("keydown", onGlobalKeydown));
|
|||||||
{{ id }}
|
{{ id }}
|
||||||
</CommandItem>
|
</CommandItem>
|
||||||
</CommandGroup>
|
</CommandGroup>
|
||||||
<CommandGroup v-if="tasks.length" heading="Tasks">
|
<CommandGroup v-if="tasksError" heading="Tasks">
|
||||||
|
<CommandItem value="tasks-error" @select="loadEntries">Couldn't load tasks — Retry</CommandItem>
|
||||||
|
</CommandGroup>
|
||||||
|
<CommandGroup v-else-if="tasks.length" heading="Tasks">
|
||||||
<CommandItem
|
<CommandItem
|
||||||
v-for="task in tasks"
|
v-for="task in tasks"
|
||||||
:key="task.id"
|
:key="task.id"
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { computed } from "vue";
|
import { computed } from "vue";
|
||||||
|
|
||||||
|
import { Button } from "@/components/ui/button";
|
||||||
import { Input } from "@/components/ui/input";
|
import { Input } from "@/components/ui/input";
|
||||||
import { Label } from "@/components/ui/label";
|
import { Label } from "@/components/ui/label";
|
||||||
import {
|
import {
|
||||||
@@ -16,8 +17,11 @@ import { eventTypeLabel } from "@/captures/event-types";
|
|||||||
import {
|
import {
|
||||||
captures,
|
captures,
|
||||||
capturesEnabled,
|
capturesEnabled,
|
||||||
|
capturesError,
|
||||||
draft,
|
draft,
|
||||||
eventTypes,
|
eventTypes,
|
||||||
|
eventTypesError,
|
||||||
|
loadMappings,
|
||||||
selectCapture,
|
selectCapture,
|
||||||
type Capture,
|
type Capture,
|
||||||
} from "./state";
|
} from "./state";
|
||||||
@@ -49,9 +53,11 @@ function captureLabel(capture: Capture): string {
|
|||||||
return `${capture.source || "(unknown)"} · ${ago(capture.received_at)}`;
|
return `${capture.source || "(unknown)"} · ${ago(capture.received_at)}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** What an empty picker means, which is not the same on every deployment. */
|
/** What an empty picker means, which is not the same on every deployment.
|
||||||
|
* A failed read is not an empty store, so it shows no hint here -- the error
|
||||||
|
* row below says so and offers Retry. */
|
||||||
const captureHint = computed(() => {
|
const captureHint = computed(() => {
|
||||||
if (captures.value.length) return null;
|
if (capturesError.value || captures.value.length) return null;
|
||||||
return capturesEnabled.value
|
return capturesEnabled.value
|
||||||
? "No captured events yet."
|
? "No captured events yet."
|
||||||
: "Capture is not configured on this deployment.";
|
: "Capture is not configured on this deployment.";
|
||||||
@@ -83,6 +89,10 @@ const captureHint = computed(() => {
|
|||||||
</SelectGroup>
|
</SelectGroup>
|
||||||
</SelectContent>
|
</SelectContent>
|
||||||
</Select>
|
</Select>
|
||||||
|
<p v-if="eventTypesError" class="flex items-center gap-2 text-xs text-danger">
|
||||||
|
Couldn't load event types
|
||||||
|
<Button variant="link" size="xs" class="px-0" @click="loadMappings">Retry</Button>
|
||||||
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="flex flex-col gap-2">
|
<div class="flex flex-col gap-2">
|
||||||
@@ -112,6 +122,10 @@ const captureHint = computed(() => {
|
|||||||
</SelectContent>
|
</SelectContent>
|
||||||
</Select>
|
</Select>
|
||||||
<p v-if="captureHint" class="text-xs text-fg-subtle">{{ captureHint }}</p>
|
<p v-if="captureHint" class="text-xs text-fg-subtle">{{ captureHint }}</p>
|
||||||
|
<p v-if="capturesError" class="flex items-center gap-2 text-xs text-danger">
|
||||||
|
Couldn't load captured events
|
||||||
|
<Button variant="link" size="xs" class="px-0" @click="loadMappings">Retry</Button>
|
||||||
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@@ -103,6 +103,10 @@ export const listLoading = ref(true);
|
|||||||
/** A failed list load. Distinct from an action failure: the list is unusable,
|
/** A failed list load. Distinct from an action failure: the list is unusable,
|
||||||
* where a refused action leaves it perfectly readable. */
|
* where a refused action leaves it perfectly readable. */
|
||||||
export const loadError = ref<string | null>(null);
|
export const loadError = ref<string | null>(null);
|
||||||
|
// The optional legs fail on their own: the flag says the picker's data is a
|
||||||
|
// failed read, not an empty store, so the form can offer Retry.
|
||||||
|
export const capturesError = ref(false);
|
||||||
|
export const eventTypesError = ref(false);
|
||||||
|
|
||||||
/** Whether the editor overlay is showing the draft. */
|
/** Whether the editor overlay is showing the draft. */
|
||||||
export const editorOpen = ref(false);
|
export const editorOpen = ref(false);
|
||||||
@@ -136,8 +140,8 @@ export async function loadMappings(): Promise<void> {
|
|||||||
listLoading.value = true;
|
listLoading.value = true;
|
||||||
try {
|
try {
|
||||||
// Capture storage is optional infrastructure -- a deployment can serve
|
// Capture storage is optional infrastructure -- a deployment can serve
|
||||||
// mappings without it -- so a failing capture leg degrades to an empty
|
// mappings without it -- so a failing capture leg flags the picker instead
|
||||||
// picker instead of taking the mappings list down with it.
|
// of taking the mappings list down with it.
|
||||||
const [listed, captured, types] = await Promise.all([
|
const [listed, captured, types] = await Promise.all([
|
||||||
api.mappings<{ mappings?: Mapping[] }>(useEventsStore().workspace),
|
api.mappings<{ mappings?: Mapping[] }>(useEventsStore().workspace),
|
||||||
api
|
api
|
||||||
@@ -149,6 +153,8 @@ export async function loadMappings(): Promise<void> {
|
|||||||
eventTypes.value = types?.event_types || [];
|
eventTypes.value = types?.event_types || [];
|
||||||
captures.value = captured?.captures || [];
|
captures.value = captured?.captures || [];
|
||||||
capturesEnabled.value = captured?.enabled !== false;
|
capturesEnabled.value = captured?.enabled !== false;
|
||||||
|
capturesError.value = captured === null;
|
||||||
|
eventTypesError.value = types === null;
|
||||||
loadError.value = null;
|
loadError.value = null;
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
loadError.value = String((err as Error).message || err);
|
loadError.value = String((err as Error).message || err);
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import { Badge } from "@/components/ui/badge";
|
|||||||
import { Button } from "@/components/ui/button";
|
import { Button } from "@/components/ui/button";
|
||||||
import { Section } from "@/components/ui/section";
|
import { Section } from "@/components/ui/section";
|
||||||
import { Input } from "@/components/ui/input";
|
import { Input } from "@/components/ui/input";
|
||||||
|
import { Empty, EmptyHeader, EmptyTitle } from "@/components/ui/empty";
|
||||||
import {
|
import {
|
||||||
Table,
|
Table,
|
||||||
TableBody,
|
TableBody,
|
||||||
@@ -37,6 +38,7 @@ import { useSources } from "./use-sources";
|
|||||||
*/
|
*/
|
||||||
const {
|
const {
|
||||||
sources,
|
sources,
|
||||||
|
loadError,
|
||||||
failure,
|
failure,
|
||||||
revealed,
|
revealed,
|
||||||
busy,
|
busy,
|
||||||
@@ -96,6 +98,11 @@ function url(source: Source): string {
|
|||||||
<AlertDescription>{{ failure }}</AlertDescription>
|
<AlertDescription>{{ failure }}</AlertDescription>
|
||||||
</Alert>
|
</Alert>
|
||||||
|
|
||||||
|
<Alert v-if="loadError" variant="destructive">
|
||||||
|
<AlertTitle>Couldn't load sources</AlertTitle>
|
||||||
|
<AlertDescription>{{ loadError }} <Button variant="link" size="xs" @click="load">Retry</Button></AlertDescription>
|
||||||
|
</Alert>
|
||||||
|
|
||||||
<SourceSecret v-if="revealed" :source="revealed" @dismiss="revealed = null" />
|
<SourceSecret v-if="revealed" :source="revealed" @dismiss="revealed = null" />
|
||||||
|
|
||||||
<Section v-if="sources && sources.length">
|
<Section v-if="sources && sources.length">
|
||||||
@@ -220,5 +227,9 @@ function url(source: Source): string {
|
|||||||
</TableBody>
|
</TableBody>
|
||||||
</Table>
|
</Table>
|
||||||
</Section>
|
</Section>
|
||||||
|
|
||||||
|
<Empty v-else-if="sources && !loadError">
|
||||||
|
<EmptyHeader><EmptyTitle>No sources yet</EmptyTitle></EmptyHeader>
|
||||||
|
</Empty>
|
||||||
</section>
|
</section>
|
||||||
</template>
|
</template>
|
||||||
@@ -12,6 +12,9 @@ import type { Source, SourceRefusals } from "./source-signing";
|
|||||||
export function useSources() {
|
export function useSources() {
|
||||||
// null means loading, [] means loaded and empty.
|
// null means loading, [] means loaded and empty.
|
||||||
const sources = ref<Source[] | null>(null);
|
const sources = ref<Source[] | null>(null);
|
||||||
|
// Read failures are kept apart from write failures: a failed load is not "a
|
||||||
|
// write that did not take effect", and belongs next to the list, with Retry.
|
||||||
|
const loadError = ref<string | null>(null);
|
||||||
const failure = ref<string | null>(null);
|
const failure = ref<string | null>(null);
|
||||||
const revealed = ref<Source | null>(null);
|
const revealed = ref<Source | null>(null);
|
||||||
const refusals = ref<Record<string, SourceRefusals>>({});
|
const refusals = ref<Record<string, SourceRefusals>>({});
|
||||||
@@ -30,8 +33,9 @@ export function useSources() {
|
|||||||
sources.value = res.sources || [];
|
sources.value = res.sources || [];
|
||||||
refusals.value = res.refusals || {};
|
refusals.value = res.refusals || {};
|
||||||
failure.value = null;
|
failure.value = null;
|
||||||
|
loadError.value = null;
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
failure.value = message(err);
|
loadError.value = message(err);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -51,6 +55,7 @@ export function useSources() {
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
sources,
|
sources,
|
||||||
|
loadError,
|
||||||
failure,
|
failure,
|
||||||
revealed,
|
revealed,
|
||||||
refusals,
|
refusals,
|
||||||
|
|||||||
Reference in new issue
Block a user