-
Notifications
You must be signed in to change notification settings - Fork 58
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
[Navigation] Register all plugins to NavGroups #1926
Changes from 6 commits
43ff505
27641b5
bfa82c8
1519828
f5e26f3
6abb8ed
60ebb7c
393815a
9b58c3a
1488866
289451c
30e164a
080c17c
ec684c5
493c16c
7825747
65fc08c
f7a416d
6c821ed
8bdc12a
ef393c7
59e5500
2b92e6e
6fdc251
158c8a7
17994c2
1917733
7396203
0bbc6d4
453f171
50d44d4
4755904
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,7 @@ | |
import { EuiGlobalToastList } from '@elastic/eui'; | ||
import { Toast } from '@elastic/eui/src/components/toast/global_toast_list'; | ||
import React, { ReactChild, useEffect, useState } from 'react'; | ||
import { HashRouter, Route, RouteComponentProps } from 'react-router-dom'; | ||
import { HashRouter, Route, RouteComponentProps, Redirect } from 'react-router-dom'; | ||
import { | ||
ChromeBreadcrumb, | ||
ChromeStart, | ||
|
@@ -44,6 +44,7 @@ | |
dataSourceManagement: DataSourceManagementPluginSetup; | ||
setActionMenu: (menuMount: MountPoint | undefined) => void; | ||
savedObjectsMDSClient: SavedObjectsStart; | ||
defaultRoute?: string; | ||
} | ||
|
||
interface HomeProps extends RouteComponentProps, TraceAnalyticsCoreDeps {} | ||
|
@@ -69,7 +70,7 @@ | |
}: { | ||
spanId: string; | ||
isFlyoutVisible: boolean; | ||
addSpanFilter: (field: string, value: any) => void; | ||
spanMode: TraceAnalyticsMode; | ||
spanDataSourceMDSId: string; | ||
}) => void; | ||
|
@@ -119,6 +120,7 @@ | |
|
||
const [dataSourceMDSId, setDataSourceMDSId] = useState([{ id: '', label: '' }]); | ||
const [currentSelectedService, setCurrentSelectedService] = useState(''); | ||
const { defaultRoute = '/services' } = props; | ||
|
||
useEffect(() => { | ||
handleDataPrepperIndicesExistRequest( | ||
|
@@ -127,7 +129,7 @@ | |
dataSourceMDSId[0].id | ||
); | ||
handleJaegerIndicesExistRequest(props.http, setJaegerIndicesExist, dataSourceMDSId[0].id); | ||
}, [dataSourceMDSId]); | ||
|
||
const modes = [ | ||
{ id: 'jaeger', title: 'Jaeger', 'data-test-subj': 'jaeger-mode' }, | ||
|
@@ -161,7 +163,7 @@ | |
const serviceBreadcrumbs = [ | ||
{ | ||
text: 'Trace analytics', | ||
href: '#/', | ||
href: '#/services', | ||
}, | ||
{ | ||
text: 'Services', | ||
|
@@ -172,7 +174,7 @@ | |
const traceBreadcrumbs = [ | ||
{ | ||
text: 'Trace analytics', | ||
href: '#/', | ||
href: '#/services', | ||
}, | ||
{ | ||
text: 'Traces', | ||
|
@@ -326,7 +328,7 @@ | |
/> | ||
<Route | ||
exact | ||
path={['/services', '/']} | ||
path={['/services']} | ||
render={(_routerProps) => ( | ||
<TraceSideBar> | ||
<Services | ||
|
@@ -364,6 +366,7 @@ | |
/> | ||
)} | ||
/> | ||
<Route path="/" render={() => <Redirect to={defaultRoute} />} /> | ||
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 this change? 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. Because we need to remove in-app navigation when the new navigation is enabled. In such case, different apps registered to new left navigation will have difference landing pages. |
||
</HashRouter> | ||
{flyout} | ||
{spanFlyoutComponent} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -50,7 +50,10 @@ import { | |
observabilityPanelsID, | ||
observabilityPanelsPluginOrder, | ||
observabilityPanelsTitle, | ||
observabilityPanelsTitleForNav, | ||
observabilityPluginOrder, | ||
observabilityServicesPluginOrder, | ||
observabilityServicesTitle, | ||
observabilityTracesID, | ||
observabilityTracesPluginOrder, | ||
observabilityTracesTitle, | ||
|
@@ -108,6 +111,7 @@ import { | |
SetupDependencies, | ||
} from './types'; | ||
import { TablesFlyout } from './components/event_analytics/explorer/datasources/tables_flyout'; | ||
import { registerAllPluginNavGroups } from './plugin_nav'; | ||
|
||
interface PublicConfig { | ||
query_assist: { | ||
|
@@ -267,7 +271,9 @@ export class ObservabilityPlugin | |
// prometheus: openSearchLocalDataSourcePluggable | ||
}; | ||
|
||
const appMountWithStartPage = (startPage: string) => async (params: AppMountParameters) => { | ||
const appMountWithStartPage = (startPage: string, defaultRoute?: string) => async ( | ||
params: AppMountParameters | ||
) => { | ||
const { Observability } = await import('./components/index'); | ||
const [coreStart, depsStart] = await core.getStartServices(); | ||
const dslService = new DSLService(coreStart.http); | ||
|
@@ -286,7 +292,8 @@ export class ObservabilityPlugin | |
startPage, | ||
dataSourcePluggables, // just pass down for now due to time constraint, later may better expose this as context | ||
dataSourceManagement, | ||
coreStart.savedObjects | ||
coreStart.savedObjects, | ||
defaultRoute | ||
); | ||
}; | ||
|
||
|
@@ -322,6 +329,24 @@ export class ObservabilityPlugin | |
mount: appMountWithStartPage('traces'), | ||
}); | ||
|
||
if (core.chrome.navGroup.getNavGroupEnabled()) { | ||
core.application.register({ | ||
id: 'observability-traces-nav', | ||
title: observabilityTracesTitle, | ||
order: observabilityTracesPluginOrder, | ||
category: DEFAULT_APP_CATEGORIES.investigate, | ||
mount: appMountWithStartPage('traces', '/traces'), | ||
}); | ||
|
||
core.application.register({ | ||
id: 'observability-services-nav', | ||
title: observabilityServicesTitle, | ||
order: observabilityServicesPluginOrder, | ||
category: DEFAULT_APP_CATEGORIES.investigate, | ||
mount: appMountWithStartPage('traces', '/services'), | ||
}); | ||
} | ||
|
||
core.application.register({ | ||
id: observabilityNotebookID, | ||
title: observabilityNotebookTitle, | ||
|
@@ -330,13 +355,23 @@ export class ObservabilityPlugin | |
mount: appMountWithStartPage('notebooks'), | ||
}); | ||
|
||
core.application.register({ | ||
id: observabilityPanelsID, | ||
title: observabilityPanelsTitle, | ||
category: OBSERVABILITY_APP_CATEGORIES.observability, | ||
order: observabilityPanelsPluginOrder, | ||
mount: appMountWithStartPage('dashboards'), | ||
}); | ||
if (core.chrome.navGroup.getNavGroupEnabled()) { | ||
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. Just for my knowledge, is this like a feature flag? 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. Yes, the navigation change can be toggled, and the UI plan currently list regular dashboards as going into the same category. Until it is depreciated the idea was to rename ours for clarity while using the new navigation. |
||
core.application.register({ | ||
id: observabilityPanelsID, | ||
title: observabilityPanelsTitleForNav, | ||
category: OBSERVABILITY_APP_CATEGORIES.observability, | ||
order: observabilityPanelsPluginOrder, | ||
mount: appMountWithStartPage('dashboards'), | ||
}); | ||
} else { | ||
core.application.register({ | ||
id: observabilityPanelsID, | ||
title: observabilityPanelsTitle, | ||
category: OBSERVABILITY_APP_CATEGORIES.observability, | ||
order: observabilityPanelsPluginOrder, | ||
mount: appMountWithStartPage('dashboards'), | ||
}); | ||
} | ||
|
||
core.application.register({ | ||
id: observabilityIntegrationsID, | ||
|
@@ -346,6 +381,8 @@ export class ObservabilityPlugin | |
mount: appMountWithStartPage('integrations'), | ||
}); | ||
|
||
registerAllPluginNavGroups(core); | ||
|
||
core.application.register({ | ||
id: observabilityDataConnectionsID, | ||
title: observabilityDataConnectionsTitle, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,138 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
import { | ||
observabilityApplicationsID, | ||
observabilityIntegrationsID, | ||
observabilityLogsID, | ||
observabilityMetricsID, | ||
observabilityNotebookID, | ||
observabilityPanelsID, | ||
observabilityTracesID, | ||
} from '../common/constants/shared'; | ||
import { CoreSetup } from '../../../src/core/public'; | ||
import { AppPluginStartDependencies } from './types'; | ||
import { DEFAULT_NAV_GROUPS, DEFAULT_APP_CATEGORIES } from '../../../src/core/public'; | ||
|
||
export function registerAllPluginNavGroups(core: CoreSetup<AppPluginStartDependencies>) { | ||
core.chrome.navGroup.addNavLinksToGroup(DEFAULT_NAV_GROUPS.observability, [ | ||
TackAdam marked this conversation as resolved.
Show resolved
Hide resolved
|
||
{ | ||
id: observabilityApplicationsID, | ||
category: DEFAULT_APP_CATEGORIES.dashboardAndReport, | ||
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. OSD core has changed the category to visualizeAndReport but keep the |
||
}, | ||
]); | ||
|
||
core.chrome.navGroup.addNavLinksToGroup(DEFAULT_NAV_GROUPS.observability, [ | ||
{ | ||
id: observabilityLogsID, | ||
category: DEFAULT_APP_CATEGORIES.investigate, | ||
}, | ||
]); | ||
core.chrome.navGroup.addNavLinksToGroup(DEFAULT_NAV_GROUPS[`security-analytics`], [ | ||
{ | ||
id: observabilityLogsID, | ||
category: DEFAULT_APP_CATEGORIES.investigate, | ||
}, | ||
]); | ||
core.chrome.navGroup.addNavLinksToGroup(DEFAULT_NAV_GROUPS.analytics, [ | ||
{ | ||
id: observabilityLogsID, | ||
category: DEFAULT_APP_CATEGORIES.investigate, | ||
}, | ||
]); | ||
core.chrome.navGroup.addNavLinksToGroup(DEFAULT_NAV_GROUPS.search, [ | ||
{ | ||
id: observabilityLogsID, | ||
category: DEFAULT_APP_CATEGORIES.analyzeSearch, | ||
}, | ||
]); | ||
|
||
core.chrome.navGroup.addNavLinksToGroup(DEFAULT_NAV_GROUPS.observability, [ | ||
{ | ||
id: observabilityMetricsID, | ||
category: DEFAULT_APP_CATEGORIES.investigate, | ||
}, | ||
]); | ||
|
||
core.chrome.navGroup.addNavLinksToGroup(DEFAULT_NAV_GROUPS.observability, [ | ||
{ | ||
id: observabilityTracesID, | ||
category: DEFAULT_APP_CATEGORIES.investigate, | ||
}, | ||
]); | ||
|
||
core.chrome.navGroup.addNavLinksToGroup(DEFAULT_NAV_GROUPS.observability, [ | ||
{ | ||
id: observabilityNotebookID, | ||
category: DEFAULT_APP_CATEGORIES.dashboardAndReport, | ||
TackAdam marked this conversation as resolved.
Show resolved
Hide resolved
|
||
}, | ||
]); | ||
core.chrome.navGroup.addNavLinksToGroup(DEFAULT_NAV_GROUPS[`security-analytics`], [ | ||
{ | ||
id: observabilityNotebookID, | ||
category: DEFAULT_APP_CATEGORIES.dashboardAndReport, | ||
TackAdam marked this conversation as resolved.
Show resolved
Hide resolved
|
||
}, | ||
]); | ||
core.chrome.navGroup.addNavLinksToGroup(DEFAULT_NAV_GROUPS.analytics, [ | ||
{ | ||
id: observabilityNotebookID, | ||
category: DEFAULT_APP_CATEGORIES.dashboardAndReport, | ||
TackAdam marked this conversation as resolved.
Show resolved
Hide resolved
|
||
}, | ||
]); | ||
|
||
core.chrome.navGroup.addNavLinksToGroup(DEFAULT_NAV_GROUPS.observability, [ | ||
{ | ||
id: observabilityPanelsID, | ||
category: DEFAULT_APP_CATEGORIES.dashboardAndReport, | ||
}, | ||
]); | ||
core.chrome.navGroup.addNavLinksToGroup(DEFAULT_NAV_GROUPS[`security-analytics`], [ | ||
{ | ||
id: observabilityPanelsID, | ||
category: DEFAULT_APP_CATEGORIES.dashboardAndReport, | ||
}, | ||
]); | ||
core.chrome.navGroup.addNavLinksToGroup(DEFAULT_NAV_GROUPS.analytics, [ | ||
{ | ||
id: observabilityPanelsID, | ||
category: DEFAULT_APP_CATEGORIES.dashboardAndReport, | ||
}, | ||
]); | ||
core.chrome.navGroup.addNavLinksToGroup(DEFAULT_NAV_GROUPS.search, [ | ||
{ | ||
id: observabilityPanelsID, | ||
category: DEFAULT_APP_CATEGORIES.analyzeSearch, | ||
}, | ||
]); | ||
|
||
core.chrome.navGroup.addNavLinksToGroup(DEFAULT_NAV_GROUPS.observability, [ | ||
{ | ||
id: observabilityIntegrationsID, | ||
category: DEFAULT_APP_CATEGORIES.dashboardAndReport, | ||
TackAdam marked this conversation as resolved.
Show resolved
Hide resolved
|
||
}, | ||
]); | ||
core.chrome.navGroup.addNavLinksToGroup(DEFAULT_NAV_GROUPS[`security-analytics`], [ | ||
{ | ||
id: observabilityIntegrationsID, | ||
category: DEFAULT_APP_CATEGORIES.dashboardAndReport, | ||
TackAdam marked this conversation as resolved.
Show resolved
Hide resolved
|
||
}, | ||
]); | ||
core.chrome.navGroup.addNavLinksToGroup(DEFAULT_NAV_GROUPS.analytics, [ | ||
{ | ||
id: observabilityIntegrationsID, | ||
category: DEFAULT_APP_CATEGORIES.dashboardAndReport, | ||
TackAdam marked this conversation as resolved.
Show resolved
Hide resolved
|
||
}, | ||
]); | ||
|
||
core.chrome.navGroup.addNavLinksToGroup(DEFAULT_NAV_GROUPS.analytics, [ | ||
{ | ||
id: 'observability-traces-nav', | ||
category: DEFAULT_APP_CATEGORIES.investigate, | ||
}, | ||
{ | ||
id: 'observability-services-nav', | ||
category: DEFAULT_APP_CATEGORIES.investigate, | ||
}, | ||
]); | ||
} |
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.
can't change this here as it also changes in the name existing side-nav
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.
+1