Skip to content

Commit

Permalink
Merge pull request #1 from stephmilovic/michael-detection-engine
Browse files Browse the repository at this point in the history
fix detection-engine href redirect issue
  • Loading branch information
Michael Marcialis authored Oct 7, 2019
2 parents f4b0f91 + 66a5154 commit 178827e
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { RedirectToHostsPage, RedirectToHostDetailsPage } from './redirect_to_ho
import { RedirectToNetworkPage } from './redirect_to_network';
import { RedirectToOverviewPage } from './redirect_to_overview';
import { RedirectToTimelinesPage } from './redirect_to_timelines';
import { RedirectToDetectionEnginePage } from './redirect_to_detection_engine';
import { HostsTableType } from '../../store/hosts/model';

interface LinkToPageProps {
Expand Down Expand Up @@ -41,6 +42,10 @@ export const LinkToPage = pure<LinkToPageProps>(({ match }) => (
component={RedirectToNetworkPage}
/>
<Route path={`${match.url}/:pageName(timelines)`} component={RedirectToTimelinesPage} />
<Route
path={`${match.url}/:pageName(detection-engine)`}
component={RedirectToDetectionEnginePage}
/>
<Redirect to="/" />
</Switch>
));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ export const SiemNavigationComponent = React.memo<TabNavigationProps & RouteSpyS
});
}
}, [pathName, search, hosts, hostDetails, network, navTabs, timerange, timelineId]);

return (
<TabNavigation
display={display}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ export const getUrlType = (pageName: string): UrlStateType => {
return 'overview';
} else if (pageName === SiemPageName.timelines) {
return 'timeline';
} else if (pageName === SiemPageName.detectionEngine) {
return 'detection-engine';
}
return 'overview';
};
Expand Down Expand Up @@ -114,6 +116,8 @@ export const getCurrentLocation = (
return CONSTANTS.overviewPage;
} else if (pageName === SiemPageName.timelines) {
return CONSTANTS.timelinePage;
} else if (pageName === SiemPageName.detectionEngine) {
return CONSTANTS.detectionEnginePage;
}
return CONSTANTS.unknown;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,11 @@ export const URL_STATE_KEYS: Record<UrlStateType, KeyUrlState[]> = {
network: [CONSTANTS.kqlQuery, CONSTANTS.timerange, CONSTANTS.timelineId],
timeline: [CONSTANTS.timelineId, CONSTANTS.timerange],
overview: [CONSTANTS.timelineId, CONSTANTS.timerange],
'detection-engine': [],
};

export type LocationTypes =
| CONSTANTS.detectionEnginePage
| CONSTANTS.networkDetails
| CONSTANTS.networkPage
| CONSTANTS.hostsDetails
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import * as React from 'react';
import { MockedProvider } from 'react-apollo/test-utils';
import { MemoryRouter } from 'react-router-dom';

import { Overview } from './index';
import { DetectionEngine } from './index';

import '../../mock/ui_settings';
import { mocksSource } from '../../containers/source/mock';
Expand All @@ -35,7 +35,7 @@ let localSource: Array<{
};
}>;

describe('Overview', () => {
describe('DetectionEngine', () => {
describe('rendering', () => {
beforeEach(() => {
localSource = cloneDeep(mocksSource);
Expand All @@ -47,7 +47,7 @@ describe('Overview', () => {
<TestProviders>
<MockedProvider mocks={localSource} addTypename={false}>
<MemoryRouter>
<Overview />
<DetectionEngine />
</MemoryRouter>
</MockedProvider>
</TestProviders>
Expand All @@ -64,7 +64,7 @@ describe('Overview', () => {
<TestProviders>
<MockedProvider mocks={localSource} addTypename={false}>
<MemoryRouter>
<Overview />
<DetectionEngine />
</MemoryRouter>
</MockedProvider>
</TestProviders>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,25 @@

import React from 'react';
import { pure } from 'recompose';
import chrome from 'ui/chrome';
import { documentationLinks } from 'ui/documentation_links';
// import chrome from 'ui/chrome';
// import { documentationLinks } from 'ui/documentation_links';

import { HeaderPage } from '../../components/header_page';
import { GlobalTime } from '../../containers/global_time';

import { EmptyPage } from '../../components/empty_page';
import { WithSource, indicesExistOrDataTemporarilyUnavailable } from '../../containers/source';
// import { GlobalTime } from '../../containers/global_time';
//
// import { EmptyPage } from '../../components/empty_page';
// import { WithSource, indicesExistOrDataTemporarilyUnavailable } from '../../containers/source';
import { SpyRoute } from '../../utils/route/spy_routes';

import * as i18n from './translations';

const basePath = chrome.getBasePath();
// const basePath = chrome.getBasePath();

export const DetectionEngineComponent = pure(() => {
return (
<>
<HeaderPage subtitle={i18n.PAGE_SUBTITLE} title={i18n.PAGE_TITLE} />

<p>{'HELLO WORLD'}</p>
{/* <WithSource sourceId="default">
{({ indicesExist }) =>
indicesExistOrDataTemporarilyUnavailable(indicesExist) ? (
Expand Down
2 changes: 1 addition & 1 deletion x-pack/legacy/plugins/siem/public/pages/home/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ export const HomePage = pure(() => (
<NetworkContainer url={match.url} location={location} />
)}
/>
<Route path="/:pageName(detectionEngine)" render={() => <DetectionEngine />} />
<Route path="/:pageName(detection-engine)" render={() => <DetectionEngine />} />
<Route path="/:pageName(timelines)" render={() => <Timelines />} />
<Route path="/link-to" component={LinkToPage} />
<Route
Expand Down

0 comments on commit 178827e

Please sign in to comment.