Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Sqllab to Explore UX improvements #11755

Merged
merged 156 commits into from
Dec 9, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
156 commits
Select commit Hold shift + click to select a range
fc914fd
create boiler modal component
hughhhh Oct 31, 2020
bfac037
hello world modal
hughhhh Nov 2, 2020
b2a8d6b
setup modal flow
hughhhh Nov 2, 2020
04e1216
setup savemodal for components
hughhhh Nov 10, 2020
6d2a61b
flake8
hughhhh Nov 15, 2020
3170382
fix onclick reference
hughhhh Nov 16, 2020
268052c
working create datasource boiler
hughhhh Nov 16, 2020
74348a1
saving spot for callback on text input
hughhhh Nov 16, 2020
711c5ac
working dataset with input box
hughhhh Nov 16, 2020
a734442
working redirect on completion
hughhhh Nov 16, 2020
0c7810a
get data for owners dropdown
hughhhh Nov 16, 2020
b8fe70e
fix merge conflicts
hughhhh Nov 18, 2020
c356796
fix build with pull from master
hughhhh Nov 18, 2020
d3cd168
fix the filteroption
hughhhh Nov 18, 2020
e72d882
💯
hughhhh Nov 18, 2020
4c7364f
move state to upper component
hughhhh Nov 18, 2020
dba206a
add overwrite state
hughhhh Nov 18, 2020
398bfee
hacked overwrite process
hughhhh Nov 19, 2020
07e7388
linting
hughhhh Nov 19, 2020
203aa15
fix filter
hughhhh Nov 19, 2020
f8a34be
cleaning up the coe
hughhhh Nov 19, 2020
066054e
Delete preset.code-workspace
hughhhh Nov 19, 2020
f35b59b
Merge branch 'hugh/SO-1117-modal' of https://github.com/apache/incuba…
hughhhh Nov 19, 2020
482353f
remove unused code
hughhhh Nov 19, 2020
cc5dfff
remove visualize
hughhhh Nov 19, 2020
616480b
update default value
hughhhh Nov 19, 2020
c6f17dc
remove unneeded vars
hughhhh Nov 20, 2020
251b829
checkout package-lock.json
hughhhh Nov 20, 2020
14b2a71
linting
hughhhh Nov 20, 2020
ab6c525
Merge branch 'add-userinfo-sqllab' into hugh/SO-1117-modal
hughhhh Nov 20, 2020
2c99c7f
get user id
hughhhh Nov 20, 2020
c02a818
remove page filter
hughhhh Nov 20, 2020
f51cf13
Merge branch 'master' of https://github.com/apache/incubator-superset…
hughhhh Nov 20, 2020
4ad9bee
setup proper call for updating columns in dataset
hughhhh Nov 20, 2020
98fa585
add move to explore flow
hughhhh Nov 20, 2020
2a8cca1
linting
hughhhh Nov 20, 2020
ef96939
add param for overriding columns
hughhhh Nov 23, 2020
140227c
linting
hughhhh Nov 23, 2020
56d4648
change title
hughhhh Nov 23, 2020
acb255a
fix some tings
hughhhh Nov 23, 2020
546dd2a
cleanup
hughhhh Nov 24, 2020
c1a2615
linting
hughhhh Nov 24, 2020
9991c60
add types in some places
hughhhh Nov 24, 2020
a09f9c4
save toast
hughhhh Nov 24, 2020
80179cb
use moment
hughhhh Nov 24, 2020
fb31793
add error toast
hughhhh Nov 24, 2020
fdd06e5
create enum for radio states
hughhhh Nov 24, 2020
a3e4cc7
initial state for saving query
hughhhh Nov 24, 2020
a7228bf
add tpying
hughhhh Nov 24, 2020
0b1acfd
addressing concerns
hughhhh Nov 24, 2020
3f9c417
update propTypes
hughhhh Nov 24, 2020
02f4da7
add functionality for CTAS explor btn
hughhhh Nov 24, 2020
9b1f5a2
handle CTAS state
hughhhh Nov 24, 2020
9e3d528
fix onclick to reference upper level component
hughhhh Nov 24, 2020
d13943e
formatting
hughhhh Nov 24, 2020
3d07498
reset state after closing
hughhhh Nov 24, 2020
12cba4e
add error message when user doesn't pick an already selected dataset
hughhhh Nov 24, 2020
886c84a
remove unneeded todo
hughhhh Nov 24, 2020
dc350cc
remove styling
hughhhh Nov 25, 2020
a3315da
move async calls to api directory
hughhhh Nov 26, 2020
af766a9
remove console.log
hughhhh Nov 26, 2020
18d86de
add user id param
hughhhh Nov 26, 2020
1f54439
typing
hughhhh Nov 26, 2020
6d3f846
littty
hughhhh Nov 26, 2020
f4a7849
move put to seperate file
hughhhh Nov 27, 2020
7509940
save
hughhhh Nov 27, 2020
49e4e86
dsf
hughhhh Nov 27, 2020
62924ba
Merge branch 'master' of https://github.com/apache/incubator-superset…
hughhhh Nov 27, 2020
4173174
fix typing errors
hughhhh Nov 30, 2020
f67d21a
adding more types
hughhhh Nov 30, 2020
a4b5513
fix typing erros
hughhhh Nov 30, 2020
056bf14
linting
hughhhh Nov 30, 2020
f6c60e8
add basic spec test
hughhhh Nov 30, 2020
1344681
fix conflicts
hughhhh Nov 30, 2020
4f647c4
fix merge conflicts
hughhhh Nov 30, 2020
7834b19
create dataset modal
hughhhh Nov 30, 2020
734efab
add components reference
hughhhh Nov 30, 2020
77594ce
Rename SaveDatasetModal_spec.jsx to SaveDatasetModal_spec.tsx
hughhhh Nov 30, 2020
bde85eb
remove sinon for now
hughhhh Dec 1, 2020
7c26b28
fix typing errors on modal files
hughhhh Dec 1, 2020
b46f125
fix linting
hughhhh Dec 1, 2020
014cdee
Merge branch 'master' of https://github.com/apache/incubator-superset…
hughhhh Dec 1, 2020
c9b79c5
fix merge conflict
hughhhh Dec 1, 2020
d4d4ddd
address comments
hughhhh Dec 2, 2020
d01b0be
attempt to fix linting
hughhhh Dec 2, 2020
c597782
add props
hughhhh Dec 2, 2020
5f134d2
fix test
hughhhh Dec 2, 2020
f76ac59
yea
hughhhh Dec 2, 2020
aa1df1b
fix the linting
hughhhh Dec 2, 2020
e4988f2
yerp
hughhhh Dec 2, 2020
e0e1261
fix this references
hughhhh Dec 2, 2020
38f03df
spaces
hughhhh Dec 2, 2020
1c44814
handleOverwriteCancel reference cleanup
hughhhh Dec 2, 2020
ad4f952
rename bool value for shouldOverwriteDataset
hughhhh Dec 2, 2020
1d880ab
fix typing for onChange
hughhhh Dec 2, 2020
cf72da0
fix merge conflicts
hughhhh Dec 2, 2020
ee444a8
Merge branch 'master' of https://github.com/apache/incubator-superset…
hughhhh Dec 2, 2020
cadca8e
you still the best in the world
hughhhh Dec 2, 2020
2622a82
fix spec
hughhhh Dec 3, 2020
e3c7e46
align branches
hughhhh Dec 3, 2020
5e78213
push
hughhhh Dec 3, 2020
c3d40be
fix key names
hughhhh Dec 3, 2020
7f95519
fix dataset reference
hughhhh Dec 3, 2020
e88bd0d
fix conflicts
hughhhh Dec 3, 2020
1dbb294
Merge branch 'master' of https://github.com/apache/incubator-superset…
hughhhh Dec 4, 2020
f57859a
lowercase
hughhhh Dec 4, 2020
34deb19
fix save bug with tiem
hughhhh Dec 4, 2020
ccef2de
fixed styling
hughhhh Dec 4, 2020
e51b294
fix date state after push to explore
hughhhh Dec 4, 2020
6d78f7f
add disabling states
hughhhh Dec 4, 2020
ef3bece
plz refactor this
hughhhh Dec 4, 2020
f667f40
this is working fully now
hughhhh Dec 4, 2020
527af3d
do some renaming
hughhhh Dec 5, 2020
cd82c75
renaming
hughhhh Dec 5, 2020
6a7ebda
remove console.logs
hughhhh Dec 5, 2020
2e95b72
still refactoring
hughhhh Dec 5, 2020
6a675e8
remove unneeded code
hughhhh Dec 5, 2020
148130c
remove unneeded variables
hughhhh Dec 5, 2020
6821374
still cleaning
hughhhh Dec 5, 2020
56e6aa2
added interface
hughhhh Dec 5, 2020
391e562
fix typing issues
hughhhh Dec 5, 2020
eaf7590
cleanup unused code
hughhhh Dec 5, 2020
92cb044
fix npm lnit
hughhhh Dec 5, 2020
6fd598c
fix initial problems
hughhhh Dec 5, 2020
31ef47a
Merge branch 'master' of https://github.com/apache/incubator-superset…
hughhhh Dec 5, 2020
2a0d045
add props to test
hughhhh Dec 5, 2020
b07b5e5
remove unneeded files
hughhhh Dec 7, 2020
e2c1f20
skip linting
hughhhh Dec 7, 2020
9697f9e
saving
hughhhh Dec 7, 2020
c8dd04d
this works
hughhhh Dec 7, 2020
b43412e
remove old test
hughhhh Dec 7, 2020
d1d98ac
Merge branch 'master' of https://github.com/apache/incubator-superset…
hughhhh Dec 7, 2020
86c7984
remove old test
hughhhh Dec 7, 2020
3734ca0
fix linting
hughhhh Dec 7, 2020
bbb706e
fix broken test
hughhhh Dec 7, 2020
3d39241
remove jsx file
hughhhh Dec 7, 2020
6cbc4f4
refactoring
hughhhh Dec 7, 2020
c9d5c6c
cleanup
hughhhh Dec 7, 2020
e732386
remove comments
hughhhh Dec 7, 2020
f237210
reset user object
hughhhh Dec 7, 2020
8d2d982
fix functions
hughhhh Dec 7, 2020
d361296
fix this
hughhhh Dec 7, 2020
70166d0
reverting CTAS btn flow
hughhhh Dec 7, 2020
b4c53b6
remove onclick
hughhhh Dec 7, 2020
250fd99
save frontend work
hughhhh Dec 8, 2020
c09950c
allow for database id to be passed as param in body
hughhhh Dec 8, 2020
0bae866
use enum
hughhhh Dec 8, 2020
d9a6434
fix linting
hughhhh Dec 8, 2020
e3af417
Merge branch 'master' of https://github.com/apache/incubator-superset…
hughhhh Dec 8, 2020
d151c1b
style alignment
hughhhh Dec 8, 2020
2ec480a
get rid of .then
hughhhh Dec 8, 2020
1d8686a
add function to compute default value with tiem
hughhhh Dec 8, 2020
88ba7a1
lit
hughhhh Dec 8, 2020
1aff0f1
remove ts-error
hughhhh Dec 8, 2020
2953258
fix typing
hughhhh Dec 8, 2020
d10f0da
Merge branch 'master' of https://github.com/apache/incubator-superset…
hughhhh Dec 8, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import sinon from 'sinon';
import fetchMock from 'fetch-mock';
import shortid from 'shortid';
import sqlLabReducer from 'src/SqlLab/reducers/index';
import * as actions from 'src/SqlLab/actions/sqlLab';
import ExploreResultsButton from 'src/SqlLab/components/ExploreResultsButton';
import * as exploreUtils from 'src/explore/exploreUtils';
import Button from 'src/components/Button';
Expand Down Expand Up @@ -184,77 +183,5 @@ describe('ExploreResultsButton', () => {
wrapper.instance().buildVizOptions.restore();
fetchMock.reset();
});

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removing old test since functionality now lives in the ResultSet file

