mirror of
https://github.com/apache/superset.git
synced 2026-05-12 19:35:17 +00:00
Migrates Label component from Bootstrap to AntD. (#12774)
This commit is contained in:
committed by
GitHub
parent
388edbf7b2
commit
2adfb85597
@@ -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>
|
||||
|
||||
@@ -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} />
|
||||
|
||||
Reference in New Issue
Block a user