Skip to content
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

Use Observability Page Template from Observability Shared in APM and Profiling #154776

Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion x-pack/packages/ml/agg_utils/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"@kbn/ml-is-populated-object",
"@kbn/ml-string-hash",
"@kbn/data-views-plugin",
"@kbn/ml-random-sampler-utils"
"@kbn/ml-random-sampler-utils",
],
"exclude": [
"target/**/*",
Expand Down
6 changes: 2 additions & 4 deletions x-pack/plugins/apm/kibana.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,7 @@
"id": "apm",
"server": true,
"browser": true,
"configPath": [
"xpack",
"apm"
],
"configPath": ["xpack", "apm"],
"requiredPlugins": [
"data",
"embeddable",
Expand All @@ -19,6 +16,7 @@
"inspector",
"licensing",
"observability",
"observabilityShared",
"exploratoryView",
"ruleRegistry",
"triggersActionsUi",
Expand Down
1 change: 1 addition & 0 deletions x-pack/plugins/apm/public/application/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ export const renderApp = ({
data: pluginsStart.data,
inspector: pluginsStart.inspector,
observability: pluginsStart.observability,
observabilityShared: pluginsStart.observabilityShared,
observabilityRuleTypeRegistry,
dataViews: pluginsStart.dataViews,
unifiedSearch: pluginsStart.unifiedSearch,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ const pageHeader = {

function ErrorWithTemplate({ error }: { error: Error }) {
const { services } = useKibana<ApmPluginStartDeps>();
const { observability } = services;
const { observabilityShared } = services;

const ObservabilityPageTemplate = observability.navigation.PageTemplate;
const ObservabilityPageTemplate = observabilityShared.navigation.PageTemplate;

if (error instanceof NotFoundRouteException) {
return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import { EuiPageHeaderProps } from '@elastic/eui';
import { useKibana } from '@kbn/kibana-react-plugin/public';
import { ObservabilityPageTemplateProps } from '@kbn/observability-plugin/public/components/shared/page_template/page_template';
import { ObservabilityPageTemplateProps } from '@kbn/observability-shared-plugin/public';
import type { KibanaPageTemplateProps } from '@kbn/shared-ux-page-kibana-template';
import React from 'react';
import { useLocation } from 'react-router-dom';
Expand Down Expand Up @@ -54,10 +54,10 @@ export function ApmMainTemplate({
const location = useLocation();

const { services } = useKibana<ApmPluginStartDeps>();
const { http, docLinks, observability, application } = services;
const { http, docLinks, observabilityShared, application } = services;
const basePath = http?.basePath.get();

const ObservabilityPageTemplate = observability.navigation.PageTemplate;
const ObservabilityPageTemplate = observabilityShared.navigation.PageTemplate;

const { data, status } = useFetcher((callApmApi) => {
return callApmApi('GET /internal/apm/has_data');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { SettingsTemplate } from './settings_template';
type Args = ComponentProps<typeof SettingsTemplate>;

const coreMock = {
observability: {
observabilityShared: {
navigation: {
PageTemplate: () => {
return <>hello world</>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ const mockCorePlugins = {
inspector: {},
maps: {},
observability: {},
observabilityShared: {},
data: {},
};

Expand Down
8 changes: 7 additions & 1 deletion x-pack/plugins/apm/public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ import type { LicensingPluginSetup } from '@kbn/licensing-plugin/public';
import type { MapsStartApi } from '@kbn/maps-plugin/public';
import type { MlPluginSetup, MlPluginStart } from '@kbn/ml-plugin/public';
import type { SharePluginSetup } from '@kbn/share-plugin/public';
import type {
ObservabilitySharedPluginSetup,
ObservabilitySharedPluginStart,
} from '@kbn/observability-shared-plugin/public';
import {
FetchDataParams,
METRIC_TYPE,
Expand Down Expand Up @@ -80,6 +84,7 @@ export interface ApmPluginSetupDeps {
licensing: LicensingPluginSetup;
ml?: MlPluginSetup;
observability: ObservabilityPublicSetup;
observabilityShared: ObservabilitySharedPluginSetup;
triggersActionsUi: TriggersAndActionsUIPublicPluginSetup;
share: SharePluginSetup;
}
Expand All @@ -96,6 +101,7 @@ export interface ApmPluginStartDeps {
ml?: MlPluginStart;
triggersActionsUi: TriggersAndActionsUIPublicPluginStart;
observability: ObservabilityPublicStart;
observabilityShared: ObservabilitySharedPluginStart;
fleet?: FleetStart;
fieldFormats?: FieldFormatsStart;
security?: SecurityPluginStart;
Expand Down Expand Up @@ -162,7 +168,7 @@ export class ApmPlugin implements Plugin<ApmPluginSetup, ApmPluginStart> {
}

// register observability nav if user has access to plugin
plugins.observability.navigation.registerSections(
plugins.observabilityShared.navigation.registerSections(
from(core.getStartServices()).pipe(
map(([coreStart, pluginsStart]) => {
if (coreStart.application.capabilities.apm.show) {
Expand Down
1 change: 1 addition & 0 deletions x-pack/plugins/apm/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@
"@kbn/alerts-as-data-utils",
"@kbn/exploratory-view-plugin",
"@kbn/logging-mocks",
"@kbn/observability-shared-plugin",
],
"exclude": [
"target/**/*",
Expand Down
2 changes: 1 addition & 1 deletion x-pack/plugins/profiling/public/plugin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ export class ProfilingPlugin implements Plugin {
})
);

pluginsSetup.observability.navigation.registerSections(section$);
pluginsSetup.observabilityShared.navigation.registerSections(section$);

coreSetup.application.register({
id: 'profiling',
Expand Down
2 changes: 2 additions & 0 deletions x-pack/plugins/profiling/public/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,12 @@ import type {
ObservabilityPublicSetup,
ObservabilityPublicStart,
} from '@kbn/observability-plugin/public';
import { ObservabilitySharedPluginSetup } from '@kbn/observability-shared-plugin/public/plugin';
import { ChartsPluginSetup, ChartsPluginStart } from '@kbn/charts-plugin/public';

export interface ProfilingPluginPublicSetupDeps {
observability: ObservabilityPublicSetup;
observabilityShared: ObservabilitySharedPluginSetup;
dataViews: DataViewsPublicPluginSetup;
data: DataPublicPluginSetup;
charts: ChartsPluginSetup;
Expand Down
1 change: 1 addition & 0 deletions x-pack/plugins/profiling/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
"@kbn/i18n-react",
"@kbn/ml-plugin",
"@kbn/share-plugin",
"@kbn/observability-shared-plugin",
// add references to other TypeScript projects the plugin depends on

// requiredPlugins from ./kibana.json
Expand Down