fix: maintenance index name, shared host read only view and badge polling

This commit is contained in:
LukeGus committed 2026-10-01 13:14:07 -05:00
1 parent 5ff5ae19d9
commit 3b58415f8f
16 files changed
+166 -37

No files matched your search

@@ -41,7 +41,7 @@ function VisibleBadge({
return (
<Badge
variant="outline"
title={`${active.reasons.join("; ")}\n${active.estimatedEnd}`}
title={`${active.reasons.join("; ")}\n${new Date(active.estimatedEnd).toLocaleString()}`}
>
{title}
</Badge>
@@ -72,9 +72,11 @@ function MaintenanceEditor({
store: MaintenanceStore;
}) {
const { t } = useTranslation();
const canEdit = usePermission("edit");
const canEditPermission = usePermission("edit");
const states = useSyncExternalStore(store.subscribe, store.snapshot);
const state = states[Number(host.id)];
// A shared host shows its owner's maintenance, read only.
const canEdit = canEditPermission && state?.owned !== false;
const [mode, setMode] = useState<"start" | "schedule">("start");
const [reason, setReason] = useState("");
const [start, setStart] = useState("");
@@ -174,6 +176,11 @@ function MaintenanceEditor({
))}
</section>
)}
{state?.owned === false && (
<p className="text-sm text-muted-foreground">
{t("maintenance.sharedReadOnly")}
</p>
)}
{canEdit && (
<form onSubmit={submit} className="space-y-4 border p-4">
<div className="flex flex-wrap gap-3">