74 lines
2.1 KiB
Vue
74 lines
2.1 KiB
Vue
<script lang="ts">
|
|
import type { StatusKind } from "@/lib/status";
|
|
import type { CuratorActionEntry } from "./CuratorAction.vue";
|
|
|
|
/** A registered curator, its point-in-time health, and its recent activity. */
|
|
export interface Curator {
|
|
name: string;
|
|
health?: { status?: string; message?: string };
|
|
last_run_at?: string | number;
|
|
last_run_actions?: number;
|
|
recent_actions?: CuratorActionEntry[];
|
|
}
|
|
</script>
|
|
|
|
<script setup lang="ts">
|
|
import { Badge } from "@/components/ui/badge";
|
|
import { Section } from "@/components/ui/section";
|
|
import { Timestamp } from "@/components/ui/timestamp";
|
|
import { Empty, EmptyHeader, EmptyTitle } from "@/components/ui/empty";
|
|
import CuratorAction from "./CuratorAction.vue";
|
|
|
|
const props = defineProps<{ curator: Curator }>();
|
|
|
|
function healthKind(status: string | undefined): StatusKind {
|
|
switch (status) {
|
|
case "healthy":
|
|
return "ok";
|
|
case "degraded":
|
|
return "warn";
|
|
case "unhealthy":
|
|
return "danger";
|
|
default:
|
|
return "idle";
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<template>
|
|
<Section :title="props.curator.name" class="mb-0">
|
|
<template #action>
|
|
<Badge :variant="healthKind(props.curator.health?.status)">
|
|
{{ props.curator.health?.status || "unknown" }}
|
|
</Badge>
|
|
</template>
|
|
<p class="mb-3 text-xs text-fg-subtle">
|
|
<template v-if="props.curator.last_run_at">
|
|
Last ran <Timestamp :at="props.curator.last_run_at" /> · {{ props.curator.last_run_actions }} action{{ props.curator.last_run_actions === 1 ? "" : "s" }}
|
|
</template>
|
|
<template v-else>Has not run yet</template>
|
|
</p>
|
|
<p
|
|
v-if="props.curator.health?.message"
|
|
class="mb-3 text-sm text-fg-muted"
|
|
>
|
|
{{ props.curator.health.message }}
|
|
</p>
|
|
<ul
|
|
v-if="props.curator.recent_actions?.length"
|
|
class="flex flex-col gap-2"
|
|
>
|
|
<CuratorAction
|
|
v-for="(a, i) in props.curator.recent_actions"
|
|
:key="i"
|
|
:action="a"
|
|
/>
|
|
</ul>
|
|
<Empty v-else>
|
|
<EmptyHeader>
|
|
<EmptyTitle>No activity</EmptyTitle>
|
|
</EmptyHeader>
|
|
</Empty>
|
|
</Section>
|
|
</template>
|