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

[8.x] [Inventory] Remove inventory dependency from observability plugin (#193251) #193344

Merged
merged 1 commit into from
Sep 18, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import React from 'react';
import ReactDOM from 'react-dom';
import { i18n } from '@kbn/i18n';
import { from, map } from 'rxjs';
import {
AppMountParameters,
APP_WRAPPER_CLASS,
Expand Down Expand Up @@ -49,6 +50,31 @@ export class InventoryPlugin
): InventoryPublicSetup {
const inventoryAPIClient = createCallInventoryAPI(coreSetup);

pluginsSetup.observabilityShared.navigation.registerSections(
from(coreSetup.getStartServices()).pipe(
map(([coreStart, pluginsStart]) => {
return [
{
label: '',
sortKey: 101,
entries: [
{
label: i18n.translate('xpack.inventory.inventoryLinkTitle', {
defaultMessage: 'Inventory',
}),
app: INVENTORY_APP_ID,
path: '/',
matchPath(currentPath: string) {
return ['/', ''].some((testPath) => currentPath.startsWith(testPath));
},
},
],
},
];
})
)
);

coreSetup.application.register({
id: INVENTORY_APP_ID,
title: i18n.translate('xpack.inventory.appTitle', {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,7 @@
"id": "observability",
"server": true,
"browser": true,
"configPath": [
"xpack",
"observability"
],
"configPath": ["xpack", "observability"],
"requiredPlugins": [
"aiops",
"alerting",
Expand Down Expand Up @@ -52,19 +49,16 @@
"serverless",
"guidedOnboarding",
"observabilityAIAssistant",
"investigate",
"inventory"
"investigate"
],
"requiredBundles": [
"data",
"kibanaReact",
"kibanaUtils",
"unifiedSearch",
"stackAlerts",
"spaces",
"spaces"
],
"extraPublicDirs": [
"common"
]
"extraPublicDirs": ["common"]
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -49,22 +49,6 @@ export function createNavTree(pluginsStart: ObservabilityPublicPluginsStart) {
return pathNameSerialized.startsWith(prepend('/app/dashboards'));
},
},
...(pluginsStart.inventory
? [
{
link: 'inventory' as const,
getIsActive: ({
pathNameSerialized,
prepend,
}: {
pathNameSerialized: string;
prepend: (path: string) => string;
}) => {
return pathNameSerialized.startsWith(prepend('/app/observability/inventory'));
},
},
]
: []),
{
link: 'observability-overview:alerts',
},
Expand All @@ -83,6 +67,9 @@ export function createNavTree(pluginsStart: ObservabilityPublicPluginsStart) {
{
link: 'slo',
},
{
link: 'inventory',
},
{
id: 'aiMl',
title: i18n.translate('xpack.observability.obltNav.ml.aiAndMlGroupTitle', {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,9 @@ import { BehaviorSubject, from, map, mergeMap } from 'rxjs';

import type { AiopsPluginStart } from '@kbn/aiops-plugin/public/types';
import type { DataViewFieldEditorStart } from '@kbn/data-view-field-editor-plugin/public';
import { INVENTORY_APP_ID } from '@kbn/deeplinks-observability/constants';
import type { EmbeddableSetup } from '@kbn/embeddable-plugin/public';
import type { ExploratoryViewPublicStart } from '@kbn/exploratory-view-plugin/public';
import type { GuidedOnboardingPluginStart } from '@kbn/guided-onboarding-plugin/public';
import type { InventoryPublicSetup, InventoryPublicStart } from '@kbn/inventory-plugin/public';
import type { InvestigatePublicStart } from '@kbn/investigate-plugin/public';
import type { LicenseManagementUIPluginSetup } from '@kbn/license-management-plugin/public';
import type { LicensingPluginStart } from '@kbn/licensing-plugin/public';
Expand Down Expand Up @@ -126,7 +124,6 @@ export interface ObservabilityPublicPluginsSetup {
licensing: LicensingPluginSetup;
serverless?: ServerlessPluginSetup;
presentationUtil?: PresentationUtilPluginStart;
inventory?: InventoryPublicSetup;
}
export interface ObservabilityPublicPluginsStart {
actionTypeRegistry: ActionTypeRegistryContract;
Expand Down Expand Up @@ -165,7 +162,6 @@ export interface ObservabilityPublicPluginsStart {
dataViewFieldEditor: DataViewFieldEditorStart;
toastNotifications: ToastsStart;
investigate?: InvestigatePublicStart;
inventory?: InventoryPublicStart;
}
export type ObservabilityPublicStart = ReturnType<Plugin['start']>;

Expand Down Expand Up @@ -361,18 +357,6 @@ export class Plugin
]
: [];

const inventoryLink = pluginsSetup.inventory
? [
{
label: i18n.translate('xpack.observability.inventoryLinkTitle', {
defaultMessage: 'Inventory',
}),
app: INVENTORY_APP_ID,
path: '',
},
]
: [];

const isAiAssistantEnabled =
pluginsStart.observabilityAIAssistant?.service.isEnabled();

Expand Down Expand Up @@ -436,7 +420,6 @@ export class Plugin
sortKey: 100,
entries: [
...overviewLink,
...inventoryLink,
...alertsLink,
...sloLink,
...casesLink,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"public/**/*.json",
"server/**/*",
"typings/**/*",
"../../../../typings/**/*",
"../../../../typings/**/*"
],
"kbn_references": [
"@kbn/rule-data-utils",
Expand Down Expand Up @@ -94,7 +94,6 @@
"@kbn/home-plugin",
"@kbn/data-view-field-editor-plugin",
"@kbn/guided-onboarding-plugin",
"@kbn/inventory-plugin",
"@kbn/investigate-plugin",
"@kbn/license-management-plugin",
"@kbn/presentation-util-plugin",
Expand All @@ -114,9 +113,7 @@
"@kbn/io-ts-utils",
"@kbn/core-ui-settings-server-mocks",
"@kbn/es-types",
"@kbn/logging-mocks",
"@kbn/logging-mocks"
],
"exclude": [
"target/**/*"
]
"exclude": ["target/**/*"]
}