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

Release 20190531b #39

Merged
merged 36 commits into from
Jun 3, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
156b0aa
feat: Live query validation in the SQL Lab UI (#7461) (#7516) (#7518)
May 15, 2019
9423e9a
chore: Truncate progressbar percentage decimals (#7499) (#7517) (#7519)
May 15, 2019
7f858e4
[sql lab] Fix new query stuck at pending state (#7523)
May 16, 2019
21a4670
Talisman config (#7529)
craig-rueda May 17, 2019
f0f719c
Validate start/end when scheduling queries (#7544)
betodealmeida May 18, 2019
dcafabd
Show scheduled queries (#7545)
betodealmeida May 18, 2019
c79077d
feat: add header tooltip (#7556)
khtruong May 20, 2019
1fdc96a
Disabling flask-talisman by default (#7535)
mistercrunch May 20, 2019
023faf3
Rjurney master docs update (#7426)
rjurney May 21, 2019
74704f6
[security] New, deprecate merge_perm, FAB method is fixed (#7355)
dpgaspar May 21, 2019
1ae000a
Boxplot should not require a datetime column (#5096)
AxelMathei May 21, 2019
551fe92
Add dotenv to dependencies (#7330)
mistercrunch May 21, 2019
efb085a
[cypress] fix accessing a cross-origin frame error (#7552)
May 21, 2019
6b9790c
[ad-hoc] Fixing type for count distinct (#7573)
john-bodley May 22, 2019
e5739fb
[testconn] Explicit closing engine connection (#7570)
john-bodley May 22, 2019
421183d
Adding controls for verifying options (#7468)
michellethomas May 22, 2019
9c8f494
A few improvements to scheduling queries (#7585)
betodealmeida May 23, 2019
f68f979
Fix for polling queries (#7559)
betodealmeida May 23, 2019
265e117
Add link to scheduled pipeline (#7584)
betodealmeida May 23, 2019
e4f8444
add American Express to list of users on readme (#7576)
TheLastSultan May 24, 2019
2014329
[sql lab]revert #4833 (#7498)
May 24, 2019
47ba2ad
Remove aggregates from metric options if datasource has no columns (#…
michellethomas May 24, 2019
f7d3413
Add support for period character in table names (#7453)
villebro May 26, 2019
b21f8ec
Remove the use of Pandas' iloc() in WorldMapViz (#7379)
elukey May 28, 2019
2a2f395
Add "Auto" option to Mapbox visualization point radius (#7579)
ali-bahjati May 29, 2019
fd5befe
Bump python libs, address insecure releases (#7550)
mistercrunch May 29, 2019
fc3b043
Add support for Apache Drill (#6610)
cgivre May 29, 2019
34407e8
Make timestamp expression native SQLAlchemy element (#7131)
villebro May 30, 2019
145d72c
Fix SQL Lab window resizing layout bug (#7615)
etr2460 May 30, 2019
dbdb6b0
[SQL Lab] fix unnecessary offline action (#7594)
May 30, 2019
c1712e5
Add relative start param for time filters (#7525)
villebro May 31, 2019
d408e30
Show expanded columns in gray in SQL Editor (#7627)
betodealmeida May 31, 2019
d296734
View Presto row and array objects clearly in the data grid (#7625)
khtruong May 31, 2019
9acafd5
fix: handle presto columns with whitespace (#7630)
khtruong May 31, 2019
c82a7f4
Update bug_report.md (#7583)
john-bodley May 31, 2019
8d75644
Merge
betodealmeida May 31, 2019
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
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ If applicable, add screenshots to help explain your problem.

(please complete the following information):

- superset version: [e.g. `v0.29`, `master`, `commit`]
- superset version: `superset version`
- python version: `python --version`
- node.js version: `node -v`
- npm version: `npm -v`
Expand Down
72 changes: 72 additions & 0 deletions superset/assets/spec/javascripts/sqllab/QueryAutoRefresh_spec.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import React from 'react';
import { shallow } from 'enzyme';
import sinon from 'sinon';
import thunk from 'redux-thunk';
import configureStore from 'redux-mock-store';

import QueryAutoRefresh from '../../../src/SqlLab/components/QueryAutoRefresh';
import { initialState, runningQuery } from './fixtures';

describe('QueryAutoRefresh', () => {
const middlewares = [thunk];
const mockStore = configureStore(middlewares);
const sqlLab = {
...initialState.sqlLab,
queries: {
ryhMUZCGb: runningQuery,
},
};
const state = {
...initialState,
sqlLab,

};
const store = mockStore(state);

const getWrapper = () => (
shallow(<QueryAutoRefresh />, {
context: { store },
}).dive());

let wrapper;

it('shouldCheckForQueries', () => {
wrapper = getWrapper();
expect(wrapper.instance().shouldCheckForQueries()).toBe(true);
});

it('setUserOffline', () => {
wrapper = getWrapper();
const spy = sinon.spy(wrapper.instance().props.actions, 'setUserOffline');

// state not changed
wrapper.setState({
offline: false,
});
expect(spy.called).toBe(false);

// state is changed
wrapper.setState({
offline: true,
});
expect(spy.callCount).toBe(1);
});
});
38 changes: 37 additions & 1 deletion superset/assets/spec/javascripts/sqllab/SqlEditor_spec.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,19 @@ import React from 'react';
import { shallow } from 'enzyme';

import { defaultQueryEditor, initialState, queries, table } from './fixtures';
import {
SQL_EDITOR_GUTTER_HEIGHT,
SQL_EDITOR_GUTTER_MARGIN,
SQL_TOOLBAR_HEIGHT,
} from '../../../src/SqlLab/constants';
import AceEditorWrapper from '../../../src/SqlLab/components/AceEditorWrapper';
import LimitControl from '../../../src/SqlLab/components/LimitControl';
import SouthPane from '../../../src/SqlLab/components/SouthPane';
import SqlEditor from '../../../src/SqlLab/components/SqlEditor';
import SqlEditorLeftBar from '../../../src/SqlLab/components/SqlEditorLeftBar';

const MOCKED_SQL_EDITOR_HEIGHT = 500;

describe('SqlEditor', () => {
const mockedProps = {
actions: {},
Expand All @@ -40,7 +49,7 @@ describe('SqlEditor', () => {
};

beforeAll(() => {
jest.spyOn(SqlEditor.prototype, 'getSqlEditorHeight').mockImplementation(() => 500);
jest.spyOn(SqlEditor.prototype, 'getSqlEditorHeight').mockImplementation(() => MOCKED_SQL_EDITOR_HEIGHT);
});

it('is valid', () => {
Expand All @@ -52,6 +61,33 @@ describe('SqlEditor', () => {
const wrapper = shallow(<SqlEditor {...mockedProps} />);
expect(wrapper.find(SqlEditorLeftBar)).toHaveLength(1);
});
it('render an AceEditorWrapper', () => {
const wrapper = shallow(<SqlEditor {...mockedProps} />);
expect(wrapper.find(AceEditorWrapper)).toHaveLength(1);
});
it('render an SouthPane', () => {
const wrapper = shallow(<SqlEditor {...mockedProps} />);
expect(wrapper.find(SouthPane)).toHaveLength(1);
});
it('does not overflow the editor window', () => {
const wrapper = shallow(<SqlEditor {...mockedProps} />);
const totalSize = parseFloat(wrapper.find(AceEditorWrapper).props().height)
+ wrapper.find(SouthPane).props().height
+ SQL_TOOLBAR_HEIGHT
+ (SQL_EDITOR_GUTTER_MARGIN * 2)
+ SQL_EDITOR_GUTTER_HEIGHT;
expect(totalSize).toEqual(MOCKED_SQL_EDITOR_HEIGHT);
});
it('does not overflow the editor window after resizing', () => {
const wrapper = shallow(<SqlEditor {...mockedProps} />);
wrapper.setState({ height: 450 });
const totalSize = parseFloat(wrapper.find(AceEditorWrapper).props().height)
+ wrapper.find(SouthPane).props().height
+ SQL_TOOLBAR_HEIGHT
+ (SQL_EDITOR_GUTTER_MARGIN * 2)
+ SQL_EDITOR_GUTTER_HEIGHT;
expect(totalSize).toEqual(450);
});
it('render a LimitControl with default limit', () => {
const defaultQueryLimit = 101;
const updatedProps = { ...mockedProps, defaultQueryLimit };
Expand Down
18 changes: 17 additions & 1 deletion superset/assets/spec/javascripts/sqllab/fixtures.js
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,20 @@ export const queries = [
type: 'STRING',
},
],
selected_columns: [
{
is_date: true,
is_dim: false,
name: 'ds',
type: 'STRING',
},
{
is_date: false,
is_dim: true,
name: 'gender',
type: 'STRING',
},
],
data: [{ col1: 0, col2: 1 }, { col1: 2, col2: 3 }],
},
},
Expand Down Expand Up @@ -264,7 +278,7 @@ export const queryWithBadColumns = {
...queries[0],
results: {
data: queries[0].results.data,
columns: [
selected_columns: [
{
is_date: true,
is_dim: false,
Expand Down Expand Up @@ -366,11 +380,13 @@ export const runningQuery = {
id: 'ryhMUZCGb',
progress: 90,
state: 'running',
startDttm: Date.now() - 500,
};
export const cachedQuery = Object.assign({}, queries[0], { cached: true });

export const initialState = {
sqlLab: {
offline: false,
alerts: [],
queries: {},
databases: {},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ class ExploreResultsButton extends React.PureComponent {
}
getColumns() {
const props = this.props;
if (props.query && props.query.results && props.query.results.columns) {
return props.query.results.columns;
if (props.query && props.query.results && props.query.results.selected_columns) {
return props.query.results.selected_columns;
}
return [];
}
Expand All @@ -97,7 +97,7 @@ class ExploreResultsButton extends React.PureComponent {
const re1 = /^[A-Za-z_]\w*$/; // starts with char or _, then only alphanum
const re2 = /__\d+$/; // does not finish with __ and then a number which screams dup col name

return this.props.query.results.columns.map(col => col.name)
return this.props.query.results.selected_columns.map(col => col.name)
.filter(col => !re1.test(col) || re2.test(col));
}
datasourceName() {
Expand Down
23 changes: 18 additions & 5 deletions superset/assets/src/SqlLab/components/QueryAutoRefresh.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,20 @@ const MAX_QUERY_AGE_TO_POLL = 21600000;
const QUERY_TIMEOUT_LIMIT = 10000;

class QueryAutoRefresh extends React.PureComponent {
constructor(props) {
super(props);
this.state = {
offline: props.offline,
};
}
componentWillMount() {
this.startTimer();
}
componentDidUpdate(prevProps) {
if (prevProps.offline !== this.state.offline) {
this.props.actions.setUserOffline(this.state.offline);
}
}
componentWillUnmount() {
this.stopTimer();
}
Expand Down Expand Up @@ -70,26 +81,28 @@ class QueryAutoRefresh extends React.PureComponent {
if (Object.keys(json).length > 0) {
this.props.actions.refreshQueries(json);
}
this.props.actions.setUserOffline(false);
}).catch(() => {
this.props.actions.setUserOffline(true);
});
this.setState({ offline: false });
}).catch(() => {
this.setState({ offline: true });
});
} else {
this.props.actions.setUserOffline(false);
this.setState({ offline: false });
}
}
render() {
return null;
}
}
QueryAutoRefresh.propTypes = {
offline: PropTypes.bool.isRequired,
queries: PropTypes.object.isRequired,
actions: PropTypes.object.isRequired,
queriesLastUpdate: PropTypes.number.isRequired,
};

function mapStateToProps({ sqlLab }) {
return {
offline: sqlLab.offline,
queries: sqlLab.queries,
queriesLastUpdate: sqlLab.queriesLastUpdate,
};
Expand Down
4 changes: 4 additions & 0 deletions superset/assets/src/SqlLab/components/ResultSet.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,9 @@ export default class ResultSet extends React.PureComponent {
data = results.data;
}
if (data && data.length > 0) {
const expandedColumns = results.expanded_columns
? results.expanded_columns.map(col => col.name)
: [];
return (
<React.Fragment>
{this.renderControls.bind(this)()}
Expand All @@ -216,6 +219,7 @@ export default class ResultSet extends React.PureComponent {
orderedColumnKeys={results.columns.map(col => col.name)}
height={height}
filterText={this.state.searchText}
expandedColumns={expandedColumns}
/>
</React.Fragment>
);
Expand Down
Loading