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

[Lens] Add tooltip and change icon to "collapse by" feature #132581

Merged
merged 1 commit into from
May 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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 @@ -203,10 +203,11 @@ export const getDatatableVisualization = ({
)
.map((accessor) => ({
columnId: accessor,
triggerIcon:
columnMap[accessor].hidden || columnMap[accessor].collapseFn
? 'invisible'
: undefined,
triggerIcon: columnMap[accessor].hidden
? 'invisible'
: columnMap[accessor].collapseFn
? 'aggregate'
: undefined,
})),
supportsMoreColumns: true,
filterOperations: (op) => op.isBucketed,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,17 @@ export function ColorIndicator({
})}
/>
)}
{accessorConfig.triggerIcon === 'aggregate' && (
<EuiIcon
{...baseIconProps}
type="fold"
color="subdued"
aria-label={i18n.translate('xpack.lens.editorFrame.aggregateIndicatorLabel', {
defaultMessage:
'This dimension is not visible in the chart because all individual values are aggregated into a single value',
})}
/>
)}
{accessorConfig.triggerIcon === 'colorBy' && (
<EuiIcon
{...baseIconProps}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* 2.0.
*/

import { EuiFormRow, EuiSelect } from '@elastic/eui';
import { EuiFormRow, EuiIcon, EuiSelect, EuiToolTip } from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import React from 'react';

Expand All @@ -26,7 +26,22 @@ export function CollapseSetting({
}) {
return (
<EuiFormRow
label={i18n.translate('xpack.lens.collapse.label', { defaultMessage: 'Collapse by' })}
label={
<EuiToolTip
delay="long"
position="top"
content={i18n.translate('xpack.lens.collapse.infoIcon', {
defaultMessage:
'Do not show this dimension in the visualization and aggregate all metric values which have the same value for this dimension into a single number.',
})}
>
<span>
{i18n.translate('xpack.lens.collapse.label', { defaultMessage: 'Collapse by' })}
{''}
<EuiIcon type="questionInCircle" color="subdued" size="s" className="eui-alignTop" />
</span>
</EuiToolTip>
}
display="columnCompressed"
fullWidth
>
Expand Down
2 changes: 1 addition & 1 deletion x-pack/plugins/lens/public/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -557,7 +557,7 @@ export type VisualizationDimensionEditorProps<T = unknown> = VisualizationConfig

export interface AccessorConfig {
columnId: string;
triggerIcon?: 'color' | 'disabled' | 'colorBy' | 'none' | 'invisible';
triggerIcon?: 'color' | 'disabled' | 'colorBy' | 'none' | 'invisible' | 'aggregate';
color?: string;
palette?: string[] | Array<{ color: string; stop: number }>;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ export const getXyVisualization = ({
? [
{
columnId: dataLayer.splitAccessor,
triggerIcon: dataLayer.collapseFn ? ('invisible' as const) : ('colorBy' as const),
triggerIcon: dataLayer.collapseFn ? ('aggregate' as const) : ('colorBy' as const),
palette: dataLayer.collapseFn
? undefined
: paletteService
Expand Down