Skip to content

Commit

Permalink
Fetch charts with GET to benefit from browser cache and conditional r…
Browse files Browse the repository at this point in the history
…equests (#7032)

* Sparkline dates aren't formatting in Time Series Table (#6976)

* Exclude venv for python linter to ignore

* Fix NaN error

* Fix the white background shown in SQL editor on drag (#7021)

This PR sets the background-color css property on `.ace_scroller` instead of `.ace_content` to prevent the white background shown during resizing of the SQL editor before drag ends.

* Show tooltip with time frame (#6979)

* Fix time filter control (#6978)

* Enhancement of query context and object. (#6962)

* added more functionalities for query context and object.

* fixed cache logic

* added default value for groupby

* updated comments and removed print

(cherry picked from commit d5b9795)

* [fix] /superset/slice/id url is too long (#6989)


(cherry picked from commit 6a4d507)

* [WIP] fix user specified JSON metadata not updating dashboard on refresh (#7027)


(cherry picked from commit cc58f0e)

* feat: add ability to change font size in big number (#7003)

* Add ability to change font sizes in Big Number

* rename big number to header

* Add comment to clarify font size values

* Allow LIMIT to be specified in parameters (#7052)

* [fix] Cursor jumping when editing chart and dashboard titles (#7038)


(cherry picked from commit fc1770f)

* Changing time table viz to pass formatTime a date (#7020)

(cherry picked from commit 7f3c145)

* [db-engine-spec] Aligning Hive/Presto partition logic (#7007)


(cherry picked from commit 05be866)

* [fix] explore chart from dashboard missed slice title (#7046)


(cherry picked from commit a6d48d4)

* fix inaccurate data calculation with adata rolling and contribution (#7035)


(cherry picked from commit 0782e83)

* Adding warning message for sqllab save query (#7028)


(cherry picked from commit ead3d48)

* [datasource] Ensuring consistent behavior of datasource editing/saving. (#7037)

* Update datasource.py

* Update datasource.py

(cherry picked from commit c771625)

* [csv-upload] Fixing message encoding (#6971)


(cherry picked from commit 48431ab)

* [sql-parse] Fixing LIMIT exceptions (#6963)


(cherry picked from commit 3e076cb)

* Adding custom control overrides (#6956)

* Adding extraOverrides to line chart

* Updating extraOverrides to fit with more cases

* Moving extraOverrides to index.js

* Removing webpack-merge in package.json

* Fixing metrics control clearing metric

(cherry picked from commit e619405)

* [sqlparse] Fixing table name extraction for ill-defined query (#7029)


(cherry picked from commit 07c340c)

* [missing values] Removing replacing missing values (#4905)


(cherry picked from commit 61add60)

* [SQL Lab] Improved query and results tabs rendering reliability (#7082)

closes #7080

(cherry picked from commit 9b58e9f)

* Fix filter_box migration PR #6523 (#7066)

* Fix filter_box migration PR #6523

* Fix druid-related bug

(cherry picked from commit b210742)

* SQL editor layout makeover (#7102)

This PR includes the following layout and css tweaks:
- Using flex to layout the north and south sub panes of query pane so resizing works properly in both Chrome and Firefox
- Removal of necessary wrapper divs and tweaking of css in sql lab so we can scroll to the bottom of both the table list and the results pane
- Make sql lab's content not overflow vertically and layout the query result area to eliminate double scroll bars
- css tweaks on the basic.html page so the loading animation appears in the center of the page across the board

(cherry picked from commit 71f1bbd)

* [forms] Fix handling of NULLs

(cherry picked from commit e83a07d)

* handle null column_name in sqla and druid models

(cherry picked from commit 2ff721a)

* Use metric name instead of metric in filter box (#7106)


(cherry picked from commit 003364e)

* Bump python lib croniter to an existing version (#7132)

Package maintainers should really never delete packages, but it appears
this happened with croniter and resulted in breaking our builds.

This PR bumps to a more recent existing version of the library

(cherry picked from commit 215ed39)

* Revert PR #6933 (#7162)

* Add decorator for etag cache

* Fetch charts with GET

* Small fixes

* Fix typo

* Compute correct cache key; fix logging

* Check perms on cached response

* Revert change

* If perms fail, return naked response

* Fix lint

* Compute cache key from all form data

* Pass extra_filters in GET request

* Fix pylint

* Fix flake8

* Use ETags even if no cache is set

* Handle adhoc filters

* Raise in debug mode

* Rename actions

* Fix integration tests

* Do POST request on new charts

* Set extra/adhoc filters only in GET requests

* Raise if check_perms fails

* Refactor auth

* Fix flake8

* Fix js unit tests

* Fix js unit tests that fail in lyftga

* Fix js

* Sparkline dates aren't formatting in Time Series Table (#6976)

* Exclude venv for python linter to ignore

* Fix NaN error

* Changing time table viz to pass formatTime a date (#7020)

(cherry picked from commit 7f3c145)

* SQL editor layout makeover (#7102)

This PR includes the following layout and css tweaks:
- Using flex to layout the north and south sub panes of query pane so resizing works properly in both Chrome and Firefox
- Removal of necessary wrapper divs and tweaking of css in sql lab so we can scroll to the bottom of both the table list and the results pane
- Make sql lab's content not overflow vertically and layout the query result area to eliminate double scroll bars
- css tweaks on the basic.html page so the loading animation appears in the center of the page across the board

(cherry picked from commit 71f1bbd)

* Add decorator for etag cache

* Fetch charts with GET

* Small fixes

* Fix typo

* Compute correct cache key; fix logging

* Check perms on cached response

* Revert change

* If perms fail, return naked response

* Fix lint

* Compute cache key from all form data

* Pass extra_filters in GET request

* Fix pylint

* Fix flake8

* Use ETags even if no cache is set

* Handle adhoc filters

* Raise in debug mode

* Rename actions

* Fix integration tests

* Do POST request on new charts

* Set extra/adhoc filters only in GET requests

* Raise if check_perms fails

* Refactor auth

* Fix flake8

* Fix js unit tests

* Fix js unit tests that fail in lyftga

* Fix js

* Fix bad merge

* Use far future when max_age=0
  • Loading branch information
betodealmeida authored Apr 3, 2019
1 parent 8e14807 commit 538776b
Show file tree
Hide file tree
Showing 20 changed files with 552 additions and 370 deletions.
2 changes: 1 addition & 1 deletion superset/assets/cypress/integration/dashboard/controls.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export default () => describe('top-level controls', () => {
.forEach((id) => {
const sliceRequest = `getJson_${id}`;
sliceRequests.push(`@${sliceRequest}`);
cy.route('POST', `/superset/explore_json/?form_data={"slice_id":${id}}`).as(sliceRequest);
cy.route('GET', `/superset/explore_json/?form_data={"slice_id":${id}}`).as(sliceRequest);

const forceRefresh = `getJson_${id}_force`;
forceRefreshRequests.push(`@${forceRefresh}`);
Expand Down
2 changes: 1 addition & 1 deletion superset/assets/cypress/integration/dashboard/edit_mode.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export default () => describe('edit mode', () => {
const dashboard = bootstrapData.dashboard_data;
const boxplotChartId = dashboard.slices.find(slice => (slice.form_data.viz_type === 'box_plot')).slice_id;
const boxplotRequest = `/superset/explore_json/?form_data={"slice_id":${boxplotChartId}}`;
cy.route('POST', boxplotRequest).as('boxplotRequest');
cy.route('GET', boxplotRequest).as('boxplotRequest');
});

cy.get('.dashboard-header').contains('Edit dashboard').click();
Expand Down
2 changes: 1 addition & 1 deletion superset/assets/cypress/integration/dashboard/filter.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export default () => describe('dashboard filter', () => {
const aliases = [];

const filterRoute = `/superset/explore_json/?form_data={"slice_id":${filterId}}`;
cy.route('POST', filterRoute).as('fetchFilter');
cy.route('GET', filterRoute).as('fetchFilter');
cy.wait('@fetchFilter');
sliceIds
.filter(id => (parseInt(id, 10) !== filterId))
Expand Down
2 changes: 1 addition & 1 deletion superset/assets/cypress/integration/dashboard/load.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export default () => describe('load', () => {
// then define routes and create alias for each requests
slices.forEach((slice) => {
const alias = `getJson_${slice.slice_id}`;
cy.route('POST', `/superset/explore_json/?form_data={"slice_id":${slice.slice_id}}`).as(alias);
cy.route('GET', `/superset/explore_json/?form_data={"slice_id":${slice.slice_id}}`).as(alias);
aliases.push(`@${alias}`);
});
});
Expand Down
2 changes: 1 addition & 1 deletion superset/assets/cypress/integration/dashboard/save.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export default () => describe('save', () => {

// should have box_plot chart
const boxplotRequest = `/superset/explore_json/?form_data={"slice_id":${boxplotChartId}}`;
cy.route('POST', boxplotRequest).as('boxplotRequest');
cy.route('GET', boxplotRequest).as('boxplotRequest');
cy.wait('@boxplotRequest');
cy.get('.grid-container .box_plot').should('be.exist');

Expand Down
36 changes: 21 additions & 15 deletions superset/assets/cypress/integration/explore/control.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ describe('Groupby', () => {
cy.server();
cy.login();

cy.route('POST', '/superset/explore_json/**').as('getJson');
cy.route('GET', '/superset/explore_json/**').as('getJson');
cy.route('POST', '/superset/explore_json/**').as('postJson');
cy.visitChartByName('Num Births Trend');
cy.verifySliceSuccess({ waitAlias: '@getJson' });

Expand All @@ -36,15 +37,16 @@ describe('Groupby', () => {
cy.get('.VirtualizedSelectFocusedOption').click();
});
cy.get('button.query').click();
cy.verifySliceSuccess({ waitAlias: '@getJson', chartSelector: 'svg' });
cy.verifySliceSuccess({ waitAlias: '@postJson', chartSelector: 'svg' });
});
});

describe('AdhocMetrics', () => {
beforeEach(() => {
cy.login();
cy.server();
cy.route('POST', '/superset/explore_json/**').as('getJson');
cy.route('GET', '/superset/explore_json/**').as('getJson');
cy.route('POST', '/superset/explore_json/**').as('postJson');
});

it('Clear metric and set simple adhoc metric', () => {
Expand Down Expand Up @@ -74,7 +76,7 @@ describe('AdhocMetrics', () => {

cy.get('button.query').click();
cy.verifySliceSuccess({
waitAlias: '@getJson',
waitAlias: '@postJson',
querySubstring: metricName,
chartSelector: 'svg',
});
Expand Down Expand Up @@ -105,7 +107,7 @@ describe('AdhocMetrics', () => {

cy.get('button.query').click();
cy.verifySliceSuccess({
waitAlias: '@getJson',
waitAlias: '@postJson',
querySubstring: metric,
chartSelector: 'svg',
});
Expand Down Expand Up @@ -137,7 +139,7 @@ describe('AdhocMetrics', () => {

cy.get('button.query').click();
cy.verifySliceSuccess({
waitAlias: '@getJson',
waitAlias: '@postJson',
chartSelector: 'svg',
});
});
Expand All @@ -147,7 +149,8 @@ describe('AdhocFilters', () => {
beforeEach(() => {
cy.login();
cy.server();
cy.route('POST', '/superset/explore_json/**').as('getJson');
cy.route('GET', '/superset/explore_json/**').as('getJson');
cy.route('POST', '/superset/explore_json/**').as('postJson');
});

it('Set simple adhoc filter', () => {
Expand Down Expand Up @@ -177,7 +180,7 @@ describe('AdhocFilters', () => {

cy.get('button.query').click();
cy.verifySliceSuccess({
waitAlias: '@getJson',
waitAlias: '@postJson',
chartSelector: 'svg',
});
});
Expand Down Expand Up @@ -206,7 +209,7 @@ describe('AdhocFilters', () => {

cy.get('button.query').click();
cy.verifySliceSuccess({
waitAlias: '@getJson',
waitAlias: '@postJson',
chartSelector: 'svg',
});
});
Expand All @@ -217,7 +220,8 @@ describe('Advanced analytics', () => {
beforeEach(() => {
cy.login();
cy.server();
cy.route('POST', '/superset/explore_json/**').as('getJson');
cy.route('GET', '/superset/explore_json/**').as('getJson');
cy.route('POST', '/superset/explore_json/**').as('postJson');
});

it('Create custom time compare', () => {
Expand All @@ -240,7 +244,7 @@ describe('Advanced analytics', () => {
});

cy.get('button.query').click();
cy.wait('@getJson');
cy.wait('@postJson');
cy.reload();
cy.verifySliceSuccess({
waitAlias: '@getJson',
Expand All @@ -257,7 +261,8 @@ describe('Annotations', () => {
beforeEach(() => {
cy.login();
cy.server();
cy.route('POST', '/superset/explore_json/**').as('getJson');
cy.route('GET', '/superset/explore_json/**').as('getJson');
cy.route('POST', '/superset/explore_json/**').as('postJson');
});

it('Create formula annotation y-axis goal line', () => {
Expand All @@ -280,7 +285,7 @@ describe('Annotations', () => {

cy.get('button.query').click();
cy.verifySliceSuccess({
waitAlias: '@getJson',
waitAlias: '@postJson',
chartSelector: 'svg',
});

Expand All @@ -292,7 +297,8 @@ describe('Time range filter', () => {
beforeEach(() => {
cy.login();
cy.server();
cy.route('POST', '/superset/explore_json/**').as('getJson');
cy.route('GET', '/superset/explore_json/**').as('getJson');
cy.route('POST', '/superset/explore_json/**').as('postJson');
});

it('Defaults to the correct tab for time_range params', () => {
Expand All @@ -304,7 +310,7 @@ describe('Time range filter', () => {
};

cy.visitChartByParams(JSON.stringify(formData));
cy.verifySliceSuccess({ waitAlias: '@getJson' });
cy.verifySliceSuccess({ waitAlias: '@postJson' });

cy.get('[data-test=time_range]').within(() => {
cy.get('span.label').click();
Expand Down
9 changes: 5 additions & 4 deletions superset/assets/cypress/integration/explore/link.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ describe('Test explore links', () => {
beforeEach(() => {
cy.login();
cy.server();
cy.route('POST', '/superset/explore_json/**').as('getJson');
cy.route('GET', '/superset/explore_json/**').as('getJson');
cy.route('POST', '/superset/explore_json/**').as('postJson');
});

it('Open and close view query modal', () => {
Expand All @@ -35,7 +36,7 @@ describe('Test explore links', () => {

cy.get('button#query').click();
cy.get('span').contains('View query').parent().click();
cy.wait('@getJson').then(() => {
cy.wait('@postJson').then(() => {
cy.get('code');
});
cy.get('.modal-header').within(() => {
Expand Down Expand Up @@ -83,7 +84,7 @@ describe('Test explore links', () => {
const newChartName = 'Test chart';

cy.visitChartByParams(JSON.stringify(formData));
cy.verifySliceSuccess({ waitAlias: '@getJson' });
cy.verifySliceSuccess({ waitAlias: '@postJson' });
cy.url().then((url) => {
cy.get('button[data-target="#save_modal"]').click();
cy.get('.modal-content').within(() => {
Expand All @@ -109,7 +110,7 @@ describe('Test explore links', () => {
cy.get('.modal-content').within(() => {
cy.get('button#btn_modal_save').click();
});
cy.verifySliceSuccess({ waitAlias: '@getJson' });
cy.verifySliceSuccess({ waitAlias: '@postJson' });
cy.request(`/chart/api/read?_flt_3_slice_name=${chartName}`).then((response) => {
cy.request('DELETE', `/chart/api/delete/${response.body.pks[0]}`);
});
Expand Down
Loading

0 comments on commit 538776b

Please sign in to comment.