Skip to content

Commit

Permalink
feat: Migrates Pivot Table v1 to v2 (#23712)
Browse files Browse the repository at this point in the history
  • Loading branch information
michael-s-molina authored Jun 8, 2023
1 parent e13b80a commit 522eb97
Show file tree
Hide file tree
Showing 63 changed files with 34,117 additions and 25,415 deletions.
1 change: 1 addition & 0 deletions UPDATING.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ assists people when migrating to a new version.

### Breaking Changes

- [23712](https://github.com/apache/superset/pull/23712) Migrates the Pivot Table v1 chart to v2 and removes v1 code.
- [24029](https://github.com/apache/superset/pull/24029) Removes the `user` and `username` arguments for the `QUERY_LOGGER` and `SQL_QUERY_MUTATOR` methods respectively. If the username for the current user is required, the `superset.utils.core.get_username` method should be used.
- [24128](https://github.com/apache/superset/pull/24128) The `RLS_BASE_RELATED_FIELD_FILTERS` config parameter has been removed. Now the Tables dropdown will feature the same tables that the user is able to see elsewhere in the application using the standard `DatasourceFilter`, and the Roles dropdown will be filtered using the filter defined in `EXTRA_RELATED_QUERY_FILTERS["role"]`.
- [23785](https://github.com/apache/superset/pull/23785) Deprecated the following feature flags: `CLIENT_CACHE`, `DASHBOARD_CACHE`, `DASHBOARD_FILTERS_EXPERIMENTAL`, `DASHBOARD_NATIVE_FILTERS`, `DASHBOARD_NATIVE_FILTERS_SET`, `DISABLE_DATASET_SOURCE_EDIT`, `ENABLE_EXPLORE_JSON_CSRF_PROTECTION`, `REMOVE_SLICE_LEVEL_LABEL_COLORS`. It also removed `DASHBOARD_EDIT_CHART_IN_NEW_TAB` as the feature is supported without the need for a feature flag.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,25 +18,26 @@
*/
describe('Visualization > Pivot Table', () => {
beforeEach(() => {
cy.intercept('POST', '/superset/explore_json/**').as('getJson');
cy.intercept('POST', '/api/v1/chart/data**').as('chartData');
});

const PIVOT_TABLE_FORM_DATA = {
datasource: '3__table',
viz_type: 'pivot_table',
viz_type: 'pivot_table_v2',
slice_id: 61,
granularity_sqla: 'ds',
time_grain_sqla: 'P1D',
time_range: '100 years ago : now',
metrics: ['sum__num'],
adhoc_filters: [],
groupby: ['name'],
columns: ['state'],
row_limit: 5000,
pandas_aggfunc: 'sum',
pivot_margins: true,
number_format: '.3s',
combine_metric: false,
groupbyRows: ['name'],
groupbyColumns: ['state'],
series_limit: 5000,
aggregateFunction: 'Sum',
rowTotals: true,
colTotals: true,
valueFormat: '.3s',
combineMetric: false,
};

const TEST_METRIC = {
Expand All @@ -59,23 +60,23 @@ describe('Visualization > Pivot Table', () => {

function verify(formData) {
cy.visitChartByParams(formData);
cy.verifySliceSuccess({ waitAlias: '@getJson', chartSelector: 'table' });
cy.verifySliceSuccess({ waitAlias: '@chartData', chartSelector: 'table' });
}

it('should work with single groupby', () => {
verify(PIVOT_TABLE_FORM_DATA);
cy.get('.chart-container tr:eq(0) th:eq(1)').contains('sum__num');
cy.get('.chart-container tr:eq(0) th:eq(2)').contains('sum__num');
cy.get('.chart-container tr:eq(1) th:eq(0)').contains('state');
cy.get('.chart-container tr:eq(2) th:eq(0)').contains('name');
});

it('should work with more than one groupby', () => {
verify({
...PIVOT_TABLE_FORM_DATA,
groupby: ['name', 'gender'],
groupbyRows: ['name', 'gender'],
});
cy.get('.chart-container tr:eq(0) th:eq(2)').contains('sum__num');
cy.get('.chart-container tr:eq(1) th:eq(1)').contains('state');
cy.get('.chart-container tr:eq(1) th:eq(0)').contains('state');
cy.get('.chart-container tr:eq(2) th:eq(0)').contains('name');
cy.get('.chart-container tr:eq(2) th:eq(1)').contains('gender');
});
Expand All @@ -85,16 +86,16 @@ describe('Visualization > Pivot Table', () => {
...PIVOT_TABLE_FORM_DATA,
metrics: ['sum__num', TEST_METRIC],
});
cy.get('.chart-container tr:eq(0) th:eq(1)').contains('sum__num');
cy.get('.chart-container tr:eq(0) th:eq(2)').contains('SUM(num_boys)');
cy.get('.chart-container tr:eq(0) th:eq(2)').contains('sum__num');
cy.get('.chart-container tr:eq(0) th:eq(3)').contains('SUM(num_boys)');
cy.get('.chart-container tr:eq(1) th:eq(0)').contains('state');
cy.get('.chart-container tr:eq(2) th:eq(0)').contains('name');
});

it('should work with multiple groupby and multiple metrics', () => {
verify({
...PIVOT_TABLE_FORM_DATA,
groupby: ['name', 'gender'],
groupbyRows: ['name', 'gender'],
metrics: ['sum__num', TEST_METRIC],
});
cy.get('.chart-container tr:eq(0) th:eq(2)').contains('sum__num');
Expand Down
28 changes: 0 additions & 28 deletions superset-frontend/package-lock.json

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

1 change: 0 additions & 1 deletion superset-frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@
"@superset-ui/legacy-plugin-chart-paired-t-test": "file:./plugins/legacy-plugin-chart-paired-t-test",
"@superset-ui/legacy-plugin-chart-parallel-coordinates": "file:./plugins/legacy-plugin-chart-parallel-coordinates",
"@superset-ui/legacy-plugin-chart-partition": "file:./plugins/legacy-plugin-chart-partition",
"@superset-ui/legacy-plugin-chart-pivot-table": "file:./plugins/legacy-plugin-chart-pivot-table",
"@superset-ui/legacy-plugin-chart-rose": "file:./plugins/legacy-plugin-chart-rose",
"@superset-ui/legacy-plugin-chart-sankey": "file:./plugins/legacy-plugin-chart-sankey",
"@superset-ui/legacy-plugin-chart-sankey-loop": "file:./plugins/legacy-plugin-chart-sankey-loop",
Expand Down
35 changes: 17 additions & 18 deletions superset-frontend/packages/superset-ui-demo/package.json
Original file line number Diff line number Diff line change
@@ -1,22 +1,8 @@
{
"name": "@superset-ui/demo",
"version": "0.18.25",
"description": "Storybook for Superset UI ✨",
"private": true,
"main": "index.js",
"scripts": {
"demo:clean": "rm -rf _gh-pages",
"demo:build": "npm run demo:clean && build-storybook -o _gh-pages",
"demo:publish": "gh-pages -d _gh-pages",
"deploy-demo": "npm run demo:build && npm run demo:publish && npm run demo:clean",
"storybook": "start-storybook -p 9001",
"build-storybook": "npm run demo:clean && build-storybook"
},
"repository": {
"type": "git",
"url": "https://github.com/apache/superset.git",
"directory": "superset-frontend/packages/superset-ui-demo"
},
"description": "Storybook for Superset UI ✨",
"keywords": [
"storybook",
"superset",
Expand All @@ -25,11 +11,25 @@
"analysis",
"data"
],
"license": "Apache-2.0",
"homepage": "https://github.com/apache/superset/tree/master/superset-frontend/packages/superset-ui-demo#readme",
"bugs": {
"url": "https://github.com/apache/superset/issues"
},
"homepage": "https://github.com/apache/superset/tree/master/superset-frontend/packages/superset-ui-demo#readme",
"repository": {
"type": "git",
"url": "https://github.com/apache/superset.git",
"directory": "superset-frontend/packages/superset-ui-demo"
},
"license": "Apache-2.0",
"main": "index.js",
"scripts": {
"build-storybook": "npm run demo:clean && build-storybook",
"demo:build": "npm run demo:clean && build-storybook -o _gh-pages",
"demo:clean": "rm -rf _gh-pages",
"demo:publish": "gh-pages -d _gh-pages",
"deploy-demo": "npm run demo:build && npm run demo:publish && npm run demo:clean",
"storybook": "start-storybook -p 9001"
},
"dependencies": {
"@data-ui/event-flow": "^0.0.84",
"@emotion/cache": "^11.4.0",
Expand Down Expand Up @@ -77,7 +77,6 @@
"@superset-ui/legacy-plugin-chart-paired-t-test": "*",
"@superset-ui/legacy-plugin-chart-parallel-coordinates": "*",
"@superset-ui/legacy-plugin-chart-partition": "*",
"@superset-ui/legacy-plugin-chart-pivot-table": "*",
"@superset-ui/legacy-plugin-chart-rose": "*",
"@superset-ui/legacy-plugin-chart-sankey": "*",
"@superset-ui/legacy-plugin-chart-sankey-loop": "*",
Expand Down

This file was deleted.

Loading

0 comments on commit 522eb97

Please sign in to comment.