diff --git a/x-pack/plugins/observability_solution/infra/public/components/asset_details/header/flyout_header.tsx b/x-pack/plugins/observability_solution/infra/public/components/asset_details/header/flyout_header.tsx index 8a410d4518352..ec2e0dd3f0494 100644 --- a/x-pack/plugins/observability_solution/infra/public/components/asset_details/header/flyout_header.tsx +++ b/x-pack/plugins/observability_solution/infra/public/components/asset_details/header/flyout_header.tsx @@ -21,10 +21,9 @@ import { import { css } from '@emotion/react'; import type { InventoryItemType } from '@kbn/metrics-data-access-plugin/common/inventory_models/types'; import { PageTitleWithPopover } from './page_title_with_popover'; + type Props = Pick & { - hasSystemIntegration: boolean; assetType: InventoryItemType; - metadataLoading: boolean; loading: boolean; }; @@ -32,9 +31,7 @@ export const FlyoutHeader = ({ title, tabs = [], rightSideItems = [], - hasSystemIntegration, assetType, - metadataLoading, loading, }: Props) => { const { euiTheme } = useEuiTheme(); @@ -55,19 +52,10 @@ export const FlyoutHeader = ({ `} > - {metadataLoading || loading ? ( + {loading ? ( ) : ( -

- {assetType === 'host' ? ( - - ) : ( - title - )} -

+

{assetType === 'host' ? : title}

)}
diff --git a/x-pack/plugins/observability_solution/infra/public/components/asset_details/header/page_title_with_popover.tsx b/x-pack/plugins/observability_solution/infra/public/components/asset_details/header/page_title_with_popover.tsx index 5453506623ff4..8b22165d3df69 100644 --- a/x-pack/plugins/observability_solution/infra/public/components/asset_details/header/page_title_with_popover.tsx +++ b/x-pack/plugins/observability_solution/infra/public/components/asset_details/header/page_title_with_popover.tsx @@ -6,61 +6,65 @@ */ import React from 'react'; -import { EuiText, EuiLink, EuiFlexGroup, EuiFlexItem } from '@elastic/eui'; +import { EuiText, EuiLink, EuiFlexGroup, EuiFlexItem, EuiLoadingSpinner } from '@elastic/eui'; import { FormattedMessage } from '@kbn/i18n-react'; import { APM_HOST_TROUBLESHOOTING_LINK } from '../constants'; import { Popover } from '../tabs/common/popover'; +import { useMetadataStateContext } from '../hooks/use_metadata_state'; -export const PageTitleWithPopover = ({ - hasSystemMetrics, - name, -}: { - hasSystemMetrics: boolean; - name: string; -}) => { - return !hasSystemMetrics ? ( +export const PageTitleWithPopover = ({ name }: { name: string }) => { + const { metadata, loading } = useMetadataStateContext(); + + return ( {name} - - - -

- - - - ), - }} - /> -

-

- - - -

-
-
-
+ {loading ? ( + + ) : ( + !metadata?.hasSystemIntegration && ( + + + +

+ + + + ), + }} + /> +

+

+ + + +

+
+
+
+ ) + )}
- ) : ( - <>{name} ); }; diff --git a/x-pack/plugins/observability_solution/infra/public/components/asset_details/template/flyout.tsx b/x-pack/plugins/observability_solution/infra/public/components/asset_details/template/flyout.tsx index 223ac061ea118..57ee9d50bc5c5 100644 --- a/x-pack/plugins/observability_solution/infra/public/components/asset_details/template/flyout.tsx +++ b/x-pack/plugins/observability_solution/infra/public/components/asset_details/template/flyout.tsx @@ -17,7 +17,6 @@ import { useAssetDetailsUrlState } from '../hooks/use_asset_details_url_state'; import { usePageHeader } from '../hooks/use_page_header'; import { useTabSwitcherContext } from '../hooks/use_tab_switcher'; import type { ContentTemplateProps } from '../types'; -import { useMetadataStateContext } from '../hooks/use_metadata_state'; export const Flyout = ({ tabs = [], @@ -31,7 +30,6 @@ export const Flyout = ({ const { services: { telemetry }, } = useKibanaContextForPlugin(); - const { metadata, loading: metadataLoading } = useMetadataStateContext(); useEffectOnce(() => { telemetry.reportAssetDetailsFlyoutViewed({ @@ -59,9 +57,7 @@ export const Flyout = ({ title={asset.name} tabs={tabEntries} rightSideItems={rightSideItems} - hasSystemIntegration={!!metadata?.hasSystemIntegration} assetType={asset.type} - metadataLoading={metadataLoading} loading={loading} /> diff --git a/x-pack/plugins/observability_solution/infra/public/components/asset_details/template/page.tsx b/x-pack/plugins/observability_solution/infra/public/components/asset_details/template/page.tsx index 3c43984e2ecb4..dad8ab5ce477e 100644 --- a/x-pack/plugins/observability_solution/infra/public/components/asset_details/template/page.tsx +++ b/x-pack/plugins/observability_solution/infra/public/components/asset_details/template/page.tsx @@ -87,10 +87,7 @@ export const Page = ({ tabs = [], links = [] }: ContentTemplateProps) => { pageTitle: loading ? ( ) : asset.type === 'host' ? ( - + ) : ( asset.name ),