diff --git a/cypress/integration/1_detectors.spec.js b/cypress/integration/1_detectors.spec.js index 1cdab23b5..65d1027f2 100644 --- a/cypress/integration/1_detectors.spec.js +++ b/cypress/integration/1_detectors.spec.js @@ -222,7 +222,7 @@ describe('Detectors', () => { cy.contains('tr', 'USB Device Plugged').within(() => { // Of note, timeout can sometimes work instead of wait here, but is very unreliable from case to case. cy.wait(1000); - cy.get('button').eq(0).click(); + cy.get('button').eq(1).click(); }); // Save changes @@ -246,7 +246,7 @@ describe('Detectors', () => { // Toggle single search result to checked cy.contains('tr', 'USB Device Plugged').within(() => { cy.wait(2000); - cy.get('button').eq(0).click({ force: true }); + cy.get('button').eq(1).click({ force: true }); }); // Save changes diff --git a/public/pages/Detectors/components/UpdateRules/UpdateRules.tsx b/public/pages/Detectors/components/UpdateRules/UpdateRules.tsx index 3d3b10995..26a132202 100644 --- a/public/pages/Detectors/components/UpdateRules/UpdateRules.tsx +++ b/public/pages/Detectors/components/UpdateRules/UpdateRules.tsx @@ -166,6 +166,11 @@ export const UpdateDetectorRules: React.FC = (props) = } }; + const onAllRulesToggle = (isActive: boolean) => { + setCustomRuleItems(customRuleItems.map((rule) => ({ ...rule, active: isActive }))); + setPrePackagedRuleItems(prePackagedRuleItems.map((rule) => ({ ...rule, active: isActive }))); + }; + const onCancel = useCallback(() => { props.history.replace({ pathname: `${ROUTES.DETECTOR_DETAILS}/${detectorId}`, @@ -216,6 +221,7 @@ export const UpdateDetectorRules: React.FC = (props) = loading={loading} ruleItems={ruleItems} onRuleActivationToggle={onToggle} + onAllRulesToggled={onAllRulesToggle} />