46 lines
1.7 KiB
Vue
46 lines
1.7 KiB
Vue
<script setup lang="ts">
|
|
import { storeToRefs } from "pinia";
|
|
import { errors } from "@/copy/errors";
|
|
import { computed, onMounted, onUnmounted } from "vue";
|
|
|
|
import PageHeader from "@/base/PageHeader.vue";
|
|
import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert";
|
|
import { ReadError } from "@/components/ui/read-error";
|
|
import { MetadataList } from "@/components/ui/metadata-list";
|
|
import { Section } from "@/components/ui/section";
|
|
import ServicesCard from "./ServicesCard.vue";
|
|
import UpdateSettingsCard from "./UpdateSettingsCard.vue";
|
|
import VersionsCard from "./VersionsCard.vue";
|
|
import { useSettingsStore } from "@/stores/settings";
|
|
|
|
const store = useSettingsStore();
|
|
const { config, catalogError } = storeToRefs(store);
|
|
const bootstrapRows = computed(() =>
|
|
Object.entries(config.value?.bootstrap ?? {}).map(([label, value]) => ({ label, value, mono: true })),
|
|
);
|
|
|
|
let timer: ReturnType<typeof setInterval>;
|
|
onMounted(() => {
|
|
void store.loadConfig();
|
|
timer = setInterval(() => void store.loadConfig(), 15_000);
|
|
});
|
|
onUnmounted(() => clearInterval(timer));
|
|
</script>
|
|
|
|
<template>
|
|
<PageHeader title="Status" />
|
|
<div>
|
|
<ReadError v-if="catalogError" :message="catalogError" retry-label="Retry" class="mb-4" @retry="store.load()" />
|
|
<Alert v-if="config?.reload?.last_error" variant="destructive" class="mb-4">
|
|
<AlertTitle>{{ errors.settings.status.reload }}</AlertTitle>
|
|
<AlertDescription>{{ config.reload.last_error }}</AlertDescription>
|
|
</Alert>
|
|
<ServicesCard />
|
|
<VersionsCard />
|
|
<UpdateSettingsCard />
|
|
<Section v-if="config?.bootstrap && Object.keys(config.bootstrap).length" title="Startup settings">
|
|
<MetadataList :rows="bootstrapRows" />
|
|
</Section>
|
|
</div>
|
|
</template>
|