mirror of
https://github.com/apache/superset.git
synced 2026-04-25 11:04:48 +00:00
Show clear and actionable query timeout error message (#2763)
* Show clear and actionable query timeout error message 1. Instead of waiting for a long time or server-side response 504 Gateway timeout, explore view now add a query timeout threshold. After timeout it will show specific querytimeout message. 2. fix alert box close button position. * Show clear and actionable query timeout error message 1. Instead of waiting for a long time or server-side response 504 Gateway timeout, explore view now add a query timeout threshold. After timeout it will show specific querytimeout message. 2. fix alert box close button position. 3. fix a linting error.
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
import { it, describe } from 'mocha';
|
||||
import { expect } from 'chai';
|
||||
import sinon from 'sinon';
|
||||
import $ from 'jquery';
|
||||
import * as actions from '../../../javascripts/explorev2/actions/exploreActions';
|
||||
import * as exploreUtils from '../../../javascripts/explorev2/exploreUtils';
|
||||
import { defaultState } from '../../../javascripts/explorev2/stores/store';
|
||||
import { exploreReducer } from '../../../javascripts/explorev2/reducers/exploreReducer';
|
||||
|
||||
@@ -16,3 +19,21 @@ describe('reducers', () => {
|
||||
expect(newState.controls.show_legend.value).to.equal(true);
|
||||
});
|
||||
});
|
||||
|
||||
describe('runQuery', () => {
|
||||
it('should handle query timeout', () => {
|
||||
const dispatch = sinon.spy();
|
||||
const urlStub = sinon.stub(exploreUtils, 'getExploreUrl', () => ('mockURL'));
|
||||
const ajaxStub = sinon.stub($, 'ajax');
|
||||
ajaxStub.yieldsTo('error', { statusText: 'timeout' });
|
||||
|
||||
const request = actions.runQuery({});
|
||||
request(dispatch);
|
||||
|
||||
expect(dispatch.callCount).to.equal(2);
|
||||
expect(dispatch.args[0][0].type).to.equal(actions.CHART_UPDATE_TIMEOUT);
|
||||
|
||||
urlStub.restore();
|
||||
ajaxStub.restore();
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user