mirror of
https://github.com/apache/superset.git
synced 2026-04-18 15:44:57 +00:00
Get sections to render when switching datasource (#1660)
* Get sections to render when switching datasource - Move sectionsToRender in store and use is for defaultFormData - Change some SelectField to FreeFormSelect according to forms.py * Solved the css not found problem in staging * Fixed js tests
This commit is contained in:
@@ -182,12 +182,14 @@ class ChartContainer extends React.Component {
|
||||
/>
|
||||
</Alert>
|
||||
}
|
||||
{!this.props.isChartLoading &&
|
||||
<div
|
||||
{this.props.isChartLoading ?
|
||||
(<img alt="loading" width="25" src="/static/assets/images/loading.gif" />)
|
||||
:
|
||||
(<div
|
||||
id={this.props.containerId}
|
||||
ref={(ref) => { this.chartContainerRef = ref; }}
|
||||
className={this.props.viz_type}
|
||||
/>
|
||||
/>)
|
||||
}
|
||||
</Panel>
|
||||
</div>
|
||||
|
||||
@@ -4,7 +4,7 @@ import { bindActionCreators } from 'redux';
|
||||
import * as actions from '../actions/exploreActions';
|
||||
import { connect } from 'react-redux';
|
||||
import { Panel, Alert } from 'react-bootstrap';
|
||||
import { visTypes, commonControlPanelSections } from '../stores/store';
|
||||
import { visTypes, sectionsToRender } from '../stores/store';
|
||||
import ControlPanelSection from './ControlPanelSection';
|
||||
import FieldSetRow from './FieldSetRow';
|
||||
|
||||
@@ -37,17 +37,11 @@ class ControlPanelsContainer extends React.Component {
|
||||
}
|
||||
|
||||
onChange(name, value, label) {
|
||||
this.props.actions.setFieldValue(name, value, label);
|
||||
this.props.actions.setFieldValue(this.props.datasource_type, name, value, label);
|
||||
}
|
||||
|
||||
sectionsToRender() {
|
||||
const viz = visTypes[this.props.form_data.viz_type];
|
||||
const timeSection = this.props.datasource_type === 'table' ?
|
||||
commonControlPanelSections.sqlaTimeSeries : commonControlPanelSections.druidTimeSeries;
|
||||
const { datasourceAndVizType, sqlClause } = commonControlPanelSections;
|
||||
const sectionsToRender = [datasourceAndVizType].concat(
|
||||
viz.controlPanelSections, timeSection, sqlClause);
|
||||
return sectionsToRender;
|
||||
return sectionsToRender(this.props.form_data.viz_type, this.props.datasource_type);
|
||||
}
|
||||
|
||||
fieldOverrides() {
|
||||
|
||||
Reference in New Issue
Block a user