From a0b610cd9744c091dd4d0d7d05c2fda61b959af1 Mon Sep 17 00:00:00 2001 From: Antonio Rivero Date: Tue, 30 Jan 2024 21:39:45 +0100 Subject: [PATCH] Period Over Period Plugin: - Add Feature Flag so experimental chart plugins are not available unless explicitly set to True --- RESOURCES/FEATURE_FLAGS.md | 1 + .../superset-ui-core/src/utils/featureFlags.ts | 1 + .../src/visualizations/presets/MainPreset.js | 10 ++++++++-- superset/config.py | 2 ++ 4 files changed, 12 insertions(+), 2 deletions(-) diff --git a/RESOURCES/FEATURE_FLAGS.md b/RESOURCES/FEATURE_FLAGS.md index d782c10cbec79..a697592e1371a 100644 --- a/RESOURCES/FEATURE_FLAGS.md +++ b/RESOURCES/FEATURE_FLAGS.md @@ -31,6 +31,7 @@ These features are considered **unfinished** and should only be used on developm - PRESTO_EXPAND_DATA - SHARE_QUERIES_VIA_KV_STORE - TAGGING_SYSTEM +- CHART_PLUGINS_EXPERIMENTAL ## In Testing diff --git a/superset-frontend/packages/superset-ui-core/src/utils/featureFlags.ts b/superset-frontend/packages/superset-ui-core/src/utils/featureFlags.ts index f993e451f3bf3..dccab0a90e101 100644 --- a/superset-frontend/packages/superset-ui-core/src/utils/featureFlags.ts +++ b/superset-frontend/packages/superset-ui-core/src/utils/featureFlags.ts @@ -26,6 +26,7 @@ export enum FeatureFlag { ALERT_REPORTS = 'ALERT_REPORTS', ALLOW_FULL_CSV_EXPORT = 'ALLOW_FULL_CSV_EXPORT', AVOID_COLORS_COLLISION = 'AVOID_COLORS_COLLISION', + CHART_PLUGINS_EXPERIMENTAL = 'CHART_PLUGINS_EXPERIMENTAL', CONFIRM_DASHBOARD_DIFF = 'CONFIRM_DASHBOARD_DIFF', /** @deprecated */ DASHBOARD_CROSS_FILTERS = 'DASHBOARD_CROSS_FILTERS', diff --git a/superset-frontend/src/visualizations/presets/MainPreset.js b/superset-frontend/src/visualizations/presets/MainPreset.js index 040df25b43f94..98ee67a5d21ec 100644 --- a/superset-frontend/src/visualizations/presets/MainPreset.js +++ b/superset-frontend/src/visualizations/presets/MainPreset.js @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -import { Preset } from '@superset-ui/core'; +import { isFeatureEnabled, FeatureFlag, Preset } from '@superset-ui/core'; import CalendarChartPlugin from '@superset-ui/legacy-plugin-chart-calendar'; import ChordChartPlugin from '@superset-ui/legacy-plugin-chart-chord'; import CountryMapChartPlugin from '@superset-ui/legacy-plugin-chart-country-map'; @@ -81,6 +81,12 @@ import TimeTableChartPlugin from '../TimeTable'; export default class MainPreset extends Preset { constructor() { + const experimentalPlugins = isFeatureEnabled( + FeatureFlag.CHART_PLUGINS_EXPERIMENTAL, + ) + ? [new PopKPIPlugin().configure({ key: 'pop_kpi' })] + : []; + super({ name: 'Legacy charts', presets: [new DeckGLChartPreset()], @@ -156,7 +162,7 @@ export default class MainPreset extends Preset { new EchartsSunburstChartPlugin().configure({ key: 'sunburst_v2' }), new HandlebarsChartPlugin().configure({ key: 'handlebars' }), new EchartsBubbleChartPlugin().configure({ key: 'bubble_v2' }), - new PopKPIPlugin().configure({ key: 'pop_kpi' }), + ...experimentalPlugins, ], }); } diff --git a/superset/config.py b/superset/config.py index 1d6409deb8ac0..0f81401f65491 100644 --- a/superset/config.py +++ b/superset/config.py @@ -485,6 +485,8 @@ class D3Format(TypedDict, total=False): # Unlike Selenium, Playwright reports support deck.gl visualizations # Enabling this feature flag requires installing "playwright" pip package "PLAYWRIGHT_REPORTS_AND_THUMBNAILS": False, + # Set to True to enable experimental chart plugins + "CHART_PLUGINS_EXPERIMENTAL": False, } # ------------------------------