mirror of
https://github.com/apache/superset.git
synced 2026-04-22 17:45:21 +00:00
add new slice form improvements (#2928)
* dont set first datasource as default * not used * add a disabled class if datasource is not selected * sort datasources alphabettically * make btn disabled is no datasource is selected * fix linting
This commit is contained in:
@@ -17,9 +17,6 @@ export default class AddSliceContainer extends React.PureComponent {
|
||||
const visTypeKeys = Object.keys(visTypes);
|
||||
this.vizTypeOptions = visTypeKeys.map(vt => ({ label: visTypes[vt].label, value: vt }));
|
||||
this.state = {
|
||||
datasourceValue: this.props.datasources[0].value,
|
||||
datasourceId: this.props.datasources[0].value.split('__')[0],
|
||||
datasourceType: this.props.datasources[0].value.split('__')[1],
|
||||
visType: 'table',
|
||||
};
|
||||
}
|
||||
@@ -42,14 +39,14 @@ export default class AddSliceContainer extends React.PureComponent {
|
||||
});
|
||||
}
|
||||
|
||||
changeSliceName(e) {
|
||||
this.setState({ sliceName: e.target.value });
|
||||
}
|
||||
|
||||
changeVisType(e) {
|
||||
this.setState({ visType: e.value });
|
||||
}
|
||||
|
||||
isBtnDisabled() {
|
||||
return !(this.state.datasourceId && this.state.visType);
|
||||
}
|
||||
|
||||
render() {
|
||||
return (
|
||||
<div className="container">
|
||||
@@ -81,7 +78,11 @@ export default class AddSliceContainer extends React.PureComponent {
|
||||
/>
|
||||
</div>
|
||||
<br />
|
||||
<Button bsStyle="primary" onClick={this.gotoSlice.bind(this)}>
|
||||
<Button
|
||||
bsStyle="primary"
|
||||
disabled={this.isBtnDisabled()}
|
||||
onClick={this.gotoSlice.bind(this)}
|
||||
>
|
||||
Create new slice
|
||||
</Button>
|
||||
<br /><br />
|
||||
|
||||
Reference in New Issue
Block a user