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

[7.x] [Lens] Heatmap / Swim lane integration (#97978) #101426

Merged
merged 1 commit into from
Jun 4, 2021
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
31 changes: 31 additions & 0 deletions x-pack/plugins/lens/public/assets/chart_heatmap.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/*
* 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 { EuiIconProps } from '@elastic/eui';
import React from 'react';

export const LensIconChartHeatmap = ({ title, titleId, ...props }: Omit<EuiIconProps, 'type'>) => (
<svg
width={30}
height={22}
viewBox="0 0 30 22"
fill="none"
xmlns="http://www.w3.org/2000/svg"
aria-labelledby={titleId}
{...props}
>
{title ? <title id={titleId}>{title}</title> : null}
<path
className="lensChartIcon__accent"
d="M16 1a1 1 0 011-1h4a1 1 0 011 1v4a1 1 0 01-1 1h-4a1 1 0 01-1-1V1zM0 17a1 1 0 011-1h4a1 1 0 011 1v4a1 1 0 01-1 1H1a1 1 0 01-1-1v-4zm17-9a1 1 0 00-1 1v4a1 1 0 001 1h4a1 1 0 001-1V9a1 1 0 00-1-1h-4zm-1 9a1 1 0 011-1h4a1 1 0 011 1v4a1 1 0 01-1 1h-4a1 1 0 01-1-1v-4zm9-17a1 1 0 00-1 1v4a1 1 0 001 1h4a1 1 0 001-1V1a1 1 0 00-1-1h-4z"
/>
<path
className="lensChartIcon__subdued"
d="M0 1a1 1 0 011-1h4a1 1 0 011 1v4a1 1 0 01-1 1H1a1 1 0 01-1-1V1zm0 8a1 1 0 011-1h4a1 1 0 011 1v4a1 1 0 01-1 1H1a1 1 0 01-1-1V9zm9-9a1 1 0 00-1 1v4a1 1 0 001 1h4a1 1 0 001-1V1a1 1 0 00-1-1H9zM8 9a1 1 0 011-1h4a1 1 0 011 1v4a1 1 0 01-1 1H9a1 1 0 01-1-1V9zm1 7a1 1 0 00-1 1v4a1 1 0 001 1h4a1 1 0 001-1v-4a1 1 0 00-1-1H9zm15-7a1 1 0 011-1h4a1 1 0 011 1v4a1 1 0 01-1 1h-4a1 1 0 01-1-1V9zm1 7a1 1 0 00-1 1v4a1 1 0 001 1h4a1 1 0 001-1v-4a1 1 0 00-1-1h-4z"
/>
</svg>
);
1 change: 1 addition & 0 deletions x-pack/plugins/lens/public/async_services.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export * from './datatable_visualization/datatable_visualization';
export * from './metric_visualization/metric_visualization';
export * from './pie_visualization/pie_visualization';
export * from './xy_visualization/xy_visualization';
export * from './heatmap_visualization/heatmap_visualization';

export * from './indexpattern_datasource/indexpattern';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@
color: $euiTextSubduedColor;
}

.lnsChartSwitch__append {
display: inline-flex;
}

// Targeting img as this won't target normal EuiIcon's only the custom svgs's
img.lnsChartSwitch__chartIcon { // stylelint-disable-line selector-no-qualifying-type
// The large icons aren't square so max out the width to fill the height
Expand All @@ -19,4 +23,4 @@ img.lnsChartSwitch__chartIcon { // stylelint-disable-line selector-no-qualifying

.lnsChartSwitch__search {
width: 7 * $euiSizeXXL;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import {
EuiSelectable,
EuiIconTip,
EuiSelectableOption,
EuiBadge,
} from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import { FormattedMessage } from '@kbn/i18n/react';
Expand Down Expand Up @@ -286,6 +287,7 @@ export const ChartSwitch = memo(function ChartSwitch(props: Props) {
.map(
(v): SelectableEntry => ({
'aria-label': v.fullLabel || v.label,
className: 'lnsChartSwitch__option',
isGroupLabel: false,
key: `${v.visualizationId}:${v.id}`,
value: `${v.visualizationId}:${v.id}`,
Expand All @@ -295,22 +297,45 @@ export const ChartSwitch = memo(function ChartSwitch(props: Props) {
<EuiIcon className="lnsChartSwitch__chartIcon" type={v.icon || 'empty'} />
),
append:
v.selection.dataLoss !== 'nothing' ? (
<EuiIconTip
aria-label={i18n.translate('xpack.lens.chartSwitch.dataLossLabel', {
defaultMessage: 'Warning',
})}
type="alert"
color="warning"
content={i18n.translate('xpack.lens.chartSwitch.dataLossDescription', {
defaultMessage:
'Selecting this chart type will result in a partial loss of currently applied configuration selections.',
})}
iconProps={{
className: 'lnsChartSwitch__chartIcon',
'data-test-subj': `lnsChartSwitchPopoverAlert_${v.id}`,
}}
/>
v.selection.dataLoss !== 'nothing' || v.showBetaBadge ? (
<EuiFlexGroup
gutterSize="xs"
responsive={false}
className="lnsChartSwitch__append"
>
{v.selection.dataLoss !== 'nothing' ? (
<EuiFlexItem grow={false}>
<EuiIconTip
aria-label={i18n.translate('xpack.lens.chartSwitch.dataLossLabel', {
defaultMessage: 'Warning',
})}
type="alert"
color="warning"
content={i18n.translate(
'xpack.lens.chartSwitch.dataLossDescription',
{
defaultMessage:
'Selecting this chart type will result in a partial loss of currently applied configuration selections.',
}
)}
iconProps={{
className: 'lnsChartSwitch__chartIcon',
'data-test-subj': `lnsChartSwitchPopoverAlert_${v.id}`,
}}
/>
</EuiFlexItem>
) : null}
{v.showBetaBadge ? (
<EuiFlexItem grow={false}>
<EuiBadge color="hollow">
<FormattedMessage
id="xpack.lens.chartSwitch.betaLabel"
defaultMessage="Beta"
/>
</EuiBadge>
</EuiFlexItem>
) : null}
</EuiFlexGroup>
) : null,
// Apparently checked: null is not valid for TS
...(subVisualizationId === v.id && { checked: 'on' }),
Expand Down Expand Up @@ -363,6 +388,7 @@ export const ChartSwitch = memo(function ChartSwitch(props: Props) {
</EuiFlexGroup>
</EuiPopoverTitle>
<EuiSelectable
className="lnsChartSwitch__options"
height={computeListHeight(visualizationTypes, MAX_LIST_HEIGHT)}
searchable
singleSelection
Expand Down
Loading