63 lines
2.5 KiB
Vue
63 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 { 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>
|
|
|
|
<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>
|