This is an automated email from the ASF dual-hosted git repository.

rusackas pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-superset.git


The following commit(s) were added to refs/heads/master by this push:
     new 98a26c4  migrating controls (#9373)
98a26c4 is described below

commit 98a26c4f2cf2b9d4a3b0cd18ed1d662d96729116
Author: Evan Rusackas <e...@preset.io>
AuthorDate: Thu Mar 26 21:32:23 2020 -0700

    migrating controls (#9373)
---
 CONTRIBUTING.md                                    |   7 -
 .../src/explore/controlPanels/Mapbox.js            | 151 ++++++++++++++++++++-
 superset-frontend/src/explore/controls.jsx         |  98 +------------
 3 files changed, 146 insertions(+), 110 deletions(-)

diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 250748f..e5749bd 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -1111,7 +1111,6 @@ Note the `y_axis_format` is defined under various section 
for some charts.
 | `autozoom`                      | _N/A_ |       |
 | `bar_stacked`                   | _N/A_ |       |
 | `cache_timeout`                 | _N/A_ |       |
-| `clustering_radius`             | _N/A_ |       |
 | `code`                          | _N/A_ |       |
 | `collapsed_fieldsets`           | _N/A_ |       |
 | `column_collection`             | _N/A_ |       |
@@ -1155,7 +1154,6 @@ Note the `y_axis_format` is defined under various section 
for some charts.
 | `line_width`                    | _N/A_ |       |
 | `linear_color_scheme`           | _N/A_ |       |
 | `log_scale`                     | _N/A_ |       |
-| `mapbox_color`                  | _N/A_ |       |
 | `mapbox_label`                  | _N/A_ |       |
 | `mapbox_style`                  | _N/A_ |       |
 | `marker_labels`                 | _N/A_ |       |
@@ -1179,9 +1177,7 @@ Note the `y_axis_format` is defined under various section 
for some charts.
 | `partition_threshold`           | _N/A_ |       |
 | `period_ratio_type`             | _N/A_ |       |
 | `perm`                          | _N/A_ |       |
-| `point_radius`                  | _N/A_ |       |
 | `point_radius_fixed`            | _N/A_ |       |
-| `point_radius_unit`             | _N/A_ |       |
 | `point_unit`                    | _N/A_ |       |
 | `prefix_metric_with_slice_name` | _N/A_ |       |
 | `range_labels`                  | _N/A_ |       |
@@ -1190,7 +1186,6 @@ Note the `y_axis_format` is defined under various section 
for some charts.
 | `reduce_x_ticks`                | _N/A_ |       |
 | `refresh_frequency`             | _N/A_ |       |
 | `remote_id`                     | _N/A_ |       |
-| `render_while_dragging`         | _N/A_ |       |
 | `resample_fillmethod`           | _N/A_ |       |
 | `resample_how`                  | _N/A_ |       |
 | `resample_method`               | _N/A_ |       |
@@ -1229,6 +1224,4 @@ Note the `y_axis_format` is defined under various section 
for some charts.
 | `url`                           | _N/A_ |       |
 | `userid`                        | _N/A_ |       |
 | `viewport`                      | _N/A_ |       |
-| `viewport_latitude`             | _N/A_ |       |
-| `viewport_longitude`            | _N/A_ |       |
 | `viewport_zoom`                 | _N/A_ |       |
diff --git a/superset-frontend/src/explore/controlPanels/Mapbox.js 
b/superset-frontend/src/explore/controlPanels/Mapbox.js
index f2e4d08..46b6385 100644
--- a/superset-frontend/src/explore/controlPanels/Mapbox.js
+++ b/superset-frontend/src/explore/controlPanels/Mapbox.js
@@ -17,6 +17,8 @@
  * under the License.
  */
 import { t } from '@superset-ui/translation';
+import { formatSelectOptions } from '../../modules/utils';
+import { columnChoices } from '../controls';
 
 export default {
   controlPanelSections: [
@@ -25,7 +27,33 @@ export default {
       expanded: true,
       controlSetRows: [
         ['all_columns_x', 'all_columns_y'],
-        ['clustering_radius'],
+        [
+          {
+            name: 'clustering_radius',
+            config: {
+              type: 'SelectControl',
+              freeForm: true,
+              label: t('Clustering Radius'),
+              default: '60',
+              choices: formatSelectOptions([
+                '0',
+                '20',
+                '40',
+                '60',
+                '80',
+                '100',
+                '200',
+                '500',
+                '1000',
+              ]),
+              description: t(
+                'The radius (in pixels) the algorithm uses to define a 
cluster. ' +
+                  'Choose 0 to turn off clustering, but beware that a large ' +
+                  'number of points (>1000) will cause lag.',
+              ),
+            },
+          },
+        ],
         ['row_limit'],
         ['adhoc_filters'],
         ['groupby'],
@@ -33,7 +61,42 @@ export default {
     },
     {
       label: t('Points'),
-      controlSetRows: [['point_radius'], ['point_radius_unit']],
+      controlSetRows: [
+        [
+          {
+            name: 'point_radius',
+            config: {
+              type: 'SelectControl',
+              label: t('Point Radius'),
+              default: 'Auto',
+              description: t(
+                'The radius of individual points (ones that are not in a 
cluster). ' +
+                  'Either a numerical column or `Auto`, which scales the point 
based ' +
+                  'on the largest cluster',
+              ),
+              mapStateToProps: state => ({
+                choices: formatSelectOptions(['Auto']).concat(
+                  columnChoices(state.datasource),
+                ),
+              }),
+            },
+          },
+        ],
+        [
+          {
+            name: 'point_radius_unit',
+            config: {
+              type: 'SelectControl',
+              label: t('Point Radius Unit'),
+              default: 'Pixels',
+              choices: formatSelectOptions(['Pixels', 'Miles', 'Kilometers']),
+              description: t(
+                'The unit of measure for the specified point radius',
+              ),
+            },
+          },
+        ],
+      ],
     },
     {
       label: t('Labelling'),
@@ -42,18 +105,94 @@ export default {
     {
       label: t('Visual Tweaks'),
       controlSetRows: [
-        ['render_while_dragging'],
+        [
+          {
+            name: 'render_while_dragging',
+            config: {
+              type: 'CheckboxControl',
+              label: t('Live render'),
+              default: true,
+              description: t(
+                'Points and clusters will update as the viewport is being 
changed',
+              ),
+            },
+          },
+        ],
         ['mapbox_style'],
         ['global_opacity'],
-        ['mapbox_color'],
+        [
+          {
+            name: 'mapbox_color',
+            config: {
+              type: 'SelectControl',
+              freeForm: true,
+              label: t('RGB Color'),
+              default: 'rgb(0, 122, 135)',
+              choices: [
+                ['rgb(0, 139, 139)', 'Dark Cyan'],
+                ['rgb(128, 0, 128)', 'Purple'],
+                ['rgb(255, 215, 0)', 'Gold'],
+                ['rgb(69, 69, 69)', 'Dim Gray'],
+                ['rgb(220, 20, 60)', 'Crimson'],
+                ['rgb(34, 139, 34)', 'Forest Green'],
+              ],
+              description: t('The color for points and clusters in RGB'),
+            },
+          },
+        ],
       ],
     },
     {
       label: t('Viewport'),
       expanded: true,
       controlSetRows: [
-        ['viewport_longitude', 'viewport_latitude'],
-        ['viewport_zoom', null],
+        [
+          {
+            name: 'viewport_longitude',
+            config: {
+              type: 'TextControl',
+              label: t('Default longitude'),
+              renderTrigger: true,
+              default: -122.405293,
+              isFloat: true,
+              description: t('Longitude of default viewport'),
+              places: 8,
+              // Viewport longitude changes shouldn't prompt user to re-run 
query
+              dontRefreshOnChange: true,
+            },
+          },
+          {
+            name: 'viewport_latitude',
+            config: {
+              type: 'TextControl',
+              label: t('Default latitude'),
+              renderTrigger: true,
+              default: 37.772123,
+              isFloat: true,
+              description: t('Latitude of default viewport'),
+              places: 8,
+              // Viewport latitude changes shouldn't prompt user to re-run 
query
+              dontRefreshOnChange: true,
+            },
+          },
+        ],
+        [
+          {
+            name: 'viewport_zoom',
+            config: {
+              type: 'TextControl',
+              label: t('Zoom'),
+              renderTrigger: true,
+              isFloat: true,
+              default: 11,
+              description: t('Zoom level of the map'),
+              places: 8,
+              // Viewport zoom shouldn't prompt user to re-run query
+              dontRefreshOnChange: true,
+            },
+          },
+          null,
+        ],
       ],
     },
   ],
diff --git a/superset-frontend/src/explore/controls.jsx 
b/superset-frontend/src/explore/controls.jsx
index 0e84cd6..32df8df 100644
--- a/superset-frontend/src/explore/controls.jsx
+++ b/superset-frontend/src/explore/controls.jsx
@@ -191,7 +191,7 @@ const jsFunctionInfo = (
   </div>
 );
 
-function columnChoices(datasource) {
+export function columnChoices(datasource) {
   if (datasource && datasource.columns) {
     return datasource.columns
       .map(col => [col.column_name, col.verbose_name || col.column_name])
@@ -1562,29 +1562,6 @@ export const controls = {
     description: t('Base layer map style'),
   },
 
-  clustering_radius: {
-    type: 'SelectControl',
-    freeForm: true,
-    label: t('Clustering Radius'),
-    default: '60',
-    choices: formatSelectOptions([
-      '0',
-      '20',
-      '40',
-      '60',
-      '80',
-      '100',
-      '200',
-      '500',
-      '1000',
-    ]),
-    description: t(
-      'The radius (in pixels) the algorithm uses to define a cluster. ' +
-        'Choose 0 to turn off clustering, but beware that a large ' +
-        'number of points (>1000) will cause lag.',
-    ),
-  },
-
   point_radius_fixed: {
     type: 'FixedOrMetricControl',
     label: t('Point Size'),
@@ -1595,30 +1572,6 @@ export const controls = {
     }),
   },
 
-  point_radius: {
-    type: 'SelectControl',
-    label: t('Point Radius'),
-    default: 'Auto',
-    description: t(
-      'The radius of individual points (ones that are not in a cluster). ' +
-        'Either a numerical column or `Auto`, which scales the point based ' +
-        'on the largest cluster',
-    ),
-    mapStateToProps: state => ({
-      choices: formatSelectOptions(['Auto']).concat(
-        columnChoices(state.datasource),
-      ),
-    }),
-  },
-
-  point_radius_unit: {
-    type: 'SelectControl',
-    label: t('Point Radius Unit'),
-    default: 'Pixels',
-    choices: formatSelectOptions(['Pixels', 'Miles', 'Kilometers']),
-    description: t('The unit of measure for the specified point radius'),
-  },
-
   point_unit: {
     type: 'SelectControl',
     label: t('Point Unit'),
@@ -1679,55 +1632,6 @@ export const controls = {
     dontRefreshOnChange: true,
   },
 
-  viewport_latitude: {
-    type: 'TextControl',
-    label: t('Default latitude'),
-    renderTrigger: true,
-    default: 37.772123,
-    isFloat: true,
-    description: t('Latitude of default viewport'),
-    places: 8,
-    // Viewport latitude changes shouldn't prompt user to re-run query
-    dontRefreshOnChange: true,
-  },
-
-  viewport_longitude: {
-    type: 'TextControl',
-    label: t('Default longitude'),
-    renderTrigger: true,
-    default: -122.405293,
-    isFloat: true,
-    description: t('Longitude of default viewport'),
-    places: 8,
-    // Viewport longitude changes shouldn't prompt user to re-run query
-    dontRefreshOnChange: true,
-  },
-
-  render_while_dragging: {
-    type: 'CheckboxControl',
-    label: t('Live render'),
-    default: true,
-    description: t(
-      'Points and clusters will update as the viewport is being changed',
-    ),
-  },
-
-  mapbox_color: {
-    type: 'SelectControl',
-    freeForm: true,
-    label: t('RGB Color'),
-    default: 'rgb(0, 122, 135)',
-    choices: [
-      ['rgb(0, 139, 139)', 'Dark Cyan'],
-      ['rgb(128, 0, 128)', 'Purple'],
-      ['rgb(255, 215, 0)', 'Gold'],
-      ['rgb(69, 69, 69)', 'Dim Gray'],
-      ['rgb(220, 20, 60)', 'Crimson'],
-      ['rgb(34, 139, 34)', 'Forest Green'],
-    ],
-    description: t('The color for points and clusters in RGB'),
-  },
-
   color: {
     type: 'ColorPickerControl',
     label: t('Color'),

Reply via email to