-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Infra UI] Change breadcrumbs and add return button (#164726)
closes: #148956 ## Summary This PR adds a return button to the Node Details page, both old and new versions. When returning to the previous page, the page has to load with its previous state. **This doesn't work for the Inventory and Metrics UI.** The Return button will not show when: the URL is copied from the address bar and opened in a new tab/browser. Clicking on the a link to open the page in a new tab will show the return button. **Return to Host View** https://github.com/elastic/kibana/assets/2767137/06e218fc-5f35-4e67-a4f9-3f04b3f79dee **Return to Inventory UI** https://github.com/elastic/kibana/assets/2767137/906012ce-e5ca-49dd-a19b-2b3d16e9e4f6 _Returning state in Inventory UI doesn't work. There are 2 main problems: The hierarchy of the WaffleOptionContext in the page and the Saved View load, which overrides the URL state._ **Return to Metrics UI** https://github.com/elastic/kibana/assets/2767137/de2b19f4-c5e2-4368-8e00-b50ae9ba357b _Returning state in Metrics UI doesn't work because the Saved View overrides the URL state._ **Return to APM** https://github.com/elastic/kibana/assets/2767137/704ce2f0-17eb-4fa9-a791-f0cf9b29c43a **Return button remains after page refresh** https://github.com/elastic/kibana/assets/2767137/58600504-1863-4254-83ea-a2d488e2b38a **Here it's possible to see that the Inventory UI doesn't return to its previous state** ### How to test this PR. - Setup a new Kibana instance - Follow the steps from the video above --------- Co-authored-by: Kibana Machine <[email protected]>
- Loading branch information
1 parent
ae7aa29
commit 9ca30e8
Showing
23 changed files
with
347 additions
and
121 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
x-pack/plugins/infra/public/pages/link_to/use_node_details_redirect.test.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import React from 'react'; | ||
import { renderHook } from '@testing-library/react-hooks'; | ||
import { useNodeDetailsRedirect } from './use_node_details_redirect'; | ||
import { coreMock } from '@kbn/core/public/mocks'; | ||
import { KibanaContextProvider } from '@kbn/kibana-react-plugin/public'; | ||
|
||
const coreStartMock = coreMock.createStart(); | ||
|
||
jest.mock('react-router-dom', () => ({ | ||
...jest.requireActual('react-router-dom'), | ||
useLocation: jest.fn(() => ({ | ||
pathname: '', | ||
search: '', | ||
})), | ||
})); | ||
|
||
const wrapper = ({ children }: { children: React.ReactNode }): JSX.Element => ( | ||
<KibanaContextProvider services={{ ...coreStartMock }}>{children}</KibanaContextProvider> | ||
); | ||
|
||
describe('useNodeDetailsRedirect', () => { | ||
it('should return the LinkProperties', () => { | ||
const { result } = renderHook(() => useNodeDetailsRedirect(), { wrapper }); | ||
|
||
const fromDateStrig = '2019-01-01T11:00:00Z'; | ||
const toDateStrig = '2019-01-01T12:00:00Z'; | ||
|
||
expect( | ||
result.current.getNodeDetailUrl({ | ||
nodeType: 'host', | ||
nodeId: 'example-01', | ||
search: { | ||
from: new Date(fromDateStrig).getTime(), | ||
to: new Date(toDateStrig).getTime(), | ||
}, | ||
}) | ||
).toStrictEqual({ | ||
app: 'metrics', | ||
pathname: 'link-to/host-detail/example-01', | ||
search: { from: '1546340400000', to: '1546344000000' }, | ||
}); | ||
}); | ||
}); |
Oops, something went wrong.