-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Infra UI] Add tooltips to Asset Details (#164858)
Closes #164594 ## Summary This PR adds tooltips to explain the time range used to collect process data and metadata. The tooltips will be shown inside the overview (metadata summary section) tab, metadata tab, and processes tab (both flyout and full page views). ## Fixes I saw that the icons showing different explanation/ docs links inside the overveiew tab are not consistent ( sometimes we have `questionInCircle` and sometimes `iInCircles`) - the designs are using `iInCircles` so I changed it everywhere: <img width="671" alt="icons" src="https://github.com/elastic/kibana/assets/14139027/edda271b-5030-4d83-9722-448fbae8cf8b"> ## Testing 1. Go to host view and open the flyout for any host. The new explanation and tooltips should be shown in: - Overview tab <img width="938" alt="overview" src="https://github.com/elastic/kibana/assets/14139027/ac4ae369-d825-4fba-8865-c9410de29c28"> - Metadata tab <img width="945" alt="metadata" src="https://github.com/elastic/kibana/assets/14139027/4d174bf3-3411-40a5-a208-eb5df2266c61"> - Processed tab <img width="937" alt="processes" src="https://github.com/elastic/kibana/assets/14139027/11d32c66-4a25-4fce-a95e-42698f2e1682"> 2. Click Open as page and check the same on the asset details page <img width="1653" alt="Screenshot 2023-08-28 at 11 28 47" src="https://github.com/elastic/kibana/assets/14139027/342d1565-bb51-4961-b8ac-8b8270c851ff"> <img width="1637" alt="Screenshot 2023-08-28 at 11 28 32" src="https://github.com/elastic/kibana/assets/14139027/63b66a12-d634-4ecc-83de-ad1e1b79334c"> <img width="1649" alt="Screenshot 2023-08-28 at 11 28 16" src="https://github.com/elastic/kibana/assets/14139027/59720bf3-88ad-44b1-8584-769b38d956ed"> --------- Co-authored-by: Kibana Machine <[email protected]>
- Loading branch information
1 parent
cf16ebd
commit a511426
Showing
12 changed files
with
437 additions
and
162 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
102 changes: 102 additions & 0 deletions
102
x-pack/plugins/infra/public/components/asset_details/components/metadata_explanation.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
/* | ||
* 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 React from 'react'; | ||
import { EuiText, EuiLink } from '@elastic/eui'; | ||
import { FormattedDate, FormattedMessage, FormattedTime } from '@kbn/i18n-react'; | ||
import { EuiFlexGroup, EuiFlexItem, EuiLoadingSpinner } from '@elastic/eui'; | ||
import { Popover } from '../tabs/common/popover'; | ||
import { useMetadataStateProviderContext } from '../hooks/use_metadata_state'; | ||
|
||
const HOSTNAME_DOCS_LINK = | ||
'https://www.elastic.co/guide/en/ecs/current/ecs-host.html#field-host-name'; | ||
|
||
const MetadataExplanationTooltipContent = React.memo(() => { | ||
const onClick = (e: React.MouseEvent<HTMLDivElement, MouseEvent>) => { | ||
e.stopPropagation(); | ||
}; | ||
|
||
return ( | ||
<EuiText size="s" onClick={onClick} style={{ width: 200 }}> | ||
<FormattedMessage | ||
id="xpack.infra.assetDetails.metadata.tooltip.documentationLabel" | ||
defaultMessage="{metadata} is populated from the last event detected for this {hostName} for the selected date period." | ||
values={{ | ||
metadata: ( | ||
<i> | ||
<FormattedMessage | ||
id="xpack.infra.assetDetails.metadata.tooltip.metadata" | ||
defaultMessage="Metadata" | ||
/> | ||
</i> | ||
), | ||
hostName: ( | ||
<EuiLink | ||
data-test-subj="infraAssetDetailsTooltipDocumentationLink" | ||
href={HOSTNAME_DOCS_LINK} | ||
target="_blank" | ||
> | ||
<FormattedMessage | ||
id="xpack.infra.assetDetails.metadata.tooltip.documentationLink" | ||
defaultMessage="host.name" | ||
/> | ||
</EuiLink> | ||
), | ||
}} | ||
/> | ||
</EuiText> | ||
); | ||
}); | ||
|
||
export const MetadataExplanationMessage = () => { | ||
const { metadata, loading } = useMetadataStateProviderContext(); | ||
|
||
return loading ? ( | ||
<EuiLoadingSpinner /> | ||
) : metadata?.info?.timestamp ? ( | ||
<EuiFlexGroup gutterSize="xs" alignItems="baseline"> | ||
<EuiFlexItem grow={false}> | ||
<EuiText size="xs" color="subdued"> | ||
<FormattedMessage | ||
id="xpack.infra.assetDetails.metadata.tooltip.metadataSectionTitle" | ||
defaultMessage="Showing metadata collected on {date} @ {time}" | ||
values={{ | ||
date: ( | ||
<FormattedDate | ||
value={new Date(metadata?.info?.timestamp)} | ||
month="short" | ||
day="numeric" | ||
year="numeric" | ||
/> | ||
), | ||
time: ( | ||
<FormattedTime | ||
value={new Date(metadata?.info?.timestamp)} | ||
hour12={false} | ||
hour="2-digit" | ||
minute="2-digit" | ||
second="2-digit" | ||
/> | ||
), | ||
}} | ||
/> | ||
</EuiText> | ||
</EuiFlexItem> | ||
<EuiFlexItem grow={false}> | ||
<Popover | ||
iconSize="s" | ||
iconColor="subdued" | ||
icon="iInCircle" | ||
panelPaddingSize="m" | ||
data-test-subj="infraAssetDetailsMetadataPopoverButton" | ||
> | ||
<MetadataExplanationTooltipContent /> | ||
</Popover> | ||
</EuiFlexItem> | ||
</EuiFlexGroup> | ||
) : null; | ||
}; |
111 changes: 111 additions & 0 deletions
111
x-pack/plugins/infra/public/components/asset_details/components/processes_explanation.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
/* | ||
* 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 React from 'react'; | ||
import { EuiText, EuiLink } from '@elastic/eui'; | ||
import { FormattedDate, FormattedMessage, FormattedTime } from '@kbn/i18n-react'; | ||
import { EuiFlexGroup, EuiFlexItem } from '@elastic/eui'; | ||
import { useDateRangeProviderContext } from '../hooks/use_date_range'; | ||
import { Popover } from '../tabs/common/popover'; | ||
|
||
const DOCUMENTATION_LINK = | ||
'https://www.elastic.co/guide/en/observability/current/view-infrastructure-metrics.html'; | ||
const SYSTEM_INTEGRATION_DOCS_LINK = 'https://docs.elastic.co/en/integrations/system'; | ||
|
||
const ProcessesExplanationTooltipContent = React.memo(() => { | ||
const onClick = (e: React.MouseEvent<HTMLDivElement, MouseEvent>) => { | ||
e.stopPropagation(); | ||
}; | ||
|
||
return ( | ||
<EuiText size="s" onClick={onClick} style={{ width: 300 }}> | ||
<p> | ||
<FormattedMessage | ||
id="xpack.infra.assetDetails.processes.tooltip.explanationLabel" | ||
defaultMessage="The processes listed are based on an aggregation of the top CPU and the top memory consuming processes for the 1 minute preceding the end date of the selected time period. The number of top processes is configurable in the {systemIntegration}." | ||
values={{ | ||
systemIntegration: ( | ||
<EuiLink | ||
data-test-subj="infraAssetDetailsTooltipSystemIntegrationDocumentationLink" | ||
href={SYSTEM_INTEGRATION_DOCS_LINK} | ||
target="_blank" | ||
> | ||
<FormattedMessage | ||
id="xpack.infra.assetDetails.processes.tooltip.systemIntegrationDocumentationLink" | ||
defaultMessage="System Integration" | ||
/> | ||
</EuiLink> | ||
), | ||
}} | ||
/> | ||
</p> | ||
<p> | ||
<FormattedMessage | ||
id="xpack.infra.assetDetails.processes.tooltip.documentationLabel" | ||
defaultMessage="Please see the following {documentation} for more details on processes." | ||
values={{ | ||
documentation: ( | ||
<EuiLink | ||
data-test-subj="infraAssetDetailsTooltipDocumentationLink" | ||
href={DOCUMENTATION_LINK} | ||
target="_blank" | ||
> | ||
<FormattedMessage | ||
id="xpack.infra.assetDetails.processes.tooltip.documentationLink" | ||
defaultMessage="documentation" | ||
/> | ||
</EuiLink> | ||
), | ||
}} | ||
/> | ||
</p> | ||
</EuiText> | ||
); | ||
}); | ||
|
||
export const ProcessesExplanationMessage = () => { | ||
const { getDateRangeInTimestamp } = useDateRangeProviderContext(); | ||
const dateFromRange = new Date(getDateRangeInTimestamp().to); | ||
|
||
return ( | ||
<EuiFlexGroup gutterSize="xs" alignItems="baseline"> | ||
<EuiFlexItem grow={false}> | ||
<EuiText size="xs" color="subdued"> | ||
<FormattedMessage | ||
id="xpack.infra.assetDetails.overview.processesSectionTitle" | ||
defaultMessage="Showing process data collected for the 1 minute preceding {date} @ {time}" | ||
values={{ | ||
date: ( | ||
<FormattedDate value={dateFromRange} month="short" day="numeric" year="numeric" /> | ||
), | ||
time: ( | ||
<FormattedTime | ||
value={dateFromRange} | ||
hour12={false} | ||
hour="2-digit" | ||
minute="2-digit" | ||
second="2-digit" | ||
/> | ||
), | ||
}} | ||
/> | ||
</EuiText> | ||
</EuiFlexItem> | ||
<EuiFlexItem grow={false}> | ||
<Popover | ||
iconSize="s" | ||
iconColor="subdued" | ||
icon="iInCircle" | ||
panelPaddingSize="m" | ||
data-test-subj="infraAssetDetailsProcessesPopoverButton" | ||
> | ||
<ProcessesExplanationTooltipContent /> | ||
</Popover> | ||
</EuiFlexItem> | ||
</EuiFlexGroup> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.