From 99c057c1ca3c9750b31e886b46743d3520dbfbff Mon Sep 17 00:00:00 2001 From: Riya Saxena Date: Fri, 30 Aug 2024 19:14:25 -0700 Subject: [PATCH] routes changed Signed-off-by: Riya Saxena --- .../Alerts/__snapshots__/Alerts.test.tsx.snap | 2 -- .../Correlations/containers/CorrelationRules.tsx | 9 +++++++-- .../__snapshots__/DetectorRulesView.test.tsx.snap | 3 --- .../__snapshots__/DetectorDetails.test.tsx.snap | 3 --- .../__snapshots__/DetectorDetailsView.test.tsx.snap | 3 --- .../Detectors/__snapshots__/Detectors.test.tsx.snap | 12 +++++------- public/pages/LogTypes/containers/CreateLogType.tsx | 9 +++++++-- public/pages/LogTypes/containers/LogTypes.tsx | 9 +++++++-- public/pages/Rules/containers/EditRule/EditRule.tsx | 13 +++++++++++-- public/utils/constants.ts | 4 ++++ 10 files changed, 41 insertions(+), 26 deletions(-) diff --git a/public/pages/Alerts/containers/Alerts/__snapshots__/Alerts.test.tsx.snap b/public/pages/Alerts/containers/Alerts/__snapshots__/Alerts.test.tsx.snap index fb0040d6..45e3122a 100644 --- a/public/pages/Alerts/containers/Alerts/__snapshots__/Alerts.test.tsx.snap +++ b/public/pages/Alerts/containers/Alerts/__snapshots__/Alerts.test.tsx.snap @@ -2058,7 +2058,6 @@ exports[` spec renders the component 1`] = ` spec renders the component 1`] = ` = (props: Correla }, [DataStore.correlations.getCorrelationRules]); useEffect(() => { - setBreadcrumbs([BREADCRUMBS.CORRELATIONS, BREADCRUMBS.CORRELATION_RULES]); - }, []); + if (getUseUpdatedUx()) { + setBreadcrumbs([BREADCRUMBS.CORRELATION_RULES]); + } else { + setBreadcrumbs([BREADCRUMBS.CORRELATIONS, BREADCRUMBS.CORRELATION_RULES]); + } + }, [getUseUpdatedUx()]); useEffect(() => { getCorrelationRules(); diff --git a/public/pages/Detectors/components/DetectorRulesView/__snapshots__/DetectorRulesView.test.tsx.snap b/public/pages/Detectors/components/DetectorRulesView/__snapshots__/DetectorRulesView.test.tsx.snap index 64ea93c8..8f8d782e 100644 --- a/public/pages/Detectors/components/DetectorRulesView/__snapshots__/DetectorRulesView.test.tsx.snap +++ b/public/pages/Detectors/components/DetectorRulesView/__snapshots__/DetectorRulesView.test.tsx.snap @@ -819,7 +819,6 @@ exports[` spec renders the component 1`] = ` spec renders the component 1`] = ` spec renders the component 1`] = ` spec renders the component 1`] = ` spec renders the component 1`] = ` spec renders the component 1`] = ` spec renders the component 1`] = ` spec renders the component 1`] = ` spec renders the component 1`] = ` spec renders the component 1`] = ` "renderComponent": Create detector , @@ -338,12 +338,12 @@ exports[` spec renders the component 1`] = ` spec renders the component 1`] = ` data-test-subj="detectorsCreateButton" element="a" fill={true} - href="opensearch_security_analytics_dashboards#/create-detector" + href="#/create-detector" isDisabled={false} rel="noreferrer" size="s" @@ -360,7 +360,7 @@ exports[` spec renders the component 1`] = ` className="euiButton euiButton--primary euiButton--small euiButton--fill" data-test-subj="detectorsCreateButton" disabled={false} - href="opensearch_security_analytics_dashboards#/create-detector" + href="#/create-detector" rel="noreferrer" style={ Object { @@ -928,7 +928,6 @@ exports[` spec renders the component 1`] = ` spec renders the component 1`] = ` = ({ history, notificat const [logTypeDetails, setLogTypeDetails] = useState({ ...defaultLogType }); useEffect(() => { - setBreadcrumbs([BREADCRUMBS.DETECTORS, BREADCRUMBS.LOG_TYPES, BREADCRUMBS.LOG_TYPE_CREATE]); - }, []); + if (getUseUpdatedUx()) { + setBreadcrumbs([BREADCRUMBS.LOG_TYPES, BREADCRUMBS.LOG_TYPE_CREATE]); + } else { + setBreadcrumbs([BREADCRUMBS.DETECTORS, BREADCRUMBS.LOG_TYPES, BREADCRUMBS.LOG_TYPE_CREATE]); + } + }, [getUseUpdatedUx()]); const description = 'Create log type to categorize and identify detection rules for your data sources.'; diff --git a/public/pages/LogTypes/containers/LogTypes.tsx b/public/pages/LogTypes/containers/LogTypes.tsx index fabf74bb..af19b276 100644 --- a/public/pages/LogTypes/containers/LogTypes.tsx +++ b/public/pages/LogTypes/containers/LogTypes.tsx @@ -24,6 +24,7 @@ import { NotificationsStart } from 'opensearch-dashboards/public'; import { setBreadcrumbs, successNotificationToast } from '../../../utils/helpers'; import { DeleteLogTypeModal } from '../components/DeleteLogTypeModal'; import { PageHeader } from '../../../components/PageHeader/PageHeader'; +import { getUseUpdatedUx } from '../../../services/utils/constants'; export interface LogTypesProps extends RouteComponentProps, DataSourceProps { notifications: NotificationsStart; @@ -49,8 +50,12 @@ export const LogTypes: React.FC = ({ history, notifications, data }; useEffect(() => { - setBreadcrumbs([BREADCRUMBS.DETECTORS, BREADCRUMBS.LOG_TYPES]); - }, []); + if (getUseUpdatedUx()) { + setBreadcrumbs([BREADCRUMBS.LOG_TYPES]); + } else { + setBreadcrumbs([BREADCRUMBS.DETECTORS, BREADCRUMBS.LOG_TYPES]); + } + }, [getUseUpdatedUx()]); useEffect(() => { getLogTypes(); diff --git a/public/pages/Rules/containers/EditRule/EditRule.tsx b/public/pages/Rules/containers/EditRule/EditRule.tsx index 24fdf963..2f753748 100644 --- a/public/pages/Rules/containers/EditRule/EditRule.tsx +++ b/public/pages/Rules/containers/EditRule/EditRule.tsx @@ -12,6 +12,7 @@ import { NotificationsStart } from 'opensearch-dashboards/public'; import { setRulesRelatedBreadCrumb } from '../../utils/helpers'; import { RuleItemInfoBase } from '../../../../../types'; import { setBreadcrumbs } from '../../../../utils/helpers'; +import { getUseUpdatedUx } from '../../../../services/utils/constants'; export interface EditRuleProps extends RouteComponentProps { @@ -20,9 +21,17 @@ export interface EditRuleProps } export const EditRule: React.FC = ({ history, location, notifications }) => { + useEffect(() => { - setRulesRelatedBreadCrumb(BREADCRUMBS.RULES_EDIT, setBreadcrumbs); - }); + const ruleItemTitle = location.state.ruleItem._source.title; + const ruleEditDetailsBreadcrumb = BREADCRUMBS.RULE_EDIT_DETAILS(ruleItemTitle); + + if (!getUseUpdatedUx()) { + setRulesRelatedBreadCrumb(BREADCRUMBS.RULES_EDIT, setBreadcrumbs); + } else { + setBreadcrumbs([ruleEditDetailsBreadcrumb]); + } + }, [location.state.ruleItem._source.title, getUseUpdatedUx()]); // Add relevant dependencies return ( ({ + text: `${name}`, + href: `#${ROUTES.RULES_EDIT}`, + }), RULES_DUPLICATE: { text: 'Duplicate rule', href: `#${ROUTES.RULES_DUPLICATE}` }, RULES_IMPORT: { text: 'Import rule', href: `#${ROUTES.RULES_IMPORT}` }, CORRELATIONS: { text: 'Correlations', href: `#${ROUTES.CORRELATIONS}` },