Skip to content

Commit

Permalink
[Inventory] Use observability:entitycentricexperience to enable + sid…
Browse files Browse the repository at this point in the history
…e nav adjustments (#193533)

## Summary

Closes #192323 and
#193393.

### Plugin enablement
The enablement of the new Inventory plugin was previously managed via
the `xpack.inventory.enabled` setting in kibana.yml. With this PR, we
transition to enabling it through the
`observability:entitycentricexperience` advanced setting.


### Position in side nav
Additionally, this PR includes adjustments to the placement of the new
Inventory page within the side navigation and the addition of the "Tech
Preview" badge in the navigation where it was supported.

|Navigation|Screenshot|
|-|-|
|Stateful classic (first nav)|![Screenshot 2024-09-25 at 11 25
46](https://github.com/user-attachments/assets/54e92632-9931-4f5b-8648-8a32afcd0caf)|
|Stateful classic (O11y)|![Screenshot 2024-09-25 at 11 25
56](https://github.com/user-attachments/assets/ae644eb2-2559-4be0-8659-ef709399a871)|
|Stateful new O11y|![Screenshot 2024-09-25 at 11 27
52](https://github.com/user-attachments/assets/c404232c-2630-4220-9bb8-315b0f0fc55f)|
|Serverless|![Screenshot 2024-09-25 at 11 23
07](https://github.com/user-attachments/assets/7f7e6c79-7f0f-4f7d-8fed-260d73ad4d3f)|


### Global search
A modification was made to the global search to prevent a duplicate
result from appearing during searches by removing the deeplinks when
registering the plugin. The UI changes are shown below.

>[!WARNING]
If this modification causes any other issues, please let me know in a
comment.

|With deeplink (before)|Without deeplink (after)|
|-|-|

|![global_search_with_deeplink](https://github.com/user-attachments/assets/3ef5641c-3add-4892-af2f-46f72ff1722e)|![global_search_without_deeplink](https://github.com/user-attachments/assets/8ad92f27-13a2-4b85-8958-588e597f94d9)|

### Services rename to Service Inventory
Another needed change was to rename the nav item Services to Service
Inventory

>[!NOTE] 
Screenshots were taken before the navigation sorting was agreed with
product, so the "Inventory" item does not appear in the right position.

|Navigation|Screenshot|
|-|-|
|Stateful classic
(O11y)|![services_stateful_classic](https://github.com/user-attachments/assets/25ed1294-40fe-47be-9319-fe294acce8f8)|
|Stateful new
O11y|![services_stateful_new](https://github.com/user-attachments/assets/4ae9495c-56bc-4327-b2f6-b6ac9f68bd21)|

|Serverless|![services_serverless](https://github.com/user-attachments/assets/81ff51f4-3b0e-41fd-b7c6-79e8aa44e575)|

>[!NOTE] 
The rename of infra Inventory to Infrastructure Inventory is being
tracked separately in #192324.


### Tech preview badge in page
Lastly, the "Technical Preview" badge has been added to the page title.

>[!NOTE] 
The screenshot was taken before the navigation sorting was agreed with
product, so the "Inventory" item does not appear in the right position.



![inventory_title_badge](https://github.com/user-attachments/assets/172c5b8e-258e-4127-b792-40910e9dede0)


### Plugin registration in server
To make the Inventory available in the spaces and privileges
configuration the plugin has been registered in the features service.

>[!WARNING]
I lack detailed context in this area, so I’ve added default empty
configurations for most attributes. If any adjustments or improvements
are needed, please let me know.

|Space config|Privileges|
|-|-|
|![Screenshot 2024-09-23 at 10 57
35](https://github.com/user-attachments/assets/1c3a45b6-fd67-4706-8fc4-ee42a9206787)|![Screenshot
2024-09-23 at 10 57
14](https://github.com/user-attachments/assets/a852c15d-133c-459d-be77-2d73e662ffdb)|

---------

Co-authored-by: Kate Patticha <[email protected]>
Co-authored-by: kibanamachine <[email protected]>
  • Loading branch information
3 people authored Sep 30, 2024
1 parent 23effbe commit 26f5e14
Show file tree
Hide file tree
Showing 18 changed files with 282 additions and 57 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ export const applicationUsageSchema = {
fleet: commonSchema,
integrations: commonSchema,
ingestManager: commonSchema,
inventory: commonSchema,
lens: commonSchema,
maps: commonSchema,
ml: commonSchema,
Expand Down
131 changes: 131 additions & 0 deletions src/plugins/telemetry/schema/oss_plugins.json
Original file line number Diff line number Diff line change
Expand Up @@ -4194,6 +4194,137 @@
}
}
},
"inventory": {
"properties": {
"appId": {
"type": "keyword",
"_meta": {
"description": "The application being tracked"
}
},
"viewId": {
"type": "keyword",
"_meta": {
"description": "Always `main`"
}
},
"clicks_total": {
"type": "long",
"_meta": {
"description": "General number of clicks in the application since we started counting them"
}
},
"clicks_7_days": {
"type": "long",
"_meta": {
"description": "General number of clicks in the application over the last 7 days"
}
},
"clicks_30_days": {
"type": "long",
"_meta": {
"description": "General number of clicks in the application over the last 30 days"
}
},
"clicks_90_days": {
"type": "long",
"_meta": {
"description": "General number of clicks in the application over the last 90 days"
}
},
"minutes_on_screen_total": {
"type": "float",
"_meta": {
"description": "Minutes the application is active and on-screen since we started counting them."
}
},
"minutes_on_screen_7_days": {
"type": "float",
"_meta": {
"description": "Minutes the application is active and on-screen over the last 7 days"
}
},
"minutes_on_screen_30_days": {
"type": "float",
"_meta": {
"description": "Minutes the application is active and on-screen over the last 30 days"
}
},
"minutes_on_screen_90_days": {
"type": "float",
"_meta": {
"description": "Minutes the application is active and on-screen over the last 90 days"
}
},
"views": {
"type": "array",
"items": {
"properties": {
"appId": {
"type": "keyword",
"_meta": {
"description": "The application being tracked"
}
},
"viewId": {
"type": "keyword",
"_meta": {
"description": "The application view being tracked"
}
},
"clicks_total": {
"type": "long",
"_meta": {
"description": "General number of clicks in the application sub view since we started counting them"
}
},
"clicks_7_days": {
"type": "long",
"_meta": {
"description": "General number of clicks in the active application sub view over the last 7 days"
}
},
"clicks_30_days": {
"type": "long",
"_meta": {
"description": "General number of clicks in the active application sub view over the last 30 days"
}
},
"clicks_90_days": {
"type": "long",
"_meta": {
"description": "General number of clicks in the active application sub view over the last 90 days"
}
},
"minutes_on_screen_total": {
"type": "float",
"_meta": {
"description": "Minutes the application sub view is active and on-screen since we started counting them."
}
},
"minutes_on_screen_7_days": {
"type": "float",
"_meta": {
"description": "Minutes the application is active and on-screen active application sub view over the last 7 days"
}
},
"minutes_on_screen_30_days": {
"type": "float",
"_meta": {
"description": "Minutes the application is active and on-screen active application sub view over the last 30 days"
}
},
"minutes_on_screen_90_days": {
"type": "float",
"_meta": {
"description": "Minutes the application is active and on-screen active application sub view over the last 90 days"
}
}
}
}
}
}
},
"lens": {
"properties": {
"appId": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ describe('APM deep links', () => {
.type('APM', { force: true, delay: 100 })
.focus();
cy.contains('APM');
cy.contains('APM / Services');
cy.contains('APM / Service Inventory');
cy.contains('APM / Service groups');
cy.contains('APM / Traces');
cy.contains('APM / Service Map');
Expand All @@ -33,7 +33,7 @@ describe('APM deep links', () => {
.should('be.visible')
.type('APM', { force: true, delay: 100 });
// navigates to services page
cy.contains('APM / Services').click({ force: true });
cy.contains('APM / Service Inventory').click({ force: true });
cy.url().should('include', '/apm/services');

cy.getByTestSubj('nav-search-input')
Expand Down
2 changes: 1 addition & 1 deletion x-pack/plugins/observability_solution/apm/public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ const applicationsTitle = i18n.translate('xpack.apm.navigation.rootTitle', {
});

const servicesTitle = i18n.translate('xpack.apm.navigation.servicesTitle', {
defaultMessage: 'Services',
defaultMessage: 'Service Inventory',
});

const serviceGroupsTitle = i18n.translate('xpack.apm.navigation.serviceGroupsTitle', {
Expand Down
6 changes: 3 additions & 3 deletions x-pack/plugins/observability_solution/inventory/kibana.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@
"entityManager",
"inference",
"dataViews",
"share",
"features",
"unifiedSearch",
"data",
"share"
],
"requiredBundles": [
"kibanaReact"
],
"requiredBundles": ["kibanaReact"],
"optionalPlugins": [],
"extraPublicDirs": []
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
import { EuiFlexGroup, EuiFlexItem } from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import React from 'react';
import { EuiEmptyPrompt, EuiLoadingLogo } from '@elastic/eui';
import { EuiFlexGroup, EuiFlexItem, EuiEmptyPrompt, EuiLoadingLogo } from '@elastic/eui';
import { TechnicalPreviewBadge } from '@kbn/observability-shared-plugin/public';
import { useKibana } from '../../hooks/use_kibana';
import { SearchBar } from '../search_bar';
import { getEntityManagerEnablement } from './no_data_config';
Expand All @@ -16,11 +16,18 @@ import { Welcome } from '../entity_enablement/welcome_modal';
import { useInventoryAbortableAsync } from '../../hooks/use_inventory_abortable_async';
import { EmptyState } from '../empty_states/empty_state';

const pageTitle = {
pageTitle: i18n.translate('xpack.inventory.inventoryPageHeaderLabel', {
defaultMessage: 'Inventory',
}),
};
const pageTitle = (
<EuiFlexGroup gutterSize="s">
<EuiFlexItem grow={false}>
{i18n.translate('xpack.inventory.inventoryPageHeaderLabel', {
defaultMessage: 'Inventory',
})}
</EuiFlexItem>
<EuiFlexItem grow={false}>
<TechnicalPreviewBadge />
</EuiFlexItem>
</EuiFlexGroup>
);

export function InventoryPageTemplate({ children }: { children: React.ReactNode }) {
const {
Expand Down Expand Up @@ -52,20 +59,26 @@ export function InventoryPageTemplate({ children }: { children: React.ReactNode

if (isEnablementLoading || hasDataLoading) {
return (
<ObservabilityPageTemplate pageHeader={pageTitle}>
<ObservabilityPageTemplate
pageHeader={{
pageTitle,
}}
>
<EuiEmptyPrompt icon={<EuiLoadingLogo logo="logoObservability" size="xl" />} />
</ObservabilityPageTemplate>
);
}

return (
<ObservabilityPageTemplate
pageHeader={{
pageTitle,
}}
noDataConfig={getEntityManagerEnablement({
enabled: isEntityManagerEnabled,
loading: isEnablementLoading,
onSuccess: handleSuccess,
})}
pageHeader={pageTitle}
>
{value.hasData ? (
<EuiFlexGroup direction="column">
Expand Down
73 changes: 37 additions & 36 deletions x-pack/plugins/observability_solution/inventory/public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
DEFAULT_APP_CATEGORIES,
Plugin,
PluginInitializerContext,
AppStatus,
} from '@kbn/core/public';
import { INVENTORY_APP_ID } from '@kbn/deeplinks-observability/constants';
import { i18n } from '@kbn/i18n';
Expand Down Expand Up @@ -49,33 +50,39 @@ export class InventoryPlugin
pluginsSetup: InventorySetupDependencies
): InventoryPublicSetup {
const inventoryAPIClient = createCallInventoryAPI(coreSetup);
this.telemetry.setup({ analytics: coreSetup.analytics });

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));
},
},
],
},
];
})
)
const isEntityCentricExperienceSettingEnabled = coreSetup.uiSettings.get<boolean>(
'observability:entityCentricExperience',
true
);

if (isEntityCentricExperienceSettingEnabled) {
pluginsSetup.observabilityShared.navigation.registerSections(
from(coreSetup.getStartServices()).pipe(
map(([coreStart, pluginsStart]) => {
return [
{
label: '',
sortKey: 300,
entries: [
{
label: i18n.translate('xpack.inventory.inventoryLinkTitle', {
defaultMessage: 'Inventory',
}),
app: INVENTORY_APP_ID,
path: '/',
matchPath(currentPath: string) {
return ['/', ''].some((testPath) => currentPath.startsWith(testPath));
},
isTechnicalPreview: true,
},
],
},
];
})
)
);
}
this.telemetry.setup({ analytics: coreSetup.analytics });
const telemetry = this.telemetry.start();

coreSetup.application.register({
Expand All @@ -86,17 +93,11 @@ export class InventoryPlugin
euiIconType: 'logoObservability',
appRoute: '/app/observability/inventory',
category: DEFAULT_APP_CATEGORIES.observability,
visibleIn: ['sideNav'],
order: 8001,
deepLinks: [
{
id: 'inventory',
title: i18n.translate('xpack.inventory.inventoryDeepLinkTitle', {
defaultMessage: 'Inventory',
}),
path: '/',
},
],
visibleIn: ['sideNav', 'globalSearch'],
order: 8200,
status: isEntityCentricExperienceSettingEnabled
? AppStatus.accessible
: AppStatus.inaccessible,
mount: async (appMountParameters: AppMountParameters<unknown>) => {
// Load application bundle and Get start services
const [{ renderApp }, [coreStart, pluginsStart]] = await Promise.all([
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import { schema, type TypeOf } from '@kbn/config-schema';

export const config = schema.object({
enabled: schema.boolean({ defaultValue: false }),
enabled: schema.boolean({ defaultValue: true }),
});

export type InventoryConfig = TypeOf<typeof config>;
Loading

0 comments on commit 26f5e14

Please sign in to comment.