New settings/KindGate renders the store's per-kind loading/error state where the form would be: a skeleton while loading, ReadError with Retry on a failed read. Wired into Tools, SystemModels, SystemRepos, SchedulingPolicy, ContainerRuntime, OrgAlerts, Instructions, Plugins, SystemTasks, UpdateSettings, IdentityGrants, OrgModels, Channels and Authentication pages, which no longer render blank until the draft exists.
27 lines
983 B
Vue
27 lines
983 B
Vue
<script setup lang="ts">
|
|
import { computed } from "vue";
|
|
|
|
import { ReadError } from "@/components/ui/read-error";
|
|
import { Skeleton } from "@/components/ui/skeleton";
|
|
import { useSettingsStore } from "@/stores/settings";
|
|
|
|
/**
|
|
* What a settings page shows until its kind's draft has loaded: the read
|
|
* error with Retry, else a skeleton. The store already tracks loading and
|
|
* error per kind; this renders them where the form would be.
|
|
*/
|
|
const props = defineProps<{ kind: string }>();
|
|
const store = useSettingsStore();
|
|
const state = computed(() => store.stateFor(props.kind));
|
|
const error = computed(() => store.pageErrorFor(props.kind));
|
|
</script>
|
|
|
|
<template>
|
|
<ReadError v-if="!state.resource && error" :message="error" retry-label="Retry" @retry="store.load()" />
|
|
<div v-else role="status" aria-label="Loading settings" class="space-y-2 py-2">
|
|
<Skeleton class="h-8 w-full" />
|
|
<Skeleton class="h-8 w-full" />
|
|
<Skeleton class="h-24 w-full" />
|
|
</div>
|
|
</template>
|