-
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.
Browse files
Browse the repository at this point in the history
* Refactor NotFound component - shared NotFound becomes NotFoundPrompt - returns only an EuiEmptyPrompt, and individual products/plugins are in charge of their own layout, rather than NotFound doing a bunch of arduous switch handling (also closer to how errorConnecting is a component set per-plugin) - This is both due to the recent page template refactor and the fact that WS has extra complex logic of needing to switch between its kibana layout and personal dashboard layout - logos are still hosted in shared/ since they need extra custom CSS to work correctly sizing wise and in dark mode. I renamed its folder from `assets`->`logos` for extra clarity * [AS] Update current AS routers using NotFound + update EngineRouter to use NotFound * [WS] Update app router - Handle errorConnecting at the topmost level, instead of in WorkplaceSearchConfigured (to simplify various logic/expectations & match App Search) - Simplify isOrganization check to use `useRouteMatch` instead of a regex - Use new NotFound component - Add NotFound component for the personal dashboard router * [WS] Improve Source 404 UX - Add NotFound to SourceRouter + add breadcrumbs for organization views - When an actual source ID 404s, fix blanket redirect to a dashboard aware redirect - personal dashboard 404s should send the user back to personal sources, not organization sources + add a flash message error (similar to how App Search behaves for engine 404s) + harden error status checks (gracefully allow for non-http errors to fall back flashAPIErrors * [WS] Improve Settings 404 UX - This was the only remaining WS route I found that either did not have a 404 or a fallback to some overview page, so I tweaked the redirect order for a graceful redirect (vs a blank page) * Fix settings router test * Move away from custom product logos to OOTB Enterprise Search logo Keeping it simple, etc. RIP in peace fancy logos * [PR feedback] toContain over stringContaining Co-authored-by: Constance <constancecchen@users.noreply.github.com>
- Loading branch information
1 parent
ca36d0c
commit 4d7b3af
Showing
25 changed files
with
378 additions
and
394 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
38 changes: 38 additions & 0 deletions
38
.../enterprise_search/public/applications/app_search/components/not_found/not_found.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,38 @@ | ||
/* | ||
* 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 { shallow } from 'enzyme'; | ||
|
||
import { NotFoundPrompt } from '../../../shared/not_found'; | ||
import { SendAppSearchTelemetry } from '../../../shared/telemetry'; | ||
import { AppSearchPageTemplate } from '../layout'; | ||
|
||
import { NotFound } from './'; | ||
|
||
describe('NotFound', () => { | ||
const wrapper = shallow(<NotFound />); | ||
|
||
it('renders the shared not found prompt', () => { | ||
expect(wrapper.find(NotFoundPrompt)).toHaveLength(1); | ||
}); | ||
|
||
it('renders a telemetry error event', () => { | ||
expect(wrapper.find(SendAppSearchTelemetry).prop('action')).toEqual('error'); | ||
}); | ||
|
||
it('passes optional preceding page chrome', () => { | ||
wrapper.setProps({ pageChrome: ['Engines', 'some-engine'] }); | ||
|
||
expect(wrapper.find(AppSearchPageTemplate).prop('pageChrome')).toEqual([ | ||
'Engines', | ||
'some-engine', | ||
'404', | ||
]); | ||
}); | ||
}); |
23 changes: 23 additions & 0 deletions
23
...ugins/enterprise_search/public/applications/app_search/components/not_found/not_found.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,23 @@ | ||
/* | ||
* 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 { APP_SEARCH_PLUGIN } from '../../../../../common/constants'; | ||
import { PageTemplateProps } from '../../../shared/layout'; | ||
import { NotFoundPrompt } from '../../../shared/not_found'; | ||
import { SendAppSearchTelemetry } from '../../../shared/telemetry'; | ||
import { AppSearchPageTemplate } from '../layout'; | ||
|
||
export const NotFound: React.FC<PageTemplateProps> = ({ pageChrome = [] }) => { | ||
return ( | ||
<AppSearchPageTemplate pageChrome={[...pageChrome, '404']} template="centeredContent"> | ||
<SendAppSearchTelemetry action="error" metric="not_found" /> | ||
<NotFoundPrompt productSupportUrl={APP_SEARCH_PLUGIN.SUPPORT_URL} /> | ||
</AppSearchPageTemplate> | ||
); | ||
}; |
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
33 changes: 0 additions & 33 deletions
33
...plugins/enterprise_search/public/applications/shared/not_found/assets/app_search_logo.tsx
This file was deleted.
Oops, something went wrong.
39 changes: 0 additions & 39 deletions
39
...s/enterprise_search/public/applications/shared/not_found/assets/workplace_search_logo.tsx
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
|
@@ -5,4 +5,4 @@ | |
* 2.0. | ||
*/ | ||
|
||
export { NotFound } from './not_found'; | ||
export { NotFoundPrompt } from './not_found_prompt'; |
70 changes: 0 additions & 70 deletions
70
x-pack/plugins/enterprise_search/public/applications/shared/not_found/not_found.test.tsx
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.