[table editor] hide Edit Datasource option when no onDatasourceSave (#9706)

* [table editor] hide Edit Datasource option when no onDatasourceSave

* add !! operator to get truthiness
This commit is contained in:
Grace Guo
2020-04-30 17:32:01 -07:00
committed by GitHub
parent 5fb883e279
commit 43eec67291
2 changed files with 35 additions and 6 deletions

View File

@@ -48,7 +48,7 @@ const propTypes = {
const defaultProps = {
onChange: () => {},
onDatasourceSave: () => {},
onDatasourceSave: null,
value: null,
};
@@ -150,9 +150,11 @@ class DatasourceControl extends React.PureComponent {
{t('Explore in SQL Lab')}
</MenuItem>
)}
<MenuItem eventKey="3" onClick={this.toggleEditDatasourceModal}>
{t('Edit Datasource')}
</MenuItem>
{!!this.props.onDatasourceSave && (
<MenuItem eventKey="3" onClick={this.toggleEditDatasourceModal}>
{t('Edit Datasource')}
</MenuItem>
)}
</DropdownButton>
</TooltipWrapper>
<OverlayTrigger