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.
65 lines
2.5 KiB
Vue
65 lines
2.5 KiB
Vue
<script setup lang="ts">
|
|
import { Alert, AlertDescription } from "@/components/ui/alert";
|
|
import { computed, onMounted } from "vue";
|
|
import { storeToRefs } from "pinia";
|
|
|
|
import PageHeader from "@/base/PageHeader.vue";
|
|
import { Field, FieldContent, FieldDescription, FieldGroup, FieldLabel } from "@/components/ui/field";
|
|
import { Input } from "@/components/ui/input";
|
|
import { resourcesForPage, useSettingsStore } from "@/stores/settings";
|
|
import ApplyStatusRows from "./ApplyStatusRows.vue";
|
|
import DraftHint from "./DraftHint.vue";
|
|
import HistoryLink from "./HistoryLink.vue";
|
|
import KindGate from "./KindGate.vue";
|
|
import { fieldInvalid } from "./settings-form";
|
|
|
|
const KIND = "plugin-settings";
|
|
|
|
const store = useSettingsStore();
|
|
const { catalog, catalogError } = storeToRefs(store);
|
|
onMounted(store.load);
|
|
|
|
const resources = computed(() => resourcesForPage(catalog.value, "plugins"));
|
|
const form = computed(() => store.formFor(KIND));
|
|
const error = computed(() => store.pageErrorFor(KIND));
|
|
</script>
|
|
|
|
<template>
|
|
<div>
|
|
<PageHeader title="Plugins">
|
|
<HistoryLink :kinds="resources.map((r) => r.kind)" />
|
|
</PageHeader>
|
|
|
|
<Alert v-if="catalogError || error" variant="destructive" class="mb-4"><AlertDescription>{{ catalogError || error }}</AlertDescription></Alert>
|
|
|
|
<KindGate v-if="!form" :kind="KIND" />
|
|
<template v-if="form">
|
|
<FieldGroup class="@container/field-group">
|
|
<form.Field v-slot="{ field }" name="skills_dir">
|
|
<Field orientation="responsive" :data-invalid="fieldInvalid(field)">
|
|
<FieldContent>
|
|
<FieldLabel for="pl-skills">Skills directory</FieldLabel>
|
|
<FieldDescription>Empty: work directory. Applies on restart.</FieldDescription>
|
|
</FieldContent>
|
|
<div class="flex min-w-0 flex-wrap items-center gap-3 @md/field-group:flex-1">
|
|
<Input
|
|
id="pl-skills"
|
|
:model-value="field.state.value"
|
|
class="max-w-md font-mono"
|
|
:aria-invalid="fieldInvalid(field)"
|
|
@blur="field.handleBlur"
|
|
@update:model-value="field.handleChange"
|
|
/>
|
|
<DraftHint :kind="KIND" path="skills_dir" />
|
|
</div>
|
|
</Field>
|
|
</form.Field>
|
|
</FieldGroup>
|
|
<!-- A restart-required kind can only be applied by a restart, so its
|
|
per-process versions live below: a process on an older one is the
|
|
restart owed. -->
|
|
<ApplyStatusRows :kind="KIND" class="border-t border-border py-4" />
|
|
</template>
|
|
</div>
|
|
</template>
|