diff --git a/public/pages/Overview/components/GettingStarted/GettingStartedContent.tsx b/public/pages/Overview/components/GettingStarted/GettingStartedContent.tsx index 6c7d95a3..f23b58e1 100644 --- a/public/pages/Overview/components/GettingStarted/GettingStartedContent.tsx +++ b/public/pages/Overview/components/GettingStarted/GettingStartedContent.tsx @@ -19,9 +19,8 @@ import { import { RouteComponentProps } from 'react-router-dom'; import { GetStartedStep } from './GetStartedStep'; import { moreLink } from '../../utils/constants'; -import { navigateToRoute } from '../../../../utils/helpers'; import { setBreadcrumbs } from '../../../../utils/helpers'; -import { getUseUpdatedUx } from '../../../../services/utils/constants'; +import { getApplication, getUseUpdatedUx } from '../../../../services/utils/constants'; import { PageHeader } from '../../../../components/PageHeader/PageHeader'; export interface GettingStartedPopupProps { @@ -37,6 +36,15 @@ export const GettingStartedContent: React.FC = ({ if (useUpdatedUx) { setBreadcrumbs([BREADCRUMBS.GETTING_STARTED]); } + const onActionClick = (appId: string, route: string) => { + if (useUpdatedUx) { + const url = getApplication().getUrlForApp(appId, { path: `#${route}` }); + getApplication().navigateToUrl(url); + } else { + history.push(route); + } + }; + const steps: EuiContainedStepProps[] = useMemo( () => [ { @@ -51,7 +59,7 @@ export const GettingStartedContent: React.FC = ({ text: 'Create detector', onClick: () => { onStepClicked(); - navigateToRoute(history, DETECTORS_NAV_ID, ROUTES.DETECTORS_CREATE); + onActionClick(DETECTORS_NAV_ID, ROUTES.DETECTORS_CREATE); }, opts: { fill: true, @@ -73,7 +81,7 @@ export const GettingStartedContent: React.FC = ({ text: 'Manage threat intelligence sources', onClick: () => { onStepClicked(); - navigateToRoute(history, THREAT_INTEL_NAV_ID, ROUTES.THREAT_INTEL_OVERVIEW); + onActionClick(THREAT_INTEL_NAV_ID, ROUTES.THREAT_INTEL_OVERVIEW); }, }, ]} @@ -92,7 +100,7 @@ export const GettingStartedContent: React.FC = ({ text: 'View findings', onClick: () => { onStepClicked(); - navigateToRoute(history, FINDINGS_NAV_ID, ROUTES.FINDINGS); + onActionClick(FINDINGS_NAV_ID, ROUTES.FINDINGS); }, }, ]} @@ -109,7 +117,7 @@ export const GettingStartedContent: React.FC = ({ text: 'View alerts', onClick: () => { onStepClicked(); - navigateToRoute(history, THREAT_ALERTS_NAV_ID, ROUTES.ALERTS); + onActionClick(THREAT_ALERTS_NAV_ID, ROUTES.ALERTS); }, }, ]} @@ -126,7 +134,7 @@ export const GettingStartedContent: React.FC = ({ text: 'Manage rules', onClick: () => { onStepClicked(); - navigateToRoute(history, DETECTION_RULE_NAV_ID, ROUTES.RULES); + onActionClick(DETECTION_RULE_NAV_ID, ROUTES.RULES); }, }, ]} @@ -143,7 +151,7 @@ export const GettingStartedContent: React.FC = ({ text: 'Manage correlation rules', onClick: () => { onStepClicked(); - navigateToRoute(history, CORRELATIONS_RULE_NAV_ID, ROUTES.CORRELATION_RULES); + onActionClick(CORRELATIONS_RULE_NAV_ID, ROUTES.CORRELATION_RULES); }, }, ]} diff --git a/public/pages/Overview/containers/Overview/Overview.tsx b/public/pages/Overview/containers/Overview/Overview.tsx index 0a478230..cd98ec27 100644 --- a/public/pages/Overview/containers/Overview/Overview.tsx +++ b/public/pages/Overview/containers/Overview/Overview.tsx @@ -9,6 +9,9 @@ import { EuiFlexGroup, EuiFlexItem, EuiPopover, + EuiSuperDatePicker, + EuiTitle, + EuiSpacer, EuiSmallButton, EuiCard, EuiPanel, diff --git a/public/utils/constants.ts b/public/utils/constants.ts index 20739643..25ab3da8 100644 --- a/public/utils/constants.ts +++ b/public/utils/constants.ts @@ -11,6 +11,7 @@ import _ from 'lodash'; import { euiPaletteColorBlind, euiPaletteForStatus } from '@elastic/eui'; import { DataSourceOption } from 'src/plugins/data_source_management/public'; import { BehaviorSubject } from 'rxjs'; +import { i18n } from '@osd/i18n'; export const DATE_MATH_FORMAT = 'YYYY-MM-DDTHH:mm:ss.SSSZ'; export const MAX_RECENTLY_USED_TIME_RANGES = 5; @@ -308,6 +309,13 @@ export const ALERT_SEVERITY_PROPS = { }, }; +const LocalCluster: DataSourceOption = { + label: i18n.translate('dataSource.localCluster', { + defaultMessage: 'Local cluster', + }), + id: '', +}; + // We should use empty object for default value as local cluster may be disabled export const dataSourceObservable = new BehaviorSubject({}); diff --git a/public/utils/helpers.tsx b/public/utils/helpers.tsx index ed332956..ff3ba0b6 100644 --- a/public/utils/helpers.tsx +++ b/public/utils/helpers.tsx @@ -773,20 +773,6 @@ export function initializeServices(coreStart: CoreStart, indexPattern: CoreIndex DataStore.init(services, coreStart.notifications); } -export const navigateToRoute = ( - history: RouteComponentProps['history'], - appId: string, - route: string -) => { - const useUpdatedUx = getUseUpdatedUx(); - if (useUpdatedUx) { - const url = getApplication().getUrlForApp(appId, { path: `#${route}` }); - getApplication().navigateToUrl(url); - } else { - history.push(route); - } -}; - export const buildRouteUrl = (appId: string, route: string) => { const useUpdatedUx = getUseUpdatedUx(); if (useUpdatedUx) {