-
Notifications
You must be signed in to change notification settings - Fork 8.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Ingest Manager] Consolidate routing and add breadcrumbs to all pages #66475
Merged
Merged
Changes from 8 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
eb1c2ee
Initial pass at normalizing links and redirects
jen-huang 00b2a52
Remove unused nav components
jen-huang a3f136b
Normalize & centralize routing paths
jen-huang 2206740
Add breadcrumbs to all pages
jen-huang 7a3d0b0
Remove unused var
jen-huang 24ab8ec
Merge remote-tracking branch 'upstream/master' into ingest/breadcrumb
jen-huang bda8326
Merge remote-tracking branch 'upstream/master' into ingest/breadcrumb
jen-huang 7a09c91
Change /epm to /integrations (#66030)
jen-huang 2950370
Fixes from review: kuery param, getPath cleanup, use chrome.docTitle,…
jen-huang 7b61116
Merge remote-tracking branch 'upstream/master' into ingest/breadcrumb
jen-huang 9625105
Merge branch 'master' into ingest/breadcrumb
elasticmachine File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
85 changes: 85 additions & 0 deletions
85
x-pack/plugins/ingest_manager/public/applications/ingest_manager/constants/page_paths.ts
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,85 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
export type StaticPage = | ||
| 'overview' | ||
| 'integrations' | ||
| 'integrations_all' | ||
| 'integrations_installed' | ||
| 'configurations' | ||
| 'configurations_list' | ||
| 'fleet' | ||
| 'fleet_agent_list' | ||
| 'fleet_enrollment_tokens' | ||
| 'data_streams'; | ||
|
||
export type DynamicPage = | ||
| 'integration_details' | ||
| 'configuration_details' | ||
| 'add_datasource_from_configuration' | ||
| 'add_datasource_from_integration' | ||
| 'edit_datasource' | ||
| 'fleet_agent_details'; | ||
|
||
export type Page = StaticPage | DynamicPage; | ||
|
||
export interface DynamicPagePathValues { | ||
[key: string]: string; | ||
} | ||
|
||
export const BASE_PATH = '/app/ingestManager'; | ||
|
||
// If routing paths are changed here, please also check to see if | ||
// `pagePathGetters()`, below, needs any modifications | ||
export const PAGE_ROUTING_PATHS = { | ||
overview: '/', | ||
integrations: '/integrations/:tabId?', | ||
integrations_all: '/integrations', | ||
integrations_installed: '/integrations/installed', | ||
integration_details: '/integrations/detail/:pkgkey/:panel?', | ||
configurations: '/configs', | ||
configurations_list: '/configs', | ||
configuration_details: '/configs/:configId/:tabId?', | ||
configuration_details_yaml: '/configs/:configId/yaml', | ||
configuration_details_settings: '/configs/:configId/settings', | ||
add_datasource_from_configuration: '/configs/:configId/add-datasource', | ||
add_datasource_from_integration: '/integrations/:pkgkey/add-datasource', | ||
edit_datasource: '/configs/:configId/edit-datasource/:datasourceId', | ||
fleet: '/fleet', | ||
fleet_agent_list: '/fleet/agents', | ||
fleet_agent_details: '/fleet/agents/:agentId/:tabId?', | ||
fleet_agent_details_events: '/fleet/agents/:agentId', | ||
fleet_agent_details_details: '/fleet/agents/:agentId/details', | ||
fleet_enrollment_tokens: '/fleet/enrollment-tokens', | ||
data_streams: '/data-streams', | ||
}; | ||
|
||
export const pagePathGetters: { | ||
[key in StaticPage]: () => string; | ||
} & | ||
{ | ||
[key in DynamicPage]: (values: DynamicPagePathValues) => string; | ||
} = { | ||
overview: () => '/', | ||
integrations: () => '/integrations', | ||
integrations_all: () => '/integrations', | ||
integrations_installed: () => '/integrations/installed', | ||
integration_details: ({ pkgkey, panel }) => | ||
`/integrations/detail/${pkgkey}${panel ? `/${panel}` : ''}`, | ||
configurations: () => '/configs', | ||
configurations_list: () => '/configs', | ||
configuration_details: ({ configId, tabId }) => `/configs/${configId}${tabId ? `/${tabId}` : ''}`, | ||
add_datasource_from_configuration: ({ configId }) => `/configs/${configId}/add-datasource`, | ||
add_datasource_from_integration: ({ pkgkey }) => `/integrations/${pkgkey}/add-datasource`, | ||
edit_datasource: ({ configId, datasourceId }) => | ||
`/configs/${configId}/edit-datasource/${datasourceId}`, | ||
fleet: () => '/fleet', | ||
fleet_agent_list: () => '/fleet/agents', | ||
fleet_agent_details: ({ agentId, tabId }) => | ||
`/fleet/agents/${agentId}${tabId ? `/${tabId}` : ''}`, | ||
fleet_enrollment_tokens: () => '/fleet/enrollment-tokens', | ||
data_streams: () => '/data-streams', | ||
}; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,10 +4,28 @@ | |
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import { BASE_PATH } from '../constants'; | ||
import { | ||
BASE_PATH, | ||
StaticPage, | ||
DynamicPage, | ||
DynamicPagePathValues, | ||
pagePathGetters, | ||
} from '../constants'; | ||
import { useCore } from './'; | ||
|
||
export function useLink(path: string = '/') { | ||
const getPath = (page: StaticPage | DynamicPage, values?: DynamicPagePathValues): string => { | ||
return values ? pagePathGetters[page](values) : pagePathGetters[page as StaticPage](); | ||
}; | ||
|
||
export const useLink = () => { | ||
const core = useCore(); | ||
return core.http.basePath.prepend(`${BASE_PATH}#${path}`); | ||
} | ||
return { | ||
getPath: (page: StaticPage | DynamicPage, values?: DynamicPagePathValues) => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why not returning There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. good catch, leftover logic from when I DRY'd |
||
return getPath(page, values); | ||
}, | ||
getHref: (page: StaticPage | DynamicPage, values?: DynamicPagePathValues) => { | ||
const path = getPath(page, values); | ||
return core.http.basePath.prepend(`${BASE_PATH}#${path}`); | ||
}, | ||
}; | ||
}; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I saw the
kuery
param used somewhere. Can we change to something like