-
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
[APM] Add Obs side nav and refactor APM templates #101044
Merged
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
619f7dc
[APM] Add Obs side nav and refactor APM templates
sorenlouv 07ce564
Fix tests
sorenlouv 0ef11ee
[APM] Refactor Service tab navigation
sorenlouv 9d96d30
Update test
sorenlouv e754cee
Fix lint issues
sorenlouv df1dcc7
Move `ApmHeaderActionMenu`
sorenlouv f450b8c
Address feedback
sorenlouv 2d2543a
Fix translations
sorenlouv 193397e
Remove unused Fragment
sorenlouv 0b9f002
Merge branch 'master' into add-shared-obs-nav
kibanamachine 9cdab78
Disable flaky cypress test
sorenlouv e0aed46
Remove unused `environmentSelector `
sorenlouv 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
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 |
---|---|---|
|
@@ -5,99 +5,18 @@ | |
* 2.0. | ||
*/ | ||
|
||
import { ApmRoute } from '@elastic/apm-rum-react'; | ||
import euiDarkVars from '@elastic/eui/dist/eui_theme_dark.json'; | ||
import euiLightVars from '@elastic/eui/dist/eui_theme_light.json'; | ||
import React from 'react'; | ||
import ReactDOM from 'react-dom'; | ||
import { Route, Router, Switch } from 'react-router-dom'; | ||
import 'react-vis/dist/style.css'; | ||
import { DefaultTheme, ThemeProvider } from 'styled-components'; | ||
import type { ObservabilityRuleTypeRegistry } from '../../../observability/public'; | ||
import { euiStyled } from '../../../../../src/plugins/kibana_react/common'; | ||
import { ConfigSchema } from '../'; | ||
import { AppMountParameters, CoreStart } from '../../../../../src/core/public'; | ||
import { | ||
KibanaContextProvider, | ||
RedirectAppLinks, | ||
useUiSetting$, | ||
} from '../../../../../src/plugins/kibana_react/public'; | ||
import { routes } from '../components/app/Main/route_config'; | ||
import { ScrollToTopOnPathChange } from '../components/app/Main/ScrollToTopOnPathChange'; | ||
import { | ||
ApmPluginContext, | ||
ApmPluginContextValue, | ||
} from '../context/apm_plugin/apm_plugin_context'; | ||
import { LicenseProvider } from '../context/license/license_context'; | ||
import { UrlParamsProvider } from '../context/url_params_context/url_params_context'; | ||
import { useBreadcrumbs } from '../hooks/use_breadcrumbs'; | ||
import { ApmPluginSetupDeps, ApmPluginStartDeps } from '../plugin'; | ||
import { createCallApmApi } from '../services/rest/createCallApmApi'; | ||
import { createStaticIndexPattern } from '../services/rest/index_pattern'; | ||
import { setHelpExtension } from '../setHelpExtension'; | ||
import { setReadonlyBadge } from '../updateBadge'; | ||
import { AnomalyDetectionJobsContextProvider } from '../context/anomaly_detection_jobs/anomaly_detection_jobs_context'; | ||
|
||
const MainContainer = euiStyled.div` | ||
sorenlouv marked this conversation as resolved.
Show resolved
Hide resolved
|
||
height: 100%; | ||
`; | ||
|
||
function App() { | ||
const [darkMode] = useUiSetting$<boolean>('theme:darkMode'); | ||
|
||
useBreadcrumbs(routes); | ||
|
||
return ( | ||
<ThemeProvider | ||
theme={(outerTheme?: DefaultTheme) => ({ | ||
...outerTheme, | ||
eui: darkMode ? euiDarkVars : euiLightVars, | ||
darkMode, | ||
})} | ||
> | ||
<MainContainer data-test-subj="apmMainContainer" role="main"> | ||
<Route component={ScrollToTopOnPathChange} /> | ||
<Switch> | ||
{routes.map((route, i) => ( | ||
<ApmRoute key={i} {...route} /> | ||
))} | ||
</Switch> | ||
</MainContainer> | ||
</ThemeProvider> | ||
); | ||
} | ||
|
||
export function ApmAppRoot({ | ||
apmPluginContextValue, | ||
startDeps, | ||
}: { | ||
apmPluginContextValue: ApmPluginContextValue; | ||
startDeps: ApmPluginStartDeps; | ||
}) { | ||
const { appMountParameters, core } = apmPluginContextValue; | ||
const { history } = appMountParameters; | ||
const i18nCore = core.i18n; | ||
|
||
return ( | ||
<RedirectAppLinks application={core.application}> | ||
<ApmPluginContext.Provider value={apmPluginContextValue}> | ||
<KibanaContextProvider services={{ ...core, ...startDeps }}> | ||
<i18nCore.Context> | ||
<Router history={history}> | ||
<UrlParamsProvider> | ||
<LicenseProvider> | ||
<AnomalyDetectionJobsContextProvider> | ||
<App /> | ||
</AnomalyDetectionJobsContextProvider> | ||
</LicenseProvider> | ||
</UrlParamsProvider> | ||
</Router> | ||
</i18nCore.Context> | ||
</KibanaContextProvider> | ||
</ApmPluginContext.Provider> | ||
</RedirectAppLinks> | ||
); | ||
} | ||
import { ApmAppRoot } from '../components/routing/app_root'; | ||
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. Moved all of this to the routing section (which contains routing and templating) |
||
|
||
/** | ||
* This module is rendered asynchronously in the Kibana platform. | ||
|
@@ -141,7 +60,7 @@ export const renderApp = ({ | |
ReactDOM.render( | ||
<ApmAppRoot | ||
apmPluginContextValue={apmPluginContextValue} | ||
startDeps={pluginsStart} | ||
pluginsStart={pluginsStart} | ||
/>, | ||
element | ||
); | ||
|
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
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.
This is needed due to a console error introduced in #95903 (comment)
I don't think the console error in itself is an issue but it made it a bit harder to make the changes needed for this PR when the console contained unrelated errors.