Skip to content

Commit

Permalink
fix redirect to maintain search query string (#45184) (#45489)
Browse files Browse the repository at this point in the history
  • Loading branch information
XavierM authored Sep 12, 2019
1 parent 67662cf commit a60b6a0
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,12 @@ export const MlHostConditionalContainer = React.memo<MlHostConditionalProps>(({
}
}}
/>
<Redirect from="/ml-hosts/" to="/ml-hosts" />
<Route
path="/ml-hosts/"
render={({ location: { search = '' } }) => (
<Redirect from="/ml-hosts/" to={`/ml-hosts${search}`} />
)}
/>
</Switch>
));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,12 @@ export const MlNetworkConditionalContainer = React.memo<MlNetworkConditionalProp
}
}}
/>
<Redirect from="/ml-network/" to="/ml-network" />
<Route
path="/ml-network/"
render={({ location: { search = '' } }) => (
<Redirect from="/ml-network/" to={`/ml-network${search}`} />
)}
/>
</Switch>
));

Expand Down
18 changes: 14 additions & 4 deletions x-pack/legacy/plugins/siem/public/pages/hosts/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -216,11 +216,21 @@ export const HostsContainer = React.memo<Props>(({ url }) => (
</>
)}
/>
<Redirect
from={`${url}/:detailName`}
to={`${url}/:detailName/${HostsTableType.authentications}`}
<Route
path={`${url}/:detailName`}
render={({ location: { search = '' } }) => (
<Redirect
from={`${url}/:detailName`}
to={`${url}/:detailName/${HostsTableType.authentications}${search}`}
/>
)}
/>
<Route
path="/hosts/"
render={({ location: { search = '' } }) => (
<Redirect from={`/hosts/"`} to={`/hosts/${HostsTableType.hosts}${search}`} />
)}
/>
<Redirect from="/hosts/" to={`/hosts/${HostsTableType.hosts}`} />
</Switch>
)}
</GlobalTime>
Expand Down
7 changes: 6 additions & 1 deletion x-pack/legacy/plugins/siem/public/pages/network/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,12 @@ export const NetworkContainer = React.memo<Props>(() => (
},
}) => <IPDetails detailName={detailName} />}
/>
<Redirect from="/network/" to="/network" />
<Route
path="/network/"
render={({ location: { search = '' } }) => (
<Redirect from="/network/" to={`/network${search}`} />
)}
/>
</Switch>
));

Expand Down

0 comments on commit a60b6a0

Please sign in to comment.