Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: update documents and rename variables #22074

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions UPDATING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

### Breaking Changes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@ export const pivotOperator: PostProcessingFactory<PostProcessingPivot> = (
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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ export const prophetOperator: PostProcessingFactory<PostProcessingProphet> = (
formData,
queryObject,
) => {
const xAxis = getXAxisLabel(formData);
if (formData.forecastEnabled && xAxis) {
const xAxisLabel = getXAxisLabel(formData);
if (formData.forecastEnabled && xAxisLabel) {
return {
operation: 'prophet',
options: {
Expand All @@ -35,7 +35,7 @@ export const prophetOperator: PostProcessingFactory<PostProcessingProphet> = (
yearly_seasonality: formData.forecastSeasonalityYearly,
weekly_seasonality: formData.forecastSeasonalityWeekly,
daily_seasonality: formData.forecastSeasonalityDaily,
index: xAxis,
index: xAxisLabel,
},
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export const renameOperator: PostProcessingFactory<PostProcessingRename> = (
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
Expand All @@ -44,7 +44,7 @@ export const renameOperator: PostProcessingFactory<PostProcessingRename> = (
if (
metrics.length === 1 &&
columns.length > 0 &&
xAxis &&
xAxisLabel &&
!(
// todo: we should provide an approach to handle derived metrics
(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ import { PostProcessingFactory } from './types';
export const timeComparePivotOperator: PostProcessingFactory<PostProcessingPivot> =
(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,
Expand All @@ -44,7 +44,7 @@ export const timeComparePivotOperator: PostProcessingFactory<PostProcessingPivot
return {
operation: 'pivot',
options: {
index: [xAxis],
index: [xAxisLabel],
columns: ensureIsArray(queryObject.columns).map(getColumnLabel),
drop_missing_columns: !formData?.show_empty_columns,
aggregates,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,11 @@ export default function transformProps(
const { r, g, b } = colorPicker;
const mainColor = `rgb(${r}, ${g}, ${b})`;

const timeColumn = getXAxisLabel(rawFormData) as string;
const xAxisLabel = getXAxisLabel(rawFormData) as string;
let trendLineData;
let percentChange = 0;
let bigNumber = data.length === 0 ? null : data[0][metricName];
let timestamp = data.length === 0 ? null : data[0][timeColumn];
let timestamp = data.length === 0 ? null : data[0][xAxisLabel];
let bigNumberFallback;

const metricColtypeIndex = colnames.findIndex(name => name === metricName);
Expand All @@ -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));

Expand Down