From bb5219524a942be53684dd1fa3dc116a8c7ea0e1 Mon Sep 17 00:00:00 2001 From: Evan Rusackas Date: Thu, 2 Apr 2020 12:40:54 -0700 Subject: [PATCH 1/5] Migrating NVD3 Area's stacked_style config --- CONTRIBUTING.md | 1 - .../src/explore/controlPanels/Area.js | 19 ++++++++++++++++++- superset-frontend/src/explore/controls.jsx | 13 ------------- 3 files changed, 18 insertions(+), 15 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 82c23fd591fdd..00a1a0e5d9b63 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1188,7 +1188,6 @@ Note the `y_axis_format` is defined under various section for some charts. | `show_values` | _N/A_ | | | `slice_name` | _N/A_ | | | `spatial` | _N/A_ | | -| `stacked_style` | _N/A_ | | | `start_spatial` | _N/A_ | | | `stroke_color_picker` | _N/A_ | | | `stroke_width` | _N/A_ | | diff --git a/superset-frontend/src/explore/controlPanels/Area.js b/superset-frontend/src/explore/controlPanels/Area.js index 1c01fa4825235..2eda633bfadf0 100644 --- a/superset-frontend/src/explore/controlPanels/Area.js +++ b/superset-frontend/src/explore/controlPanels/Area.js @@ -29,7 +29,24 @@ export default { expanded: true, controlSetRows: [ ['show_brush', 'show_legend'], - ['line_interpolation', 'stacked_style'], + [ + 'line_interpolation', + { + name: 'stacked_style', + config: { + type: 'SelectControl', + label: t('Stacked Style'), + renderTrigger: true, + choices: [ + ['stack', 'stack'], + ['stream', 'stream'], + ['expand', 'expand'], + ], + default: 'stack', + description: '', + }, + }, + ], ['color_scheme', 'label_colors'], ['rich_tooltip', 'show_controls'], ], diff --git a/superset-frontend/src/explore/controls.jsx b/superset-frontend/src/explore/controls.jsx index 3c2648247342c..b577716fe70cf 100644 --- a/superset-frontend/src/explore/controls.jsx +++ b/superset-frontend/src/explore/controls.jsx @@ -338,19 +338,6 @@ export const controls = { description: t('Choose a metric for right axis'), }, - stacked_style: { - type: 'SelectControl', - label: t('Stacked Style'), - renderTrigger: true, - choices: [ - ['stack', 'stack'], - ['stream', 'stream'], - ['expand', 'expand'], - ], - default: 'stack', - description: '', - }, - linear_color_scheme: { type: 'ColorSchemeControl', label: t('Linear Color Scheme'), From 682a8dff0d428e8ced4e8e30f55828eac1dcb067 Mon Sep 17 00:00:00 2001 From: Evan Rusackas Date: Thu, 2 Apr 2020 13:28:53 -0700 Subject: [PATCH 2/5] test mods --- .../javascripts/explore/controlUtils_spec.jsx | 21 +++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/superset-frontend/spec/javascripts/explore/controlUtils_spec.jsx b/superset-frontend/spec/javascripts/explore/controlUtils_spec.jsx index 2725a9a975e00..bdd288e4c10ed 100644 --- a/superset-frontend/spec/javascripts/explore/controlUtils_spec.jsx +++ b/superset-frontend/spec/javascripts/explore/controlUtils_spec.jsx @@ -57,6 +57,23 @@ describe('controlUtils', () => { }, }, ], + [ + { + name: 'stacked_style', + config: { + type: 'SelectControl', + label: t('Stacked Style'), + renderTrigger: true, + choices: [ + ['stack', 'stack'], + ['stream', 'stream'], + ['expand', 'expand'], + ], + default: 'stack', + description: '', + }, + }, + ] ], }, ], @@ -148,10 +165,10 @@ describe('controlUtils', () => { }); it('removes missing/invalid choice', () => { - let control = getControlState('stacked_style', 'area', state, 'stack'); + let control = getControlState('stacked_style', 'test-chart', state, 'stack'); expect(control.value).toBe('stack'); - control = getControlState('stacked_style', 'area', state, 'FOO'); + control = getControlState('stacked_style', 'test-chart', state, 'FOO'); expect(control.value).toBe(null); }); From 74323afa54ea90a90db433a57a58c69872904bd7 Mon Sep 17 00:00:00 2001 From: Evan Rusackas Date: Thu, 2 Apr 2020 13:35:52 -0700 Subject: [PATCH 3/5] lint --- .../spec/javascripts/explore/controlUtils_spec.jsx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/superset-frontend/spec/javascripts/explore/controlUtils_spec.jsx b/superset-frontend/spec/javascripts/explore/controlUtils_spec.jsx index bdd288e4c10ed..b2bb700681bfc 100644 --- a/superset-frontend/spec/javascripts/explore/controlUtils_spec.jsx +++ b/superset-frontend/spec/javascripts/explore/controlUtils_spec.jsx @@ -73,7 +73,7 @@ describe('controlUtils', () => { description: '', }, }, - ] + ], ], }, ], @@ -165,7 +165,12 @@ describe('controlUtils', () => { }); it('removes missing/invalid choice', () => { - let control = getControlState('stacked_style', 'test-chart', state, 'stack'); + let control = getControlState( + 'stacked_style', + 'test-chart', + state, + 'stack', + ); expect(control.value).toBe('stack'); control = getControlState('stacked_style', 'test-chart', state, 'FOO'); From 8191991945944d7853b6c59fcb3ef70032da2624 Mon Sep 17 00:00:00 2001 From: Evan Rusackas Date: Thu, 2 Apr 2020 15:58:09 -0700 Subject: [PATCH 4/5] nonsense change --- superset-frontend/spec/javascripts/explore/controlUtils_spec.jsx | 1 + 1 file changed, 1 insertion(+) diff --git a/superset-frontend/spec/javascripts/explore/controlUtils_spec.jsx b/superset-frontend/spec/javascripts/explore/controlUtils_spec.jsx index b2bb700681bfc..66ba1230c111c 100644 --- a/superset-frontend/spec/javascripts/explore/controlUtils_spec.jsx +++ b/superset-frontend/spec/javascripts/explore/controlUtils_spec.jsx @@ -152,6 +152,7 @@ describe('controlUtils', () => { }); }); + describe('getControlState', () => { it('to be function free', () => { const control = getControlState('all_columns', 'table', state, ['a']); From a4cad07ebeb4e7ddf617384925d56ab5140f18dc Mon Sep 17 00:00:00 2001 From: Evan Rusackas Date: Thu, 2 Apr 2020 15:58:25 -0700 Subject: [PATCH 5/5] undoing nonsense. Come on GitHub, WORK. --- superset-frontend/spec/javascripts/explore/controlUtils_spec.jsx | 1 - 1 file changed, 1 deletion(-) diff --git a/superset-frontend/spec/javascripts/explore/controlUtils_spec.jsx b/superset-frontend/spec/javascripts/explore/controlUtils_spec.jsx index 66ba1230c111c..b2bb700681bfc 100644 --- a/superset-frontend/spec/javascripts/explore/controlUtils_spec.jsx +++ b/superset-frontend/spec/javascripts/explore/controlUtils_spec.jsx @@ -152,7 +152,6 @@ describe('controlUtils', () => { }); }); - describe('getControlState', () => { it('to be function free', () => { const control = getControlState('all_columns', 'table', state, ['a']);