Skip to content

Commit

Permalink
routes changed
Browse files Browse the repository at this point in the history
Signed-off-by: Riya Saxena <[email protected]>
  • Loading branch information
riysaxen-amzn committed Aug 31, 2024
1 parent dfc6310 commit 99c057c
Show file tree
Hide file tree
Showing 10 changed files with 41 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2058,7 +2058,6 @@ exports[`<Alerts /> spec renders the component 1`] = `
<FieldValueSelectionFilter
config={
Object {
"compressed": undefined,
"field": "severity",
"multiSelect": "or",
"name": "Alert severity",
Expand Down Expand Up @@ -2188,7 +2187,6 @@ exports[`<Alerts /> spec renders the component 1`] = `
<FieldValueSelectionFilter
config={
Object {
"compressed": undefined,
"field": "state",
"multiSelect": "or",
"name": "Status",
Expand Down
9 changes: 7 additions & 2 deletions public/pages/Correlations/containers/CorrelationRules.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import { RouteComponentProps } from 'react-router-dom';
import { DeleteCorrelationRuleModal } from '../components/DeleteModal';
import { setBreadcrumbs } from '../../../utils/helpers';
import { PageHeader } from '../../../components/PageHeader/PageHeader';
import { getUseUpdatedUx } from '../../../services/utils/constants';

export interface CorrelationRulesProps extends RouteComponentProps, DataSourceProps {}

Expand All @@ -46,8 +47,12 @@ export const CorrelationRules: React.FC<CorrelationRulesProps> = (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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -819,7 +819,6 @@ exports[`<DetectorRulesView /> spec renders the component 1`] = `
<FieldValueSelectionFilter
config={
Object {
"compressed": undefined,
"field": "category",
"multiSelect": "or",
"name": "Log type",
Expand Down Expand Up @@ -949,7 +948,6 @@ exports[`<DetectorRulesView /> spec renders the component 1`] = `
<FieldValueSelectionFilter
config={
Object {
"compressed": undefined,
"field": "level",
"multiSelect": "or",
"name": "Rule severity",
Expand Down Expand Up @@ -1125,7 +1123,6 @@ exports[`<DetectorRulesView /> spec renders the component 1`] = `
<FieldValueSelectionFilter
config={
Object {
"compressed": undefined,
"field": "source",
"multiSelect": "or",
"name": "Source",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3364,7 +3364,6 @@ exports[`<DetectorDetails /> spec renders the component 1`] = `
<FieldValueSelectionFilter
config={
Object {
"compressed": undefined,
"field": "category",
"multiSelect": "or",
"name": "Log type",
Expand Down Expand Up @@ -3494,7 +3493,6 @@ exports[`<DetectorDetails /> spec renders the component 1`] = `
<FieldValueSelectionFilter
config={
Object {
"compressed": undefined,
"field": "level",
"multiSelect": "or",
"name": "Rule severity",
Expand Down Expand Up @@ -3670,7 +3668,6 @@ exports[`<DetectorDetails /> spec renders the component 1`] = `
<FieldValueSelectionFilter
config={
Object {
"compressed": undefined,
"field": "source",
"multiSelect": "or",
"name": "Source",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2068,7 +2068,6 @@ exports[`<DetectorDetailsView /> spec renders the component 1`] = `
<FieldValueSelectionFilter
config={
Object {
"compressed": undefined,
"field": "category",
"multiSelect": "or",
"name": "Log type",
Expand Down Expand Up @@ -2198,7 +2197,6 @@ exports[`<DetectorDetailsView /> spec renders the component 1`] = `
<FieldValueSelectionFilter
config={
Object {
"compressed": undefined,
"field": "level",
"multiSelect": "or",
"name": "Rule severity",
Expand Down Expand Up @@ -2374,7 +2372,6 @@ exports[`<DetectorDetailsView /> spec renders the component 1`] = `
<FieldValueSelectionFilter
config={
Object {
"compressed": undefined,
"field": "source",
"multiSelect": "or",
"name": "Source",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ exports[`<Detectors /> spec renders the component 1`] = `
"renderComponent": <EuiSmallButton
data-test-subj="detectorsCreateButton"
fill={true}
href="opensearch_security_analytics_dashboards#/create-detector"
href="#/create-detector"
>
Create detector
</EuiSmallButton>,
Expand Down Expand Up @@ -338,20 +338,20 @@ exports[`<Detectors /> spec renders the component 1`] = `
<EuiSmallButton
data-test-subj="detectorsCreateButton"
fill={true}
href="opensearch_security_analytics_dashboards#/create-detector"
href="#/create-detector"
>
<EuiButton
data-test-subj="detectorsCreateButton"
fill={true}
href="opensearch_security_analytics_dashboards#/create-detector"
href="#/create-detector"
size="s"
>
<EuiButtonDisplay
baseClassName="euiButton"
data-test-subj="detectorsCreateButton"
element="a"
fill={true}
href="opensearch_security_analytics_dashboards#/create-detector"
href="#/create-detector"
isDisabled={false}
rel="noreferrer"
size="s"
Expand All @@ -360,7 +360,7 @@ exports[`<Detectors /> 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 {
Expand Down Expand Up @@ -928,7 +928,6 @@ exports[`<Detectors /> spec renders the component 1`] = `
<FieldValueSelectionFilter
config={
Object {
"compressed": undefined,
"field": "status",
"multiSelect": "or",
"name": "Status",
Expand Down Expand Up @@ -1063,7 +1062,6 @@ exports[`<Detectors /> spec renders the component 1`] = `
<FieldValueSelectionFilter
config={
Object {
"compressed": undefined,
"field": "logType",
"multiSelect": "or",
"name": "Log type",
Expand Down
9 changes: 7 additions & 2 deletions public/pages/LogTypes/containers/CreateLogType.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { setBreadcrumbs, successNotificationToast } from '../../../utils/helpers
import { NotificationsStart } from 'opensearch-dashboards/public';
import { EuiPanel, EuiSpacer, EuiText, EuiTitle } from '@elastic/eui';
import { PageHeader } from '../../../components/PageHeader/PageHeader';
import { getUseUpdatedUx } from '../../../services/utils/constants';

export interface CreateLogTypeProps extends RouteComponentProps {
notifications: NotificationsStart;
Expand All @@ -24,8 +25,12 @@ export const CreateLogType: React.FC<CreateLogTypeProps> = ({ history, notificat
const [logTypeDetails, setLogTypeDetails] = useState<LogTypeBase>({ ...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.';
Expand Down
9 changes: 7 additions & 2 deletions public/pages/LogTypes/containers/LogTypes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -49,8 +50,12 @@ export const LogTypes: React.FC<LogTypesProps> = ({ 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();
Expand Down
13 changes: 11 additions & 2 deletions public/pages/Rules/containers/EditRule/EditRule.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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<any, any, { ruleItem: RuleItemInfoBase }> {
Expand All @@ -20,9 +21,17 @@ export interface EditRuleProps
}

export const EditRule: React.FC<EditRuleProps> = ({ 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 (
<RuleEditorContainer
Expand Down
4 changes: 4 additions & 0 deletions public/utils/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,10 @@ export const BREADCRUMBS = Object.freeze({
ALERTS: { text: 'Threat alerts', href: `#${ROUTES.ALERTS}` },
RULES_CREATE: { text: 'Create detection rule', href: `#${ROUTES.RULES_CREATE}` },
RULES_EDIT: { text: 'Edit rule', href: `#${ROUTES.RULES_EDIT}` },
RULE_EDIT_DETAILS: (name: string) => ({
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}` },
Expand Down

0 comments on commit 99c057c

Please sign in to comment.