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

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

Merged
merged 6 commits into from
Sep 19, 2022
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 @@ -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.' },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 6 additions & 0 deletions src/plugins/telemetry/schema/oss_plugins.json
Original file line number Diff line number Diff line change
Expand Up @@ -8533,6 +8533,12 @@
"description": "Non-default value of setting."
}
},
"observability:enableInfrastructureHostsView": {
"type": "boolean",
"_meta": {
"description": "Non-default value of setting."
}
},
"securitySolution:enableGroupedNav": {
"type": "boolean",
"_meta": {
Expand Down
77 changes: 42 additions & 35 deletions x-pack/plugins/infra/public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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(
Expand All @@ -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,
},
]
: []),
Expand Down Expand Up @@ -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', {
Expand All @@ -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();
Expand Down
1 change: 1 addition & 0 deletions x-pack/plugins/observability/common/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export {
apmTraceExplorerTab,
apmOperationsTab,
apmLabsButton,
enableInfrastructureHostsView,
} from './ui_settings_keys';

export {
Expand Down
1 change: 1 addition & 0 deletions x-pack/plugins/observability/common/ui_settings_keys.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
1 change: 1 addition & 0 deletions x-pack/plugins/observability/public/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export {
enableServiceGroups,
enableNewSyntheticsView,
apmServiceGroupMaxNumberOfServices,
enableInfrastructureHostsView,
} from '../common/ui_settings_keys';
export { uptimeOverviewLocatorID } from '../common';

Expand Down
12 changes: 12 additions & 0 deletions x-pack/plugins/observability/server/ui_settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import {
apmTraceExplorerTab,
apmOperationsTab,
apmLabsButton,
enableInfrastructureHostsView,
} from '../common/ui_settings_keys';

const technicalPreviewLabel = i18n.translate(
Expand Down Expand Up @@ -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(),
},
};