Skip to content

Commit

Permalink
[Security Solution] Remove nav back to rules link (#147357)
Browse files Browse the repository at this point in the history
**Addresses:** #140263

## Summary

It removes navigation back to the rules table page link as it was [discussed](#140263 (comment)). To return back to the rules table page users intend to use either breadcrumbs or web browser navigation back button.

Before:
![Screenshot 2022-12-22 at 09 14 24](https://user-images.githubusercontent.com/3775283/209088754-2dcc7edb-844f-4a55-a41d-224b322bcd7a.png)

After:
![Screenshot 2022-12-22 at 09 15 16](https://user-images.githubusercontent.com/3775283/209088773-35f2f92f-4344-411b-b772-da77541e6855.png)


### Checklist

- [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios
  • Loading branch information
maximpn authored Dec 28, 2022
1 parent 2c2dde1 commit 6098dca
Show file tree
Hide file tree
Showing 9 changed files with 15 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ import {
import { goBackToRuleDetails } from '../../tasks/edit_rule';
import { esArchiverLoad, esArchiverUnload } from '../../tasks/es_archiver';
import { login, visit, visitWithoutDateRange } from '../../tasks/login';
import { goBackToAllRulesTable, getDetails } from '../../tasks/rule_details';
import { goBackToRulesTable, getDetails } from '../../tasks/rule_details';

import { DETECTIONS_RULE_MANAGEMENT_URL, RULE_CREATION } from '../../urls/navigation';
const DEFAULT_THREAT_MATCH_QUERY = '@timestamp >= "now-30d/d"';
Expand Down Expand Up @@ -537,7 +537,7 @@ describe('indicator match', () => {
it('Allows the rule to be duplicated from the table', () => {
duplicateFirstRule();
goBackToRuleDetails();
goBackToAllRulesTable();
goBackToRulesTable();
checkDuplicatedRule();
});

Expand All @@ -551,7 +551,7 @@ describe('indicator match', () => {
goToRuleDetails();
duplicateRuleFromMenu();
goBackToRuleDetails();
goBackToAllRulesTable();
goBackToRulesTable();
checkDuplicatedRule();
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ import {
expectNumberOfRules,
expectToContainRule,
filterBySearchTerm,
goBackFromRuleDetails,
goToRuleDetails,
} from '../../tasks/alerts_detection_rules';
import { RULE_SEARCH_FIELD } from '../../screens/alerts_detection_rules';
import { createCustomRule } from '../../tasks/api_calls/rules';
import { goBackToRulesTable } from '../../tasks/rule_details';

function createRule(id: string, name: string, tags?: string[]): void {
const rule = getNewRule();
Expand Down Expand Up @@ -63,7 +63,7 @@ describe('Persistent rules table state', () => {
expectToContainRule('rule 1');

goToRuleDetails();
goBackFromRuleDetails();
goBackToRulesTable();

cy.get(RULE_SEARCH_FIELD).should('have.value', 'rule 1');
expectNumberOfRules(1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,5 +143,3 @@ export const REFRESH_SETTINGS_SWITCH = '[data-test-subj="refreshSettingsSwitch"]
export const REFRESH_SETTINGS_SELECTION_NOTE = '[data-test-subj="refreshSettingsSelectionNote"]';

export const REFRESH_RULES_STATUS = '[data-test-subj="refreshRulesStatus"]';

export const RULE_DETAILS_BACK_TO_ALL_RULES = '[data-test-subj="ruleDetailsBackToAllRules"]';
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ export const ANOMALY_THRESHOLD_INPUT = '[data-test-subj="anomalyThresholdSlider"

export const ADVANCED_SETTINGS_BTN = '[data-test-subj="advancedSettings"] .euiAccordion__button';

export const BACK_TO_ALL_RULES_LINK = '[data-test-subj="ruleDetailsBackToAllRules"]';

export const COMBO_BOX_CLEAR_BTN = '[data-test-subj="comboBoxClearButton"]';

export const CREATE_AND_ENABLE_BTN = '[data-test-subj="create-enable"]';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,6 @@ export const TIMELINE_FIELD = (field: string) => {
export const removeExternalLinkText = (str: string) =>
str.replace(/\(opens in a new tab or window\)/g, '');

export const BACK_TO_RULES = '[data-test-subj="ruleDetailsBackToAllRules"]';

export const DEFINE_RULE_PANEL_PROGRESS =
'[data-test-subj="defineRule"] [data-test-subj="stepPanelProgress"]';

Expand All @@ -131,3 +129,5 @@ export const THREAT_TACTIC = '[data-test-subj="threatTacticLink"]';
export const THREAT_TECHNIQUE = '[data-test-subj="threatTechniqueLink"]';

export const THREAT_SUBTECHNIQUE = '[data-test-subj="threatSubtechniqueLink"]';

export const BACK_TO_RULES_TABLE = '[data-test-subj="breadcrumb"][title="Rules"]';
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ import {
MODAL_CONFIRMATION_CANCEL_BTN,
MODAL_CONFIRMATION_BODY,
RULE_SEARCH_FIELD,
RULE_DETAILS_BACK_TO_ALL_RULES,
} from '../screens/alerts_detection_rules';
import { EUI_CHECKBOX } from '../screens/common/controls';
import { ALL_ACTIONS } from '../screens/rule_details';
Expand Down Expand Up @@ -184,10 +183,6 @@ export const goToRuleDetails = () => {
cy.get(RULE_NAME).first().click({ force: true });
};

export const goBackFromRuleDetails = () => {
cy.get(RULE_DETAILS_BACK_TO_ALL_RULES).click({ force: true });
};

export const goToTheRuleDetailsOf = (ruleName: string) => {
cy.contains(RULE_NAME, ruleName).click({ force: true });
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ import {
APPLY_SELECTED_SAVED_QUERY_BUTTON,
AT_LEAST_ONE_INDEX_PATTERN,
AT_LEAST_ONE_VALID_MATCH,
BACK_TO_ALL_RULES_LINK,
COMBO_BOX_CLEAR_BTN,
CREATE_AND_ENABLE_BTN,
CUSTOM_QUERY_INPUT,
Expand Down Expand Up @@ -120,19 +119,20 @@ import { TIMELINE } from '../screens/timelines';
import { refreshPage } from './security_header';
import { EUI_FILTER_SELECT_ITEM, COMBO_BOX_INPUT } from '../screens/common/controls';
import { ruleFields } from '../data/detection_engine';
import { BACK_TO_RULES_TABLE } from '../screens/rule_details';

export const createAndEnableRule = () => {
cy.get(CREATE_AND_ENABLE_BTN).click({ force: true });
cy.get(CREATE_AND_ENABLE_BTN).should('not.exist');
cy.get(BACK_TO_ALL_RULES_LINK).click({ force: true });
cy.get(BACK_TO_ALL_RULES_LINK).should('not.exist');
cy.get(BACK_TO_RULES_TABLE).click({ force: true });
cy.get(BACK_TO_RULES_TABLE).should('not.exist');
};

export const createRuleWithoutEnabling = () => {
cy.get(CREATE_WITHOUT_ENABLING_BTN).click({ force: true });
cy.get(CREATE_WITHOUT_ENABLING_BTN).should('not.exist');
cy.get(BACK_TO_ALL_RULES_LINK).click({ force: true });
cy.get(BACK_TO_ALL_RULES_LINK).should('not.exist');
cy.get(BACK_TO_RULES_TABLE).click({ force: true });
cy.get(BACK_TO_RULES_TABLE).should('not.exist');
};

export const fillAboutRule = (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import {
} from '../screens/exceptions';
import {
ALERTS_TAB,
BACK_TO_RULES,
EXCEPTIONS_TAB,
FIELDS_BROWSER_BTN,
REFRESH_BUTTON,
Expand All @@ -29,6 +28,7 @@ import {
EDIT_EXCEPTION_BTN,
ENDPOINT_EXCEPTIONS_TAB,
EDIT_RULE_SETTINGS_LINK,
BACK_TO_RULES_TABLE,
} from '../screens/rule_details';
import {
addExceptionConditions,
Expand Down Expand Up @@ -131,8 +131,8 @@ export const waitForTheRuleToBeExecuted = () => {
});
};

export const goBackToAllRulesTable = () => {
cy.get(BACK_TO_RULES).click();
export const goBackToRulesTable = () => {
cy.get(BACK_TO_RULES_TABLE).click();
};

export const getDetails = (title: string | RegExp) =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ import { FormattedDate } from '../../../../common/components/formatted_date';
import { tableDefaults } from '../../../../common/store/data_table/defaults';
import { dataTableActions, dataTableSelectors } from '../../../../common/store/data_table';
import {
getRulesUrl,
getDetectionEngineUrl,
getRuleDetailsTabUrl,
} from '../../../../common/components/link_to/redirect_to_detection_engine';
Expand Down Expand Up @@ -672,12 +671,6 @@ const RuleDetailsPageComponent: React.FC<DetectionEngineComponentProps> = ({
<SecuritySolutionPageWrapper noPadding={globalFullScreen}>
<Display show={!globalFullScreen}>
<HeaderPage
backOptions={{
path: getRulesUrl(),
text: i18n.BACK_TO_RULES,
pageId: SecurityPageName.rules,
dataTestSubj: 'ruleDetailsBackToAllRules',
}}
border
subtitle={subTitle}
subtitle2={
Expand Down

0 comments on commit 6098dca

Please sign in to comment.