Skip to content

Commit

Permalink
[Security Solution] [Bugfix] add redirect for old external alert rout…
Browse files Browse the repository at this point in the history
…e to new one on events page (#146896)

as per #140158, old external
alert route should either take user back to main entity page or to
external alerts.

## Summary
Take advantage of `onlyExternalAlerts` param to redirect users with old
urls to the new one for external alerts.

The gif below shows the old url before hitting enter- causing the page
to redirect to the events page with external alerts checked.
![Recording 2022-12-02 at 11 54
26](https://user-images.githubusercontent.com/28942857/205355379-d0b3a396-8cdf-48f2-966d-82ad3d133676.gif)

Co-authored-by: Kristof-Pierre Cummings <[email protected]>
  • Loading branch information
jamster10 and Kristof-Pierre Cummings authored Dec 12, 2022
1 parent 8be9ae6 commit 0d64593
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
11 changes: 11 additions & 0 deletions x-pack/plugins/security_solution/public/hosts/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,17 @@ export const HostsContainer = React.memo(() => (
<Route path={`${HOSTS_PATH}/ml-hosts`}>
<MlHostConditionalContainer />
</Route>
<Route // Compatibility redirect for the old external alert path to events page with external alerts showing.
path={`${HOSTS_PATH}/externalAlerts`}
render={({ location: { search = '' } }) => (
<Redirect
to={{
pathname: `${HOSTS_PATH}/${HostsTableType.events}`,
search: `${search}&onlyExternalAlerts=true`,
}}
/>
)}
/>
<Route path={getHostsTabPath()}>
<Hosts />
</Route>
Expand Down
12 changes: 11 additions & 1 deletion x-pack/plugins/security_solution/public/users/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,17 @@ export const UsersContainer = React.memo(() => {
<Route path={usersTabPath}>
<Users />
</Route>

<Route // Compatibility redirect for the old external alert path to events page with external alerts showing.
path={`${USERS_PATH}/externalAlerts`}
render={({ location: { search = '' } }) => (
<Redirect
to={{
pathname: `${USERS_PATH}/${UsersTableType.events}`,
search: `${search}&onlyExternalAlerts=true`,
}}
/>
)}
/>
<Route
path={usersDetailsTabPath}
render={({
Expand Down

0 comments on commit 0d64593

Please sign in to comment.