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

[Inventory] Promote new inventory plugin in APM #193997

Merged
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
c362039
Remove CustomNoDataTemplate in ApmMainTemplate
iblancof Sep 23, 2024
82550a0
Create default entity inventory locator
iblancof Sep 23, 2024
f0cdb9f
Registter locator in InventoryPlugin
iblancof Sep 23, 2024
a381177
Add inventory callout in APM main template
iblancof Sep 23, 2024
08ad69e
Add dismiss action to inventoryCallout in ApmMainTemplate
iblancof Sep 23, 2024
4e500a1
Merge branch 'main' into 192856-apm-promote-new-inventory-plugin-in-apm
iblancof Sep 25, 2024
36d25fd
Remove EntityEnablement
iblancof Sep 25, 2024
d2e5ae8
Remove classic view check
iblancof Sep 25, 2024
079f844
Merge branch 'main' into 192856-apm-promote-new-inventory-plugin-in-apm
iblancof Sep 25, 2024
7e562a2
Move ApmMainTemplate
iblancof Sep 25, 2024
6ac4365
Rename ApmMainTemplate file
iblancof Sep 25, 2024
78546fe
Extract InventoryCallout
iblancof Sep 25, 2024
850687a
Extract InventoryCallout
iblancof Sep 25, 2024
d5d811d
[CI] Auto-commit changed files from 'node scripts/yarn_deduplicate'
kibanamachine Sep 25, 2024
57a5bec
Merge branch 'main' into 192856-apm-promote-new-inventory-plugin-in-apm
iblancof Sep 26, 2024
77b4d21
Rename dismissedInventoryCallout to dismissedEntitiesInventoryCallout
iblancof Sep 26, 2024
8db12a8
Rename inventory to entities inventory
iblancof Sep 26, 2024
0fe34bd
Update data-test-subj
iblancof Sep 26, 2024
778db66
Remove duplicated import
iblancof Sep 26, 2024
e9f96cb
Remove implicit typing
iblancof Sep 26, 2024
6746150
Add entities inventory locator in obs shared plugin
iblancof Sep 26, 2024
22f969a
Use entities inventory locator from obs shared in callout
iblancof Sep 26, 2024
00c3fc8
Show entities inventory callout in all tabs
iblancof Sep 26, 2024
5b0b5c0
Show entities inventory callout only in main service tabs
iblancof Sep 26, 2024
e500f9a
Set services inventory view as classic by default
iblancof Sep 26, 2024
9c90c35
Merge branch 'main' into 192856-apm-promote-new-inventory-plugin-in-apm
iblancof Sep 26, 2024
832a62c
Remove unused import
iblancof Sep 26, 2024
389e727
Merge branch 'main' into 192856-apm-promote-new-inventory-plugin-in-apm
iblancof Sep 26, 2024
a3a8e04
Remove services inventory view check in ApmMainTemplate
iblancof Sep 26, 2024
509c15e
Remove services inventory view check in ServiceInventory
iblancof Sep 26, 2024
c1180bc
Remove services inventory view check in EntityManagerEnablementContex…
iblancof Sep 26, 2024
f8cd0a6
Remove unused MultiSignalInventory and its deps
iblancof Sep 26, 2024
4175f78
[CI] Auto-commit changed files from 'node scripts/yarn_deduplicate'
kibanamachine Sep 26, 2024
377ada8
[CI] Auto-commit changed files from 'node scripts/lint_ts_projects --…
kibanamachine Sep 26, 2024
807e2c4
Revert "Remove unused MultiSignalInventory and its deps"
iblancof Sep 26, 2024
0709e1d
Merge branch '192856-apm-promote-new-inventory-plugin-in-apm' of http…
iblancof Sep 26, 2024
c2ee0e9
[CI] Auto-commit changed files from 'node scripts/yarn_deduplicate'
kibanamachine Sep 26, 2024
1394d57
Merge branch 'main' into 192856-apm-promote-new-inventory-plugin-in-apm
iblancof Sep 27, 2024
7a6297e
Remove TechnicalPreviewBadge from ServiceGroupTemplate
iblancof Sep 27, 2024
52012f7
Remove undefined/null check in EntitiesInventoryCallout
iblancof Sep 27, 2024
3bf4bdf
Fix showEntitiesInventoryCallout logic
iblancof Sep 27, 2024
f0674dc
Merge branch 'main' into 192856-apm-promote-new-inventory-plugin-in-apm
iblancof Sep 27, 2024
c88fe6b
Merge branch '192856-apm-promote-new-inventory-plugin-in-apm' of http…
iblancof Sep 27, 2024
6169c01
Remove isEnablementPending check in ServiceInventory
iblancof Sep 27, 2024
dde7a46
Remove usage of isEntityManagerEnabled
iblancof Sep 27, 2024
af90255
Remove unused inventoryLocator
iblancof Sep 27, 2024
49f4458
Merge branch 'main' into 192856-apm-promote-new-inventory-plugin-in-apm
iblancof Sep 27, 2024
676e1d5
Merge branch 'main' into 192856-apm-promote-new-inventory-plugin-in-apm
iblancof Sep 27, 2024
05f336f
Merge branch 'main' into 192856-apm-promote-new-inventory-plugin-in-apm
iblancof Sep 30, 2024
0595bec
Merge branch 'main' into 192856-apm-promote-new-inventory-plugin-in-apm
iblancof Sep 30, 2024
4aeb1d1
Merge branch 'main' into 192856-apm-promote-new-inventory-plugin-in-apm
iblancof Sep 30, 2024
e362327
Remove CustomNoDataTemplate cy tests
iblancof Sep 30, 2024
23dd716
Merge branch 'main' into 192856-apm-promote-new-inventory-plugin-in-apm
iblancof Sep 30, 2024
b562cd3
Merge branch 'main' into 192856-apm-promote-new-inventory-plugin-in-apm
iblancof Sep 30, 2024
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 @@ -11,24 +11,23 @@ import { entityCentricExperience } from '@kbn/observability-plugin/common';
import { ObservabilityPageTemplateProps } from '@kbn/observability-shared-plugin/public';
import type { KibanaPageTemplateProps } from '@kbn/shared-ux-page-kibana-template';
import React, { useContext } from 'react';
import { i18n } from '@kbn/i18n';
import { useLocation } from 'react-router-dom';
import { FeatureFeedbackButton } from '@kbn/observability-shared-plugin/public';
import { useEntityManagerEnablementContext } from '../../../context/entity_manager_context/use_entity_manager_enablement_context';
import { useDefaultAiAssistantStarterPromptsForAPM } from '../../../hooks/use_default_ai_assistant_starter_prompts_for_apm';
import { KibanaEnvironmentContext } from '../../../context/kibana_environment_context/kibana_environment_context';
import { getPathForFeedback } from '../../../utils/get_path_for_feedback';
import { EnvironmentsContextProvider } from '../../../context/environments_context/environments_context';
import { FETCH_STATUS, useFetcher } from '../../../hooks/use_fetcher';
import { ApmPluginStartDeps } from '../../../plugin';
import { ServiceGroupSaveButton } from '../../app/service_groups';
import { ServiceGroupsButtonGroup } from '../../app/service_groups/service_groups_button_group';
import { ApmEnvironmentFilter } from '../../shared/environment_filter';
import { getNoDataConfig } from './no_data_config';
import { useApmPluginContext } from '../../../context/apm_plugin/use_apm_plugin_context';
import { EntityEnablement } from '../../shared/entity_enablement';
import { CustomNoDataTemplate } from './custom_no_data_template';
import { ServiceInventoryView } from '../../../context/entity_manager_context/entity_manager_context';
import { useLocalStorage } from '../../../../hooks/use_local_storage';
import { useEntityManagerEnablementContext } from '../../../../context/entity_manager_context/use_entity_manager_enablement_context';
import { useDefaultAiAssistantStarterPromptsForAPM } from '../../../../hooks/use_default_ai_assistant_starter_prompts_for_apm';
import { KibanaEnvironmentContext } from '../../../../context/kibana_environment_context/kibana_environment_context';
import { getPathForFeedback } from '../../../../utils/get_path_for_feedback';
import { EnvironmentsContextProvider } from '../../../../context/environments_context/environments_context';
import { FETCH_STATUS, useFetcher } from '../../../../hooks/use_fetcher';
import { ApmPluginStartDeps } from '../../../../plugin';
import { ServiceGroupSaveButton } from '../../../app/service_groups';
import { ServiceGroupsButtonGroup } from '../../../app/service_groups/service_groups_button_group';
import { ApmEnvironmentFilter } from '../../../shared/environment_filter';
import { getNoDataConfig } from '../no_data_config';
import { useApmPluginContext } from '../../../../context/apm_plugin/use_apm_plugin_context';
import { ServiceInventoryView } from '../../../../context/entity_manager_context/entity_manager_context';
import { InventoryCallout } from './inventory_callout';

