Files
archie/ui/src/settings/SystemStatusPage.vue
T

47 lines
1.6 KiB
Vue

<script setup lang="ts">
import { storeToRefs } from "pinia";
import { onMounted, onUnmounted } from "vue";
import PageHeader from "@/base/PageHeader.vue";
import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert";
import { Section } from "@/components/ui/section";
import { Table, TableBody, TableCell, TableRow } from "@/components/ui/table";
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 } = storeToRefs(store);
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>
<Alert v-if="config?.reload?.last_error" variant="destructive" class="mb-4">
<AlertTitle>Configuration reload failed</AlertTitle>
<AlertDescription>{{ config.reload.last_error }}</AlertDescription>
</Alert>
<ServicesCard />
<VersionsCard />
<UpdateSettingsCard />
<Section v-if="config?.bootstrap && Object.keys(config.bootstrap).length" title="Startup settings">
<Table>
<TableBody>
<TableRow v-for="(reason, key) in config.bootstrap" :key="key">
<TableCell class="font-mono">{{ key }}</TableCell>
<TableCell class="w-full whitespace-normal text-fg-muted">{{ reason }}</TableCell>
</TableRow>
</TableBody>
</Table>
</Section>
</div>
</template>