fix(ui): distinguish loading, failed and empty lists, one role label set, en dash for no value
This commit is contained in:
16 files changed
+95
-46
No files matched your search
@@ -46,6 +46,7 @@ import {
|
||||
eventTypes,
|
||||
eventTypesEnabled,
|
||||
eventTypesError,
|
||||
eventTypesLoading,
|
||||
nameProposal,
|
||||
pasteExample,
|
||||
pendingDelete,
|
||||
@@ -159,7 +160,9 @@ function fieldCount(schema: Record<string, string> | null | undefined): number {
|
||||
</TableBody>
|
||||
</Table>
|
||||
|
||||
<Empty v-if="!proposals.length && !eventTypes.length">
|
||||
<p v-if="eventTypesLoading" class="text-sm text-fg-muted" role="status">Loading event types…</p>
|
||||
|
||||
<Empty v-else-if="!eventTypesError && !proposals.length && !eventTypes.length">
|
||||
<EmptyHeader>
|
||||
<EmptyTitle>No event types yet</EmptyTitle>
|
||||
</EmptyHeader>
|
||||
|
||||
@@ -27,6 +27,9 @@ export const eventTypes = ref<EventType[]>([]);
|
||||
export const proposals = ref<Proposal[]>([]);
|
||||
export const eventTypesEnabled = ref(true);
|
||||
export const eventTypesError = ref<string | null>(null);
|
||||
/** True until the first read settled, so the list can wait instead of
|
||||
* presenting a pending read as an empty one. */
|
||||
export const eventTypesLoading = ref(true);
|
||||
|
||||
/** The editor's modes: naming a proposal, pasting an example, editing a type. */
|
||||
export type DraftMode = "proposal" | "paste" | "edit";
|
||||
@@ -55,6 +58,8 @@ export async function loadEventTypes(): Promise<void> {
|
||||
eventTypesError.value = null;
|
||||
} catch (err) {
|
||||
eventTypesError.value = (err as Error).message || String(err);
|
||||
} finally {
|
||||
eventTypesLoading.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user