it('should build request with correct args', () => {
return new Promise(done => {
wrapper.instance().visualize();

setTimeout(() => {
const calls = fetchMock.calls(visualizeEndpoint);
expect(calls).toHaveLength(1);
const formData = calls[0][1].body;
Object.keys(mockOptions).forEach(key => {
// eslint-disable-next-line no-unused-expressions
expect(formData.get(key)).toBeDefined();
});

done();
});
});
});

it('should export chart and add an info toast', () => {
return new Promise(done => {
const infoToastSpy = sinon.spy();
const datasourceSpy = sinon.stub();

datasourceSpy.callsFake(() => Promise.resolve(visualizationPayload));

wrapper.setProps({
actions: {
addInfoToast: infoToastSpy,
createDatasource: datasourceSpy,
},
});

wrapper.instance().visualize();

setTimeout(() => {
expect(datasourceSpy.callCount).toBe(1);
expect(exploreUtils.exploreChart.callCount).toBe(1);
expect(exploreUtils.exploreChart.getCall(0).args[0].datasource).toBe(
'107__table',
);
expect(infoToastSpy.callCount).toBe(1);
done();
});
});
});

it('should add error toast', () => {
return new Promise(done => {
const dangerToastSpy = sinon.stub(actions, 'addDangerToast');
const datasourceSpy = sinon.stub();

datasourceSpy.callsFake(() => Promise.reject({ error: 'error' }));

wrapper.setProps({
actions: {
createDatasource: datasourceSpy,
addDangerToast: dangerToastSpy,
},
});

wrapper.instance().visualize();

setTimeout(() => {
expect(datasourceSpy.callCount).toBe(1);
expect(exploreUtils.exportChart.callCount).toBe(0);
expect(dangerToastSpy.callCount).toBe(1);
dangerToastSpy.restore();
done();
});
});
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,16 @@ describe('SaveDatasetModal', () => {
userDatasetsOwned: [],
handleSaveDatasetRadioBtnState: () => {},
saveDatasetRadioBtnState: 1,
shouldOverwriteDataset: false,
handleOverwriteCancel: () => {},
handleOverwriteDataset: () => {},
handleOverwriteDatasetOption: () => {},
defaultCreateDatasetValue: 'someDatasets',
shouldOverwriteDataset: false,
userDatasetOptions: [],
disableSaveAndExploreBtn: false,
handleSaveDatasetModalSearch: () => {},
filterAutocompleteOption: () => false,
onChangeAutoComplete: () => {},
};
it('renders a radio group btn', () => {
const wrapper = shallow(<SaveDatasetModal {...mockedProps} />);
Expand Down
56 changes: 2 additions & 54 deletions superset-frontend/src/SqlLab/components/ExploreResultsButton.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,7 @@ import { t } from '@superset-ui/core';
import { InfoTooltipWithTrigger } from '@superset-ui/chart-controls';
import shortid from 'shortid';

import Modal from 'src/common/components/Modal';
import Button from 'src/components/Button';
import { exploreChart } from '../../explore/exploreUtils';
import * as actions from '../actions/sqlLab';

const propTypes = {
Expand All @@ -37,6 +35,7 @@ const propTypes = {
errorMessage: PropTypes.string,
timeout: PropTypes.number,
database: PropTypes.object.isRequired,
onClick: PropTypes.func.isRequired,
};
const defaultProps = {
query: {},
Expand All @@ -45,34 +44,12 @@ const defaultProps = {
class ExploreResultsButton extends React.PureComponent {
constructor(props) {
super(props);
this.visualize = this.visualize.bind(this);
this.onClick = this.onClick.bind(this);
this.getInvalidColumns = this.getInvalidColumns.bind(this);
this.renderInvalidColumnMessage = this.renderInvalidColumnMessage.bind(
this,
);
}

onClick() {
const { timeout } = this.props;
const msg = this.renderInvalidColumnMessage();
if (Math.round(this.getQueryDuration()) > timeout) {
Modal.confirm({
title: t('Explore'),
content: this.renderTimeoutWarning(),
onOk: this.visualize,
icon: null,
});
} else if (msg) {
Modal.warning({
title: t('Explore'),
content: msg,
});
} else {
this.visualize();
}
}

getColumns() {
const { props } = this;
if (
Expand Down Expand Up @@ -123,35 +100,6 @@ class ExploreResultsButton extends React.PureComponent {
};
}

visualize() {
this.props.actions
.createDatasource(this.buildVizOptions())
.then(data => {
const columns = this.getColumns();
const formData = {
datasource: `${data.table_id}__table`,
metrics: [],
groupby: [],
time_range: 'No filter',
viz_type: 'table',
all_columns: columns.map(c => c.name),
row_limit: 1000,
};

this.props.actions.addInfoToast(
t('Creating a data source and creating a new tab'),
);

// open new window for data visualization
exploreChart(formData);
})
.catch(() => {
this.props.actions.addDangerToast(
this.props.errorMessage || t('An error occurred'),
);
});
}

renderTimeoutWarning() {
return (
<Alert bsStyle="warning">
Expand Down Expand Up @@ -203,7 +151,7 @@ class ExploreResultsButton extends React.PureComponent {
<>
<Button
buttonSize="small"
onClick={this.onClick}
onClick={this.props.onClick}
betodealmeida marked this conversation as resolved.
Show resolved Hide resolved
disabled={!allowsSubquery}
tooltip={t('Explore the result set in the data exploration view')}
>
Expand Down
Loading