Add a status strip to the server page: status, maintenance, alerts, updates, disk, load and uptime at a glance
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
f9991a49af
commit
87e07b2209
5 files changed
+369
No files matched your search
@@ -9,6 +9,8 @@ import {
|
||||
type ProxmoxGuest,
|
||||
type ScheduleType,
|
||||
type ServerDetail as ServerDetailResponse,
|
||||
type AlertItem,
|
||||
type MaintenanceWindow,
|
||||
type ServerLink,
|
||||
type TaskRecord,
|
||||
} from "../api/client";
|
||||
@@ -44,6 +46,7 @@ import ViewTabs from "../components/ViewTabs";
|
||||
import ConnectedThrough from "../components/ConnectedThrough";
|
||||
import HetznerServerCard from "../components/HetznerServerCard";
|
||||
import ServerBlock, { ArrangeBar } from "../components/ServerBlock";
|
||||
import ServerStatusStrip from "../components/ServerStatusStrip";
|
||||
|
||||
const SCHEDULE_TYPE_OPTIONS: { value: ScheduleType; label: string }[] = Object.entries(SCHEDULE_TYPE_LABELS).map(
|
||||
([value, label]) => ({ value: value as ScheduleType, label }),
|
||||
@@ -173,6 +176,25 @@ export default function ServerDetail({ user }: { user: CurrentUser }) {
|
||||
});
|
||||
}, [serverId]);
|
||||
|
||||
// What the strip under the name says that is not in the server's own record: the alerts about it and the maintenance windows. Read again whenever the page is (the Refresh button).
|
||||
const [stripAlerts, setStripAlerts] = useState<AlertItem[] | null>(null);
|
||||
const [stripWindows, setStripWindows] = useState<MaintenanceWindow[] | null>(null);
|
||||
useEffect(() => {
|
||||
if (!detail) return;
|
||||
let live = true;
|
||||
api.alerts
|
||||
.list()
|
||||
.then((r) => live && setStripAlerts(r.alerts))
|
||||
.catch(() => live && setStripAlerts(null));
|
||||
api.maintenance
|
||||
.list()
|
||||
.then((r) => live && setStripWindows(r.windows))
|
||||
.catch(() => live && setStripWindows(null));
|
||||
return () => {
|
||||
live = false;
|
||||
};
|
||||
}, [detail]);
|
||||
|
||||
const loadTasks = useCallback(() => {
|
||||
api.tasks
|
||||
.list({ serverId, includeStale: true })
|
||||
@@ -434,6 +456,8 @@ export default function ServerDetail({ user }: { user: CurrentUser }) {
|
||||
</div>
|
||||
<ErrorNotice error={error} />
|
||||
|
||||
<ServerStatusStrip server={server} hardware={detail.hardware} defaults={detail.thresholdDefaults} alerts={stripAlerts} windows={stripWindows} />
|
||||
|
||||
<ServerTags
|
||||
serverId={serverId}
|
||||
tags={server.tags}
|
||||
|
||||
Reference in new issue
Block a user