// Paths that must skip the no data screen
const bypassNoDataScreenPaths = ['/settings', '/diagnostics'];
Expand Down Expand Up @@ -117,11 +116,6 @@ export function ApmMainTemplate({

const hasApmData = !!data?.hasData;
const hasApmIntegrations = !!fleetApmPoliciesData?.hasApmPolicies;
const showCustomEmptyState =
!hasApmData &&
!isLoading &&
isEntityCentricExperienceSettingEnabled &&
serviceInventoryViewLocalStorageSetting === ServiceInventoryView.classic;

const noDataConfig = getNoDataConfig({
basePath,
Expand All @@ -142,6 +136,7 @@ export function ApmMainTemplate({
const rightSideItems = [...(showServiceGroupSaveButton ? [<ServiceGroupSaveButton />] : [])];

const sanitizedPath = getPathForFeedback(window.location.pathname);

const pageHeaderTitle = (
<EuiFlexGroup justifyContent="spaceBetween" wrap={true}>
{pageHeader?.pageTitle ?? pageTitle}
Expand All @@ -168,47 +163,49 @@ export function ApmMainTemplate({
</EuiFlexGroup>
);

const pageTemplate = showCustomEmptyState ? (
<CustomNoDataTemplate isPageDataLoaded={isLoading === false} noDataConfig={noDataConfig} />
) : (
<ObservabilityPageTemplate
noDataConfig={
shouldBypassNoDataScreen ||
serviceInventoryViewLocalStorageSetting === ServiceInventoryView.entity
? undefined
: noDataConfig
}
isPageDataLoaded={isLoading === false}
pageHeader={{
rightSideItems,
...pageHeader,
pageTitle: pageHeaderTitle,
children: (
<EuiFlexGroup direction="column">
{isEntityCentricExperienceSettingEnabled &&
showEnablementCallout &&
selectedNavButton === 'allServices' ? (
<EntityEnablement
label={i18n.translate('xpack.apm.eemEnablement.tryItButton.', {
defaultMessage: 'Try our new experience!',
})}
tooltip={i18n.translate('xpack.apm.entityEnablement.content', {
defaultMessage:
'Our new experience combines both APM-instrumented services with services detected from logs in a single service inventory.',
})}
/>
) : null}
{showServiceGroupsNav && selectedNavButton && (
<ServiceGroupsButtonGroup selectedNavButton={selectedNavButton} />
)}
</EuiFlexGroup>
),
}}
{...pageTemplateProps}
>
{children}
</ObservabilityPageTemplate>
const [dismissedInventoryCallout, setDismissedInventoryCallout] = useLocalStorage(
`apm.dismissedInventoryCallout`,
iblancof marked this conversation as resolved.
Show resolved Hide resolved
false
);

return <EnvironmentsContextProvider>{pageTemplate}</EnvironmentsContextProvider>;
const showInventoryCallout =
!dismissedInventoryCallout &&
isEntityCentricExperienceSettingEnabled &&
selectedNavButton === 'allServices';
iblancof marked this conversation as resolved.
Show resolved Hide resolved

return (
<EnvironmentsContextProvider>
<ObservabilityPageTemplate
noDataConfig={
shouldBypassNoDataScreen ||
serviceInventoryViewLocalStorageSetting === ServiceInventoryView.entity
? undefined
: noDataConfig
}
isPageDataLoaded={isLoading === false}
pageHeader={{
rightSideItems,
...pageHeader,
pageTitle: pageHeaderTitle,
children: (
<EuiFlexGroup direction="column">
{showInventoryCallout ? (
<InventoryCallout
iblancof marked this conversation as resolved.
Show resolved Hide resolved
onDissmiss={() => {
setDismissedInventoryCallout(true);
}}
/>
) : null}
{showServiceGroupsNav && selectedNavButton && (
<ServiceGroupsButtonGroup selectedNavButton={selectedNavButton} />
)}
</EuiFlexGroup>
),
}}
{...pageTemplateProps}
>
{children}
</ObservabilityPageTemplate>
</EnvironmentsContextProvider>
);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/

import { EuiFlexGroup, EuiFlexItem, EuiLink, EuiToolTip, EuiButtonIcon } from '@elastic/eui';
import { TechnicalPreviewBadge } from '@kbn/observability-shared-plugin/public';
import React from 'react';
import { FormattedMessage } from '@kbn/i18n-react';
import { ENTITY_INVENTORY_LOCATOR_ID } from '@kbn/observability-shared-plugin/common';
import { SerializableRecord } from '@kbn/utility-types';
import { useApmPluginContext } from '../../../../context/apm_plugin/use_apm_plugin_context';

export interface InventoryCalloutProps {
iblancof marked this conversation as resolved.
Show resolved Hide resolved
onDissmiss: () => void;
}

export function InventoryCallout({ onDissmiss }: InventoryCalloutProps) {
const { share } = useApmPluginContext();
const inventoryLocator = share.url.locators.get<SerializableRecord>(ENTITY_INVENTORY_LOCATOR_ID);
iblancof marked this conversation as resolved.
Show resolved Hide resolved
iblancof marked this conversation as resolved.
Show resolved Hide resolved

return (
<EuiFlexGroup direction="row" alignItems="center" gutterSize="xs">
<EuiFlexItem grow={false}>
<TechnicalPreviewBadge icon="beaker" style={{ verticalAlign: 'middle' }} />
</EuiFlexItem>
<EuiFlexItem grow={false}>
<EuiLink data-test-subj="inventoryCalloutLink" href={inventoryLocator?.useUrl({})}>
iblancof marked this conversation as resolved.
Show resolved Hide resolved
<FormattedMessage
id="xpack.apm.inventoryCallout.linklabel"
defaultMessage="Try our new Inventory!"
/>
</EuiLink>
</EuiFlexItem>
<EuiFlexItem grow={false}>
<EuiToolTip
content={
<FormattedMessage
id="xpack.apm.inventoryCallout.linkTooltip"
defaultMessage="Hide this"
/>
}
>
<EuiButtonIcon
data-test-subj="inventoryCalloutDismiss"
iblancof marked this conversation as resolved.
Show resolved Hide resolved
iconType="cross"
onClick={onDissmiss}
/>
</EuiToolTip>
</EuiFlexItem>
</EuiFlexGroup>
);
}

This file was deleted.

Loading
Loading