Skip to content

Commit

Permalink
Merge branch 'master' into Flag-category-upgates
Browse files Browse the repository at this point in the history
  • Loading branch information
rusackas authored Apr 13, 2023
2 parents a9e1c56 + 04bd528 commit d8222a7
Show file tree
Hide file tree
Showing 69 changed files with 2,959 additions and 1,445 deletions.
1,177 changes: 1,177 additions & 0 deletions CHANGELOG.md

Large diffs are not rendered by default.

3 changes: 1 addition & 2 deletions RESOURCES/FEATURE_FLAGS.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ These features are **finished** but currently being tested. They are usable, but
- RLS_IN_SQLLAB
- SSH_TUNNELING [(docs)](https://superset.apache.org/docs/installation/setup-ssh-tunneling)
- USE_ANALAGOUS_COLORS
- UX_BETA
- VERSIONED_EXPORT

## Stable
Expand All @@ -86,7 +85,6 @@ These features flags are **safe for production**. They have been tested and will
- ENABLE_DND_WITH_CLICK_UX
- ENABLE_EXPLORE_DRAG_AND_DROP
- ENABLE_TEMPLATE_PROCESSING
- ENFORCE_DB_ENCRYPTION_UI
- ESCAPE_MARKDOWN_HTML
- LISTVIEWS_DEFAULT_CARD_VIEW
- SCHEDULED_QUERIES [(docs)](https://superset.apache.org/docs/installation/alerts-reports)
Expand All @@ -103,3 +101,4 @@ These features flags currently default to True and **will be removed in a future
- ALLOW_DASHBOARD_DOMAIN_SHARDING
- DISPLAY_MARKDOWN_HTML
- FORCE_DATABASE_CONNECTIONS_SSL
- GENERIC_CHART_AXES
2 changes: 2 additions & 0 deletions UPDATING.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ assists people when migrating to a new version.

## Next

- [23652](https://github.com/apache/superset/pull/23652) Enables GENERIC_CHART_AXES feature flag by default.
- [23226](https://github.com/apache/superset/pull/23226) Migrated endpoint `/estimate_query_cost/<int:database_id>` to `/api/v1/sqllab/estimate/`. Corresponding permissions are can estimate query cost on SQLLab. Make sure you add/replace the necessary permissions on any custom roles you may have.
- [22809](https://github.com/apache/superset/pull/22809): Migrated endpoint `/superset/sql_json` and `/superset/results/` to `/api/v1/sqllab/execute/` and `/api/v1/sqllab/results/` respectively. Corresponding permissions are `can sql_json on Superset` to `can execute on SQLLab`, `can results on Superset` to `can results on SQLLab`. Make sure you add/replace the necessary permissions on any custom roles you may have.
- [22931](https://github.com/apache/superset/pull/22931): Migrated endpoint `/superset/get_or_create_table/` to `/api/v1/dataset/get_or_create/`. Corresponding permissions are `can get or create table on Superset` to `can get or create dataset on Dataset`. Make sure you add/replace the necessary permissions on any custom roles you may have.
Expand All @@ -47,6 +48,7 @@ assists people when migrating to a new version.

### Breaking Changes

- [23651](https://github.com/apache/superset/pull/23651) Removes UX_BETA feature flag.
- [22798](https://github.com/apache/superset/pull/22798): To make the welcome page more relevant in production environments, the last tab on the welcome page has been changed from to feature all charts/dashboards the user has access to (previously only examples were shown). To keep current behavior unchanged, add the following to your `superset_config.py`: `WELCOME_PAGE_LAST_TAB = "examples"`
- [22328](https://github.com/apache/superset/pull/22328): For deployments that have enabled the "THUMBNAILS" feature flag, the function that calculates dashboard digests has been updated to consider additional properties to more accurately identify changes in the dashboard metadata. This change will invalidate all currently cached dashboard thumbnails.
- [21765](https://github.com/apache/superset/pull/21765): For deployments that have enabled the "ALERT_REPORTS" feature flag, Gamma users will no longer have read and write access to Alerts & Reports by default. To give Gamma users the ability to schedule reports from the Dashboard and Explore view like before, create an additional role with "can read on ReportSchedule" and "can write on ReportSchedule" permissions. To further give Gamma users access to the "Alerts & Reports" menu and CRUD view, add "menu access on Manage" and "menu access on Alerts & Report" permissions to the role.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ describe('Visualization > Table', () => {
granularity_sqla: undefined,
metrics: ['count'],
});
cy.get('[data-test=granularity_sqla] .column-option-label').contains('ds');
cy.get('[data-test=adhoc_filters]').contains('ds');
});

it('Format non-numeric metrics correctly', () => {
Expand Down Expand Up @@ -126,7 +126,7 @@ describe('Visualization > Table', () => {
// should handle frontend sorting correctly
cy.get('.chart-container th').contains('name').click();
cy.get('.chart-container td:nth-child(2):eq(0)').contains('Adam');
cy.get('.chart-container th').contains('Time').click().click();
cy.get('.chart-container th').contains('ds').click().click();
cy.get('.chart-container td:nth-child(1):eq(0)').contains('2008');
});

Expand Down
95 changes: 66 additions & 29 deletions superset-frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion superset-frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@
"@emotion/react": "^11.4.1",
"@emotion/styled": "^11.3.0",
"@fontsource/inter": "^4.0.0",
"@reduxjs/toolkit": "^1.9.3",
"@superset-ui/chart-controls": "file:./packages/superset-ui-chart-controls",
"@superset-ui/core": "file:./packages/superset-ui-core",
"@superset-ui/legacy-plugin-chart-calendar": "file:./plugins/legacy-plugin-chart-calendar",
Expand Down Expand Up @@ -197,7 +198,7 @@
"react-virtualized": "9.19.1",
"react-virtualized-auto-sizer": "^1.0.7",
"react-window": "^1.8.8",
"redux": "^4.0.5",
"redux": "^4.2.1",
"redux-localstorage": "^0.4.1",
"redux-thunk": "^2.1.0",
"redux-undo": "^1.0.0-beta9-9-7",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import {
QueryColumn,
DatasourceType,
} from '@superset-ui/core';
import { ColumnMeta } from './types';
import { ColumnMeta, SortSeriesData, SortSeriesType } from './types';

// eslint-disable-next-line import/prefer-default-export
export const TIME_FILTER_LABELS = {
Expand Down Expand Up @@ -57,3 +57,21 @@ export const QueryModeLabel = {
[QueryMode.aggregate]: t('Aggregate'),
[QueryMode.raw]: t('Raw records'),
};

export const DEFAULT_SORT_SERIES_DATA: SortSeriesData = {
sort_series_type: SortSeriesType.Sum,
sort_series_ascending: false,
};

export const SORT_SERIES_CHOICES = [
[SortSeriesType.Name, t('Category name')],
[SortSeriesType.Sum, t('Total value')],
[SortSeriesType.Min, t('Minimum value')],
[SortSeriesType.Max, t('Maximum value')],
[SortSeriesType.Avg, t('Average value')],
];

export const DEFAULT_XAXIS_SORT_SERIES_DATA: SortSeriesData = {
sort_series_type: SortSeriesType.Name,
sort_series_ascending: true,
};
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,10 @@ import { hasGenericChartAxes, t } from '@superset-ui/core';
import { ControlPanelSectionConfig, ControlSetRow } from '../types';
import {
contributionModeControl,
xAxisSortControl,
xAxisSortAscControl,
xAxisSortControl,
xAxisSortSeriesAscendingControl,
xAxisSortSeriesControl,
} from '../shared-controls';

const controlsWithoutXAxis: ControlSetRow[] = [
Expand Down Expand Up @@ -55,6 +57,8 @@ export const echartsTimeSeriesQueryWithXAxisSort: ControlPanelSectionConfig = {
[hasGenericChartAxes ? 'time_grain_sqla' : null],
[hasGenericChartAxes ? xAxisSortControl : null],
[hasGenericChartAxes ? xAxisSortAscControl : null],
[hasGenericChartAxes ? xAxisSortSeriesControl : null],
[hasGenericChartAxes ? xAxisSortSeriesAscendingControl : null],
...controlsWithoutXAxis,
],
};
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ import {
isDataset,
} from '../types';
import { isTemporalColumn } from '../utils';
import {
DEFAULT_XAXIS_SORT_SERIES_DATA,
SORT_SERIES_CHOICES,
} from '../constants';

export const contributionModeControl = {
name: 'contributionMode',
Expand All @@ -59,6 +63,19 @@ const xAxisSortVisibility = ({ controls }: { controls: ControlStateMapping }) =>
Array.isArray(controls?.groupby?.value) &&
controls.groupby.value.length === 0;

const xAxisMultiSortVisibility = ({
controls,
}: {
controls: ControlStateMapping;
}) =>
isDefined(controls?.x_axis?.value) &&
!isTemporalColumn(
getColumnLabel(controls?.x_axis?.value as QueryFormColumn),
controls?.datasource?.datasource,
) &&
Array.isArray(controls?.groupby?.value) &&
!!controls.groupby.value.length;

export const xAxisSortControl = {
name: 'x_axis_sort',
config: {
Expand Down Expand Up @@ -125,3 +142,35 @@ export const xAxisSortAscControl = {
visibility: xAxisSortVisibility,
},
};

export const xAxisSortSeriesControl = {
name: 'x_axis_sort_series',
config: {
type: 'SelectControl',
freeForm: false,
label: (state: ControlPanelState) =>
state.form_data?.orientation === 'horizontal'
? t('Y-Axis Sort By')
: t('X-Axis Sort By'),
choices: SORT_SERIES_CHOICES,
default: DEFAULT_XAXIS_SORT_SERIES_DATA.sort_series_type,
renderTrigger: true,
description: t('Decides which measure to sort the base axis by.'),
visibility: xAxisMultiSortVisibility,
},
};

export const xAxisSortSeriesAscendingControl = {
name: 'x_axis_sort_series_ascending',
config: {
type: 'CheckboxControl',
label: (state: ControlPanelState) =>
state.form_data?.orientation === 'horizontal'
? t('Y-Axis Sort Ascending')
: t('X-Axis Sort Ascending'),
default: DEFAULT_XAXIS_SORT_SERIES_DATA.sort_series_ascending,
description: t('Whether to sort ascending or descending on the base Axis.'),
renderTrigger: true,
visibility: xAxisMultiSortVisibility,
},
};
13 changes: 13 additions & 0 deletions superset-frontend/packages/superset-ui-chart-controls/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -481,3 +481,16 @@ export function isQueryResponse(
): datasource is QueryResponse {
return !!datasource && 'results' in datasource && 'sql' in datasource;
}

export enum SortSeriesType {
Name = 'name',
Max = 'max',
Min = 'min',
Sum = 'sum',
Avg = 'avg',
}

export type SortSeriesData = {
sort_series_type: SortSeriesType;
sort_series_ascending: boolean;
};
Loading

0 comments on commit d8222a7

Please sign in to comment.