From f56b291148c8bc446fb38c78d63b1b5554b58b82 Mon Sep 17 00:00:00 2001 From: Beto Dealmeida Date: Thu, 3 Jan 2019 11:36:59 -0800 Subject: [PATCH] Add FSA to deck.gl Polygon (cherry picked from commit 600d5808e91312960323f165d02c09e1bafe64d2) (cherry picked from commit 1fe113a34aa79b4a2bb2d9ddd412ad4244e82081) --- .../components/controls/SpatialControl.jsx | 25 ++++++++ superset/assets/src/explore/controls.jsx | 1 + .../visualizations/deckgl/layers/common.jsx | 2 +- superset/viz.py | 64 ++++++++++++++++++- 4 files changed, 89 insertions(+), 3 deletions(-) diff --git a/superset/assets/src/explore/components/controls/SpatialControl.jsx b/superset/assets/src/explore/components/controls/SpatialControl.jsx index 7332193cfb04e..356f7d41763e7 100644 --- a/superset/assets/src/explore/components/controls/SpatialControl.jsx +++ b/superset/assets/src/explore/components/controls/SpatialControl.jsx @@ -15,6 +15,7 @@ const spatialTypes = { delimited: 'delimited', geohash: 'geohash', zipcode: 'zipcode', + fsa: 'fsa', }; const propTypes = { @@ -47,6 +48,7 @@ export default class SpatialControl extends React.Component { reverseCheckbox: v.reverseCheckbox || false, geohashCol: v.geohashCol || defaultCol, zipcodeCol: v.zipcodeCol || defaultCol, + fsaCol: v.fsaCol || defaultCol, value: null, errors: [], }; @@ -87,6 +89,12 @@ export default class SpatialControl extends React.Component { if (!value.zipcodeCol) { errors.push(errMsg); } + } else if (type === spatialTypes.fsa) { + value.fsaCol = this.state.fsaCol; + value.reverseCheckbox = this.state.reverseCheckbox; + if (!value.fsaCol) { + errors.push(errMsg); + } } this.setState({ value, errors }); this.props.onChange(value, errors); @@ -112,6 +120,8 @@ export default class SpatialControl extends React.Component { return `${this.state.geohashCol}`; } else if (this.state.type === spatialTypes.zipcode) { return `${this.state.zipcodeCol}`; + } else if (this.state.type === spatialTypes.fsa) { + return `${this.state.fsaCol}`; } return null; } @@ -206,6 +216,21 @@ export default class SpatialControl extends React.Component { + + + + Column + {this.renderSelect('fsaCol', spatialTypes.fsa)} + + + {this.renderReverseCheckbox()} + + +