import { useTranslation } from "react-i18next"; import { Activity, LayoutDashboard, Plus, Server, Trash2, Zap, } from "lucide-react"; import { Button } from "@/components/button"; import { Input } from "@/components/input"; import { SectionCard, SettingRow, FakeSwitch } from "@/components/section-card"; import type { HostEditorForm } from "./HostEditorData"; type SetHostField = ( key: K, value: HostEditorForm[K], ) => void; export function HostStatsTab({ form, setField, snippets, }: { form: HostEditorForm; setField: SetHostField; snippets: { id: number; name: string }[]; }) { const { t } = useTranslation(); return ( <> } >
setField("statsConfig", { ...form.statsConfig, statusCheckEnabled: v, }) } /> {form.statsConfig.statusCheckEnabled && ( setField("statsConfig", { ...form.statsConfig, useGlobalStatusInterval: v, }) } /> )} {form.statsConfig.statusCheckEnabled && !form.statsConfig.useGlobalStatusInterval && ( setField("statsConfig", { ...form.statsConfig, statusCheckInterval: Number(e.target.value), }) } className="w-20 h-7 text-xs text-right [appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none" /> )}
} >
setField("statsConfig", { ...form.statsConfig, metricsEnabled: v, }) } /> {form.statsConfig.metricsEnabled && ( setField("statsConfig", { ...form.statsConfig, useGlobalMetricsInterval: v, }) } /> )} {form.statsConfig.metricsEnabled && !form.statsConfig.useGlobalMetricsInterval && ( setField("statsConfig", { ...form.statsConfig, metricsInterval: Number(e.target.value), }) } className="w-20 h-7 text-xs text-right [appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none" /> )}
} >

{t("hosts.widgetsMovedToHostMetrics")}

} action={ } >

{t("hosts.quickActionsToolbar")}

{form.quickActions.length === 0 && (
{t("hosts.noQuickActions")}
)} {form.quickActions.map((a, i) => (
{ const updated = [...form.quickActions]; updated[i] = { ...updated[i], name: e.target.value }; setField("quickActions", updated); }} />
))}
); }