fix(explore): long metric name display (#12387)

* fix(explore): long metric name display

* add tooltip to control
This commit is contained in:
Yongjie Zhao 2021-01-11 09:42:38 +08:00 committed by GitHub
parent 9acf48fd1e
commit c327cb911e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 31 additions and 12 deletions

View File

@ -58,6 +58,12 @@ const ResizeIcon = styled.i`
margin-left: ${({ theme }) => theme.gridUnit * 2}px;
`;
const ColumnOptionStyle = styled.span`
.option-label {
display: inline;
}
`;
const SAVED_TAB_KEY = 'SAVED';
const startingWidth = 320;
@ -220,7 +226,11 @@ export default class AdhocMetricEditPopover extends React.Component {
if (column.metric_name && !column.verbose_name) {
column.verbose_name = column.metric_name;
}
return <ColumnOption column={column} showType />;
return (
<ColumnOptionStyle>
<ColumnOption column={column} showType />
</ColumnOptionStyle>
);
}
render() {

View File

@ -18,6 +18,7 @@
*/
import React from 'react';
import PropTypes from 'prop-types';
import { Tooltip } from 'src/common/components/Tooltip';
import AdhocMetric from '../AdhocMetric';
import columnType from '../propTypes/columnType';
import savedMetricType from '../propTypes/savedMetricType';
@ -70,17 +71,22 @@ class AdhocMetricOption extends React.PureComponent {
savedMetric={savedMetric}
datasourceType={datasourceType}
>
<DraggableOptionControlLabel
savedMetric={savedMetric}
label={adhocMetric.label}
onRemove={this.onRemoveMetric}
onMoveLabel={onMoveLabel}
onDropLabel={onDropLabel}
index={index}
type={OPTION_TYPES.metric}
isAdhoc
isFunction
/>
<Tooltip
placement="top"
title={savedMetric.expression || adhocMetric.label}
>
<DraggableOptionControlLabel
savedMetric={savedMetric}
label={adhocMetric.label}
onRemove={this.onRemoveMetric}
onMoveLabel={onMoveLabel}
onDropLabel={onDropLabel}
index={index}
type={OPTION_TYPES.metric}
isAdhoc
isFunction
/>
</Tooltip>
</AdhocMetricPopoverTrigger>
);
}

View File

@ -60,6 +60,9 @@ const Label = styled.div`
svg {
margin-right: ${({ theme }) => theme.gridUnit}px;
}
.option-label {
display: inline;
}
`;
const CaretContainer = styled.div`