From d463f03e2053a62cb96755f71cbd7942700a62a4 Mon Sep 17 00:00:00 2001 From: Evan Rusackas Date: Thu, 3 Dec 2020 23:27:38 -0800 Subject: [PATCH] refactor: Relocating/renaming various chart controls (#836) * refactor: relocating/renaming various chart controls * typo * Reverting to "additional metadata" --- .../packages/superset-ui-chart-controls/src/sections.tsx | 1 - .../packages/superset-ui-chart-controls/src/types.ts | 6 +++--- .../superset-ui-core/src/color/CategoricalColorScale.ts | 2 +- .../superset-ui-core/src/color/SequentialScheme.ts | 1 + .../legacy-plugin-chart-calendar/src/controlPanel.js | 1 + .../legacy-plugin-chart-country-map/src/controlPanel.ts | 7 ++++--- .../legacy-plugin-chart-event-flow/src/controlPanel.tsx | 8 ++++---- .../src/controlPanel.js | 3 ++- .../legacy-plugin-chart-heatmap/src/controlPanel.js | 5 +++-- .../legacy-plugin-chart-histogram/src/controlPanel.js | 2 +- .../legacy-plugin-chart-paired-t-test/src/controlPanel.ts | 2 +- .../legacy-plugin-chart-partition/src/controlPanel.jsx | 3 +++ .../legacy-plugin-chart-treemap/src/controlPanel.js | 1 + .../legacy-preset-chart-nvd3/src/Area/controlPanel.ts | 2 ++ .../legacy-preset-chart-nvd3/src/Bubble/controlPanel.ts | 3 +++ .../src/LineMulti/controlPanel.ts | 5 +++-- 16 files changed, 33 insertions(+), 19 deletions(-) diff --git a/superset-frontend/temporary_superset_ui/superset-ui/packages/superset-ui-chart-controls/src/sections.tsx b/superset-frontend/temporary_superset_ui/superset-ui/packages/superset-ui-chart-controls/src/sections.tsx index cf71a25d382c6..13b1adce52e5b 100644 --- a/superset-frontend/temporary_superset_ui/superset-ui/packages/superset-ui-chart-controls/src/sections.tsx +++ b/superset-frontend/temporary_superset_ui/superset-ui/packages/superset-ui-chart-controls/src/sections.tsx @@ -101,7 +101,6 @@ export const annotations = { default: [], description: 'Annotation Layers', renderTrigger: true, - tabOverride: 'data', }, }, ], diff --git a/superset-frontend/temporary_superset_ui/superset-ui/packages/superset-ui-chart-controls/src/types.ts b/superset-frontend/temporary_superset_ui/superset-ui/packages/superset-ui-chart-controls/src/types.ts index f7b806ed7e9eb..bba16b3ddf7f0 100644 --- a/superset-frontend/temporary_superset_ui/superset-ui/packages/superset-ui-chart-controls/src/types.ts +++ b/superset-frontend/temporary_superset_ui/superset-ui/packages/superset-ui-chart-controls/src/types.ts @@ -154,7 +154,7 @@ export type InternalControlType = // eslint-disable-next-line @typescript-eslint/no-explicit-any export type ControlType = InternalControlType | React.ComponentType; -export type TabOverride = 'data' | boolean; +export type TabOverride = 'data' | 'customize' | boolean; /** * Control config specifying how chart controls appear in the control panel, all @@ -179,7 +179,8 @@ export type TabOverride = 'data' | boolean; * show a warning based on the value of another component. It's also possible to bind * arbitrary data from the redux store to the component this way. * - tabOverride: set to 'data' if you want to force a renderTrigger to show up on the `Data` - * tab, otherwise `renderTrigger: true` components will show up on the `Style` tab. + tab, or 'customize' if you want it to show up on that tam. Otherwise sections with ALL + `renderTrigger: true` components will show up on the `Customize` tab. * - visibility: a function that uses control panel props to check whether a control should * be visibile. */ @@ -198,7 +199,6 @@ export interface BaseControlConfig< error?: ReactNode; // override control panel state props mapStateToProps?: (state: ControlPanelState, control: this) => ExtraControlProps; - tabOverride?: TabOverride; visibility?: (props: ControlPanelsContainerProps) => boolean; } diff --git a/superset-frontend/temporary_superset_ui/superset-ui/packages/superset-ui-core/src/color/CategoricalColorScale.ts b/superset-frontend/temporary_superset_ui/superset-ui/packages/superset-ui-core/src/color/CategoricalColorScale.ts index c2c12390f6005..6616706ab2ff7 100644 --- a/superset-frontend/temporary_superset_ui/superset-ui/packages/superset-ui-core/src/color/CategoricalColorScale.ts +++ b/superset-frontend/temporary_superset_ui/superset-ui/packages/superset-ui-core/src/color/CategoricalColorScale.ts @@ -68,7 +68,7 @@ class CategoricalColorScale extends ExtensibleFunction { * @returns an object where the key is the data value and the value is the hex color code */ getColorMap() { - const colorMap: { [key: string]: string } = {}; + const colorMap: { [key: string]: string | undefined } = {}; this.scale.domain().forEach(value => { colorMap[value.toString()] = this.scale(value); }); diff --git a/superset-frontend/temporary_superset_ui/superset-ui/packages/superset-ui-core/src/color/SequentialScheme.ts b/superset-frontend/temporary_superset_ui/superset-ui/packages/superset-ui-core/src/color/SequentialScheme.ts index 8b04d31d80196..d86ce2b556880 100644 --- a/superset-frontend/temporary_superset_ui/superset-ui/packages/superset-ui-core/src/color/SequentialScheme.ts +++ b/superset-frontend/temporary_superset_ui/superset-ui/packages/superset-ui-core/src/color/SequentialScheme.ts @@ -52,6 +52,7 @@ export default class SequentialScheme extends ColorScheme { const piecewiseScale: (t: number) => string = piecewise(interpolateHcl, this.colors); const adjustExtent = scaleLinear().range(extent).clamp(true); + // @ts-ignore return quantize(t => piecewiseScale(adjustExtent(t)), numColors); } } diff --git a/superset-frontend/temporary_superset_ui/superset-ui/plugins/legacy-plugin-chart-calendar/src/controlPanel.js b/superset-frontend/temporary_superset_ui/superset-ui/plugins/legacy-plugin-chart-calendar/src/controlPanel.js index 02334a3405fca..df678457c72a8 100644 --- a/superset-frontend/temporary_superset_ui/superset-ui/plugins/legacy-plugin-chart-calendar/src/controlPanel.js +++ b/superset-frontend/temporary_superset_ui/superset-ui/plugins/legacy-plugin-chart-calendar/src/controlPanel.js @@ -62,6 +62,7 @@ export default { { label: t('Chart Options'), expanded: true, + tabOverride: 'customize', controlSetRows: [ ['linear_color_scheme'], [ diff --git a/superset-frontend/temporary_superset_ui/superset-ui/plugins/legacy-plugin-chart-country-map/src/controlPanel.ts b/superset-frontend/temporary_superset_ui/superset-ui/plugins/legacy-plugin-chart-country-map/src/controlPanel.ts index 64a64c4f3e829..aec33735d0eb9 100644 --- a/superset-frontend/temporary_superset_ui/superset-ui/plugins/legacy-plugin-chart-country-map/src/controlPanel.ts +++ b/superset-frontend/temporary_superset_ui/superset-ui/plugins/legacy-plugin-chart-country-map/src/controlPanel.ts @@ -27,8 +27,9 @@ export default { controlSetRows: [['entity'], ['metric'], ['adhoc_filters']], }, { - label: t('Options'), + label: t('Chart Options'), expanded: true, + tabOverride: 'customize', controlSetRows: [ [ { @@ -88,9 +89,9 @@ export default { ], controlOverrides: { entity: { - label: t('ISO 3166-2 codes of region/province/department'), + label: t('ISO 3166-2 Codes'), description: t( - "It's ISO 3166-2 of your region/province/department in your table. (see documentation for list of ISO 3166-2)", + 'Column containing ISO 3166-2 codes of region/province/department in your table.', ), }, metric: { diff --git a/superset-frontend/temporary_superset_ui/superset-ui/plugins/legacy-plugin-chart-event-flow/src/controlPanel.tsx b/superset-frontend/temporary_superset_ui/superset-ui/plugins/legacy-plugin-chart-event-flow/src/controlPanel.tsx index 0b3b315329d90..f2b9b157a3b79 100644 --- a/superset-frontend/temporary_superset_ui/superset-ui/plugins/legacy-plugin-chart-event-flow/src/controlPanel.tsx +++ b/superset-frontend/temporary_superset_ui/superset-ui/plugins/legacy-plugin-chart-event-flow/src/controlPanel.tsx @@ -38,7 +38,7 @@ const config: ControlPanelConfig = { name: 'all_columns_x', config: { type: 'SelectControl', - label: t('Column containing event names'), + label: t('Event Names'), description: t('Columns to display'), mapStateToProps: state => ({ choices: columnChoices(state?.datasource), @@ -98,7 +98,7 @@ const config: ControlPanelConfig = { config: { type: 'SelectControl', multi: true, - label: t('Meta data'), + label: t('Metadata'), default: [], description: t('Select any columns for metadata inspection'), optionRenderer: c => , @@ -118,11 +118,11 @@ const config: ControlPanelConfig = { ], controlOverrides: { entity: { - label: t('Column containing entity ids'), + label: t('Entity ID'), description: t('e.g., a "user id" column'), }, row_limit: { - label: t('Event count limit'), + label: t('Max Events'), description: t('The maximum number of events to return, equivalent to the number of rows'), }, }, diff --git a/superset-frontend/temporary_superset_ui/superset-ui/plugins/legacy-plugin-chart-force-directed/src/controlPanel.js b/superset-frontend/temporary_superset_ui/superset-ui/plugins/legacy-plugin-chart-force-directed/src/controlPanel.js index f49474895062c..20b65339b238e 100644 --- a/superset-frontend/temporary_superset_ui/superset-ui/plugins/legacy-plugin-chart-force-directed/src/controlPanel.js +++ b/superset-frontend/temporary_superset_ui/superset-ui/plugins/legacy-plugin-chart-force-directed/src/controlPanel.js @@ -27,7 +27,8 @@ export default { controlSetRows: [['groupby'], ['metric'], ['adhoc_filters'], ['row_limit']], }, { - label: t('Options'), + label: t('Chart Options'), + expanded: true, controlSetRows: [ [ { diff --git a/superset-frontend/temporary_superset_ui/superset-ui/plugins/legacy-plugin-chart-heatmap/src/controlPanel.js b/superset-frontend/temporary_superset_ui/superset-ui/plugins/legacy-plugin-chart-heatmap/src/controlPanel.js index 8df709b391d62..16b4fbb9b28b4 100644 --- a/superset-frontend/temporary_superset_ui/superset-ui/plugins/legacy-plugin-chart-heatmap/src/controlPanel.js +++ b/superset-frontend/temporary_superset_ui/superset-ui/plugins/legacy-plugin-chart-heatmap/src/controlPanel.js @@ -41,7 +41,7 @@ export default { name: 'all_columns_x', config: { type: 'SelectControl', - label: 'X', + label: 'X Axis', default: null, description: t('Columns to display'), mapStateToProps: state => ({ @@ -54,7 +54,7 @@ export default { name: 'all_columns_y', config: { type: 'SelectControl', - label: 'Y', + label: 'Y Axis', default: null, description: t('Columns to display'), mapStateToProps: state => ({ @@ -72,6 +72,7 @@ export default { { label: t('Heatmap Options'), expanded: true, + tabOverride: 'customize', controlSetRows: [ ['linear_color_scheme'], [ diff --git a/superset-frontend/temporary_superset_ui/superset-ui/plugins/legacy-plugin-chart-histogram/src/controlPanel.js b/superset-frontend/temporary_superset_ui/superset-ui/plugins/legacy-plugin-chart-histogram/src/controlPanel.js index 47bc4f6ce1cd3..0640ab596ecd8 100644 --- a/superset-frontend/temporary_superset_ui/superset-ui/plugins/legacy-plugin-chart-histogram/src/controlPanel.js +++ b/superset-frontend/temporary_superset_ui/superset-ui/plugins/legacy-plugin-chart-histogram/src/controlPanel.js @@ -30,7 +30,7 @@ export default { name: 'all_columns_x', config: { type: 'SelectControl', - label: t('Numeric Columns'), + label: t('Columns'), default: null, description: t('Select the numeric columns to draw the histogram'), mapStateToProps: state => ({ diff --git a/superset-frontend/temporary_superset_ui/superset-ui/plugins/legacy-plugin-chart-paired-t-test/src/controlPanel.ts b/superset-frontend/temporary_superset_ui/superset-ui/plugins/legacy-plugin-chart-paired-t-test/src/controlPanel.ts index bd872a29a0ada..6672759f9c52a 100644 --- a/superset-frontend/temporary_superset_ui/superset-ui/plugins/legacy-plugin-chart-paired-t-test/src/controlPanel.ts +++ b/superset-frontend/temporary_superset_ui/superset-ui/plugins/legacy-plugin-chart-paired-t-test/src/controlPanel.ts @@ -52,7 +52,7 @@ export default { ], }, { - label: t('Paired t-test'), + label: t('Parameters'), expanded: false, controlSetRows: [ [ diff --git a/superset-frontend/temporary_superset_ui/superset-ui/plugins/legacy-plugin-chart-partition/src/controlPanel.jsx b/superset-frontend/temporary_superset_ui/superset-ui/plugins/legacy-plugin-chart-partition/src/controlPanel.jsx index b6963a91d7e5a..bd39bbf1c627d 100644 --- a/superset-frontend/temporary_superset_ui/superset-ui/plugins/legacy-plugin-chart-partition/src/controlPanel.jsx +++ b/superset-frontend/temporary_superset_ui/superset-ui/plugins/legacy-plugin-chart-partition/src/controlPanel.jsx @@ -125,6 +125,7 @@ export default { { label: t('Chart Options'), expanded: true, + tabOverride: 'customize', controlSetRows: [ ['color_scheme', 'label_colors'], [ @@ -192,6 +193,8 @@ export default { description: t('Use a log scale'), }, }, + ], + [ { name: 'equal_date_size', config: { diff --git a/superset-frontend/temporary_superset_ui/superset-ui/plugins/legacy-plugin-chart-treemap/src/controlPanel.js b/superset-frontend/temporary_superset_ui/superset-ui/plugins/legacy-plugin-chart-treemap/src/controlPanel.js index c0778ec0a16c8..6fb329e3e7366 100644 --- a/superset-frontend/temporary_superset_ui/superset-ui/plugins/legacy-plugin-chart-treemap/src/controlPanel.js +++ b/superset-frontend/temporary_superset_ui/superset-ui/plugins/legacy-plugin-chart-treemap/src/controlPanel.js @@ -28,6 +28,7 @@ export default { { label: t('Chart Options'), expanded: true, + tabOverride: 'customize', controlSetRows: [ ['color_scheme', 'label_colors'], [ diff --git a/superset-frontend/temporary_superset_ui/superset-ui/plugins/legacy-preset-chart-nvd3/src/Area/controlPanel.ts b/superset-frontend/temporary_superset_ui/superset-ui/plugins/legacy-preset-chart-nvd3/src/Area/controlPanel.ts index 73b45fc9f9c28..bf4d2c91fb60c 100644 --- a/superset-frontend/temporary_superset_ui/superset-ui/plugins/legacy-preset-chart-nvd3/src/Area/controlPanel.ts +++ b/superset-frontend/temporary_superset_ui/superset-ui/plugins/legacy-preset-chart-nvd3/src/Area/controlPanel.ts @@ -66,6 +66,7 @@ export default { }, { label: t('X Axis'), + tabOverride: 'customize', expanded: true, controlSetRows: [ [xAxisLabel, bottomMargin], @@ -75,6 +76,7 @@ export default { }, { label: t('Y Axis'), + tabOverride: 'customize', expanded: true, controlSetRows: [ ['y_axis_format', yAxisBounds], diff --git a/superset-frontend/temporary_superset_ui/superset-ui/plugins/legacy-preset-chart-nvd3/src/Bubble/controlPanel.ts b/superset-frontend/temporary_superset_ui/superset-ui/plugins/legacy-preset-chart-nvd3/src/Bubble/controlPanel.ts index 7358878ecb114..1a1727dc916e4 100644 --- a/superset-frontend/temporary_superset_ui/superset-ui/plugins/legacy-preset-chart-nvd3/src/Bubble/controlPanel.ts +++ b/superset-frontend/temporary_superset_ui/superset-ui/plugins/legacy-preset-chart-nvd3/src/Bubble/controlPanel.ts @@ -61,6 +61,7 @@ export default { { label: t('Chart Options'), expanded: true, + tabOverride: 'customize', controlSetRows: [ ['color_scheme', 'label_colors'], [showLegend, null], @@ -69,6 +70,7 @@ export default { { label: t('X Axis'), expanded: true, + tabOverride: 'customize', controlSetRows: [ [xAxisLabel, leftMargin], [ @@ -100,6 +102,7 @@ export default { { label: t('Y Axis'), expanded: true, + tabOverride: 'customize', controlSetRows: [ [yAxisLabel, bottomMargin], ['y_axis_format', null], diff --git a/superset-frontend/temporary_superset_ui/superset-ui/plugins/legacy-preset-chart-nvd3/src/LineMulti/controlPanel.ts b/superset-frontend/temporary_superset_ui/superset-ui/plugins/legacy-preset-chart-nvd3/src/LineMulti/controlPanel.ts index 6a17f332f9ca8..fe13badf3a49d 100644 --- a/superset-frontend/temporary_superset_ui/superset-ui/plugins/legacy-preset-chart-nvd3/src/LineMulti/controlPanel.ts +++ b/superset-frontend/temporary_superset_ui/superset-ui/plugins/legacy-preset-chart-nvd3/src/LineMulti/controlPanel.ts @@ -44,6 +44,7 @@ export default { controlPanelSections: [ { label: t('Chart Options'), + tabOverride: 'customize', expanded: true, controlSetRows: [ ['color_scheme', 'label_colors'], @@ -73,7 +74,7 @@ export default { ], }, { - label: t('Y Axis 1'), + label: t('Y Axis Left'), expanded: true, controlSetRows: [ [ @@ -105,7 +106,7 @@ export default { ], }, { - label: t('Y Axis 2'), + label: t('Y Axis Right'), expanded: false, controlSetRows: [ [