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

45 lines
1.8 KiB
Vue

<script setup lang="ts">
import { computed } from "vue";
import { RouterLink } from "vue-router";
import { MetadataList } from "@/components/ui/metadata-list";
import { Section } from "@/components/ui/section";
import { Timestamp } from "@/components/ui/timestamp";
import type { SystemHealth } from "@/lib/api";
const props = defineProps<{ health: SystemHealth }>();
const rows = computed(() => {
const h = props.health;
const runs = h.waiting?.runs;
return [
{ label: "Version", value: h.version, mono: true },
{ label: "Workers", value: String(h.runner.workers) },
...(h.waiting
? [
{ label: "Approvals waiting", value: String(h.waiting.approvals) },
{ label: "Runs parked", value: String(runs?.parked ?? 0) },
{ label: "Runs waiting", value: String((runs?.waiting ?? 0) + (runs?.waiting_approval ?? 0)) },
{ label: "Runs queued", value: String(runs?.queued ?? 0) },
{ label: "Runs running", value: String(runs?.running ?? 0) },
]
: []),
];
});
</script>
<template>
<Section title="Instance">
<p v-if="health.runner.error" role="alert" class="mb-3 flex flex-wrap items-center gap-x-2 text-label text-danger">
Runner: {{ health.runner.error }}
<Timestamp v-if="health.runner.error_at" :at="health.runner.error_at" />
</p>
<p v-if="health.last_failure" class="mb-3 flex flex-wrap items-center gap-x-2 text-label text-danger">
<Timestamp :at="health.last_failure.at" />
<span class="font-mono">{{ health.last_failure.source }}</span><span class="min-w-0 break-words" :title="health.last_failure.cause">{{ health.last_failure.cause.split("\n")[0] }}</span>
<RouterLink v-if="health.last_failure.run_id" :to="`/runs/${health.last_failure.run_id}`" class="underline">Run</RouterLink>
</p>
<MetadataList :rows="rows" />
</Section>
</template>