Add visualize advise for long query (#2879)

in SqlLab view, if query takes over 45 seconds, we will show advise to store a summarized data set before user clicks on Visualize button.
This advise will not block Visualize button.

fixes https://github.com/airbnb/superset/issues/2733
This commit is contained in:
Grace Guo
2017-05-31 15:50:26 -07:00
committed by GitHub
parent e300273e71
commit db052b17ea
2 changed files with 39 additions and 0 deletions

View File

@@ -246,6 +246,26 @@ describe('VisualizeModal', () => {
});
});
it('should build visualize advise for long query', () => {
const longQuery = Object.assign({}, queries[0], { endDttm: 1476910666798 });
const props = {
show: true,
query: longQuery,
};
const longQueryWrapper = shallow(<VisualizeModal {...props} />, {
context: { store },
}).dive();
const alertWrapper = shallow(longQueryWrapper.instance().buildVisualizeAdvise());
expect(alertWrapper.hasClass('alert')).to.equal(true);
expect(alertWrapper.text()).to.contain(
'This query took 101 seconds to run, and the explore view times out at 45 seconds');
});
it('should not build visualize advise', () => {
const wrapper = getVisualizeModalWrapper();
expect(wrapper.instance().buildVisualizeAdvise()).to.be.a('undefined');
});
describe('visualize', () => {
const wrapper = getVisualizeModalWrapper();
const mockOptions = { attr: 'mockOptions' };