[sql lab] simplify the visualize flow (#5523)

* [sql lab] simplify the visualize flow

The "visualize flow" linking SQL Lab to the "explore view" has never
worked so great for people, here's a list of issues:

* it's not really clear to users that their query is wrapped as a
subquery, and the explore view runs queries on top of it

* lint + fix tests

* Addressing comments
This commit is contained in:
Maxime Beauchemin
2018-08-02 10:52:38 -07:00
committed by GitHub
parent 1b9e5d4174
commit fe6846b8db
18 changed files with 475 additions and 1578 deletions

View File

@@ -4,9 +4,9 @@ import { describe, it } from 'mocha';
import { expect } from 'chai';
import sinon from 'sinon';
import { Alert, ProgressBar, Button } from 'react-bootstrap';
import { Alert, ProgressBar } from 'react-bootstrap';
import FilterableTable from '../../../src/components/FilterableTable/FilterableTable';
import VisualizeModal from '../../../src/SqlLab/components/VisualizeModal';
import ExploreResultsButton from '../../../src/SqlLab/components/ExploreResultsButton';
import ResultSet from '../../../src/SqlLab/components/ResultSet';
import { queries, stoppedQuery, runningQuery, cachedQuery } from './fixtures';
@@ -48,20 +48,6 @@ describe('ResultSet', () => {
const wrapper = shallow(<ResultSet {...mockedProps} />);
expect(wrapper.find(FilterableTable)).to.have.length(1);
});
describe('getControls', () => {
it('should render controls', () => {
const wrapper = shallow(<ResultSet {...mockedProps} />);
wrapper.instance().getControls();
expect(wrapper.find(Button)).to.have.length(2);
expect(wrapper.find('input').props().placeholder).to.equal('Search Results');
});
it('should handle no controls', () => {
const wrapper = shallow(<ResultSet {...mockedProps} />);
wrapper.setProps({ search: false, visualize: false, csv: false });
const controls = wrapper.instance().getControls();
expect(controls.props.className).to.equal('noControls');
});
});
describe('componentWillReceiveProps', () => {
const wrapper = shallow(<ResultSet {...mockedProps} />);
let spy;
@@ -88,7 +74,7 @@ describe('ResultSet', () => {
const wrapper = shallow(<ResultSet {...mockedProps} />);
const filterableTable = wrapper.find(FilterableTable);
expect(filterableTable.props().data).to.equal(mockedProps.query.results.data);
expect(wrapper.find(VisualizeModal)).to.have.length(1);
expect(wrapper.find(ExploreResultsButton)).to.have.length(1);
});
it('should render empty results', () => {
const wrapper = shallow(<ResultSet {...mockedProps} />);