Migrates Label component from Bootstrap to AntD. (#12774)

This commit is contained in:
Michael S. Molina
2021-02-02 03:15:07 -03:00
committed by GitHub
parent 388edbf7b2
commit 2adfb85597
21 changed files with 162 additions and 225 deletions

View File

@@ -37,7 +37,7 @@ const defaultProps = {
export default function RowCountLabel({ rowcount, limit, suffix, loading }) {
const limitReached = rowcount === limit;
const bsStyle =
const type =
limitReached || (rowcount === 0 && !loading) ? 'danger' : 'default';
const formattedRowCount = getNumberFormatter()(rowcount);
const tooltip = (
@@ -48,7 +48,7 @@ export default function RowCountLabel({ rowcount, limit, suffix, loading }) {
);
return (
<TooltipWrapper label="tt-rowcount" tooltip={tooltip}>
<Label bsStyle={bsStyle}>
<Label type={type} data-test="row-count-label">
{loading ? 'Loading...' : `${formattedRowCount} ${suffix}`}
</Label>
</TooltipWrapper>

View File

@@ -34,12 +34,12 @@ const propTypes = {
name: PropTypes.string.isRequired,
onChange: PropTypes.func,
value: PropTypes.string.isRequired,
labelBsStyle: PropTypes.string,
labelType: PropTypes.string,
};
const defaultProps = {
onChange: () => {},
labelBsStyle: 'default',
labelType: 'default',
};
const registry = getChartMetadataRegistry();
@@ -162,7 +162,7 @@ const VizTypeControl = props => {
);
};
const { value, labelBsStyle } = props;
const { value, labelType } = props;
const filterString = filter.toLowerCase();
const filteredTypes = DEFAULT_ORDER.filter(type => registry.has(type))
@@ -201,7 +201,11 @@ const VizTypeControl = props => {
title={t('Click to change visualization type')}
>
<>
<Label onClick={toggleModal} bsStyle={labelBsStyle}>
<Label
onClick={toggleModal}
type={labelType}
data-test="visualization-type"
>
{registry.has(value) ? registry.get(value).name : `${value}`}
</Label>
<VizSupportValidation vizType={value} />