mirror of
https://github.com/henrygd/beszel.git
synced 2026-09-23 08:24:19 +00:00
fix(ui): disable Add Monitor button when no eligible systems exist (#2392)
This commit is contained in:
@@ -353,6 +353,8 @@ export function AddMonitorDialog({ systemId, monitors }: { systemId?: string; mo
|
||||
const 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; mo
|
||||
return (
|
||||
<>
|
||||
<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>
|
||||
|
||||
Reference in New Issue
Block a user