Skip to content

Commit

Permalink
fix type
Browse files Browse the repository at this point in the history
  • Loading branch information
XavierM committed Jan 17, 2020
1 parent aeddd3f commit d58a473
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export const HeaderGlobal = React.memo<HeaderGlobalProps>(({ hideDetectionEngine
display="condensed"
navTabs={
hideDetectionEngine
? pickBy((_, key) => key !== SiemPageName.detectionEngine, navTabs)
? pickBy((_, key) => key !== SiemPageName.detections, navTabs)
: navTabs
}
/>
Expand Down
10 changes: 5 additions & 5 deletions x-pack/legacy/plugins/siem/public/components/link_to/link_to.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,26 +60,26 @@ export const LinkToPage = React.memo<LinkToPageProps>(({ match }) => (
<Route
component={RedirectToDetectionEnginePage}
exact
path={`${match.url}/:pageName(${SiemPageName.detectionEngine})`}
path={`${match.url}/:pageName(${SiemPageName.detections})`}
strict
/>
<Route
component={RedirectToRulesPage}
exact
path={`${match.url}/:pageName(${SiemPageName.detectionEngine})/rules`}
path={`${match.url}/:pageName(${SiemPageName.detections})/rules`}
/>
<Route
component={RedirectToCreateRulePage}
path={`${match.url}/:pageName(${SiemPageName.detectionEngine})/rules/create-rule`}
path={`${match.url}/:pageName(${SiemPageName.detections})/rules/create-rule`}
/>
<Route
component={RedirectToRuleDetailsPage}
exact
path={`${match.url}/:pageName(${SiemPageName.detectionEngine})/rules/rule-details`}
path={`${match.url}/:pageName(${SiemPageName.detections})/rules/rule-details`}
/>
<Route
component={RedirectToEditRulePage}
path={`${match.url}/:pageName(${SiemPageName.detectionEngine})/rules/rule-details/edit-rule`}
path={`${match.url}/:pageName(${SiemPageName.detections})/rules/rule-details/edit-rule`}
/>
<Route
component={RedirectToTimelinesPage}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export const getUrlType = (pageName: string): UrlStateType => {
return 'host';
} else if (pageName === SiemPageName.network) {
return 'network';
} else if (pageName === SiemPageName.detectionEngine) {
} else if (pageName === SiemPageName.detections) {
return 'detections';
} else if (pageName === SiemPageName.timelines) {
return 'timeline';
Expand Down Expand Up @@ -111,8 +111,8 @@ export const getCurrentLocation = (
return CONSTANTS.networkDetails;
}
return CONSTANTS.networkPage;
} else if (pageName === SiemPageName.detectionEngine) {
return CONSTANTS.detectionEnginePage;
} else if (pageName === SiemPageName.detections) {
return CONSTANTS.detectionsPage;
} else if (pageName === SiemPageName.timelines) {
return CONSTANTS.timelinePage;
}
Expand All @@ -129,7 +129,8 @@ export const isKqlForRoute = (
(currentLocation === CONSTANTS.hostsPage && queryLocation === CONSTANTS.hostsPage) ||
(currentLocation === CONSTANTS.networkPage && queryLocation === CONSTANTS.networkPage) ||
(currentLocation === CONSTANTS.hostsDetails && queryLocation === CONSTANTS.hostsDetails) ||
(currentLocation === CONSTANTS.networkDetails && queryLocation === CONSTANTS.networkDetails)
(currentLocation === CONSTANTS.networkDetails && queryLocation === CONSTANTS.networkDetails) ||
(currentLocation === CONSTANTS.detectionsPage && queryLocation === CONSTANTS.detectionsPage)
) {
return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export const URL_STATE_KEYS: Record<UrlStateType, KeyUrlState[]> = {
};

export type LocationTypes =
| CONSTANTS.detectionEnginePage
| CONSTANTS.detectionsPage
| CONSTANTS.hostsDetails
| CONSTANTS.hostsPage
| CONSTANTS.networkDetails
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ export const navTabs: SiemNavTab = {
disabled: false,
urlKey: 'network',
},
[SiemPageName.detectionEngine]: {
id: SiemPageName.detectionEngine,
[SiemPageName.detections]: {
id: SiemPageName.detections,
name: i18n.DETECTION_ENGINE,
href: getDetectionEngineUrl(),
disabled: false,
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 @@ -105,7 +105,7 @@ export const HomePage: React.FC = () => (
)}
/>
<Route
path={`/:pageName(${SiemPageName.detectionEngine})`}
path={`/:pageName(${SiemPageName.detections})`}
render={({ location, match }) => (
<DetectionEngineContainer location={location} url={match.url} />
)}
Expand Down
4 changes: 2 additions & 2 deletions x-pack/legacy/plugins/siem/public/pages/home/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ export enum SiemPageName {
overview = 'overview',
hosts = 'hosts',
network = 'network',
detectionEngine = 'detections',
detections = 'detections',
timelines = 'timelines',
}

export type SiemNavTabKey =
| SiemPageName.overview
| SiemPageName.hosts
| SiemPageName.network
| SiemPageName.detectionEngine
| SiemPageName.detections
| SiemPageName.timelines;

export type SiemNavTab = Record<SiemNavTabKey, NavTab>;

0 comments on commit d58a473

Please sign in to comment.