[Infra UI] Alerts link in overview: required to click back 2 times to go back (#162312)

Closes #162240 
Closes #162220 
Closes #162221 

## Summary

This PR fixes the navigation to the alerts page issue when the back
button is used - in this case, the user stays on the same page instead
of going back to the previous page. This issue was found on the hosts
view page after adding the 'show all' link inside the overview tab but
it exists also when you navigate from the observability overview page.

I tested also navigating using the menu, from observability overview and
hosts view, outside of observability and the navigation works fine with
the change. If there are any concerns or if I miss something I will be
happy to discuss this.

Before:


dc9590c9-ef7e-469c-aad4-6c6f377d9bef


After:


be3d1f9a-bd27-426d-bd6e-61f5a0a206f3
This commit is contained in:
jennypavlova 2023-07-20 19:20:13 +02:00 committed by GitHub
parent e4c4eddcd8
commit 84fd8c0254
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 4 deletions

View file

@ -144,6 +144,10 @@ function syncUrlStateWithInitialContainerState(
};
stateContainer.set(newState);
urlStateStorage.set(urlStorageKey, stateContainer.get(), {
replace: true,
});
return;
} else if (timefilterService.isTimeTouched()) {
const { from, to } = timefilterService.getTime();
const newState = {
@ -151,7 +155,6 @@ function syncUrlStateWithInitialContainerState(
rangeFrom: from,
rangeTo: to,
};
stateContainer.set(newState);
} else {
// Reset the state container when no URL state or timefilter range is set to avoid accidentally

View file

@ -155,9 +155,7 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => {
return !!currentUrl.match(path);
});
// Failing: See https://github.com/elastic/kibana/issues/162221
// Failing: See https://github.com/elastic/kibana/issues/162220
describe.skip('Hosts View', function () {
describe('Hosts View', function () {
before(async () => {
await Promise.all([
esArchiver.load('x-pack/test/functional/es_archives/infra/alerts'),