-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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 UI] Update Processes tooltips #166251
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
/* | ||
* 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 { FormattedMessage } from '@kbn/i18n-react'; | ||
|
||
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'; | ||
|
||
export const TopProcessesTooltipContent = React.memo(() => { | ||
const onClick = (e: React.MouseEvent<HTMLDivElement, MouseEvent>) => { | ||
e.stopPropagation(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you clarify please why this is needed? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It was added initially as a bug fix because of the table sorting issue with the tooltip there #161565 but in this case, I don't think we need it - removed 👍 |
||
}; | ||
|
||
return ( | ||
<EuiText size="xs" onClick={onClick} style={{ width: 300 }}> | ||
<p> | ||
<FormattedMessage | ||
id="xpack.infra.assetDetails.processes.tooltip.topProcesses" | ||
defaultMessage="The processes listed are based on an aggregation of the top CPU and the top memory consuming processes. It does not show all processes." | ||
/> | ||
</p> | ||
<p> | ||
<FormattedMessage | ||
id="xpack.infra.assetDetails.processes.tooltip.label" | ||
defaultMessage="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> | ||
); | ||
}); |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,7 +12,6 @@ import { | |
EuiSearchBar, | ||
EuiEmptyPrompt, | ||
EuiButton, | ||
EuiIconTip, | ||
EuiTitle, | ||
Query, | ||
EuiFlexGroup, | ||
|
@@ -34,6 +33,8 @@ import { useAssetDetailsRenderPropsContext } from '../../hooks/use_asset_details | |
import { useDateRangeProviderContext } from '../../hooks/use_date_range'; | ||
import { ProcessesExplanationMessage } from '../../components/processes_explanation'; | ||
import { useAssetDetailsUrlState } from '../../hooks/use_asset_details_url_state'; | ||
import { TopProcessesTooltipContent } from '../../components/top_processes_tooltip'; | ||
import { Popover } from '../common/popover'; | ||
|
||
const options = Object.entries(STATE_NAMES).map(([value, view]: [string, string]) => ({ | ||
value, | ||
|
@@ -119,23 +120,19 @@ export const Processes = () => { | |
</EuiTitle> | ||
</EuiFlexItem> | ||
<EuiFlexItem grow={false}> | ||
<EuiIconTip | ||
<Popover | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I wonder if it makes sense to put the whole popover into the dedicated component instead of just its content. it would declutter a bit the parent component, and strictly speaking, there is no need to have the content separately as we don't use it anywhere else. wdyt? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes in this case it makes sense to keep the |
||
aria-label={i18n.translate( | ||
'xpack.infra.metrics.nodeDetails.processesHeader.tooltipLabel', | ||
{ | ||
defaultMessage: 'More info', | ||
} | ||
)} | ||
size="m" | ||
type="iInCircle" | ||
content={i18n.translate( | ||
'xpack.infra.metrics.nodeDetails.processesHeader.tooltipBody', | ||
{ | ||
defaultMessage: | ||
'The table below aggregates the top CPU and top memory consuming processes. It does not display all processes.', | ||
} | ||
)} | ||
/> | ||
iconSize="m" | ||
icon="iInCircle" | ||
data-test-subj="infraAssetDetailsProcessesPopoverButton" | ||
> | ||
<TopProcessesTooltipContent /> | ||
</Popover> | ||
</EuiFlexItem> | ||
</EuiFlexGroup> | ||
</EuiFlexItem> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might be better to name the file and component inside using the same name, but I'm not sure how strictly we follow this convention usually
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After moving the popup here I renamed it to
TopProcessesTooltip
which matches the file name