diff --git a/superset/assets/src/datasource/DatasourceModal.jsx b/superset/assets/src/datasource/DatasourceModal.jsx
index 5d95a7e059534..92bbad171184d 100644
--- a/superset/assets/src/datasource/DatasourceModal.jsx
+++ b/superset/assets/src/datasource/DatasourceModal.jsx
@@ -49,10 +49,8 @@ class DatasourceModal extends React.PureComponent {
super(props);
this.state = {
errors: [],
- showDatasource: false,
datasource: props.datasource,
};
- this.toggleShowDatasource = this.toggleShowDatasource.bind(this);
this.setSearchRef = this.setSearchRef.bind(this);
this.onDatasourceChange = this.onDatasourceChange.bind(this);
this.onClickSave = this.onClickSave.bind(this);
@@ -111,10 +109,6 @@ class DatasourceModal extends React.PureComponent {
this.dialog = ref;
}
- toggleShowDatasource() {
- this.setState({ showDatasource: !this.state.showDatasource });
- }
-
renderSaveDialog() {
return (
diff --git a/superset/assets/src/explore/components/controls/DatasourceControl.jsx b/superset/assets/src/explore/components/controls/DatasourceControl.jsx
index 35647eddd9342..ae12fe4dceab4 100644
--- a/superset/assets/src/explore/components/controls/DatasourceControl.jsx
+++ b/superset/assets/src/explore/components/controls/DatasourceControl.jsx
@@ -19,13 +19,19 @@
import React from 'react';
import PropTypes from 'prop-types';
import {
+ Col,
+ Collapse,
Label,
OverlayTrigger,
+ Row,
Tooltip,
+ Well,
} from 'react-bootstrap';
import { t } from '@superset-ui/translation';
import ControlHeader from '../ControlHeader';
+import ColumnOption from '../../../components/ColumnOption';
+import MetricOption from '../../../components/MetricOption';
import DatasourceModal from '../../../datasource/DatasourceModal';
const propTypes = {
@@ -52,25 +58,51 @@ class DatasourceControl extends React.PureComponent {
};
this.toggleShowDatasource = this.toggleShowDatasource.bind(this);
this.toggleEditDatasourceModal = this.toggleEditDatasourceModal.bind(this);
- }
-
- onChange(vizType) {
- this.props.onChange(vizType);
- this.setState({ showModal: false });
+ this.renderDatasource = this.renderDatasource.bind(this);
}
toggleShowDatasource() {
this.setState(({ showDatasource }) => ({ showDatasource: !showDatasource }));
}
- toggleModal() {
- this.setState(({ showModal }) => ({ showModal: !showModal }));
- }
toggleEditDatasourceModal() {
this.setState(({ showEditDatasourceModal }) => ({
showEditDatasourceModal: !showEditDatasourceModal,
}));
}
+ renderDatasource() {
+ const datasource = this.props.datasource;
+ return (
+
+
+
+
+ {` ${datasource.database.name} `}
+
+
+
+ Columns
+ {datasource.columns.map(col => (
+
+
+
+ ))}
+
+
+ Metrics
+ {datasource.metrics.map(m => (
+
+
+
+ ))}
+
+
+
+
+ );
+ }
render() {
return (
@@ -85,6 +117,21 @@ class DatasourceControl extends React.PureComponent {
{this.props.datasource.name}
+
+ {t('Expand/collapse datasource configuration')}
+
+ }
+ >
+
+
+
+
{this.props.datasource.type === 'table' &&
}
+
{this.renderDatasource()}