Lightweight server monitoring with historical data, docker stats, and alerts.
fix(ui): disable Add Monitor button when no eligible systems exist (#2392)
Sven van Ginkel627d364071b6
diff --git a/internal/site/src/components/network-monitors-table/monitor-dialog.tsx b/internal/site/src/components/network-monitors-table/monitor-dialog.tsxindex 733935dc7..a227ef209 100644--- a/internal/site/src/components/network-monitors-table/monitor-dialog.tsx+++ b/internal/site/src/components/network-monitors-table/monitor-dialog.tsx@@ -353,6 +353,8 @@ export function AddMonitorDialog({ systemId, monitors }: { systemId?: string; moconst bulkFormRef = useRef<HTMLFormElement>(null)const { toast } = useToast()const { t } = useLingui()+ const systems = useStore($systems)+ const hasEligibleSystems = systemId ? true : systems.some(supportsNetworkMonitors)const resetBulkForm = () => {setBulkInput("")@@ -443,14 +445,19 @@ export function AddMonitorDialog({ systemId, monitors }: { systemId?: string; moreturn (<><div className="flex gap-0 rounded-lg">- <Button variant="outline" onClick={openAdd} className="rounded-e-none grow">+ <Button variant="outline" onClick={openAdd} className="rounded-e-none grow" disabled={!hasEligibleSystems}>{/* <PlusIcon className="size-4 me-1" /> */}<Trans>Add {{ foo: t`Monitor` }}</Trans></Button><div className="w-px h-full bg-muted"></div><DropdownMenu><DropdownMenuTrigger asChild>- <Button variant="outline" className="px-2 rounded-s-none border-s-0" aria-label={`More actions`}>+ <Button+ variant="outline"+ className="px-2 rounded-s-none border-s-0"+ aria-label={`More actions`}+ disabled={!hasEligibleSystems}+ ><ChevronDownIcon className="size-4" /></Button></DropdownMenuTrigger>