Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.
Go aialertsdashboarddockerdocker-monitoringgohomelabinfrastructure-monitoringkubernetesmonitoringmspproxmoxproxmox-backup-serverproxmox-mail-gatewayproxmox-veself-hostedtruenastypescriptvspherewebhooks
import { Component, Show } from 'solid-js';
import { formatHistoryChartTooltipValue, getHistorySourceNotice } from './historyChartModel';
import type { HistoryChartState } from './useHistoryChartState';
interface HistoryChartHeaderProps {
chart: HistoryChartState;
compact?: boolean;
hideSelector?: boolean;
label?: string;
unit?: string;
}
export const HistoryChartHeader: Component<HistoryChartHeaderProps> = (props) => {
return (
<div
class={`flex flex-wrap items-center justify-between gap-2 ${props.compact ? 'mb-2' : 'mb-4'}`}
>
<div class="flex flex-wrap items-center gap-2">
<span class="text-sm font-medium text-base-content">{props.label || 'History'}</span>
<Show when={props.unit}>
<span class="text-xs text-slate-400">({props.unit})</span>
</Show>
<Show when={getHistorySourceNotice(props.chart.source())}>
{(notice) => (
<span
class={`text-[10px] font-semibold px-2 py-0.5 rounded-full uppercase tracking-wide ${
props.chart.source() === 'live'
? 'bg-red-100 text-red-700 dark:bg-red-900/25 dark:text-red-300'
: 'bg-amber-100 text-amber-700 dark:bg-amber-900/25 dark:text-amber-300'
}`}
title={notice().detail}
>
{notice().badge}
</span>
)}
</Show>
</div>
<div class="flex min-w-0 max-w-full flex-wrap items-center gap-3">
<Show when={props.chart.dataMin() !== null && props.chart.dataMax() !== null}>
<div class="flex items-center gap-2 text-[10px]">
<span>
<span class="text-muted">Min </span>
<span class="text-blue-400">
{formatHistoryChartTooltipValue(props.chart.dataMin()!, props.unit)}
</span>
</span>
<span>
<span class="text-muted">Max </span>
<span class="text-red-400">
{formatHistoryChartTooltipValue(props.chart.dataMax()!, props.unit)}
</span>
</span>
</div>
</Show>
<Show when={!props.hideSelector}>
<div
role="group"
aria-label={props.label ? `${props.label} history window` : 'History window'}
class="flex max-w-full flex-wrap bg-surface-hover rounded-md p-0.5"
>
{props.chart.ranges.map((range) => (
<button
type="button"
aria-pressed={props.chart.range() === range}
onClick={() => props.chart.updateRange(range)}
class={`px-3 py-1 text-xs font-medium rounded-md transition-colors ${
props.chart.range() === range
? 'bg-surface text-base-content shadow-xs'
: 'text-muted hover:text-base-content'
}`}
>
{range}
</button>
))}
</div>
</Show>
</div>
</div>
);
};