From 5b67e0712d5d3c738abf3281e67755af741c5c01 Mon Sep 17 00:00:00 2001 From: Yongjie Zhao Date: Fri, 11 Nov 2022 18:04:56 +0800 Subject: [PATCH] refactor: update documents and rename variables (#22074) --- UPDATING.md | 6 +++--- .../src/operators/pivotOperator.ts | 6 +++--- .../src/operators/prophetOperator.ts | 6 +++--- .../src/operators/renameOperator.ts | 4 ++-- .../src/operators/timeComparePivotOperator.ts | 6 +++--- .../src/BigNumber/BigNumberWithTrendline/transformProps.ts | 6 +++--- 6 files changed, 17 insertions(+), 17 deletions(-) diff --git a/UPDATING.md b/UPDATING.md index 4ca468ecbc..65b15f622b 100644 --- a/UPDATING.md +++ b/UPDATING.md @@ -25,11 +25,11 @@ assists people when migrating to a new version. ## Next - [22022](https://github.com/apache/superset/pull/22022): HTTP API endpoints `/superset/approve` and `/superset/request_access` have been deprecated and their HTTP methods were changed from GET to POST -- [21895](https://github.com/apache/superset/pull/21895): Markdown components had their security increased by adhering to the same sanitization process enforced by Github. This means that some HTML elements found in markdowns are not allowed anymore due to the security risks they impose. If you're deploying Superset in a trusted environment and wish to use some of the blocked elements, then you can use the HTML_SANITIZATION_SCHEMA_EXTENSIONS configuration to extend the default sanitization schema. There's also the option to disable HTML sanitization using the HTML_SANITIZATION configuration but we do not recommend this approach because of the security risks. Given the provided configurations, we don't view the improved sanitization as a breaking change but as a security patch. +- [21895](https://github.com/apache/superset/pull/21895): Markdown components had their security increased by adhering to the same sanitization process enforced by GitHub. This means that some HTML elements found in markdowns are not allowed anymore due to the security risks they impose. If you're deploying Superset in a trusted environment and wish to use some of the blocked elements, then you can use the HTML_SANITIZATION_SCHEMA_EXTENSIONS configuration to extend the default sanitization schema. There's also the option to disable HTML sanitization using the HTML_SANITIZATION configuration but we do not recommend this approach because of the security risks. Given the provided configurations, we don't view the improved sanitization as a breaking change but as a security patch. - [20606](https://github.com/apache/superset/pull/20606): When user clicks on chart title or "Edit chart" button in Dashboard page, Explore opens in the same tab. Clicking while holding cmd/ctrl opens Explore in a new tab. To bring back the old behaviour (always opening Explore in a new tab), flip feature flag `DASHBOARD_EDIT_CHART_IN_NEW_TAB` to `True`. -- [20799](https://github.com/apache/superset/pull/20799): Presto and Trino engine will now display tracking URL for running queries in SQL Lab. If for some reason you don't want to show the tracking URL (for example, when your data warehouse hasn't enable access for to Presto or Trino UI), update `TRACKING_URL_TRANSFORMER` in `config.py` to return `None`. +- [20799](https://github.com/apache/superset/pull/20799): Presto and Trino engine will now display tracking URL for running queries in SQL Lab. If for some reason you don't want to show the tracking URL (for example, when your data warehouse hasn't enabled access for to Presto or Trino UI), update `TRACKING_URL_TRANSFORMER` in `config.py` to return `None`. - [21002](https://github.com/apache/superset/pull/21002): Support Python 3.10 and bump pandas 1.4 and pyarrow 6. -- [21163](https://github.com/apache/superset/pull/21163): When `GENERIC_CHART_AXES` feature flags set to `True`, the Time Grain control will move below the X-Axis control. +- [21163](https://github.com/apache/superset/pull/21163): The time grain will be decoupled from the time filter column and the time grain control will move below the X-Axis control when `GENERIC_CHART_AXES` feature flags set to `True`. The time grain will be applied on the time column in the column-like controls(x axis, dimensions) instead of the time column in the time section. - [21284](https://github.com/apache/superset/pull/21284): The non-functional `MAX_TABLE_NAMES` config key has been removed. - [21794](https://github.com/apache/superset/pull/21794): Deprecates the undocumented `PRESTO_SPLIT_VIEWS_FROM_TABLES` feature flag. Now for Presto, like other engines, only physical tables are treated as tables. diff --git a/superset-frontend/packages/superset-ui-chart-controls/src/operators/pivotOperator.ts b/superset-frontend/packages/superset-ui-chart-controls/src/operators/pivotOperator.ts index 4db7e4125a..8190c951d6 100644 --- a/superset-frontend/packages/superset-ui-chart-controls/src/operators/pivotOperator.ts +++ b/superset-frontend/packages/superset-ui-chart-controls/src/operators/pivotOperator.ts @@ -30,13 +30,13 @@ export const pivotOperator: PostProcessingFactory = ( queryObject, ) => { const metricLabels = ensureIsArray(queryObject.metrics).map(getMetricLabel); - const xAxis = getXAxisLabel(formData); + const xAxisLabel = getXAxisLabel(formData); - if (xAxis && metricLabels.length) { + if (xAxisLabel && metricLabels.length) { return { operation: 'pivot', options: { - index: [xAxis], + index: [xAxisLabel], columns: ensureIsArray(queryObject.columns).map(getColumnLabel), // Create 'dummy' mean aggregates to assign cell values in pivot table // use the 'mean' aggregates to avoid drop NaN. PR: https://github.com/apache-superset/superset-ui/pull/1231 diff --git a/superset-frontend/packages/superset-ui-chart-controls/src/operators/prophetOperator.ts b/superset-frontend/packages/superset-ui-chart-controls/src/operators/prophetOperator.ts index 274cadb4b6..269dc1e801 100644 --- a/superset-frontend/packages/superset-ui-chart-controls/src/operators/prophetOperator.ts +++ b/superset-frontend/packages/superset-ui-chart-controls/src/operators/prophetOperator.ts @@ -24,8 +24,8 @@ export const prophetOperator: PostProcessingFactory = ( formData, queryObject, ) => { - const xAxis = getXAxisLabel(formData); - if (formData.forecastEnabled && xAxis) { + const xAxisLabel = getXAxisLabel(formData); + if (formData.forecastEnabled && xAxisLabel) { return { operation: 'prophet', options: { @@ -35,7 +35,7 @@ export const prophetOperator: PostProcessingFactory = ( yearly_seasonality: formData.forecastSeasonalityYearly, weekly_seasonality: formData.forecastSeasonalityWeekly, daily_seasonality: formData.forecastSeasonalityDaily, - index: xAxis, + index: xAxisLabel, }, }; } diff --git a/superset-frontend/packages/superset-ui-chart-controls/src/operators/renameOperator.ts b/superset-frontend/packages/superset-ui-chart-controls/src/operators/renameOperator.ts index fb254e0469..34dc028361 100644 --- a/superset-frontend/packages/superset-ui-chart-controls/src/operators/renameOperator.ts +++ b/superset-frontend/packages/superset-ui-chart-controls/src/operators/renameOperator.ts @@ -34,7 +34,7 @@ export const renameOperator: PostProcessingFactory = ( const metrics = ensureIsArray(queryObject.metrics); const columns = ensureIsArray(queryObject.columns); const { truncate_metric } = formData; - const xAxis = getXAxisLabel(formData); + const xAxisLabel = getXAxisLabel(formData); // remove or rename top level of column name(metric name) in the MultiIndex when // 1) only 1 metric // 2) exist dimentsion @@ -44,7 +44,7 @@ export const renameOperator: PostProcessingFactory = ( if ( metrics.length === 1 && columns.length > 0 && - xAxis && + xAxisLabel && !( // todo: we should provide an approach to handle derived metrics ( diff --git a/superset-frontend/packages/superset-ui-chart-controls/src/operators/timeComparePivotOperator.ts b/superset-frontend/packages/superset-ui-chart-controls/src/operators/timeComparePivotOperator.ts index d2b8d0d81d..c3a2ef074f 100644 --- a/superset-frontend/packages/superset-ui-chart-controls/src/operators/timeComparePivotOperator.ts +++ b/superset-frontend/packages/superset-ui-chart-controls/src/operators/timeComparePivotOperator.ts @@ -30,9 +30,9 @@ import { PostProcessingFactory } from './types'; export const timeComparePivotOperator: PostProcessingFactory = (formData, queryObject) => { const metricOffsetMap = getMetricOffsetsMap(formData, queryObject); - const xAxis = getXAxisLabel(formData); + const xAxisLabel = getXAxisLabel(formData); - if (isTimeComparison(formData, queryObject) && xAxis) { + if (isTimeComparison(formData, queryObject) && xAxisLabel) { const aggregates = Object.fromEntries( [...metricOffsetMap.values(), ...metricOffsetMap.keys()].map(metric => [ metric, @@ -44,7 +44,7 @@ export const timeComparePivotOperator: PostProcessingFactory name === metricName); @@ -115,7 +115,7 @@ export default function transformProps( if (data.length > 0) { const sortedData = (data as BigNumberDatum[]) - .map(d => [d[timeColumn], parseMetricValue(d[metricName])]) + .map(d => [d[xAxisLabel], parseMetricValue(d[metricName])]) // sort in time descending order .sort((a, b) => (a[0] !== null && b[0] !== null ? b[0] - a[0] : 0));