-
Notifications
You must be signed in to change notification settings - Fork 8k
/
index.tsx
44 lines (39 loc) · 1.57 KB
/
index.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
import React from 'react';
import { Switch } from 'react-router-dom';
import { Route } from '@kbn/shared-ux-router';
import { TrackApplicationView } from '@kbn/usage-collection-plugin/public';
import {
ALERTS_PATH,
ALERT_DETAILS_REDIRECT_PATH,
SecurityPageName,
} from '../../../../common/constants';
import { NotFoundPage } from '../../../app/404';
import * as i18n from './translations';
import { DetectionEnginePage } from '../detection_engine/detection_engine';
import { SpyRoute } from '../../../common/utils/route/spy_routes';
import { useReadonlyHeader } from '../../../use_readonly_header';
import { AlertDetailsRedirect } from './alert_details_redirect';
const AlertsRoute = () => (
<TrackApplicationView viewId={SecurityPageName.alerts}>
<DetectionEnginePage />
<SpyRoute pageName={SecurityPageName.alerts} />
</TrackApplicationView>
);
const AlertsContainerComponent: React.FC = () => {
useReadonlyHeader(i18n.READ_ONLY_BADGE_TOOLTIP);
return (
<Switch>
<Route path={ALERTS_PATH} exact component={AlertsRoute} />
{/* Redirect to the alerts page filtered for the given alert id */}
<Route path={`${ALERT_DETAILS_REDIRECT_PATH}/:alertId`} component={AlertDetailsRedirect} />
<Route component={NotFoundPage} />
</Switch>
);
};
export const Alerts = React.memo(AlertsContainerComponent);