From 811ee8ccdc76a2630a4c8014df26558391b981fe Mon Sep 17 00:00:00 2001 From: vera-liu Date: Wed, 16 Nov 2016 14:33:00 -0800 Subject: [PATCH] Deleted unused components in exploreV2 (#1613) * Deleted unused components in exploreV2 * Deleted constants.js --- .../explorev2/actions/exploreActions.js | 5 -- .../explorev2/components/ChartControl.jsx | 89 ------------------- .../explorev2/components/GroupBy.jsx | 68 -------------- .../explorev2/components/NotGroupBy.jsx | 68 -------------- .../explorev2/components/Options.jsx | 61 ------------- .../explorev2/components/SelectArray.jsx | 74 --------------- .../explorev2/components/TimeFilter.jsx | 88 ------------------ .../assets/javascripts/explorev2/constants.js | 48 ---------- .../explorev2/reducers/exploreReducer.js | 12 --- 9 files changed, 513 deletions(-) delete mode 100644 superset/assets/javascripts/explorev2/components/ChartControl.jsx delete mode 100644 superset/assets/javascripts/explorev2/components/GroupBy.jsx delete mode 100644 superset/assets/javascripts/explorev2/components/NotGroupBy.jsx delete mode 100644 superset/assets/javascripts/explorev2/components/Options.jsx delete mode 100644 superset/assets/javascripts/explorev2/components/SelectArray.jsx delete mode 100644 superset/assets/javascripts/explorev2/components/TimeFilter.jsx delete mode 100644 superset/assets/javascripts/explorev2/constants.js diff --git a/superset/assets/javascripts/explorev2/actions/exploreActions.js b/superset/assets/javascripts/explorev2/actions/exploreActions.js index 0661c75ac0945..c03e25a8e082c 100644 --- a/superset/assets/javascripts/explorev2/actions/exploreActions.js +++ b/superset/assets/javascripts/explorev2/actions/exploreActions.js @@ -6,11 +6,6 @@ export function setFieldOptions(options) { return { type: SET_FIELD_OPTIONS, options }; } -export const CLEAR_ALL_OPTS = 'CLEAR_ALL_OPTS'; -export function clearAllOpts() { - return { type: CLEAR_ALL_OPTS }; -} - export const SET_DATASOURCE_TYPE = 'SET_DATASOURCE_TYPE'; export function setDatasourceType(datasourceType) { return { type: SET_DATASOURCE_TYPE, datasourceType }; diff --git a/superset/assets/javascripts/explorev2/components/ChartControl.jsx b/superset/assets/javascripts/explorev2/components/ChartControl.jsx deleted file mode 100644 index fe44d96bbac59..0000000000000 --- a/superset/assets/javascripts/explorev2/components/ChartControl.jsx +++ /dev/null @@ -1,89 +0,0 @@ -import React from 'react'; -import Select from 'react-select'; -import { bindActionCreators } from 'redux'; -import * as actions from '../actions/exploreActions'; -import { connect } from 'react-redux'; -import { VIZ_TYPES } from '../constants'; - -const propTypes = { - actions: React.PropTypes.object, - datasources: React.PropTypes.array, - datasourceId: React.PropTypes.number, - datasourceType: React.PropTypes.string, - vizType: React.PropTypes.string, -}; - -const defaultProps = { - datasources: [], - datasourceId: null, - datasourceType: null, - vizType: null, -}; - -class ChartControl extends React.Component { - componentWillMount() { - if (this.props.datasourceId) { - this.props.actions.setFormOpts(this.props.datasourceId, this.props.datasourceType); - } - } - changeDatasource(datasourceOpt) { - const val = (datasourceOpt) ? datasourceOpt.value : null; - this.props.actions.setDatasource(val); - this.props.actions.resetFormData(); - this.props.actions.setFormOpts(val, this.props.datasourceType); - } - changeViz(opt) { - const val = opt ? opt.value : null; - this.props.actions.setFormData('vizType', val); - } - render() { - return ( -
-
Chart Options
-
-
Datasource
-
- -
-
-
- ); - } -} - -ChartControl.propTypes = propTypes; -ChartControl.defaultProps = defaultProps; - -function mapStateToProps(state) { - return { - datasources: state.datasources, - datasourceId: state.datasourceId, - datasourceType: state.datasourceType, - vizType: state.viz.formData.vizType, - }; -} - -function mapDispatchToProps(dispatch) { - return { - actions: bindActionCreators(actions, dispatch), - }; -} -export default connect(mapStateToProps, mapDispatchToProps)(ChartControl); diff --git a/superset/assets/javascripts/explorev2/components/GroupBy.jsx b/superset/assets/javascripts/explorev2/components/GroupBy.jsx deleted file mode 100644 index a49ab1a78eed5..0000000000000 --- a/superset/assets/javascripts/explorev2/components/GroupBy.jsx +++ /dev/null @@ -1,68 +0,0 @@ -import React from 'react'; -import { bindActionCreators } from 'redux'; -import * as actions from '../actions/exploreActions'; -import { connect } from 'react-redux'; -import SelectArray from './SelectArray'; - -const propTypes = { - actions: React.PropTypes.object, - metricsOpts: React.PropTypes.array, - metrics: React.PropTypes.array, - groupByColumnOpts: React.PropTypes.array, - groupByColumns: React.PropTypes.array, -}; - -const defaultProps = { - metricsOpts: [], - metrics: [], - groupByColumnOpts: [], - groupByColumns: [], -}; - -const GroupBy = (props) => { - const selects = [ - { - key: 'groupByColumns', - title: 'Group By', - options: props.groupByColumnOpts, - value: props.groupByColumns, - multi: true, - width: '12', - }, - { - key: 'metrics', - title: 'Metrics', - options: props.metricsOpts, - value: props.metrics, - multi: true, - width: '12', - }]; - return ( -
-
GroupBy
-
- -
-
- ); -}; - -GroupBy.propTypes = propTypes; -GroupBy.defaultProps = defaultProps; - -function mapStateToProps(state) { - return { - metricsOpts: state.metricsOpts, - metrics: state.viz.formData.metrics, - groupByColumnOpts: state.groupByColumnOpts, - groupByColumns: state.viz.formData.groupByColumns, - }; -} - -function mapDispatchToProps(dispatch) { - return { - actions: bindActionCreators(actions, dispatch), - }; -} - -export default connect(mapStateToProps, mapDispatchToProps)(GroupBy); diff --git a/superset/assets/javascripts/explorev2/components/NotGroupBy.jsx b/superset/assets/javascripts/explorev2/components/NotGroupBy.jsx deleted file mode 100644 index 2dabdbc850dc6..0000000000000 --- a/superset/assets/javascripts/explorev2/components/NotGroupBy.jsx +++ /dev/null @@ -1,68 +0,0 @@ -import React from 'react'; -import SelectArray from './SelectArray'; -import { bindActionCreators } from 'redux'; -import * as actions from '../actions/exploreActions'; -import { connect } from 'react-redux'; - -const propTypes = { - actions: React.PropTypes.object, - columnOpts: React.PropTypes.array, - columns: React.PropTypes.array, - orderingOpts: React.PropTypes.array, - orderings: React.PropTypes.array, -}; - -const defaultProps = { - columnOpts: [], - columns: [], - orderingOpts: [], - orderings: [], -}; - -const NotGroupBy = (props) => { - const selects = [ - { - key: 'columns', - title: 'Columns', - options: props.columnOpts, - value: props.columns, - multi: true, - width: '12', - }, - { - key: 'orderings', - title: 'Orderings', - options: props.orderingOpts, - value: props.orderings, - multi: true, - width: '12', - }]; - return ( -
-
Not GroupBy
-
- -
-
- ); -}; - -NotGroupBy.propTypes = propTypes; -NotGroupBy.defaultProps = defaultProps; - -function mapStateToProps(state) { - return { - columnOpts: state.columnOpts, - columns: state.viz.formData.columns, - orderingOpts: state.orderingOpts, - orderings: state.viz.formData.orderings, - }; -} - -function mapDispatchToProps(dispatch) { - return { - actions: bindActionCreators(actions, dispatch), - }; -} - -export default connect(mapStateToProps, mapDispatchToProps)(NotGroupBy); diff --git a/superset/assets/javascripts/explorev2/components/Options.jsx b/superset/assets/javascripts/explorev2/components/Options.jsx deleted file mode 100644 index f52662a96de39..0000000000000 --- a/superset/assets/javascripts/explorev2/components/Options.jsx +++ /dev/null @@ -1,61 +0,0 @@ -import React from 'react'; -import SelectArray from './SelectArray'; -import { bindActionCreators } from 'redux'; -import * as actions from '../actions/exploreActions'; -import { connect } from 'react-redux'; -import { timestampOptions, rowLimitOptions } from '../constants'; - -const propTypes = { - actions: React.PropTypes.object, - timeStampFormat: React.PropTypes.string, - rowLimit: React.PropTypes.number, -}; - -const defaultProps = { - timeStampFormat: null, - rowLimit: null, -}; - -const Options = (props) => { - const selects = [ - { - key: 'timeStampFormat', - title: 'Timestamp Format', - options: timestampOptions.map((t) => ({ value: t[0], label: t[1] })), - value: props.timeStampFormat, - width: '12', - }, - { - key: 'rowLimit', - title: 'Row Limit', - options: rowLimitOptions.map((r) => ({ value: r, label: r })), - value: props.rowLimit, - width: '12', - }]; - return ( -
-
Options
-
- -
-
- ); -}; - -Options.propTypes = propTypes; -Options.defaultProps = defaultProps; - -function mapStateToProps(state) { - return { - timeStampFormat: state.viz.formData.timeStampFormat, - rowLimit: state.viz.formData.rowLimit, - }; -} - -function mapDispatchToProps(dispatch) { - return { - actions: bindActionCreators(actions, dispatch), - }; -} - -export default connect(mapStateToProps, mapDispatchToProps)(Options); diff --git a/superset/assets/javascripts/explorev2/components/SelectArray.jsx b/superset/assets/javascripts/explorev2/components/SelectArray.jsx deleted file mode 100644 index 7c60d1d763bee..0000000000000 --- a/superset/assets/javascripts/explorev2/components/SelectArray.jsx +++ /dev/null @@ -1,74 +0,0 @@ -import React from 'react'; -import Select from 'react-select'; -import { bindActionCreators } from 'redux'; -import * as actions from '../actions/exploreActions'; -import { connect } from 'react-redux'; - -const propTypes = { - actions: React.PropTypes.object, - selectArray: React.PropTypes.arrayOf( - React.PropTypes.shape({ - key: React.PropTypes.string.isRequired, - title: React.PropTypes.string.isRequired, - options: React.PropTypes.array.isRequired, - value: React.PropTypes.oneOfType([ - React.PropTypes.string, - React.PropTypes.array, - ]), - width: React.PropTypes.string, - multi: React.PropTypes.bool, - }) - ).isRequired, -}; - -const defaultProps = { - selectArray: [], -}; - -class SelectArray extends React.Component { - changeSelectData(key, multi, opt) { - if (multi) this.props.actions.setFormData(key, opt); - else { - const val = opt ? opt.value : null; - this.props.actions.setFormData(key, val); - } - } - render() { - const selects = this.props.selectArray.map((obj) => ( -
-
{obj.title}
-