[8.x] [Lens] Replace the inline quick function documentation icon and popover with tooltips (#216204) (#216812)

# Backport

This will backport the following commits from `main` to `8.x`:
- [[Lens] Replace the inline quick function documentation icon and
popover with tooltips
(#216204)](https://github.com/elastic/kibana/pull/216204)

<!--- Backport version: 9.6.6 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sorenlouv/backport)

<!--BACKPORT [{"author":{"name":"Andreana
Malama","email":"72010092+andrimal@users.noreply.github.com"},"sourceCommit":{"committedDate":"2025-04-02T12:22:47Z","message":"[Lens]
Replace the inline quick function documentation icon and popover with
tooltips (#216204)\n\n## Summary\n\nFix #152522 \n\nThis PR replaces the
inline quick function documentation icon and\npopover (screenshot 1)
with simple tooltips for every function\n(screenshot 2).\n<img
width=\"670\" alt=\"Screenshot 2025-03-31 at 8 15
17 PM\"\nsrc=\"https://github.com/user-attachments/assets/f98d065b-a82b-4807-9375-79994dab9117\"\n/>\n<img
width=\"635\" alt=\"Screenshot 2025-03-31 at 8 14
12 PM\"\nsrc=\"https://github.com/user-attachments/assets/a3788318-27b5-4435-abf8-157dc9efd1df\"\n/>\n\nIf
a function is disabled then the tooltip should show the\ndisabled-reason
and not the documentation:\n\n![Kapture 2025-03-31 at 20
21\n05](https://github.com/user-attachments/assets/5a25fc1c-2017-427d-b3fc-5b7906d9c62b)\n\n###
Checklist\n\nCheck the PR satisfies following conditions. \n\nReviewers
should verify this PR satisfies this list as well.\n\n- [ ] Any text
added follows [EUI's
writing\nguidelines](https://elastic.github.io/eui/#/guidelines/writing),
uses\nsentence case text and includes
[i18n\nsupport](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md)\n-
[
]\n[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\nwas
added for features that require explanation or tutorials\n- [ ] [Unit or
functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere
updated or added to match the most common scenarios\n- [ ] If a plugin
configuration key changed, check if it needs to be\nallowlisted in the
cloud and added to the
[docker\nlist](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)\n-
[ ] This was checked for breaking HTTP API changes, and any
breaking\nchanges have been approved by the breaking-change committee.
The\n`release_note:breaking` label should be applied in these
situations.\n- [ ] [Flaky
Test\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1)
was\nused on any tests changed\n- [ ] The PR description includes the
appropriate Release Notes section,\nand the correct `release_note:*`
label is applied per
the\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\n\n---------\n\nCo-authored-by:
Marco Liberati
<dej611@users.noreply.github.com>","sha":"40e02f1745a534604f829ffd9eb7b17dbcc22314","branchLabelMapping":{"^v9.1.0$":"main","^v8.19.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Team:Visualizations","release_note:skip","Feature:Lens","backport:version","v9.1.0","v8.19.0"],"title":"[Lens]
Replace the inline quick function documentation icon and popover with
tooltips","number":216204,"url":"https://github.com/elastic/kibana/pull/216204","mergeCommit":{"message":"[Lens]
Replace the inline quick function documentation icon and popover with
tooltips (#216204)\n\n## Summary\n\nFix #152522 \n\nThis PR replaces the
inline quick function documentation icon and\npopover (screenshot 1)
with simple tooltips for every function\n(screenshot 2).\n<img
width=\"670\" alt=\"Screenshot 2025-03-31 at 8 15
17 PM\"\nsrc=\"https://github.com/user-attachments/assets/f98d065b-a82b-4807-9375-79994dab9117\"\n/>\n<img
width=\"635\" alt=\"Screenshot 2025-03-31 at 8 14
12 PM\"\nsrc=\"https://github.com/user-attachments/assets/a3788318-27b5-4435-abf8-157dc9efd1df\"\n/>\n\nIf
a function is disabled then the tooltip should show the\ndisabled-reason
and not the documentation:\n\n![Kapture 2025-03-31 at 20
21\n05](https://github.com/user-attachments/assets/5a25fc1c-2017-427d-b3fc-5b7906d9c62b)\n\n###
Checklist\n\nCheck the PR satisfies following conditions. \n\nReviewers
should verify this PR satisfies this list as well.\n\n- [ ] Any text
added follows [EUI's
writing\nguidelines](https://elastic.github.io/eui/#/guidelines/writing),
uses\nsentence case text and includes
[i18n\nsupport](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md)\n-
[
]\n[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\nwas
added for features that require explanation or tutorials\n- [ ] [Unit or
functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere
updated or added to match the most common scenarios\n- [ ] If a plugin
configuration key changed, check if it needs to be\nallowlisted in the
cloud and added to the
[docker\nlist](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)\n-
[ ] This was checked for breaking HTTP API changes, and any
breaking\nchanges have been approved by the breaking-change committee.
The\n`release_note:breaking` label should be applied in these
situations.\n- [ ] [Flaky
Test\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1)
was\nused on any tests changed\n- [ ] The PR description includes the
appropriate Release Notes section,\nand the correct `release_note:*`
label is applied per
the\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\n\n---------\n\nCo-authored-by:
Marco Liberati
<dej611@users.noreply.github.com>","sha":"40e02f1745a534604f829ffd9eb7b17dbcc22314"}},"sourceBranch":"main","suggestedTargetBranches":["8.x"],"targetPullRequestStates":[{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/216204","number":216204,"mergeCommit":{"message":"[Lens]
Replace the inline quick function documentation icon and popover with
tooltips (#216204)\n\n## Summary\n\nFix #152522 \n\nThis PR replaces the
inline quick function documentation icon and\npopover (screenshot 1)
with simple tooltips for every function\n(screenshot 2).\n<img
width=\"670\" alt=\"Screenshot 2025-03-31 at 8 15
17 PM\"\nsrc=\"https://github.com/user-attachments/assets/f98d065b-a82b-4807-9375-79994dab9117\"\n/>\n<img
width=\"635\" alt=\"Screenshot 2025-03-31 at 8 14
12 PM\"\nsrc=\"https://github.com/user-attachments/assets/a3788318-27b5-4435-abf8-157dc9efd1df\"\n/>\n\nIf
a function is disabled then the tooltip should show the\ndisabled-reason
and not the documentation:\n\n![Kapture 2025-03-31 at 20
21\n05](https://github.com/user-attachments/assets/5a25fc1c-2017-427d-b3fc-5b7906d9c62b)\n\n###
Checklist\n\nCheck the PR satisfies following conditions. \n\nReviewers
should verify this PR satisfies this list as well.\n\n- [ ] Any text
added follows [EUI's
writing\nguidelines](https://elastic.github.io/eui/#/guidelines/writing),
uses\nsentence case text and includes
[i18n\nsupport](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md)\n-
[
]\n[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\nwas
added for features that require explanation or tutorials\n- [ ] [Unit or
functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere
updated or added to match the most common scenarios\n- [ ] If a plugin
configuration key changed, check if it needs to be\nallowlisted in the
cloud and added to the
[docker\nlist](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)\n-
[ ] This was checked for breaking HTTP API changes, and any
breaking\nchanges have been approved by the breaking-change committee.
The\n`release_note:breaking` label should be applied in these
situations.\n- [ ] [Flaky
Test\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1)
was\nused on any tests changed\n- [ ] The PR description includes the
appropriate Release Notes section,\nand the correct `release_note:*`
label is applied per
the\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\n\n---------\n\nCo-authored-by:
Marco Liberati
<dej611@users.noreply.github.com>","sha":"40e02f1745a534604f829ffd9eb7b17dbcc22314"}},{"branch":"8.x","label":"v8.19.0","branchLabelMappingKey":"^v8.19.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Andreana Malama <72010092+andrimal@users.noreply.github.com>
Co-authored-by: Marco Liberati <dej611@users.noreply.github.com>
This commit is contained in:
Kibana Machine 2025-04-02 18:15:31 +02:00 committed by GitHub
parent 3dd2138d0f
commit 3d43f2886b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 13 additions and 98 deletions

View file

@ -27572,8 +27572,6 @@
"xpack.lens.indexPattern.formulaWarningText": "Pour écraser votre formule, sélectionnez une fonction rapide",
"xpack.lens.indexPattern.formulaWithTooManyArguments": "L'opération {operation} a trop d'arguments",
"xpack.lens.indexPattern.functionsLabel": "Fonctions",
"xpack.lens.indexPattern.functionTable.descriptionHeader": "Description",
"xpack.lens.indexPattern.functionTable.functionHeader": "Fonction",
"xpack.lens.indexPattern.groupByDropdown": "Regrouper par",
"xpack.lens.indexPattern.helpIncompatibleFieldDotLabel": "Cette fonction n'est pas compatible avec le champ actuellement sélectionné",
"xpack.lens.indexPattern.helpLabel": "Aide sur les fonctions",
@ -27659,8 +27657,6 @@
"xpack.lens.indexPattern.precisionErrorWarning.filters": "Filtres",
"xpack.lens.indexPattern.precisionErrorWarning.link": "En savoir plus.",
"xpack.lens.indexPattern.precisionErrorWarning.topValues": "Valeurs les plus élevées",
"xpack.lens.indexPattern.quickFunctions.popoverTitle": "Fonctions rapides",
"xpack.lens.indexPattern.quickFunctions.tableTitle": "Description des fonctions",
"xpack.lens.indexPattern.quickFunctionsLabel": "Fonction rapide",
"xpack.lens.indexPattern.randomSampling.disabledMessage": "Afin de sélectionner un pourcentage d'échantillonnage réduit, vous devez supprimer toutes les fonctions maximales ou minimales appliquées sur ce calque.",
"xpack.lens.indexPattern.randomSampling.help": "Des pourcentages d'échantillonnage inférieurs augmentent les performances, mais diminuent la précision. Les pourcentages d'échantillonnage inférieurs sont les mieux adaptés aux grands ensembles de données. {link}",

View file

@ -27546,8 +27546,6 @@
"xpack.lens.indexPattern.formulaWarningText": "式を上書きするには、クイック関数を選択します",
"xpack.lens.indexPattern.formulaWithTooManyArguments": "演算{operation}の引数が多すぎます",
"xpack.lens.indexPattern.functionsLabel": "関数",
"xpack.lens.indexPattern.functionTable.descriptionHeader": "説明",
"xpack.lens.indexPattern.functionTable.functionHeader": "関数",
"xpack.lens.indexPattern.groupByDropdown": "グループ分けの条件",
"xpack.lens.indexPattern.helpIncompatibleFieldDotLabel": "この関数は現在選択されているフィールドと互換性がありません。",
"xpack.lens.indexPattern.helpLabel": "関数ヘルプ",
@ -27633,8 +27631,6 @@
"xpack.lens.indexPattern.precisionErrorWarning.filters": "フィルター",
"xpack.lens.indexPattern.precisionErrorWarning.link": "詳細情報",
"xpack.lens.indexPattern.precisionErrorWarning.topValues": "上位の値",
"xpack.lens.indexPattern.quickFunctions.popoverTitle": "クイック機能",
"xpack.lens.indexPattern.quickFunctions.tableTitle": "機能の説明",
"xpack.lens.indexPattern.quickFunctionsLabel": "クイック機能",
"xpack.lens.indexPattern.randomSampling.disabledMessage": "低いサンプリングの割合を選択するには、このレイヤーに適用されている最大値または最小値の関数を削除する必要があります。",
"xpack.lens.indexPattern.randomSampling.help": "サンプリング割合が低いほど、パフォーマンスが上がりますが、正解率は低くなります。大きいデータセットではサンプリング割合が低い方が最適です。{link}",

View file

@ -27604,8 +27604,6 @@
"xpack.lens.indexPattern.formulaWarningText": "要覆盖公式,请选择快速函数",
"xpack.lens.indexPattern.formulaWithTooManyArguments": "运算 {operation} 的参数过多",
"xpack.lens.indexPattern.functionsLabel": "函数",
"xpack.lens.indexPattern.functionTable.descriptionHeader": "描述",
"xpack.lens.indexPattern.functionTable.functionHeader": "函数",
"xpack.lens.indexPattern.groupByDropdown": "分组依据",
"xpack.lens.indexPattern.helpIncompatibleFieldDotLabel": "此函数不兼容当前选定的字段",
"xpack.lens.indexPattern.helpLabel": "函数帮助",
@ -27691,8 +27689,6 @@
"xpack.lens.indexPattern.precisionErrorWarning.filters": "筛选",
"xpack.lens.indexPattern.precisionErrorWarning.link": "了解详情。",
"xpack.lens.indexPattern.precisionErrorWarning.topValues": "排名最前值",
"xpack.lens.indexPattern.quickFunctions.popoverTitle": "快选函数",
"xpack.lens.indexPattern.quickFunctions.tableTitle": "函数的描述",
"xpack.lens.indexPattern.quickFunctionsLabel": "快速函数",
"xpack.lens.indexPattern.randomSampling.disabledMessage": "要选择减小的采样百分比,必须移除在此图层上应用的任何最大值或最小值函数。",
"xpack.lens.indexPattern.randomSampling.help": "较低采样百分比会提高性能,但会降低准确性。较低采样百分比最适合大型数据集。{link}",

View file

@ -19,11 +19,6 @@ import {
useEuiTheme,
EuiFlexGroup,
EuiFlexItem,
EuiPopover,
EuiPopoverTitle,
EuiPanel,
EuiBasicTable,
EuiButtonIcon,
type UseEuiTheme,
} from '@elastic/eui';
import ReactDOM from 'react-dom';
@ -126,7 +121,6 @@ export function DimensionEditor(props: DimensionEditorProps) {
selectedColumn && operationDefinitionMap[selectedColumn.operationType];
const [temporaryState, setTemporaryState] = useState<TemporaryState>('none');
const [isHelpOpen, setIsHelpOpen] = useState(false);
// If a layer has sampling disabled, assume the toast has already fired in the past
const [hasRandomSamplingToastFired, setSamplingToastAsFired] = useState(
@ -137,9 +131,6 @@ export function DimensionEditor(props: DimensionEditorProps) {
const [hasOtherBucketToastFired, setHasOtherBucketToastFired] = useState(false);
const onHelpClick = () => setIsHelpOpen((prevIsHelpOpen) => !prevIsHelpOpen);
const closeHelp = () => setIsHelpOpen(false);
const temporaryQuickFunction = Boolean(temporaryState === quickFunctionsName);
const temporaryStaticValue = Boolean(temporaryState === staticValueOperationName);
@ -421,6 +412,7 @@ export function DimensionEditor(props: DimensionEditorProps) {
compatibleWithSampling:
getSamplingValue(state.layers[layerId]) === 1 ||
(definition.getUnsupportedSettings?.()?.sampling ?? true),
documentation: definition.quickFunctionDocumentation,
};
});
@ -434,7 +426,13 @@ export function DimensionEditor(props: DimensionEditorProps) {
(selectedColumn?.operationType != null && isQuickFunction(selectedColumn?.operationType));
const sideNavItems: EuiListGroupItemProps[] = operationsWithCompatibility.map(
({ operationType, compatibleWithCurrentField, disabledStatus, compatibleWithSampling }) => {
({
operationType,
compatibleWithCurrentField,
disabledStatus,
compatibleWithSampling,
documentation,
}) => {
const isActive = Boolean(
incompleteOperation === operationType ||
(!incompleteOperation && selectedColumn && selectedColumn.operationType === operationType)
@ -582,6 +580,11 @@ export function DimensionEditor(props: DimensionEditorProps) {
}),
}
: undefined,
showToolTip: !disabledStatus,
toolTipProps: {
position: 'left',
},
toolTipText: documentation,
onClick() {
if (
['none', 'fullReference', 'managedReference'].includes(
@ -723,43 +726,6 @@ export function DimensionEditor(props: DimensionEditorProps) {
...services,
};
const helpButton = (
<EuiButtonIcon
onClick={onHelpClick}
iconType="documentation"
aria-label={i18n.translate('xpack.lens.indexPattern.quickFunctions.tableTitle', {
defaultMessage: 'Description of functions',
})}
/>
);
const columnsSidebar = [
{
field: 'function',
name: i18n.translate('xpack.lens.indexPattern.functionTable.functionHeader', {
defaultMessage: 'Function',
}),
width: '150px',
},
{
field: 'description',
name: i18n.translate('xpack.lens.indexPattern.functionTable.descriptionHeader', {
defaultMessage: 'Description',
}),
},
];
const items = sideNavItems
.filter((item) => operationDefinitionMap[item.id!].quickFunctionDocumentation)
.map((item) => {
const operationDefinition = operationDefinitionMap[item.id!]!;
return {
id: item.id!,
function: operationDefinition.displayName,
description: operationDefinition.quickFunctionDocumentation!,
};
});
const quickFunctions = (
<>
<EuiFormRow
@ -770,45 +736,6 @@ export function DimensionEditor(props: DimensionEditorProps) {
defaultMessage: 'Functions',
})}
</EuiFlexItem>
<EuiFlexItem grow={false}>
<EuiPopover
anchorPosition="rightUp"
button={helpButton}
isOpen={isHelpOpen}
display="inlineBlock"
panelPaddingSize="none"
closePopover={closeHelp}
initialFocus="#functionsHelpBasicTableId"
>
<EuiPopoverTitle paddingSize="s">
{i18n.translate('xpack.lens.indexPattern.quickFunctions.popoverTitle', {
defaultMessage: 'Quick functions',
})}
</EuiPopoverTitle>
<EuiPanel
className="eui-yScroll"
style={{ maxHeight: '40vh' }}
color="transparent"
paddingSize="s"
>
<EuiBasicTable
id="functionsHelpBasicTableId"
style={{ width: 350 }}
tableCaption={i18n.translate(
'xpack.lens.indexPattern.quickFunctions.tableTitle',
{
defaultMessage: 'Description of functions',
}
)}
items={items}
compressed={true}
rowHeader="firstName"
columns={columnsSidebar}
responsiveBreakpoint={false}
/>
</EuiPanel>
</EuiPopover>
</EuiFlexItem>
</EuiFlexGroup>
}
fullWidth