Skip to content

Commit

Permalink
Merge branch 'master' into perm_update
Browse files Browse the repository at this point in the history
  • Loading branch information
ShengyaoQian authored May 1, 2017
2 parents aaacbc4 + ef0c4be commit 2c61ce9
Show file tree
Hide file tree
Showing 22 changed files with 103 additions and 75 deletions.
1 change: 1 addition & 0 deletions INTHEWILD.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ Organizations
- [Tooploox](https://www.tooploox.com/)
- [Tobii](http://www.tobii.com/)
- [Endress+Hauser](http://www.endress.com/)
- [Tails.com](https://tails.com)

Projects
----------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class SqlEditorLeftBar extends React.PureComponent {
this.fetchSchemas(this.props.queryEditor.dbId);
this.fetchTables(this.props.queryEditor.dbId, this.props.queryEditor.schema);
}
onChange(db) {
onDatabaseChange(db) {
const val = db ? db.value : null;
this.setState({ schemaOptions: [] });
this.props.actions.queryEditorSetSchema(this.props.queryEditor, null);
Expand Down Expand Up @@ -144,7 +144,7 @@ class SqlEditorLeftBar extends React.PureComponent {
'_oc_DatabaseView=database_name&' +
'_od_DatabaseView=asc'
}
onChange={this.onChange.bind(this)}
onChange={this.onDatabaseChange.bind(this)}
value={this.props.queryEditor.dbId}
databaseId={this.props.queryEditor.dbId}
actions={this.props.actions}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ class VisualizeModal extends React.PureComponent {
formData.metric = mainMetric.name;
}
if (mainGroupBy) {
formData.groupby = mainGroupBy.name;
formData.groupby = [mainGroupBy.name];
}
window.open(getExploreUrl(formData));
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ class ChartContainer extends React.PureComponent {
) && !this.props.queryResponse.error
&& this.props.chartStatus !== 'failed'
&& this.props.chartStatus !== 'stopped'
&& this.props.chartStatus !== 'loading'
) {
this.renderViz();
}
Expand Down
17 changes: 13 additions & 4 deletions superset/assets/javascripts/explorev2/components/Control.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,17 +51,26 @@ export default class Control extends React.PureComponent {
super(props);
this.validate = this.validate.bind(this);
this.onChange = this.onChange.bind(this);
this.validateAndSetValue(props.value, []);
}
componentDidMount() {
this.validateAndSetValue(this.props.value, []);
}
onChange(value, errors) {
this.validateAndSetValue(value, errors);
}
validateAndSetValue(value, errors) {
let validationErrors = this.validate(value);
let validationErrors = this.props.validationErrors;
let currentErrors = this.validate(value);
if (errors && errors.length > 0) {
validationErrors = validationErrors.concat(errors);
currentErrors = validationErrors.concat(errors);
}
if (validationErrors.length + currentErrors.length > 0) {
validationErrors = currentErrors;
}

if (value !== this.props.value || validationErrors !== this.props.validationErrors) {
this.props.actions.setControlValue(this.props.name, value, validationErrors);
}
this.props.actions.setControlValue(this.props.name, value, validationErrors);
}
validate(value) {
const validators = this.props.validators;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import DisplayQueryButton from './DisplayQueryButton';
const propTypes = {
canDownload: PropTypes.oneOfType([PropTypes.string, PropTypes.bool]).isRequired,
slice: PropTypes.object,
queryEndpoint: PropTypes.string,
queryEndpoint: PropTypes.string.isRequired,
queryResponse: PropTypes.object,
chartStatus: PropTypes.string,
};
Expand Down
1 change: 1 addition & 0 deletions superset/assets/javascripts/explorev2/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ const bootstrappedState = Object.assign(
queryResponse: null,
triggerQuery: true,
triggerRender: false,
alert: null,
},
);

Expand Down
1 change: 1 addition & 0 deletions superset/assets/javascripts/explorev2/stores/store.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ export function getControlsState(state, form_data) {
if (typeof control.default === 'function') {
control.default = control.default(control);
}
control.validationErrors = [];
control.value = formData[k] !== undefined ? formData[k] : control.default;
controlsState[k] = control;
});
Expand Down
2 changes: 0 additions & 2 deletions superset/assets/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@
"lodash.throttle": "^4.1.1",
"mapbox-gl": "^0.26.0",
"moment": "^2.14.1",
"moments": "0.0.2",
"mustache": "^2.2.1",
"nvd3": "1.8.5",
"prop-types": "^15.5.8",
Expand Down Expand Up @@ -97,7 +96,6 @@
"viewport-mercator-project": "^2.1.0"
},
"devDependencies": {
"babel": "^6.3.26",
"babel-cli": "^6.14.0",
"babel-core": "^6.10.4",
"babel-loader": "^6.2.4",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,12 @@ import { expect } from 'chai';
import FilterableTable from '../../../../javascripts/components/FilterableTable/FilterableTable';

describe('FilterableTable', () => {
const mockedProps = {
orderedColumnKeys: [],
data: [],
height: 0,
};
it('is valid element', () => {
expect(React.isValidElement(<FilterableTable />)).to.equal(true);
expect(React.isValidElement(<FilterableTable {...mockedProps} />)).to.equal(true);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ describe('SliceCell', () => {
const mockedProps = {
slice,
removeSlice: () => {},
expandedSlices: () => {},
expandedSlices: {},
};
it('is valid', () => {
expect(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ describe('ExploreActionButtons', () => {
json_endpoint: '',
},
},
queryEndpoint: 'localhost',
};

it('renders', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import QuerySearch from '../../../javascripts/SqlLab/components/QuerySearch';
describe('QuerySearch', () => {
const mockedProps = {
actions: {},
height: 0,
};
it('is valid', () => {
expect(
Expand Down
10 changes: 3 additions & 7 deletions superset/assets/spec/javascripts/sqllab/ResultSet_spec.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,10 @@ import { queries } from './fixtures';
describe('ResultSet', () => {
const mockedProps = {
query: queries[0],
height: 0,
};
it('renders', () => {
expect(React.isValidElement(<ResultSet />)).to.equal(true);
});
it('renders with props', () => {
expect(
React.isValidElement(<ResultSet />),
).to.equal(true);
it('is valid', () => {
expect(React.isValidElement(<ResultSet {...mockedProps} />)).to.equal(true);
});
it('renders a Table', () => {
const wrapper = shallow(<ResultSet {...mockedProps} />);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ describe('SqlEditorLeftBar', () => {
const mockedProps = {
tables: [table],
queryEditor: defaultQueryEditor,
height: 0,
};
it('is valid', () => {
expect(
Expand Down
3 changes: 3 additions & 0 deletions superset/assets/spec/javascripts/sqllab/SqlEditor_spec.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ describe('SqlEditor', () => {
latestQuery: queries[0],
tables: [table],
queries,
height: '',
editorQueries: [],
dataPreviewQueries: [],
};
it('is valid', () => {
expect(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ describe('TabbedSqlEditors', () => {
queries: {},
queryEditors: initialState.queryEditors,
tabHistory: initialState.tabHistory,
editorHeight: '',
};
it('is valid', () => {
expect(
Expand Down
5 changes: 1 addition & 4 deletions superset/assets/spec/javascripts/sqllab/Timer_spec.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,7 @@ describe('Timer', () => {
isRunning: true,
state: 'warning',
};
it('renders', () => {
expect(React.isValidElement(<Timer />)).to.equal(true);
});
it('renders with props', () => {
it('is valid', () => {
expect(React.isValidElement(<Timer {...mockedProps} />))
.to.equal(true);
});
Expand Down
11 changes: 6 additions & 5 deletions superset/assets/visualizations/filter_box.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// JS
import d3 from 'd3';
import React from 'react';
import PropTypes from 'prop-types';
import ReactDOM from 'react-dom';
import Select from 'react-select';
import { Button } from 'react-bootstrap';
Expand All @@ -10,11 +11,11 @@ import { TIME_CHOICES } from './constants';
import './filter_box.css';

const propTypes = {
origSelectedValues: React.PropTypes.object,
instantFiltering: React.PropTypes.bool,
filtersChoices: React.PropTypes.object,
onChange: React.PropTypes.func,
showDateFilter: React.PropTypes.bool,
origSelectedValues: PropTypes.object,
instantFiltering: PropTypes.bool,
filtersChoices: PropTypes.object,
onChange: PropTypes.func,
showDateFilter: PropTypes.bool,
};

const defaultProps = {
Expand Down
29 changes: 15 additions & 14 deletions superset/assets/visualizations/mapbox.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/* eslint-disable no-param-reassign */
import d3 from 'd3';
import React from 'react';
import PropTypes from 'prop-types';
import ReactDOM from 'react-dom';
import MapGL from 'react-map-gl';
import ScatterPlotOverlay from 'react-map-gl/dist/overlays/scatterplot.react';
Expand Down Expand Up @@ -256,20 +257,20 @@ class MapboxViz extends React.Component {
}
}
MapboxViz.propTypes = {
aggregatorName: React.PropTypes.string,
clusterer: React.PropTypes.object,
globalOpacity: React.PropTypes.number,
mapStyle: React.PropTypes.string,
mapboxApiKey: React.PropTypes.string,
pointRadius: React.PropTypes.number,
pointRadiusUnit: React.PropTypes.string,
renderWhileDragging: React.PropTypes.bool,
rgb: React.PropTypes.array,
sliceHeight: React.PropTypes.number,
sliceWidth: React.PropTypes.number,
viewportLatitude: React.PropTypes.number,
viewportLongitude: React.PropTypes.number,
viewportZoom: React.PropTypes.number,
aggregatorName: PropTypes.string,
clusterer: PropTypes.object,
globalOpacity: PropTypes.number,
mapStyle: PropTypes.string,
mapboxApiKey: PropTypes.string,
pointRadius: PropTypes.number,
pointRadiusUnit: PropTypes.string,
renderWhileDragging: PropTypes.bool,
rgb: PropTypes.array,
sliceHeight: PropTypes.number,
sliceWidth: PropTypes.number,
viewportLatitude: PropTypes.number,
viewportLongitude: PropTypes.number,
viewportZoom: PropTypes.number,
};

function mapbox(slice, json) {
Expand Down
Loading

0 comments on commit 2c61ce9

Please sign in to comment.