Skip to content

Commit

Permalink
[Inventory] Remove inventory dependency from observability plugin (el…
Browse files Browse the repository at this point in the history
…astic#193251)

## Summary

closes elastic#193200 
- Remove inventory dependency from observability plugin
- Register inventory in different section in classic stateful sidenav


https://github.com/user-attachments/assets/6c9c28bc-7483-4deb-b95a-67585a92f89f
  • Loading branch information
kpatticha authored Sep 18, 2024
1 parent f40bf52 commit be2d641
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 49 deletions.
26 changes: 26 additions & 0 deletions x-pack/plugins/observability_solution/inventory/public/plugin.tsx
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
14 changes: 4 additions & 10 deletions x-pack/plugins/observability_solution/observability/kibana.jsonc
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/**/*"]
}

0 comments on commit be2d641

Please sign in to comment.