mirror of
https://github.com/apache/superset.git
synced 2024-09-16 02:29:39 -04:00
fix: Remove view in sql lab from druid datasources (#13469)
This commit is contained in:
parent
c3c73763d0
commit
d2e03ab9b4
@ -93,6 +93,28 @@ describe('DatasourceControl', () => {
|
||||
</div>,
|
||||
);
|
||||
expect(menuWrapper.find(Menu.Item)).toHaveLength(2);
|
||||
|
||||
wrapper = setup({
|
||||
datasource: {
|
||||
name: 'birth_names',
|
||||
type: 'druid',
|
||||
uid: '1__druid',
|
||||
id: 1,
|
||||
columns: [],
|
||||
metrics: [],
|
||||
database: {
|
||||
backend: 'druid',
|
||||
name: 'main',
|
||||
},
|
||||
},
|
||||
});
|
||||
expect(wrapper.find('[data-test="datasource-menu"]')).toExist();
|
||||
menuWrapper = shallow(
|
||||
<div>
|
||||
{wrapper.find('[data-test="datasource-menu"]').prop('overlay')}
|
||||
</div>,
|
||||
);
|
||||
expect(menuWrapper.find(Menu.Item)).toHaveLength(2);
|
||||
});
|
||||
|
||||
it('should render health check message', () => {
|
||||
|
@ -151,7 +151,7 @@ class DatasourceControl extends React.PureComponent {
|
||||
datasourceKey: `${datasource.id}__${datasource.type}`,
|
||||
sql: datasource.sql,
|
||||
};
|
||||
postForm('/superset/sqllab', payload);
|
||||
postForm('/superset/sqllab/', payload);
|
||||
}
|
||||
}
|
||||
|
||||
@ -159,6 +159,9 @@ class DatasourceControl extends React.PureComponent {
|
||||
const { showChangeDatasourceModal, showEditDatasourceModal } = this.state;
|
||||
const { datasource, onChange } = this.props;
|
||||
const isMissingDatasource = datasource.id == null;
|
||||
|
||||
const isSqlSupported = datasource.type === 'table';
|
||||
|
||||
const datasourceMenu = (
|
||||
<Menu onClick={this.handleMenuItemClick}>
|
||||
{this.props.isEditable && (
|
||||
@ -167,7 +170,9 @@ class DatasourceControl extends React.PureComponent {
|
||||
</Menu.Item>
|
||||
)}
|
||||
<Menu.Item key={CHANGE_DATASET}>{t('Change dataset')}</Menu.Item>
|
||||
<Menu.Item key={VIEW_IN_SQL_LAB}>{t('View in SQL Lab')}</Menu.Item>
|
||||
{isSqlSupported && (
|
||||
<Menu.Item key={VIEW_IN_SQL_LAB}>{t('View in SQL Lab')}</Menu.Item>
|
||||
)}
|
||||
</Menu>
|
||||
);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user