Importing validators module from superset-ui (#9465)

* importing... this is going to break CI, but there it is.

* adding validator package.

* pluralization - maybe it should be plural, but whatevs

* updating validators to match new exports

* removing old validators

* lintage 

* validateNumeric -> validateNumber

* using legacyValidateInteger, legacyValidateNumber

* linting 

* removing extraneous package lock file
This commit is contained in:
Evan Rusackas
2020-04-14 12:00:25 -07:00
committed by GitHub
parent c343c2ff1d
commit 6270f7dc24
23 changed files with 84 additions and 114 deletions

View File

@@ -25,6 +25,7 @@ import { t } from '@superset-ui/translation';
import { SupersetClient } from '@superset-ui/connection';
import { getCategoricalSchemeRegistry } from '@superset-ui/color';
import { getChartMetadataRegistry } from '@superset-ui/chart';
import { validateNonEmpty } from '@superset-ui/validator';
import SelectControl from './SelectControl';
import TextControl from './TextControl';
@@ -40,7 +41,6 @@ import ANNOTATION_TYPES, {
import PopoverSection from '../../../components/PopoverSection';
import ControlHeader from '../ControlHeader';
import { nonEmpty } from '../../validators';
import './AnnotationLayer.less';
const AUTOMATIC_COLOR = '';
@@ -215,14 +215,18 @@ export default class AnnotationLayer extends React.PureComponent {
timeColumn,
intervalEndColumn,
} = this.state;
const errors = [nonEmpty(name), nonEmpty(annotationType), nonEmpty(value)];
const errors = [
validateNonEmpty(name),
validateNonEmpty(annotationType),
validateNonEmpty(value),
];
if (sourceType !== ANNOTATION_SOURCE_TYPES.NATIVE) {
if (annotationType === ANNOTATION_TYPES.EVENT) {
errors.push(nonEmpty(timeColumn));
errors.push(validateNonEmpty(timeColumn));
}
if (annotationType === ANNOTATION_TYPES.INTERVAL) {
errors.push(nonEmpty(timeColumn));
errors.push(nonEmpty(intervalEndColumn));
errors.push(validateNonEmpty(timeColumn));
errors.push(validateNonEmpty(intervalEndColumn));
}
}
errors.push(this.isValidFormula(value, annotationType));