[Infra Monitoring UI] add tech preview for hosts view (#140766)

* add tech preview for hosts view

* update name

* add to oss_plugins
This commit is contained in:
Sandra G 2022-09-19 15:05:23 -04:00 committed by GitHub
parent 5cec30a7c4
commit 93bfec9799
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 68 additions and 35 deletions

View file

@ -538,6 +538,10 @@ export const stackManagementSchema: MakeSchemaFrom<UsageStats> = {
type: 'boolean',
_meta: { description: 'Non-default value of setting.' },
},
'observability:enableInfrastructureHostsView': {
type: 'boolean',
_meta: { description: 'Non-default value of setting.' },
},
'securitySolution:enableGroupedNav': {
type: 'boolean',
_meta: { description: 'Non-default value of setting.' },

View file

@ -42,6 +42,7 @@ export interface UsageStats {
'observability:maxSuggestions': number;
'observability:enableComparisonByDefault': boolean;
'observability:enableServiceGroups': boolean;
'observability:enableInfrastructureHostsView': boolean;
'visualize:enableLabs': boolean;
'visualization:heatmap:maxBuckets': number;
'visualization:colorMapping': string;

View file

@ -8810,6 +8810,12 @@
"description": "Non-default value of setting."
}
},
"observability:enableInfrastructureHostsView": {
"type": "boolean",
"_meta": {
"description": "Non-default value of setting."
}
},
"securitySolution:enableGroupedNav": {
"type": "boolean",
"_meta": {

View file

@ -10,6 +10,7 @@ import { AppMountParameters, PluginInitializerContext } from '@kbn/core/public';
import { from } from 'rxjs';
import { map } from 'rxjs/operators';
import { DEFAULT_APP_CATEGORIES } from '@kbn/core/public';
import { enableInfrastructureHostsView } from '@kbn/observability-plugin/public';
import { defaultLogViewsStaticConfig } from '../common/log_views';
import { InfraPublicConfig } from '../common/plugin_config_types';
import { createInventoryMetricRuleType } from './alerting/inventory';
@ -74,6 +75,11 @@ export class Plugin implements InfraClientPluginClass {
});
/** !! Need to be kept in sync with the deepLinks in x-pack/plugins/infra/public/plugin.ts */
const infraEntries = [
{ label: 'Inventory', app: 'metrics', path: '/inventory' },
{ label: 'Metrics Explorer', app: 'metrics', path: '/explorer' },
];
const hostInfraEntry = { label: 'Hosts', app: 'metrics', path: '/hosts' };
pluginsSetup.observability.navigation.registerSections(
from(core.getStartServices()).pipe(
map(
@ -100,11 +106,9 @@ export class Plugin implements InfraClientPluginClass {
{
label: 'Infrastructure',
sortKey: 300,
entries: [
{ label: 'Hosts', app: 'metrics', path: '/hosts' },
{ label: 'Inventory', app: 'metrics', path: '/inventory' },
{ label: 'Metrics Explorer', app: 'metrics', path: '/explorer' },
],
entries: core.uiSettings.get(enableInfrastructureHostsView)
? [hostInfraEntry, ...infraEntries]
: infraEntries,
},
]
: []),
@ -167,6 +171,36 @@ export class Plugin implements InfraClientPluginClass {
},
});
const infraDeepLinks = [
{
id: 'inventory',
title: i18n.translate('xpack.infra.homePage.inventoryTabTitle', {
defaultMessage: 'Inventory',
}),
path: '/inventory',
},
{
id: 'metrics-explorer',
title: i18n.translate('xpack.infra.homePage.metricsExplorerTabTitle', {
defaultMessage: 'Metrics Explorer',
}),
path: '/explorer',
},
{
id: 'settings',
title: i18n.translate('xpack.infra.homePage.settingsTabTitle', {
defaultMessage: 'Settings',
}),
path: '/settings',
},
];
const hostInfraDeepLink = {
id: 'metrics-hosts',
title: i18n.translate('xpack.infra.homePage.metricsHostsTabTitle', {
defaultMessage: 'Hosts',
}),
path: '/hosts',
};
core.application.register({
id: 'metrics',
title: i18n.translate('xpack.infra.metrics.pluginTitle', {
@ -177,36 +211,9 @@ export class Plugin implements InfraClientPluginClass {
appRoute: '/app/metrics',
category: DEFAULT_APP_CATEGORIES.observability,
// !! Need to be kept in sync with the routes in x-pack/plugins/infra/public/pages/metrics/index.tsx
deepLinks: [
{
id: 'inventory',
title: i18n.translate('xpack.infra.homePage.inventoryTabTitle', {
defaultMessage: 'Inventory',
}),
path: '/inventory',
},
{
id: 'metrics-explorer',
title: i18n.translate('xpack.infra.homePage.metricsExplorerTabTitle', {
defaultMessage: 'Metrics Explorer',
}),
path: '/explorer',
},
{
id: 'metrics-hosts',
title: i18n.translate('xpack.infra.homePage.metricsHostsTabTitle', {
defaultMessage: 'Hosts',
}),
path: '/hosts',
},
{
id: 'settings',
title: i18n.translate('xpack.infra.homePage.settingsTabTitle', {
defaultMessage: 'Settings',
}),
path: '/settings',
},
],
deepLinks: core.uiSettings.get(enableInfrastructureHostsView)
? [hostInfraDeepLink, ...infraDeepLinks]
: infraDeepLinks,
mount: async (params: AppMountParameters) => {
// mount callback should not use setup dependencies, get start dependencies instead
const [coreStart, pluginsStart, pluginStart] = await core.getStartServices();

View file

@ -24,6 +24,7 @@ export {
apmTraceExplorerTab,
apmOperationsTab,
apmLabsButton,
enableInfrastructureHostsView,
} from './ui_settings_keys';
export {

View file

@ -19,3 +19,4 @@ export const apmServiceGroupMaxNumberOfServices =
export const apmTraceExplorerTab = 'observability:apmTraceExplorerTab';
export const apmOperationsTab = 'observability:apmOperationsTab';
export const apmLabsButton = 'observability:apmLabsButton';
export const enableInfrastructureHostsView = 'observability:enableInfrastructureHostsView';

View file

@ -30,6 +30,7 @@ export {
enableServiceGroups,
enableNewSyntheticsView,
apmServiceGroupMaxNumberOfServices,
enableInfrastructureHostsView,
} from '../common/ui_settings_keys';
export { uptimeOverviewLocatorID } from '../common';

View file

@ -22,6 +22,7 @@ import {
apmTraceExplorerTab,
apmOperationsTab,
apmLabsButton,
enableInfrastructureHostsView,
} from '../common/ui_settings_keys';
const technicalPreviewLabel = i18n.translate(
@ -242,4 +243,15 @@ export const uiSettings: Record<string, UiSettings> = {
requiresPageReload: true,
type: 'boolean',
},
[enableInfrastructureHostsView]: {
category: [observabilityFeatureId],
name: i18n.translate('xpack.observability.enableInfrastructureHostsView', {
defaultMessage: 'Infrastructure Hosts view',
}),
value: false,
description: i18n.translate('xpack.observability.enableInfrastructureHostsViewDescription', {
defaultMessage: 'Enable the Hosts view in the Infrastructure app',
}),
schema: schema.boolean(),
},
};