Skip to content

Commit

Permalink
using legacyValidateInteger, legacyValidateNumber
Browse files Browse the repository at this point in the history
  • Loading branch information
rusackas committed Apr 14, 2020
1 parent 620efa9 commit eeebcff
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import React from 'react';
import PropTypes from 'prop-types';
import { FormGroup, FormControl } from 'react-bootstrap';
import { validateNumber, validateInteger } from '@superset-ui/validator';
import { legacyValidateNumber, legacyValidateInteger } from '@superset-ui/validator';
import ControlHeader from '../ControlHeader';

const propTypes = {
Expand Down Expand Up @@ -51,15 +51,15 @@ export default class TextControl extends React.Component {
// Validation & casting
const errors = [];
if (value !== '' && this.props.isFloat) {
const error = validateNumber(value);
const error = legacyValidateNumber(value);
if (error) {
errors.push(error);
} else {
value = value.match(/.*(\.)$/g) ? value : parseFloat(value);
}
}
if (value !== '' && this.props.isInt) {
const error = validateInteger(value);
const error = legacyValidateInteger(value);
if (error) {
errors.push(error);
} else {
Expand Down
10 changes: 5 additions & 5 deletions superset-frontend/src/explore/controlPanels/CalHeatmap.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* under the License.
*/
import { t } from '@superset-ui/translation';
import { validateInteger } from '@superset-ui/validator';
import { legacyValidateInteger } from '@superset-ui/validator';
import {
// formatSelectOptionsForRange,
formatSelectOptions,
Expand Down Expand Up @@ -85,7 +85,7 @@ export default {
type: 'TextControl',
isInt: true,
default: 10,
validators: [validateInteger],
validators: [legacyValidateInteger],
renderTrigger: true,
label: t('Cell Size'),
description: t('The size of the square cell, in pixels'),
Expand All @@ -96,7 +96,7 @@ export default {
config: {
type: 'TextControl',
isInt: true,
validators: [validateInteger],
validators: [legacyValidateInteger],
renderTrigger: true,
default: 2,
label: t('Cell Padding'),
Expand All @@ -110,7 +110,7 @@ export default {
config: {
type: 'TextControl',
isInt: true,
validators: [validateInteger],
validators: [legacyValidateInteger],
renderTrigger: true,
default: 0,
label: t('Cell Radius'),
Expand All @@ -122,7 +122,7 @@ export default {
config: {
type: 'TextControl',
isInt: true,
validators: [validateInteger],
validators: [legacyValidateInteger],
renderTrigger: true,
default: 10,
label: t('Color Steps'),
Expand Down
4 changes: 2 additions & 2 deletions superset-frontend/src/explore/controlPanels/DeckArc.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* under the License.
*/
import { t } from '@superset-ui/translation';
import { validateNonEmpty, validateInteger } from '@superset-ui/validator';
import { validateNonEmpty, legacyValidateInteger } from '@superset-ui/validator';
import timeGrainSqlaAnimationOverrides from './timeGrainSqlaAnimationOverrides';
import { columnChoices, PRIMARY_COLOR } from '../controls';
import { formatSelectOptions } from '../../modules/utils';
Expand Down Expand Up @@ -112,7 +112,7 @@ export default {
type: 'SelectControl',
freeForm: true,
label: t('Stroke Width'),
validators: [validateInteger],
validators: [legacyValidateInteger],
default: null,
renderTrigger: true,
choices: formatSelectOptions([1, 2, 3, 4, 5]),
Expand Down
4 changes: 2 additions & 2 deletions superset-frontend/src/explore/controlPanels/DeckGeojson.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* under the License.
*/
import { t } from '@superset-ui/translation';
import { validateNonEmpty, validateInteger } from '@superset-ui/validator';
import { validateNonEmpty, legacyValidateInteger } from '@superset-ui/validator';
import { formatSelectOptions } from '../../modules/utils';
import { columnChoices } from '../controls';
import {
Expand Down Expand Up @@ -80,7 +80,7 @@ export default {
type: 'SelectControl',
freeForm: true,
label: t('Point Radius Scale'),
validators: [validateInteger],
validators: [legacyValidateInteger],
default: null,
choices: formatSelectOptions([0, 100, 200, 300, 500]),
},
Expand Down
6 changes: 3 additions & 3 deletions superset-frontend/src/explore/controls.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ import {
getCategoricalSchemeRegistry,
getSequentialSchemeRegistry,
} from '@superset-ui/color';
import { validateInteger, validateNonEmpty } from '@superset-ui/validator';
import { legacyValidateInteger, validateNonEmpty } from '@superset-ui/validator';

import {
formatSelectOptionsForRange,
Expand Down Expand Up @@ -677,7 +677,7 @@ export const controls = {
type: 'SelectControl',
freeForm: true,
label: t('Row limit'),
validators: [validateInteger],
validators: [legacyValidateInteger],
default: 10000,
choices: formatSelectOptions(ROW_LIMIT_OPTIONS),
},
Expand All @@ -686,7 +686,7 @@ export const controls = {
type: 'SelectControl',
freeForm: true,
label: t('Series limit'),
validators: [validateInteger],
validators: [legacyValidateInteger],
choices: formatSelectOptions(SERIES_LIMITS),
description: t(
'Limits the number of time series that get displayed. A sub query ' +
Expand Down

0 comments on commit eeebcff

Please sign in to comment.