diff --git a/frontend-modern/src/components/Alerts/ResourceTable.tsx b/frontend-modern/src/components/Alerts/ResourceTable.tsx index 22eccad17..e2c28373b 100644 --- a/frontend-modern/src/components/Alerts/ResourceTable.tsx +++ b/frontend-modern/src/components/Alerts/ResourceTable.tsx @@ -655,23 +655,29 @@ export function ResourceTable(props: ResourceTableProps) { {/* Alert toggle column */} -
- !props.globalDisableFlag?.() && props.onToggleDisabled?.(resource.id)} - class="my-[1px]" - title={ - props.globalDisableFlag?.() - ? 'Alerts disabled globally' - : resource.disabled - ? 'Click to enable alerts' - : 'Click to disable alerts' - } - ariaLabel={resource.disabled ? 'Alerts disabled for this resource' : 'Alerts enabled for this resource'} - /> -
+ {(() => { + const globallyDisabled = props.globalDisableFlag?.() ?? false; + const isChecked = !globallyDisabled && !resource.disabled; + return ( +
+ !globallyDisabled && props.onToggleDisabled?.(resource.id)} + class="my-[1px]" + title={ + globallyDisabled + ? 'Alerts disabled globally' + : resource.disabled + ? 'Click to enable alerts' + : 'Click to disable alerts' + } + ariaLabel={isChecked ? 'Alerts enabled for this resource' : 'Alerts disabled for this resource'} + /> +
+ ); + })()}
@@ -1065,24 +1071,30 @@ export function ResourceTable(props: ResourceTableProps) { {/* Alert toggle column */} -
- !props.globalDisableFlag?.() && props.onToggleDisabled?.(resource.id)} - class="my-[1px]" - title={ - props.globalDisableFlag?.() - ? 'Alerts disabled globally' - : resource.disabled - ? 'Click to enable alerts' - : 'Click to disable alerts' - } - ariaLabel={resource.disabled ? 'Alerts disabled for this resource' : 'Alerts enabled for this resource'} - /> -
-
+ {(() => { + const globallyDisabled = props.globalDisableFlag?.() ?? false; + const isChecked = !globallyDisabled && !resource.disabled; + return ( +
+ !globallyDisabled && props.onToggleDisabled?.(resource.id)} + class="my-[1px]" + title={ + globallyDisabled + ? 'Alerts disabled globally' + : resource.disabled + ? 'Click to enable alerts' + : 'Click to disable alerts' + } + ariaLabel={isChecked ? 'Alerts enabled for this resource' : 'Alerts disabled for this resource'} + /> +
+ ); + })()} +