From 718709672c3a7e4f14687b426b04d26d8f19a6c4 Mon Sep 17 00:00:00 2001 From: Evan Rusackas Date: Fri, 3 Apr 2020 16:41:50 -0700 Subject: [PATCH 01/10] importing... this is going to break CI, but there it is. --- .../components/controls/AnnotationLayer.jsx | 2 +- .../components/controls/TextControl.jsx | 6 +++--- .../src/explore/controlPanels/CalHeatmap.js | 10 +++++----- .../src/explore/controlPanels/Chord.js | 2 +- .../src/explore/controlPanels/DeckGeojson.js | 2 +- .../src/explore/controlPanels/DeckGrid.js | 2 +- .../src/explore/controlPanels/DeckMulti.js | 2 +- .../src/explore/controlPanels/DeckScatter.js | 2 +- .../explore/controlPanels/DeckScreengrid.js | 2 +- .../src/explore/controlPanels/DistBar.js | 2 +- .../src/explore/controlPanels/EventFlow.js | 2 +- .../src/explore/controlPanels/Heatmap.js | 2 +- .../src/explore/controlPanels/Histogram.js | 2 +- .../src/explore/controlPanels/LineMulti.js | 4 ++-- .../src/explore/controlPanels/Partition.jsx | 2 +- .../src/explore/controlPanels/Table.js | 4 ++-- .../src/explore/controlPanels/WordCloud.js | 2 +- superset-frontend/src/explore/controls.jsx | 20 +++++++++---------- 18 files changed, 35 insertions(+), 35 deletions(-) diff --git a/superset-frontend/src/explore/components/controls/AnnotationLayer.jsx b/superset-frontend/src/explore/components/controls/AnnotationLayer.jsx index b6f2253280ed8..6dd10fe276290 100644 --- a/superset-frontend/src/explore/components/controls/AnnotationLayer.jsx +++ b/superset-frontend/src/explore/components/controls/AnnotationLayer.jsx @@ -40,7 +40,7 @@ import ANNOTATION_TYPES, { import PopoverSection from '../../../components/PopoverSection'; import ControlHeader from '../ControlHeader'; -import { nonEmpty } from '../../validators'; +import { nonEmpty } from '@superset-ui/validators'; import './AnnotationLayer.less'; const AUTOMATIC_COLOR = ''; diff --git a/superset-frontend/src/explore/components/controls/TextControl.jsx b/superset-frontend/src/explore/components/controls/TextControl.jsx index 99212c3daf329..bb75d4ea6f955 100644 --- a/superset-frontend/src/explore/components/controls/TextControl.jsx +++ b/superset-frontend/src/explore/components/controls/TextControl.jsx @@ -19,7 +19,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import { FormGroup, FormControl } from 'react-bootstrap'; -import * as v from '../../validators'; +import { numeric, integer } from '@superset-ui/validators'; import ControlHeader from '../ControlHeader'; const propTypes = { @@ -51,7 +51,7 @@ export default class TextControl extends React.Component { // Validation & casting const errors = []; if (value !== '' && this.props.isFloat) { - const error = v.numeric(value); + const error = numeric(value); if (error) { errors.push(error); } else { @@ -59,7 +59,7 @@ export default class TextControl extends React.Component { } } if (value !== '' && this.props.isInt) { - const error = v.integer(value); + const error = integer(value); if (error) { errors.push(error); } else { diff --git a/superset-frontend/src/explore/controlPanels/CalHeatmap.js b/superset-frontend/src/explore/controlPanels/CalHeatmap.js index d4292a991de81..c7f2924363ebb 100644 --- a/superset-frontend/src/explore/controlPanels/CalHeatmap.js +++ b/superset-frontend/src/explore/controlPanels/CalHeatmap.js @@ -22,7 +22,7 @@ import { formatSelectOptions, // mainMetric, } from '../../modules/utils'; -import * as v from '.././validators'; +import { integer } from '@superset-ui/validators'; import { D3_TIME_FORMAT_OPTIONS, D3_FORMAT_DOCS } from '../controls'; export default { @@ -85,7 +85,7 @@ export default { type: 'TextControl', isInt: true, default: 10, - validators: [v.integer], + validators: [integer], renderTrigger: true, label: t('Cell Size'), description: t('The size of the square cell, in pixels'), @@ -96,7 +96,7 @@ export default { config: { type: 'TextControl', isInt: true, - validators: [v.integer], + validators: [integer], renderTrigger: true, default: 2, label: t('Cell Padding'), @@ -110,7 +110,7 @@ export default { config: { type: 'TextControl', isInt: true, - validators: [v.integer], + validators: [integer], renderTrigger: true, default: 0, label: t('Cell Radius'), @@ -122,7 +122,7 @@ export default { config: { type: 'TextControl', isInt: true, - validators: [v.integer], + validators: [integer], renderTrigger: true, default: 10, label: t('Color Steps'), diff --git a/superset-frontend/src/explore/controlPanels/Chord.js b/superset-frontend/src/explore/controlPanels/Chord.js index b932c3f0e5039..25d045cbab61d 100644 --- a/superset-frontend/src/explore/controlPanels/Chord.js +++ b/superset-frontend/src/explore/controlPanels/Chord.js @@ -17,7 +17,7 @@ * under the License. */ import { t } from '@superset-ui/translation'; -import { nonEmpty } from '../validators'; +import { nonEmpty } from '@superset-ui/validators'; export default { controlPanelSections: [ diff --git a/superset-frontend/src/explore/controlPanels/DeckGeojson.js b/superset-frontend/src/explore/controlPanels/DeckGeojson.js index 37561773f388e..f28c41a378152 100644 --- a/superset-frontend/src/explore/controlPanels/DeckGeojson.js +++ b/superset-frontend/src/explore/controlPanels/DeckGeojson.js @@ -17,7 +17,7 @@ * under the License. */ import { t } from '@superset-ui/translation'; -import { nonEmpty, integer } from '../validators'; +import { nonEmpty, integer } from '@superset-ui/validators'; import { formatSelectOptions } from '../../modules/utils'; import { columnChoices } from '../controls'; import { diff --git a/superset-frontend/src/explore/controlPanels/DeckGrid.js b/superset-frontend/src/explore/controlPanels/DeckGrid.js index 8a48eddbf9586..f058f352a5067 100644 --- a/superset-frontend/src/explore/controlPanels/DeckGrid.js +++ b/superset-frontend/src/explore/controlPanels/DeckGrid.js @@ -17,7 +17,7 @@ * under the License. */ import { t } from '@superset-ui/translation'; -import { nonEmpty } from '../validators'; +import { nonEmpty } from '@superset-ui/validators'; import { filterNulls, autozoom, diff --git a/superset-frontend/src/explore/controlPanels/DeckMulti.js b/superset-frontend/src/explore/controlPanels/DeckMulti.js index 119e67259dc9b..72fff735f3265 100644 --- a/superset-frontend/src/explore/controlPanels/DeckMulti.js +++ b/superset-frontend/src/explore/controlPanels/DeckMulti.js @@ -17,7 +17,7 @@ * under the License. */ import { t } from '@superset-ui/translation'; -import { nonEmpty } from '../validators'; +import { nonEmpty } from '@superset-ui/validators'; import { viewport } from './Shared_DeckGL'; export default { diff --git a/superset-frontend/src/explore/controlPanels/DeckScatter.js b/superset-frontend/src/explore/controlPanels/DeckScatter.js index dcd5e1fbd8311..16d9ab6744d5e 100644 --- a/superset-frontend/src/explore/controlPanels/DeckScatter.js +++ b/superset-frontend/src/explore/controlPanels/DeckScatter.js @@ -18,7 +18,7 @@ */ import { t } from '@superset-ui/translation'; import timeGrainSqlaAnimationOverrides from './timeGrainSqlaAnimationOverrides'; -import { nonEmpty } from '../validators'; +import { nonEmpty } from '@superset-ui/validators'; import { filterNulls, autozoom, diff --git a/superset-frontend/src/explore/controlPanels/DeckScreengrid.js b/superset-frontend/src/explore/controlPanels/DeckScreengrid.js index eaffd7c6cc796..2d5ed0213ac51 100644 --- a/superset-frontend/src/explore/controlPanels/DeckScreengrid.js +++ b/superset-frontend/src/explore/controlPanels/DeckScreengrid.js @@ -17,7 +17,7 @@ * under the License. */ import { t } from '@superset-ui/translation'; -import { nonEmpty } from '../validators'; +import { nonEmpty } from '@superset-ui/validators'; import timeGrainSqlaAnimationOverrides from './timeGrainSqlaAnimationOverrides'; import { filterNulls, diff --git a/superset-frontend/src/explore/controlPanels/DistBar.js b/superset-frontend/src/explore/controlPanels/DistBar.js index 06f58dffdacd8..548f7ffa73777 100644 --- a/superset-frontend/src/explore/controlPanels/DistBar.js +++ b/superset-frontend/src/explore/controlPanels/DistBar.js @@ -17,7 +17,7 @@ * under the License. */ import { t } from '@superset-ui/translation'; -import { nonEmpty } from '../validators'; +import { nonEmpty } from '@superset-ui/validators'; export default { controlPanelSections: [ diff --git a/superset-frontend/src/explore/controlPanels/EventFlow.js b/superset-frontend/src/explore/controlPanels/EventFlow.js index 9e67f9104b946..2ec1e5cfcc491 100644 --- a/superset-frontend/src/explore/controlPanels/EventFlow.js +++ b/superset-frontend/src/explore/controlPanels/EventFlow.js @@ -17,7 +17,7 @@ * under the License. */ import { t } from '@superset-ui/translation'; -import { nonEmpty } from '../validators'; +import { nonEmpty } from '@superset-ui/validators'; import { formatSelectOptionsForRange } from '../../modules/utils'; export default { diff --git a/superset-frontend/src/explore/controlPanels/Heatmap.js b/superset-frontend/src/explore/controlPanels/Heatmap.js index 1586f573943c5..fe7af2d4bebde 100644 --- a/superset-frontend/src/explore/controlPanels/Heatmap.js +++ b/superset-frontend/src/explore/controlPanels/Heatmap.js @@ -17,7 +17,7 @@ * under the License. */ import { t } from '@superset-ui/translation'; -import { nonEmpty } from '../validators'; +import { nonEmpty } from '@superset-ui/validators'; import { formatSelectOptionsForRange } from '../../modules/utils'; const sortAxisChoices = [ diff --git a/superset-frontend/src/explore/controlPanels/Histogram.js b/superset-frontend/src/explore/controlPanels/Histogram.js index d95ff80a2c926..0d18663344121 100644 --- a/superset-frontend/src/explore/controlPanels/Histogram.js +++ b/superset-frontend/src/explore/controlPanels/Histogram.js @@ -17,7 +17,7 @@ * under the License. */ import { t } from '@superset-ui/translation'; -import { nonEmpty } from '../validators'; +import { nonEmpty } from '@superset-ui/validators'; export default { controlPanelSections: [ diff --git a/superset-frontend/src/explore/controlPanels/LineMulti.js b/superset-frontend/src/explore/controlPanels/LineMulti.js index f00c5f76a5700..d9d9885571242 100644 --- a/superset-frontend/src/explore/controlPanels/LineMulti.js +++ b/superset-frontend/src/explore/controlPanels/LineMulti.js @@ -19,7 +19,7 @@ import { t } from '@superset-ui/translation'; import { annotations } from './sections'; import { D3_TIME_FORMAT_OPTIONS } from '../controls'; -import * as v from '../validators'; +import { nonEmpty } from '@superset-ui/validators'; export default { requiresTime: true, @@ -65,7 +65,7 @@ export default { type: 'SelectAsyncControl', multi: true, label: t('Left Axis chart(s)'), - validators: [v.nonEmpty], + validators: [nonEmpty], default: [], description: t('Choose one or more charts for left axis'), dataEndpoint: diff --git a/superset-frontend/src/explore/controlPanels/Partition.jsx b/superset-frontend/src/explore/controlPanels/Partition.jsx index 8cb3b9d4c8236..b773b4f9dd811 100644 --- a/superset-frontend/src/explore/controlPanels/Partition.jsx +++ b/superset-frontend/src/explore/controlPanels/Partition.jsx @@ -20,7 +20,7 @@ import React from 'react'; import { t } from '@superset-ui/translation'; import { NVD3TimeSeries } from './sections'; import OptionDescription from '../../components/OptionDescription'; -import { nonEmpty } from '../validators'; +import { nonEmpty } from '@superset-ui/validators'; export default { controlPanelSections: [ diff --git a/superset-frontend/src/explore/controlPanels/Table.js b/superset-frontend/src/explore/controlPanels/Table.js index 4c573357f2932..695d75d6f4f10 100644 --- a/superset-frontend/src/explore/controlPanels/Table.js +++ b/superset-frontend/src/explore/controlPanels/Table.js @@ -17,7 +17,7 @@ * under the License. */ import { t } from '@superset-ui/translation'; -import * as v from '../validators'; +import { nonEmpty } from '@superset-ui/validators'; import { D3_TIME_FORMAT_OPTIONS } from '../controls'; import { formatSelectOptions } from '../../modules/utils'; @@ -114,7 +114,7 @@ export default { label: t('Table Timestamp Format'), default: '%Y-%m-%d %H:%M:%S', renderTrigger: true, - validators: [v.nonEmpty], + validators: [nonEmpty], clearable: false, choices: D3_TIME_FORMAT_OPTIONS, description: t('Timestamp Format'), diff --git a/superset-frontend/src/explore/controlPanels/WordCloud.js b/superset-frontend/src/explore/controlPanels/WordCloud.js index 63bcfbbe3dac1..9070bccb10fc4 100644 --- a/superset-frontend/src/explore/controlPanels/WordCloud.js +++ b/superset-frontend/src/explore/controlPanels/WordCloud.js @@ -17,7 +17,7 @@ * under the License. */ import { t } from '@superset-ui/translation'; -import { nonEmpty } from '../validators'; +import { nonEmpty } from '@superset-ui/validators'; export default { controlPanelSections: [ diff --git a/superset-frontend/src/explore/controls.jsx b/superset-frontend/src/explore/controls.jsx index c6404388280c7..6c1f333429b45 100644 --- a/superset-frontend/src/explore/controls.jsx +++ b/superset-frontend/src/explore/controls.jsx @@ -68,7 +68,7 @@ import { formatSelectOptions, mainMetric, } from '../modules/utils'; -import * as v from './validators'; +import { integer, nonEmpty } from '@superset-ui/validators'; import ColumnOption from '../components/ColumnOption'; import { TIME_FILTER_LABELS } from './constants'; @@ -153,7 +153,7 @@ const metrics = { type: 'MetricsControl', multi: true, label: t('Metrics'), - validators: [v.nonEmpty], + validators: [nonEmpty], default: c => { const metric = mainMetric(c.savedMetrics); return metric ? [metric] : null; @@ -423,7 +423,7 @@ export const controls = { type: 'SelectControl', label: t('Longitude'), default: 1, - validators: [v.nonEmpty], + validators: [nonEmpty], description: t('Select the longitude column'), mapStateToProps: state => ({ choices: columnChoices(state.datasource), @@ -434,7 +434,7 @@ export const controls = { type: 'SelectControl', label: t('Latitude'), default: 1, - validators: [v.nonEmpty], + validators: [nonEmpty], description: t('Select the latitude column'), mapStateToProps: state => ({ choices: columnChoices(state.datasource), @@ -444,7 +444,7 @@ export const controls = { polygon: { type: 'SelectControl', label: t('Polygon Column'), - validators: [v.nonEmpty], + validators: [nonEmpty], description: t( 'Select the polygon column. Each row should contain JSON.array(N) of [longitude, latitude] points', ), @@ -677,7 +677,7 @@ export const controls = { type: 'SelectControl', freeForm: true, label: t('Row limit'), - validators: [v.integer], + validators: [integer], default: 10000, choices: formatSelectOptions(ROW_LIMIT_OPTIONS), }, @@ -686,7 +686,7 @@ export const controls = { type: 'SelectControl', freeForm: true, label: t('Series limit'), - validators: [v.integer], + validators: [integer], choices: formatSelectOptions(SERIES_LIMITS), description: t( 'Limits the number of time series that get displayed. A sub query ' + @@ -766,7 +766,7 @@ export const controls = { label: t('Entity'), default: null, multi: false, - validators: [v.nonEmpty], + validators: [nonEmpty], description: t('This defines the element to be plotted on the chart'), }, @@ -874,7 +874,7 @@ export const controls = { clearable: false, choices: formatSelectOptions(['markdown', 'html']), default: 'markdown', - validators: [v.nonEmpty], + validators: [nonEmpty], description: t('Pick your favorite markup language'), }, @@ -1225,7 +1225,7 @@ export const controls = { column_collection: { type: 'CollectionControl', label: t('Time Series Columns'), - validators: [v.nonEmpty], + validators: [nonEmpty], controlName: 'TimeSeriesColumnControl', }, From fb3432bc07e8e5b8fd81cce226b741d428b7049d Mon Sep 17 00:00:00 2001 From: Evan Rusackas Date: Thu, 9 Apr 2020 09:57:50 -0700 Subject: [PATCH 02/10] adding validator package. --- package-lock.json | 3 +++ superset-frontend/package-lock.json | 5 +++++ superset-frontend/package.json | 1 + 3 files changed, 9 insertions(+) create mode 100644 package-lock.json diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000000000..48e341a0954d5 --- /dev/null +++ b/package-lock.json @@ -0,0 +1,3 @@ +{ + "lockfileVersion": 1 +} diff --git a/superset-frontend/package-lock.json b/superset-frontend/package-lock.json index 0acef3059f470..94f066282588a 100644 --- a/superset-frontend/package-lock.json +++ b/superset-frontend/package-lock.json @@ -8609,6 +8609,11 @@ "jed": "^1.1.1" } }, + "@superset-ui/validator": { + "version": "0.12.13", + "resolved": "https://registry.npmjs.org/@superset-ui/validator/-/validator-0.12.13.tgz", + "integrity": "sha512-X6GyXP80uJOhHrSUfS5Zf+jhFCLgiil9Md3YuNwArQN2qDK7qBsgb7vfiAhxPfKQfNgvmFeO5SVPZqdcl53aTw==" + }, "@types/airbnb-prop-types": { "version": "2.13.1", "resolved": "https://registry.npmjs.org/@types/airbnb-prop-types/-/airbnb-prop-types-2.13.1.tgz", diff --git a/superset-frontend/package.json b/superset-frontend/package.json index fe19545c9c89a..632aebd771a9a 100644 --- a/superset-frontend/package.json +++ b/superset-frontend/package.json @@ -92,6 +92,7 @@ "@superset-ui/query": "^0.12.8", "@superset-ui/time-format": "^0.12.10", "@superset-ui/translation": "^0.12.8", + "@superset-ui/validator": "^0.12.13", "@types/classnames": "^2.2.9", "@types/react-json-tree": "^0.6.11", "@types/react-select": "^1.2.1", From d90380c1eb55ba138c5ea9939239839a020c555d Mon Sep 17 00:00:00 2001 From: Evan Rusackas Date: Thu, 9 Apr 2020 11:59:06 -0700 Subject: [PATCH 03/10] pluralization - maybe it should be plural, but whatevs --- .../src/explore/components/controls/AnnotationLayer.jsx | 2 +- .../src/explore/components/controls/TextControl.jsx | 2 +- superset-frontend/src/explore/controlPanels/CalHeatmap.js | 2 +- superset-frontend/src/explore/controlPanels/Chord.js | 2 +- superset-frontend/src/explore/controlPanels/DeckGeojson.js | 2 +- superset-frontend/src/explore/controlPanels/DeckGrid.js | 2 +- superset-frontend/src/explore/controlPanels/DeckMulti.js | 2 +- superset-frontend/src/explore/controlPanels/DeckScatter.js | 2 +- superset-frontend/src/explore/controlPanels/DeckScreengrid.js | 2 +- superset-frontend/src/explore/controlPanels/DistBar.js | 2 +- superset-frontend/src/explore/controlPanels/EventFlow.js | 2 +- superset-frontend/src/explore/controlPanels/Heatmap.js | 2 +- superset-frontend/src/explore/controlPanels/Histogram.js | 2 +- superset-frontend/src/explore/controlPanels/LineMulti.js | 2 +- superset-frontend/src/explore/controlPanels/Partition.jsx | 2 +- superset-frontend/src/explore/controlPanels/Table.js | 2 +- superset-frontend/src/explore/controlPanels/WordCloud.js | 2 +- superset-frontend/src/explore/controls.jsx | 2 +- 18 files changed, 18 insertions(+), 18 deletions(-) diff --git a/superset-frontend/src/explore/components/controls/AnnotationLayer.jsx b/superset-frontend/src/explore/components/controls/AnnotationLayer.jsx index 6dd10fe276290..d59d914785429 100644 --- a/superset-frontend/src/explore/components/controls/AnnotationLayer.jsx +++ b/superset-frontend/src/explore/components/controls/AnnotationLayer.jsx @@ -40,7 +40,7 @@ import ANNOTATION_TYPES, { import PopoverSection from '../../../components/PopoverSection'; import ControlHeader from '../ControlHeader'; -import { nonEmpty } from '@superset-ui/validators'; +import { nonEmpty } from '@superset-ui/validator'; import './AnnotationLayer.less'; const AUTOMATIC_COLOR = ''; diff --git a/superset-frontend/src/explore/components/controls/TextControl.jsx b/superset-frontend/src/explore/components/controls/TextControl.jsx index bb75d4ea6f955..867662169baae 100644 --- a/superset-frontend/src/explore/components/controls/TextControl.jsx +++ b/superset-frontend/src/explore/components/controls/TextControl.jsx @@ -19,7 +19,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import { FormGroup, FormControl } from 'react-bootstrap'; -import { numeric, integer } from '@superset-ui/validators'; +import { numeric, integer } from '@superset-ui/validator'; import ControlHeader from '../ControlHeader'; const propTypes = { diff --git a/superset-frontend/src/explore/controlPanels/CalHeatmap.js b/superset-frontend/src/explore/controlPanels/CalHeatmap.js index c7f2924363ebb..00d96bec3214d 100644 --- a/superset-frontend/src/explore/controlPanels/CalHeatmap.js +++ b/superset-frontend/src/explore/controlPanels/CalHeatmap.js @@ -22,7 +22,7 @@ import { formatSelectOptions, // mainMetric, } from '../../modules/utils'; -import { integer } from '@superset-ui/validators'; +import { integer } from '@superset-ui/validator'; import { D3_TIME_FORMAT_OPTIONS, D3_FORMAT_DOCS } from '../controls'; export default { diff --git a/superset-frontend/src/explore/controlPanels/Chord.js b/superset-frontend/src/explore/controlPanels/Chord.js index 25d045cbab61d..2f9f661d7a177 100644 --- a/superset-frontend/src/explore/controlPanels/Chord.js +++ b/superset-frontend/src/explore/controlPanels/Chord.js @@ -17,7 +17,7 @@ * under the License. */ import { t } from '@superset-ui/translation'; -import { nonEmpty } from '@superset-ui/validators'; +import { nonEmpty } from '@superset-ui/validator'; export default { controlPanelSections: [ diff --git a/superset-frontend/src/explore/controlPanels/DeckGeojson.js b/superset-frontend/src/explore/controlPanels/DeckGeojson.js index f28c41a378152..457bb960c986a 100644 --- a/superset-frontend/src/explore/controlPanels/DeckGeojson.js +++ b/superset-frontend/src/explore/controlPanels/DeckGeojson.js @@ -17,7 +17,7 @@ * under the License. */ import { t } from '@superset-ui/translation'; -import { nonEmpty, integer } from '@superset-ui/validators'; +import { nonEmpty, integer } from '@superset-ui/validator'; import { formatSelectOptions } from '../../modules/utils'; import { columnChoices } from '../controls'; import { diff --git a/superset-frontend/src/explore/controlPanels/DeckGrid.js b/superset-frontend/src/explore/controlPanels/DeckGrid.js index f058f352a5067..94693ebed8cae 100644 --- a/superset-frontend/src/explore/controlPanels/DeckGrid.js +++ b/superset-frontend/src/explore/controlPanels/DeckGrid.js @@ -17,7 +17,7 @@ * under the License. */ import { t } from '@superset-ui/translation'; -import { nonEmpty } from '@superset-ui/validators'; +import { nonEmpty } from '@superset-ui/validator'; import { filterNulls, autozoom, diff --git a/superset-frontend/src/explore/controlPanels/DeckMulti.js b/superset-frontend/src/explore/controlPanels/DeckMulti.js index 72fff735f3265..7ba0374cc1a9b 100644 --- a/superset-frontend/src/explore/controlPanels/DeckMulti.js +++ b/superset-frontend/src/explore/controlPanels/DeckMulti.js @@ -17,7 +17,7 @@ * under the License. */ import { t } from '@superset-ui/translation'; -import { nonEmpty } from '@superset-ui/validators'; +import { nonEmpty } from '@superset-ui/validator'; import { viewport } from './Shared_DeckGL'; export default { diff --git a/superset-frontend/src/explore/controlPanels/DeckScatter.js b/superset-frontend/src/explore/controlPanels/DeckScatter.js index 16d9ab6744d5e..3ca996c1c9150 100644 --- a/superset-frontend/src/explore/controlPanels/DeckScatter.js +++ b/superset-frontend/src/explore/controlPanels/DeckScatter.js @@ -18,7 +18,7 @@ */ import { t } from '@superset-ui/translation'; import timeGrainSqlaAnimationOverrides from './timeGrainSqlaAnimationOverrides'; -import { nonEmpty } from '@superset-ui/validators'; +import { nonEmpty } from '@superset-ui/validator'; import { filterNulls, autozoom, diff --git a/superset-frontend/src/explore/controlPanels/DeckScreengrid.js b/superset-frontend/src/explore/controlPanels/DeckScreengrid.js index 2d5ed0213ac51..db9c75915720a 100644 --- a/superset-frontend/src/explore/controlPanels/DeckScreengrid.js +++ b/superset-frontend/src/explore/controlPanels/DeckScreengrid.js @@ -17,7 +17,7 @@ * under the License. */ import { t } from '@superset-ui/translation'; -import { nonEmpty } from '@superset-ui/validators'; +import { nonEmpty } from '@superset-ui/validator'; import timeGrainSqlaAnimationOverrides from './timeGrainSqlaAnimationOverrides'; import { filterNulls, diff --git a/superset-frontend/src/explore/controlPanels/DistBar.js b/superset-frontend/src/explore/controlPanels/DistBar.js index 548f7ffa73777..db19fc20d0ec9 100644 --- a/superset-frontend/src/explore/controlPanels/DistBar.js +++ b/superset-frontend/src/explore/controlPanels/DistBar.js @@ -17,7 +17,7 @@ * under the License. */ import { t } from '@superset-ui/translation'; -import { nonEmpty } from '@superset-ui/validators'; +import { nonEmpty } from '@superset-ui/validator'; export default { controlPanelSections: [ diff --git a/superset-frontend/src/explore/controlPanels/EventFlow.js b/superset-frontend/src/explore/controlPanels/EventFlow.js index 2ec1e5cfcc491..4d934aff3d94e 100644 --- a/superset-frontend/src/explore/controlPanels/EventFlow.js +++ b/superset-frontend/src/explore/controlPanels/EventFlow.js @@ -17,7 +17,7 @@ * under the License. */ import { t } from '@superset-ui/translation'; -import { nonEmpty } from '@superset-ui/validators'; +import { nonEmpty } from '@superset-ui/validator'; import { formatSelectOptionsForRange } from '../../modules/utils'; export default { diff --git a/superset-frontend/src/explore/controlPanels/Heatmap.js b/superset-frontend/src/explore/controlPanels/Heatmap.js index fe7af2d4bebde..0dec3b203149e 100644 --- a/superset-frontend/src/explore/controlPanels/Heatmap.js +++ b/superset-frontend/src/explore/controlPanels/Heatmap.js @@ -17,7 +17,7 @@ * under the License. */ import { t } from '@superset-ui/translation'; -import { nonEmpty } from '@superset-ui/validators'; +import { nonEmpty } from '@superset-ui/validator'; import { formatSelectOptionsForRange } from '../../modules/utils'; const sortAxisChoices = [ diff --git a/superset-frontend/src/explore/controlPanels/Histogram.js b/superset-frontend/src/explore/controlPanels/Histogram.js index 0d18663344121..a973b88aafcd3 100644 --- a/superset-frontend/src/explore/controlPanels/Histogram.js +++ b/superset-frontend/src/explore/controlPanels/Histogram.js @@ -17,7 +17,7 @@ * under the License. */ import { t } from '@superset-ui/translation'; -import { nonEmpty } from '@superset-ui/validators'; +import { nonEmpty } from '@superset-ui/validator'; export default { controlPanelSections: [ diff --git a/superset-frontend/src/explore/controlPanels/LineMulti.js b/superset-frontend/src/explore/controlPanels/LineMulti.js index d9d9885571242..1782cab574c75 100644 --- a/superset-frontend/src/explore/controlPanels/LineMulti.js +++ b/superset-frontend/src/explore/controlPanels/LineMulti.js @@ -19,7 +19,7 @@ import { t } from '@superset-ui/translation'; import { annotations } from './sections'; import { D3_TIME_FORMAT_OPTIONS } from '../controls'; -import { nonEmpty } from '@superset-ui/validators'; +import { nonEmpty } from '@superset-ui/validator'; export default { requiresTime: true, diff --git a/superset-frontend/src/explore/controlPanels/Partition.jsx b/superset-frontend/src/explore/controlPanels/Partition.jsx index b773b4f9dd811..36ae4b9165b94 100644 --- a/superset-frontend/src/explore/controlPanels/Partition.jsx +++ b/superset-frontend/src/explore/controlPanels/Partition.jsx @@ -20,7 +20,7 @@ import React from 'react'; import { t } from '@superset-ui/translation'; import { NVD3TimeSeries } from './sections'; import OptionDescription from '../../components/OptionDescription'; -import { nonEmpty } from '@superset-ui/validators'; +import { nonEmpty } from '@superset-ui/validator'; export default { controlPanelSections: [ diff --git a/superset-frontend/src/explore/controlPanels/Table.js b/superset-frontend/src/explore/controlPanels/Table.js index 695d75d6f4f10..f399c1810b59b 100644 --- a/superset-frontend/src/explore/controlPanels/Table.js +++ b/superset-frontend/src/explore/controlPanels/Table.js @@ -17,7 +17,7 @@ * under the License. */ import { t } from '@superset-ui/translation'; -import { nonEmpty } from '@superset-ui/validators'; +import { nonEmpty } from '@superset-ui/validator'; import { D3_TIME_FORMAT_OPTIONS } from '../controls'; import { formatSelectOptions } from '../../modules/utils'; diff --git a/superset-frontend/src/explore/controlPanels/WordCloud.js b/superset-frontend/src/explore/controlPanels/WordCloud.js index 9070bccb10fc4..dd1256d055246 100644 --- a/superset-frontend/src/explore/controlPanels/WordCloud.js +++ b/superset-frontend/src/explore/controlPanels/WordCloud.js @@ -17,7 +17,7 @@ * under the License. */ import { t } from '@superset-ui/translation'; -import { nonEmpty } from '@superset-ui/validators'; +import { nonEmpty } from '@superset-ui/validator'; export default { controlPanelSections: [ diff --git a/superset-frontend/src/explore/controls.jsx b/superset-frontend/src/explore/controls.jsx index 6c1f333429b45..9ea87f0da3526 100644 --- a/superset-frontend/src/explore/controls.jsx +++ b/superset-frontend/src/explore/controls.jsx @@ -68,7 +68,7 @@ import { formatSelectOptions, mainMetric, } from '../modules/utils'; -import { integer, nonEmpty } from '@superset-ui/validators'; +import { integer, nonEmpty } from '@superset-ui/validator'; import ColumnOption from '../components/ColumnOption'; import { TIME_FILTER_LABELS } from './constants'; From 875061b4b26a7892af27401657193638f42f07b5 Mon Sep 17 00:00:00 2001 From: Evan Rusackas Date: Thu, 9 Apr 2020 13:38:19 -0700 Subject: [PATCH 04/10] updating validators to match new exports --- .../components/controls/AnnotationLayer.jsx | 2 +- .../components/controls/TextControl.jsx | 2 +- .../src/explore/controlPanels/CalHeatmap.js | 10 +++++----- .../src/explore/controlPanels/Chord.js | 6 +++--- .../src/explore/controlPanels/DeckArc.js | 8 ++++---- .../src/explore/controlPanels/DeckGeojson.js | 6 +++--- .../src/explore/controlPanels/DeckGrid.js | 4 ++-- .../src/explore/controlPanels/DeckMulti.js | 4 ++-- .../src/explore/controlPanels/DeckScatter.js | 6 +++--- .../explore/controlPanels/DeckScreengrid.js | 4 ++-- .../src/explore/controlPanels/DistBar.js | 4 ++-- .../src/explore/controlPanels/EventFlow.js | 4 ++-- .../src/explore/controlPanels/Heatmap.js | 6 +++--- .../src/explore/controlPanels/Histogram.js | 4 ++-- .../src/explore/controlPanels/LineMulti.js | 4 ++-- .../src/explore/controlPanels/Partition.jsx | 4 ++-- .../explore/controlPanels/Shared_DeckGL.jsx | 6 +++--- .../src/explore/controlPanels/Table.js | 4 ++-- .../src/explore/controlPanels/WordCloud.js | 4 ++-- superset-frontend/src/explore/controls.jsx | 20 +++++++++---------- 20 files changed, 56 insertions(+), 56 deletions(-) diff --git a/superset-frontend/src/explore/components/controls/AnnotationLayer.jsx b/superset-frontend/src/explore/components/controls/AnnotationLayer.jsx index d59d914785429..4e4989c9b4e5d 100644 --- a/superset-frontend/src/explore/components/controls/AnnotationLayer.jsx +++ b/superset-frontend/src/explore/components/controls/AnnotationLayer.jsx @@ -40,7 +40,7 @@ import ANNOTATION_TYPES, { import PopoverSection from '../../../components/PopoverSection'; import ControlHeader from '../ControlHeader'; -import { nonEmpty } from '@superset-ui/validator'; +import { validateNonEmpty } from '@superset-ui/validator'; import './AnnotationLayer.less'; const AUTOMATIC_COLOR = ''; diff --git a/superset-frontend/src/explore/components/controls/TextControl.jsx b/superset-frontend/src/explore/components/controls/TextControl.jsx index 867662169baae..816468ca20b7c 100644 --- a/superset-frontend/src/explore/components/controls/TextControl.jsx +++ b/superset-frontend/src/explore/components/controls/TextControl.jsx @@ -19,7 +19,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import { FormGroup, FormControl } from 'react-bootstrap'; -import { numeric, integer } from '@superset-ui/validator'; +import { validateNumeric, validateInteger } from '@superset-ui/validator'; import ControlHeader from '../ControlHeader'; const propTypes = { diff --git a/superset-frontend/src/explore/controlPanels/CalHeatmap.js b/superset-frontend/src/explore/controlPanels/CalHeatmap.js index 00d96bec3214d..301b590e7b723 100644 --- a/superset-frontend/src/explore/controlPanels/CalHeatmap.js +++ b/superset-frontend/src/explore/controlPanels/CalHeatmap.js @@ -22,7 +22,7 @@ import { formatSelectOptions, // mainMetric, } from '../../modules/utils'; -import { integer } from '@superset-ui/validator'; +import { validateInteger } from '@superset-ui/validator'; import { D3_TIME_FORMAT_OPTIONS, D3_FORMAT_DOCS } from '../controls'; export default { @@ -85,7 +85,7 @@ export default { type: 'TextControl', isInt: true, default: 10, - validators: [integer], + validators: [validateInteger], renderTrigger: true, label: t('Cell Size'), description: t('The size of the square cell, in pixels'), @@ -96,7 +96,7 @@ export default { config: { type: 'TextControl', isInt: true, - validators: [integer], + validators: [validateInteger], renderTrigger: true, default: 2, label: t('Cell Padding'), @@ -110,7 +110,7 @@ export default { config: { type: 'TextControl', isInt: true, - validators: [integer], + validators: [validateInteger], renderTrigger: true, default: 0, label: t('Cell Radius'), @@ -122,7 +122,7 @@ export default { config: { type: 'TextControl', isInt: true, - validators: [integer], + validators: [validateInteger], renderTrigger: true, default: 10, label: t('Color Steps'), diff --git a/superset-frontend/src/explore/controlPanels/Chord.js b/superset-frontend/src/explore/controlPanels/Chord.js index 2f9f661d7a177..f32a03b438d77 100644 --- a/superset-frontend/src/explore/controlPanels/Chord.js +++ b/superset-frontend/src/explore/controlPanels/Chord.js @@ -17,7 +17,7 @@ * under the License. */ import { t } from '@superset-ui/translation'; -import { nonEmpty } from '@superset-ui/validator'; +import { validateNonEmpty } from '@superset-ui/validator'; export default { controlPanelSections: [ @@ -49,13 +49,13 @@ export default { groupby: { label: t('Source'), multi: false, - validators: [nonEmpty], + validators: [validateNonEmpty], description: t('Choose a source'), }, columns: { label: t('Target'), multi: false, - validators: [nonEmpty], + validators: [validateNonEmpty], description: t('Choose a target'), }, }, diff --git a/superset-frontend/src/explore/controlPanels/DeckArc.js b/superset-frontend/src/explore/controlPanels/DeckArc.js index 43fc52c248bf9..771b00a9c6d03 100644 --- a/superset-frontend/src/explore/controlPanels/DeckArc.js +++ b/superset-frontend/src/explore/controlPanels/DeckArc.js @@ -18,7 +18,7 @@ */ import { t } from '@superset-ui/translation'; import timeGrainSqlaAnimationOverrides from './timeGrainSqlaAnimationOverrides'; -import { nonEmpty, integer } from '../validators'; +import { validateNonEmpty, validateInteger } from '@superset-ui/validator'; import { columnChoices, PRIMARY_COLOR } from '../controls'; import { formatSelectOptions } from '../../modules/utils'; import { @@ -47,7 +47,7 @@ export default { config: { type: 'SpatialControl', label: t('Start Longitude & Latitude'), - validators: [nonEmpty], + validators: [validateNonEmpty], description: t('Point to your spatial columns'), mapStateToProps: state => ({ choices: columnChoices(state.datasource), @@ -59,7 +59,7 @@ export default { config: { type: 'SpatialControl', label: t('End Longitude & Latitude'), - validators: [nonEmpty], + validators: [validateNonEmpty], description: t('Point to your spatial columns'), mapStateToProps: state => ({ choices: columnChoices(state.datasource), @@ -112,7 +112,7 @@ export default { type: 'SelectControl', freeForm: true, label: t('Stroke Width'), - validators: [integer], + validators: [validateInteger], default: null, renderTrigger: true, choices: formatSelectOptions([1, 2, 3, 4, 5]), diff --git a/superset-frontend/src/explore/controlPanels/DeckGeojson.js b/superset-frontend/src/explore/controlPanels/DeckGeojson.js index 457bb960c986a..bd61e9cec2d5c 100644 --- a/superset-frontend/src/explore/controlPanels/DeckGeojson.js +++ b/superset-frontend/src/explore/controlPanels/DeckGeojson.js @@ -17,7 +17,7 @@ * under the License. */ import { t } from '@superset-ui/translation'; -import { nonEmpty, integer } from '@superset-ui/validator'; +import { validateNonEmpty, validateInteger } from '@superset-ui/validator'; import { formatSelectOptions } from '../../modules/utils'; import { columnChoices } from '../controls'; import { @@ -47,7 +47,7 @@ export default { config: { type: 'SelectControl', label: t('GeoJson Column'), - validators: [nonEmpty], + validators: [validateNonEmpty], description: t('Select the geojson column'), mapStateToProps: state => ({ choices: columnChoices(state.datasource), @@ -80,7 +80,7 @@ export default { type: 'SelectControl', freeForm: true, label: t('Point Radius Scale'), - validators: [integer], + validators: [validateInteger], default: null, choices: formatSelectOptions([0, 100, 200, 300, 500]), }, diff --git a/superset-frontend/src/explore/controlPanels/DeckGrid.js b/superset-frontend/src/explore/controlPanels/DeckGrid.js index 94693ebed8cae..0482ab14fc4f8 100644 --- a/superset-frontend/src/explore/controlPanels/DeckGrid.js +++ b/superset-frontend/src/explore/controlPanels/DeckGrid.js @@ -17,7 +17,7 @@ * under the License. */ import { t } from '@superset-ui/translation'; -import { nonEmpty } from '@superset-ui/validator'; +import { validateNonEmpty } from '@superset-ui/validator'; import { filterNulls, autozoom, @@ -65,7 +65,7 @@ export default { size: { label: t('Height'), description: t('Metric used to control height'), - validators: [nonEmpty], + validators: [validateNonEmpty], }, }, }; diff --git a/superset-frontend/src/explore/controlPanels/DeckMulti.js b/superset-frontend/src/explore/controlPanels/DeckMulti.js index 7ba0374cc1a9b..b801cdd8a6bb3 100644 --- a/superset-frontend/src/explore/controlPanels/DeckMulti.js +++ b/superset-frontend/src/explore/controlPanels/DeckMulti.js @@ -17,7 +17,7 @@ * under the License. */ import { t } from '@superset-ui/translation'; -import { nonEmpty } from '@superset-ui/validator'; +import { validateNonEmpty } from '@superset-ui/validator'; import { viewport } from './Shared_DeckGL'; export default { @@ -35,7 +35,7 @@ export default { type: 'SelectAsyncControl', multi: true, label: t('deck.gl charts'), - validators: [nonEmpty], + validators: [validateNonEmpty], default: [], description: t( 'Pick a set of deck.gl charts to layer on top of one another', diff --git a/superset-frontend/src/explore/controlPanels/DeckScatter.js b/superset-frontend/src/explore/controlPanels/DeckScatter.js index 3ca996c1c9150..60a4203a17780 100644 --- a/superset-frontend/src/explore/controlPanels/DeckScatter.js +++ b/superset-frontend/src/explore/controlPanels/DeckScatter.js @@ -18,7 +18,7 @@ */ import { t } from '@superset-ui/translation'; import timeGrainSqlaAnimationOverrides from './timeGrainSqlaAnimationOverrides'; -import { nonEmpty } from '@superset-ui/validator'; +import { validateNonEmpty } from '@superset-ui/validator'; import { filterNulls, autozoom, @@ -99,7 +99,7 @@ export default { type: 'TextControl', label: t('Minimum Radius'), isFloat: true, - validators: [nonEmpty], + validators: [validateNonEmpty], renderTrigger: true, default: 2, description: t( @@ -114,7 +114,7 @@ export default { type: 'TextControl', label: t('Maximum Radius'), isFloat: true, - validators: [nonEmpty], + validators: [validateNonEmpty], renderTrigger: true, default: 250, description: t( diff --git a/superset-frontend/src/explore/controlPanels/DeckScreengrid.js b/superset-frontend/src/explore/controlPanels/DeckScreengrid.js index db9c75915720a..2cd77787db7c8 100644 --- a/superset-frontend/src/explore/controlPanels/DeckScreengrid.js +++ b/superset-frontend/src/explore/controlPanels/DeckScreengrid.js @@ -17,7 +17,7 @@ * under the License. */ import { t } from '@superset-ui/translation'; -import { nonEmpty } from '@superset-ui/validator'; +import { validateNonEmpty } from '@superset-ui/validator'; import timeGrainSqlaAnimationOverrides from './timeGrainSqlaAnimationOverrides'; import { filterNulls, @@ -69,7 +69,7 @@ export default { size: { label: t('Weight'), description: t("Metric used as a weight for the grid's coloring"), - validators: [nonEmpty], + validators: [validateNonEmpty], }, time_grain_sqla: timeGrainSqlaAnimationOverrides, }, diff --git a/superset-frontend/src/explore/controlPanels/DistBar.js b/superset-frontend/src/explore/controlPanels/DistBar.js index db19fc20d0ec9..891dcfbb5c60a 100644 --- a/superset-frontend/src/explore/controlPanels/DistBar.js +++ b/superset-frontend/src/explore/controlPanels/DistBar.js @@ -17,7 +17,7 @@ * under the License. */ import { t } from '@superset-ui/translation'; -import { nonEmpty } from '@superset-ui/validator'; +import { validateNonEmpty } from '@superset-ui/validator'; export default { controlPanelSections: [ @@ -56,7 +56,7 @@ export default { controlOverrides: { groupby: { label: t('Series'), - validators: [nonEmpty], + validators: [validateNonEmpty], }, columns: { label: t('Breakdowns'), diff --git a/superset-frontend/src/explore/controlPanels/EventFlow.js b/superset-frontend/src/explore/controlPanels/EventFlow.js index 4d934aff3d94e..fd6056b999f6a 100644 --- a/superset-frontend/src/explore/controlPanels/EventFlow.js +++ b/superset-frontend/src/explore/controlPanels/EventFlow.js @@ -17,7 +17,7 @@ * under the License. */ import { t } from '@superset-ui/translation'; -import { nonEmpty } from '@superset-ui/validator'; +import { validateNonEmpty } from '@superset-ui/validator'; import { formatSelectOptionsForRange } from '../../modules/utils'; export default { @@ -78,7 +78,7 @@ export default { }, all_columns_x: { label: t('Column containing event names'), - validators: [nonEmpty], + validators: [validateNonEmpty], default: control => control.choices && control.choices.length > 0 ? control.choices[0][0] diff --git a/superset-frontend/src/explore/controlPanels/Heatmap.js b/superset-frontend/src/explore/controlPanels/Heatmap.js index 0dec3b203149e..d56c96e6d561a 100644 --- a/superset-frontend/src/explore/controlPanels/Heatmap.js +++ b/superset-frontend/src/explore/controlPanels/Heatmap.js @@ -17,7 +17,7 @@ * under the License. */ import { t } from '@superset-ui/translation'; -import { nonEmpty } from '@superset-ui/validator'; +import { validateNonEmpty } from '@superset-ui/validator'; import { formatSelectOptionsForRange } from '../../modules/utils'; const sortAxisChoices = [ @@ -139,10 +139,10 @@ export default { ], controlOverrides: { all_columns_x: { - validators: [nonEmpty], + validators: [validateNonEmpty], }, all_columns_y: { - validators: [nonEmpty], + validators: [validateNonEmpty], }, normalized: t( 'Whether to apply a normal distribution based on rank on the color scale', diff --git a/superset-frontend/src/explore/controlPanels/Histogram.js b/superset-frontend/src/explore/controlPanels/Histogram.js index a973b88aafcd3..041570ea681b7 100644 --- a/superset-frontend/src/explore/controlPanels/Histogram.js +++ b/superset-frontend/src/explore/controlPanels/Histogram.js @@ -17,7 +17,7 @@ * under the License. */ import { t } from '@superset-ui/translation'; -import { nonEmpty } from '@superset-ui/validator'; +import { validateNonEmpty } from '@superset-ui/validator'; export default { controlPanelSections: [ @@ -48,7 +48,7 @@ export default { label: t('Numeric Columns'), description: t('Select the numeric columns to draw the histogram'), multi: true, - validators: [nonEmpty], + validators: [validateNonEmpty], }, link_length: { label: t('No of Bins'), diff --git a/superset-frontend/src/explore/controlPanels/LineMulti.js b/superset-frontend/src/explore/controlPanels/LineMulti.js index 1782cab574c75..c6c2c8127820c 100644 --- a/superset-frontend/src/explore/controlPanels/LineMulti.js +++ b/superset-frontend/src/explore/controlPanels/LineMulti.js @@ -19,7 +19,7 @@ import { t } from '@superset-ui/translation'; import { annotations } from './sections'; import { D3_TIME_FORMAT_OPTIONS } from '../controls'; -import { nonEmpty } from '@superset-ui/validator'; +import { validateNonEmpty } from '@superset-ui/validator'; export default { requiresTime: true, @@ -65,7 +65,7 @@ export default { type: 'SelectAsyncControl', multi: true, label: t('Left Axis chart(s)'), - validators: [nonEmpty], + validators: [validateNonEmpty], default: [], description: t('Choose one or more charts for left axis'), dataEndpoint: diff --git a/superset-frontend/src/explore/controlPanels/Partition.jsx b/superset-frontend/src/explore/controlPanels/Partition.jsx index 36ae4b9165b94..d6b8de5ab3ee4 100644 --- a/superset-frontend/src/explore/controlPanels/Partition.jsx +++ b/superset-frontend/src/explore/controlPanels/Partition.jsx @@ -20,7 +20,7 @@ import React from 'react'; import { t } from '@superset-ui/translation'; import { NVD3TimeSeries } from './sections'; import OptionDescription from '../../components/OptionDescription'; -import { nonEmpty } from '@superset-ui/validator'; +import { validateNonEmpty } from '@superset-ui/validator'; export default { controlPanelSections: [ @@ -35,7 +35,7 @@ export default { config: { type: 'SelectControl', label: t('Options'), - validators: [nonEmpty], + validators: [validateNonEmpty], default: 'not_time', valueKey: 'value', options: [ diff --git a/superset-frontend/src/explore/controlPanels/Shared_DeckGL.jsx b/superset-frontend/src/explore/controlPanels/Shared_DeckGL.jsx index a08ee476c9f66..5136e98a1befd 100644 --- a/superset-frontend/src/explore/controlPanels/Shared_DeckGL.jsx +++ b/superset-frontend/src/explore/controlPanels/Shared_DeckGL.jsx @@ -25,7 +25,7 @@ import ColumnOption from '../../components/ColumnOption'; import { D3_FORMAT_OPTIONS, columnChoices, PRIMARY_COLOR } from '../controls'; import { DEFAULT_VIEWPORT } from '../../explore/components/controls/ViewportControl'; -import { nonEmpty } from '../validators'; +import { validateNonEmpty } from '@superset-ui/validator'; const timeColumnOption = { verbose_name: 'Time', @@ -230,7 +230,7 @@ export const lineColumn = { mapStateToProps: state => ({ choices: columnChoices(state.datasource), }), - validators: [nonEmpty], + validators: [validateNonEmpty], }, }; @@ -336,7 +336,7 @@ export const spatial = { config: { type: 'SpatialControl', label: t('Longitude & Latitude'), - validators: [nonEmpty], + validators: [validateNonEmpty], description: t('Point to your spatial columns'), mapStateToProps: state => ({ choices: columnChoices(state.datasource), diff --git a/superset-frontend/src/explore/controlPanels/Table.js b/superset-frontend/src/explore/controlPanels/Table.js index f399c1810b59b..69d754193393b 100644 --- a/superset-frontend/src/explore/controlPanels/Table.js +++ b/superset-frontend/src/explore/controlPanels/Table.js @@ -17,7 +17,7 @@ * under the License. */ import { t } from '@superset-ui/translation'; -import { nonEmpty } from '@superset-ui/validator'; +import { validateNonEmpty } from '@superset-ui/validator'; import { D3_TIME_FORMAT_OPTIONS } from '../controls'; import { formatSelectOptions } from '../../modules/utils'; @@ -114,7 +114,7 @@ export default { label: t('Table Timestamp Format'), default: '%Y-%m-%d %H:%M:%S', renderTrigger: true, - validators: [nonEmpty], + validators: [validateNonEmpty], clearable: false, choices: D3_TIME_FORMAT_OPTIONS, description: t('Timestamp Format'), diff --git a/superset-frontend/src/explore/controlPanels/WordCloud.js b/superset-frontend/src/explore/controlPanels/WordCloud.js index dd1256d055246..0851064262e30 100644 --- a/superset-frontend/src/explore/controlPanels/WordCloud.js +++ b/superset-frontend/src/explore/controlPanels/WordCloud.js @@ -17,7 +17,7 @@ * under the License. */ import { t } from '@superset-ui/translation'; -import { nonEmpty } from '@superset-ui/validator'; +import { validateNonEmpty } from '@superset-ui/validator'; export default { controlPanelSections: [ @@ -83,7 +83,7 @@ export default { ], controlOverrides: { series: { - validators: [nonEmpty], + validators: [validateNonEmpty], clearable: false, }, row_limit: { diff --git a/superset-frontend/src/explore/controls.jsx b/superset-frontend/src/explore/controls.jsx index 9ea87f0da3526..3ebc7d62073e6 100644 --- a/superset-frontend/src/explore/controls.jsx +++ b/superset-frontend/src/explore/controls.jsx @@ -68,7 +68,7 @@ import { formatSelectOptions, mainMetric, } from '../modules/utils'; -import { integer, nonEmpty } from '@superset-ui/validator'; +import { validateInteger, validateNonEmpty } from '@superset-ui/validator'; import ColumnOption from '../components/ColumnOption'; import { TIME_FILTER_LABELS } from './constants'; @@ -153,7 +153,7 @@ const metrics = { type: 'MetricsControl', multi: true, label: t('Metrics'), - validators: [nonEmpty], + validators: [validateNonEmpty], default: c => { const metric = mainMetric(c.savedMetrics); return metric ? [metric] : null; @@ -423,7 +423,7 @@ export const controls = { type: 'SelectControl', label: t('Longitude'), default: 1, - validators: [nonEmpty], + validators: [validateNonEmpty], description: t('Select the longitude column'), mapStateToProps: state => ({ choices: columnChoices(state.datasource), @@ -434,7 +434,7 @@ export const controls = { type: 'SelectControl', label: t('Latitude'), default: 1, - validators: [nonEmpty], + validators: [validateNonEmpty], description: t('Select the latitude column'), mapStateToProps: state => ({ choices: columnChoices(state.datasource), @@ -444,7 +444,7 @@ export const controls = { polygon: { type: 'SelectControl', label: t('Polygon Column'), - validators: [nonEmpty], + validators: [validateNonEmpty], description: t( 'Select the polygon column. Each row should contain JSON.array(N) of [longitude, latitude] points', ), @@ -677,7 +677,7 @@ export const controls = { type: 'SelectControl', freeForm: true, label: t('Row limit'), - validators: [integer], + validators: [validateInteger], default: 10000, choices: formatSelectOptions(ROW_LIMIT_OPTIONS), }, @@ -686,7 +686,7 @@ export const controls = { type: 'SelectControl', freeForm: true, label: t('Series limit'), - validators: [integer], + validators: [validateInteger], choices: formatSelectOptions(SERIES_LIMITS), description: t( 'Limits the number of time series that get displayed. A sub query ' + @@ -766,7 +766,7 @@ export const controls = { label: t('Entity'), default: null, multi: false, - validators: [nonEmpty], + validators: [validateNonEmpty], description: t('This defines the element to be plotted on the chart'), }, @@ -874,7 +874,7 @@ export const controls = { clearable: false, choices: formatSelectOptions(['markdown', 'html']), default: 'markdown', - validators: [nonEmpty], + validators: [validateNonEmpty], description: t('Pick your favorite markup language'), }, @@ -1225,7 +1225,7 @@ export const controls = { column_collection: { type: 'CollectionControl', label: t('Time Series Columns'), - validators: [nonEmpty], + validators: [validateNonEmpty], controlName: 'TimeSeriesColumnControl', }, From 27dfba33290f2e0ae411c5024cc010c24152f6b5 Mon Sep 17 00:00:00 2001 From: Evan Rusackas Date: Thu, 9 Apr 2020 14:25:13 -0700 Subject: [PATCH 05/10] removing old validators --- superset-frontend/src/explore/validators.js | 51 --------------------- 1 file changed, 51 deletions(-) delete mode 100644 superset-frontend/src/explore/validators.js diff --git a/superset-frontend/src/explore/validators.js b/superset-frontend/src/explore/validators.js deleted file mode 100644 index 5cbdb21033c67..0000000000000 --- a/superset-frontend/src/explore/validators.js +++ /dev/null @@ -1,51 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -/* Reusable validator functions used in controls definitions - * - * validator functions receive the v and the configuration of the control - * as arguments and return something that evals to false if v is valid, - * and an error message if not valid. - * */ -import { t } from '@superset-ui/translation'; - -export function numeric(v) { - if (v && isNaN(v)) { - return t('is expected to be a number'); - } - return false; -} - -export function integer(v) { - if (v && (isNaN(v) || parseInt(v, 10) !== +v)) { - return t('is expected to be an integer'); - } - return false; -} - -export function nonEmpty(v) { - if ( - v === null || - v === undefined || - v === '' || - (Array.isArray(v) && v.length === 0) - ) { - return t('cannot be empty'); - } - return false; -} From d37a632885d72070a063d8865835d1ee2c0024bf Mon Sep 17 00:00:00 2001 From: Evan Rusackas Date: Mon, 13 Apr 2020 00:11:07 -0700 Subject: [PATCH 06/10] lintage :sparkles: --- .../components/controls/AnnotationLayer.jsx | 14 +++++++++----- .../explore/components/controls/TextControl.jsx | 4 ++-- .../src/explore/controlPanels/CalHeatmap.js | 2 +- .../src/explore/controlPanels/DeckArc.js | 2 +- .../src/explore/controlPanels/DeckScatter.js | 2 +- .../src/explore/controlPanels/LineMulti.js | 2 +- .../src/explore/controlPanels/Partition.jsx | 2 +- .../src/explore/controlPanels/Shared_DeckGL.jsx | 3 +-- superset-frontend/src/explore/controls.jsx | 2 +- 9 files changed, 18 insertions(+), 15 deletions(-) diff --git a/superset-frontend/src/explore/components/controls/AnnotationLayer.jsx b/superset-frontend/src/explore/components/controls/AnnotationLayer.jsx index 4e4989c9b4e5d..4c68cec6c30c9 100644 --- a/superset-frontend/src/explore/components/controls/AnnotationLayer.jsx +++ b/superset-frontend/src/explore/components/controls/AnnotationLayer.jsx @@ -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 { validateNonEmpty } from '@superset-ui/validator'; 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)); diff --git a/superset-frontend/src/explore/components/controls/TextControl.jsx b/superset-frontend/src/explore/components/controls/TextControl.jsx index 816468ca20b7c..cfa34607ad01c 100644 --- a/superset-frontend/src/explore/components/controls/TextControl.jsx +++ b/superset-frontend/src/explore/components/controls/TextControl.jsx @@ -51,7 +51,7 @@ export default class TextControl extends React.Component { // Validation & casting const errors = []; if (value !== '' && this.props.isFloat) { - const error = numeric(value); + const error = validateNumeric(value); if (error) { errors.push(error); } else { @@ -59,7 +59,7 @@ export default class TextControl extends React.Component { } } if (value !== '' && this.props.isInt) { - const error = integer(value); + const error = validateInteger(value); if (error) { errors.push(error); } else { diff --git a/superset-frontend/src/explore/controlPanels/CalHeatmap.js b/superset-frontend/src/explore/controlPanels/CalHeatmap.js index 301b590e7b723..a8743f73f682f 100644 --- a/superset-frontend/src/explore/controlPanels/CalHeatmap.js +++ b/superset-frontend/src/explore/controlPanels/CalHeatmap.js @@ -17,12 +17,12 @@ * under the License. */ import { t } from '@superset-ui/translation'; +import { validateInteger } from '@superset-ui/validator'; import { // formatSelectOptionsForRange, formatSelectOptions, // mainMetric, } from '../../modules/utils'; -import { validateInteger } from '@superset-ui/validator'; import { D3_TIME_FORMAT_OPTIONS, D3_FORMAT_DOCS } from '../controls'; export default { diff --git a/superset-frontend/src/explore/controlPanels/DeckArc.js b/superset-frontend/src/explore/controlPanels/DeckArc.js index 771b00a9c6d03..fd5b1509d3ef8 100644 --- a/superset-frontend/src/explore/controlPanels/DeckArc.js +++ b/superset-frontend/src/explore/controlPanels/DeckArc.js @@ -17,8 +17,8 @@ * under the License. */ import { t } from '@superset-ui/translation'; -import timeGrainSqlaAnimationOverrides from './timeGrainSqlaAnimationOverrides'; import { validateNonEmpty, validateInteger } from '@superset-ui/validator'; +import timeGrainSqlaAnimationOverrides from './timeGrainSqlaAnimationOverrides'; import { columnChoices, PRIMARY_COLOR } from '../controls'; import { formatSelectOptions } from '../../modules/utils'; import { diff --git a/superset-frontend/src/explore/controlPanels/DeckScatter.js b/superset-frontend/src/explore/controlPanels/DeckScatter.js index 60a4203a17780..efb858454724c 100644 --- a/superset-frontend/src/explore/controlPanels/DeckScatter.js +++ b/superset-frontend/src/explore/controlPanels/DeckScatter.js @@ -17,8 +17,8 @@ * under the License. */ import { t } from '@superset-ui/translation'; -import timeGrainSqlaAnimationOverrides from './timeGrainSqlaAnimationOverrides'; import { validateNonEmpty } from '@superset-ui/validator'; +import timeGrainSqlaAnimationOverrides from './timeGrainSqlaAnimationOverrides'; import { filterNulls, autozoom, diff --git a/superset-frontend/src/explore/controlPanels/LineMulti.js b/superset-frontend/src/explore/controlPanels/LineMulti.js index c6c2c8127820c..f0c1e4d9e4257 100644 --- a/superset-frontend/src/explore/controlPanels/LineMulti.js +++ b/superset-frontend/src/explore/controlPanels/LineMulti.js @@ -17,9 +17,9 @@ * under the License. */ import { t } from '@superset-ui/translation'; +import { validateNonEmpty } from '@superset-ui/validator'; import { annotations } from './sections'; import { D3_TIME_FORMAT_OPTIONS } from '../controls'; -import { validateNonEmpty } from '@superset-ui/validator'; export default { requiresTime: true, diff --git a/superset-frontend/src/explore/controlPanels/Partition.jsx b/superset-frontend/src/explore/controlPanels/Partition.jsx index d6b8de5ab3ee4..466a32fec4dd7 100644 --- a/superset-frontend/src/explore/controlPanels/Partition.jsx +++ b/superset-frontend/src/explore/controlPanels/Partition.jsx @@ -18,9 +18,9 @@ */ import React from 'react'; import { t } from '@superset-ui/translation'; +import { validateNonEmpty } from '@superset-ui/validator'; import { NVD3TimeSeries } from './sections'; import OptionDescription from '../../components/OptionDescription'; -import { validateNonEmpty } from '@superset-ui/validator'; export default { controlPanelSections: [ diff --git a/superset-frontend/src/explore/controlPanels/Shared_DeckGL.jsx b/superset-frontend/src/explore/controlPanels/Shared_DeckGL.jsx index 5136e98a1befd..ddadb47f4efb3 100644 --- a/superset-frontend/src/explore/controlPanels/Shared_DeckGL.jsx +++ b/superset-frontend/src/explore/controlPanels/Shared_DeckGL.jsx @@ -21,12 +21,11 @@ import React from 'react'; import { t } from '@superset-ui/translation'; +import { validateNonEmpty } from '@superset-ui/validator'; import ColumnOption from '../../components/ColumnOption'; import { D3_FORMAT_OPTIONS, columnChoices, PRIMARY_COLOR } from '../controls'; import { DEFAULT_VIEWPORT } from '../../explore/components/controls/ViewportControl'; -import { validateNonEmpty } from '@superset-ui/validator'; - const timeColumnOption = { verbose_name: 'Time', column_name: '__timestamp', diff --git a/superset-frontend/src/explore/controls.jsx b/superset-frontend/src/explore/controls.jsx index 3ebc7d62073e6..2f3ce533cd257 100644 --- a/superset-frontend/src/explore/controls.jsx +++ b/superset-frontend/src/explore/controls.jsx @@ -62,13 +62,13 @@ import { getCategoricalSchemeRegistry, getSequentialSchemeRegistry, } from '@superset-ui/color'; +import { validateInteger, validateNonEmpty } from '@superset-ui/validator'; import { formatSelectOptionsForRange, formatSelectOptions, mainMetric, } from '../modules/utils'; -import { validateInteger, validateNonEmpty } from '@superset-ui/validator'; import ColumnOption from '../components/ColumnOption'; import { TIME_FILTER_LABELS } from './constants'; From 620efa9920c5810d548209ead0b324d8618cbc18 Mon Sep 17 00:00:00 2001 From: Evan Rusackas Date: Mon, 13 Apr 2020 01:15:00 -0700 Subject: [PATCH 07/10] validateNumeric -> validateNumber --- .../src/explore/components/controls/TextControl.jsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/superset-frontend/src/explore/components/controls/TextControl.jsx b/superset-frontend/src/explore/components/controls/TextControl.jsx index cfa34607ad01c..af9cf7d3acc1b 100644 --- a/superset-frontend/src/explore/components/controls/TextControl.jsx +++ b/superset-frontend/src/explore/components/controls/TextControl.jsx @@ -19,7 +19,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import { FormGroup, FormControl } from 'react-bootstrap'; -import { validateNumeric, validateInteger } from '@superset-ui/validator'; +import { validateNumber, validateInteger } from '@superset-ui/validator'; import ControlHeader from '../ControlHeader'; const propTypes = { @@ -51,7 +51,7 @@ export default class TextControl extends React.Component { // Validation & casting const errors = []; if (value !== '' && this.props.isFloat) { - const error = validateNumeric(value); + const error = validateNumber(value); if (error) { errors.push(error); } else { From eeebcffc0cd7ab9fde0871d09531919629843409 Mon Sep 17 00:00:00 2001 From: Evan Rusackas Date: Mon, 13 Apr 2020 21:22:19 -0700 Subject: [PATCH 08/10] using legacyValidateInteger, legacyValidateNumber --- .../src/explore/components/controls/TextControl.jsx | 6 +++--- .../src/explore/controlPanels/CalHeatmap.js | 10 +++++----- superset-frontend/src/explore/controlPanels/DeckArc.js | 4 ++-- .../src/explore/controlPanels/DeckGeojson.js | 4 ++-- superset-frontend/src/explore/controls.jsx | 6 +++--- 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/superset-frontend/src/explore/components/controls/TextControl.jsx b/superset-frontend/src/explore/components/controls/TextControl.jsx index af9cf7d3acc1b..f7ed33f01c7e8 100644 --- a/superset-frontend/src/explore/components/controls/TextControl.jsx +++ b/superset-frontend/src/explore/components/controls/TextControl.jsx @@ -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 = { @@ -51,7 +51,7 @@ 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 { @@ -59,7 +59,7 @@ export default class TextControl extends React.Component { } } if (value !== '' && this.props.isInt) { - const error = validateInteger(value); + const error = legacyValidateInteger(value); if (error) { errors.push(error); } else { diff --git a/superset-frontend/src/explore/controlPanels/CalHeatmap.js b/superset-frontend/src/explore/controlPanels/CalHeatmap.js index a8743f73f682f..a7ded55c101da 100644 --- a/superset-frontend/src/explore/controlPanels/CalHeatmap.js +++ b/superset-frontend/src/explore/controlPanels/CalHeatmap.js @@ -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, @@ -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'), @@ -96,7 +96,7 @@ export default { config: { type: 'TextControl', isInt: true, - validators: [validateInteger], + validators: [legacyValidateInteger], renderTrigger: true, default: 2, label: t('Cell Padding'), @@ -110,7 +110,7 @@ export default { config: { type: 'TextControl', isInt: true, - validators: [validateInteger], + validators: [legacyValidateInteger], renderTrigger: true, default: 0, label: t('Cell Radius'), @@ -122,7 +122,7 @@ export default { config: { type: 'TextControl', isInt: true, - validators: [validateInteger], + validators: [legacyValidateInteger], renderTrigger: true, default: 10, label: t('Color Steps'), diff --git a/superset-frontend/src/explore/controlPanels/DeckArc.js b/superset-frontend/src/explore/controlPanels/DeckArc.js index fd5b1509d3ef8..47b84eb19fe50 100644 --- a/superset-frontend/src/explore/controlPanels/DeckArc.js +++ b/superset-frontend/src/explore/controlPanels/DeckArc.js @@ -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'; @@ -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]), diff --git a/superset-frontend/src/explore/controlPanels/DeckGeojson.js b/superset-frontend/src/explore/controlPanels/DeckGeojson.js index bd61e9cec2d5c..1ebb9c51405ba 100644 --- a/superset-frontend/src/explore/controlPanels/DeckGeojson.js +++ b/superset-frontend/src/explore/controlPanels/DeckGeojson.js @@ -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 { @@ -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]), }, diff --git a/superset-frontend/src/explore/controls.jsx b/superset-frontend/src/explore/controls.jsx index 2f3ce533cd257..ee65df71081a7 100644 --- a/superset-frontend/src/explore/controls.jsx +++ b/superset-frontend/src/explore/controls.jsx @@ -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, @@ -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), }, @@ -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 ' + From 81a07a11a2853a1f1784ec59eb0158c05c322f2f Mon Sep 17 00:00:00 2001 From: Evan Rusackas Date: Mon, 13 Apr 2020 21:41:44 -0700 Subject: [PATCH 09/10] linting :sparkles: --- .../src/explore/components/controls/TextControl.jsx | 5 ++++- superset-frontend/src/explore/controlPanels/DeckArc.js | 5 ++++- superset-frontend/src/explore/controlPanels/DeckGeojson.js | 5 ++++- superset-frontend/src/explore/controls.jsx | 5 ++++- 4 files changed, 16 insertions(+), 4 deletions(-) diff --git a/superset-frontend/src/explore/components/controls/TextControl.jsx b/superset-frontend/src/explore/components/controls/TextControl.jsx index f7ed33f01c7e8..e829aab35f377 100644 --- a/superset-frontend/src/explore/components/controls/TextControl.jsx +++ b/superset-frontend/src/explore/components/controls/TextControl.jsx @@ -19,7 +19,10 @@ import React from 'react'; import PropTypes from 'prop-types'; import { FormGroup, FormControl } from 'react-bootstrap'; -import { legacyValidateNumber, legacyValidateInteger } from '@superset-ui/validator'; +import { + legacyValidateNumber, + legacyValidateInteger, +} from '@superset-ui/validator'; import ControlHeader from '../ControlHeader'; const propTypes = { diff --git a/superset-frontend/src/explore/controlPanels/DeckArc.js b/superset-frontend/src/explore/controlPanels/DeckArc.js index 47b84eb19fe50..80c111d52d2d2 100644 --- a/superset-frontend/src/explore/controlPanels/DeckArc.js +++ b/superset-frontend/src/explore/controlPanels/DeckArc.js @@ -17,7 +17,10 @@ * under the License. */ import { t } from '@superset-ui/translation'; -import { validateNonEmpty, legacyValidateInteger } 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'; diff --git a/superset-frontend/src/explore/controlPanels/DeckGeojson.js b/superset-frontend/src/explore/controlPanels/DeckGeojson.js index 1ebb9c51405ba..f59c2d0d84ba8 100644 --- a/superset-frontend/src/explore/controlPanels/DeckGeojson.js +++ b/superset-frontend/src/explore/controlPanels/DeckGeojson.js @@ -17,7 +17,10 @@ * under the License. */ import { t } from '@superset-ui/translation'; -import { validateNonEmpty, legacyValidateInteger } from '@superset-ui/validator'; +import { + validateNonEmpty, + legacyValidateInteger, +} from '@superset-ui/validator'; import { formatSelectOptions } from '../../modules/utils'; import { columnChoices } from '../controls'; import { diff --git a/superset-frontend/src/explore/controls.jsx b/superset-frontend/src/explore/controls.jsx index ee65df71081a7..83698c74f41c7 100644 --- a/superset-frontend/src/explore/controls.jsx +++ b/superset-frontend/src/explore/controls.jsx @@ -62,7 +62,10 @@ import { getCategoricalSchemeRegistry, getSequentialSchemeRegistry, } from '@superset-ui/color'; -import { legacyValidateInteger, validateNonEmpty } from '@superset-ui/validator'; +import { + legacyValidateInteger, + validateNonEmpty, +} from '@superset-ui/validator'; import { formatSelectOptionsForRange, From 4a1c0ba983125c83c32377563b67c0a67d9542df Mon Sep 17 00:00:00 2001 From: Evan Rusackas Date: Tue, 14 Apr 2020 09:56:05 -0700 Subject: [PATCH 10/10] removing extraneous package lock file --- package-lock.json | 3 --- 1 file changed, 3 deletions(-) delete mode 100644 package-lock.json diff --git a/package-lock.json b/package-lock.json deleted file mode 100644 index 48e341a0954d5..0000000000000 --- a/package-lock.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "lockfileVersion": 1 -}