fix(explore): Filters Tooltip is not showing the full content (#14618)

* Add getTooltipTitle

* Fix tests
This commit is contained in:
Geido 2021-05-13 20:03:22 +03:00 committed by GitHub
parent 568061e8d4
commit 1e601483e3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 9 additions and 1 deletions

View File

@ -142,6 +142,10 @@ export default class AdhocFilter {
return label.length < 43 ? label : `${label.substring(0, 40)}...`;
}
getTooltipTitle() {
return this.translateToSql();
}
translateToSql() {
return translateToSql(this);
}

View File

@ -63,6 +63,7 @@ const AdhocFilterOption = ({
>
<OptionControlLabel
label={adhocFilter.getDefaultLabel()}
tooltipTitle={adhocFilter.getTooltipTitle()}
onRemove={onRemoveFilter}
onMoveLabel={onMoveLabel}
onDropLabel={onDropLabel}

View File

@ -36,6 +36,7 @@ import {
const defaultProps = {
label: <span>Test label</span>,
tooltipTitle: 'This is a tooltip title',
onRemove: jest.fn(),
onMoveLabel: jest.fn(),
onDropLabel: jest.fn(),

View File

@ -167,6 +167,7 @@ export const OptionControlLabel = ({
type,
index,
isExtra,
tooltipTitle,
...props
}: {
label: string | React.ReactNode;
@ -181,6 +182,7 @@ export const OptionControlLabel = ({
type: string;
index: number;
isExtra?: boolean;
tooltipTitle: string;
}) => {
const theme = useTheme();
const ref = useRef<HTMLDivElement>(null);
@ -246,7 +248,7 @@ export const OptionControlLabel = ({
if (savedMetric?.metric_name) {
return <StyledMetricOption metric={savedMetric} />;
}
return <Tooltip title={label}>{label}</Tooltip>;
return <Tooltip title={tooltipTitle}>{label}</Tooltip>;
};
const getOptionControlContent = () => (