Skip to content

Commit 3350099

Browse files
committed
fix rules action alerts
1 parent 8f9017a commit 3350099

File tree

3 files changed

+13
-15
lines changed
  • x-pack/plugins/security_solution

3 files changed

+13
-15
lines changed

x-pack/plugins/security_solution/public/detections/components/rules/step_rule_actions/index.tsx

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ import { useKibana } from '../../../../common/lib/kibana';
3333
import { getSchema } from './schema';
3434
import * as I18n from './translations';
3535
import { APP_ID } from '../../../../../common/constants';
36-
import { SecurityPageName } from '../../../../app/types';
3736

3837
interface StepRuleActionsProps extends RuleStepProps {
3938
defaultValues?: ActionsStepRule | null;
@@ -86,16 +85,13 @@ const StepRuleActionsComponent: FC<StepRuleActionsProps> = ({
8685
});
8786
const { submit } = form;
8887

89-
// TO DO need to make sure that logic is still valid
90-
const kibanaAbsoluteUrl = useMemo(() => {
91-
const url = application.getUrlForApp(`${APP_ID}:${SecurityPageName.detections}`, {
92-
absolute: true,
93-
});
94-
if (url != null && url.includes('app/security/alerts')) {
95-
return url.replace('app/security/alerts', 'app/security');
96-
}
97-
return url;
98-
}, [application]);
88+
const kibanaAbsoluteUrl = useMemo(
89+
() =>
90+
application.getUrlForApp(`${APP_ID}`, {
91+
absolute: true,
92+
}),
93+
[application]
94+
);
9995

10096
const onSubmit = useCallback(
10197
async (enabled: boolean) => {

x-pack/plugins/security_solution/server/lib/detection_engine/notifications/utils.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@ import { getNotificationResultsLink } from './utils';
99
describe('utils', () => {
1010
it('getNotificationResultsLink', () => {
1111
const resultLink = getNotificationResultsLink({
12-
kibanaSiemAppUrl: 'http://localhost:5601/app/siem',
12+
kibanaSiemAppUrl: 'http://localhost:5601/app/security',
1313
id: 'notification-id',
1414
from: '00000',
1515
to: '1111',
1616
});
1717
expect(resultLink).toEqual(
18-
`http://localhost:5601/app/siem#/detections/rules/id/notification-id?timerange=(global:(linkTo:!(timeline),timerange:(from:00000,kind:absolute,to:1111)),timeline:(linkTo:!(global),timerange:(from:00000,kind:absolute,to:1111)))`
18+
`http://localhost:5601/app/security/detections/rules/id/notification-id?timerange=(global:(linkTo:!(timeline),timerange:(from:00000,kind:absolute,to:1111)),timeline:(linkTo:!(global),timerange:(from:00000,kind:absolute,to:1111)))`
1919
);
2020
});
2121
});

x-pack/plugins/security_solution/server/lib/detection_engine/notifications/utils.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@
44
* you may not use this file except in compliance with the Elastic License.
55
*/
66

7+
import { APP_PATH } from '../../../../common/constants';
8+
79
export const getNotificationResultsLink = ({
8-
kibanaSiemAppUrl = '/app/siem',
10+
kibanaSiemAppUrl = APP_PATH,
911
id,
1012
from,
1113
to,
@@ -17,5 +19,5 @@ export const getNotificationResultsLink = ({
1719
}) => {
1820
if (from == null || to == null) return '';
1921

20-
return `${kibanaSiemAppUrl}#/detections/rules/id/${id}?timerange=(global:(linkTo:!(timeline),timerange:(from:${from},kind:absolute,to:${to})),timeline:(linkTo:!(global),timerange:(from:${from},kind:absolute,to:${to})))`;
22+
return `${kibanaSiemAppUrl}/detections/rules/id/${id}?timerange=(global:(linkTo:!(timeline),timerange:(from:${from},kind:absolute,to:${to})),timeline:(linkTo:!(global),timerange:(from:${from},kind:absolute,to:${to})))`;
2123
};

0 commit comments

Comments
 (0)