|
|
|
@ -124,9 +124,7 @@ export class QueryGroup extends PureComponent<Props, State> { |
|
|
|
|
defaultDataSource, |
|
|
|
|
// TODO: Detect the first panel added into a new dashboard better.
|
|
|
|
|
// This is flaky in case the UID is generated differently
|
|
|
|
|
isDataSourceModalOpen: |
|
|
|
|
locationService.getLocation().pathname === '/dashboard/new' && |
|
|
|
|
locationService.getSearchObject().editPanel === '1', |
|
|
|
|
isDataSourceModalOpen: !!locationService.getSearchObject().firstPanel, |
|
|
|
|
}); |
|
|
|
|
} catch (error) { |
|
|
|
|
console.log('failed to load data source', error); |
|
|
|
@ -261,6 +259,11 @@ export class QueryGroup extends PureComponent<Props, State> { |
|
|
|
|
this.setState({ isHelpOpen: false }); |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
onCloseDataSourceModal = () => { |
|
|
|
|
this.setState({ isDataSourceModalOpen: false }); |
|
|
|
|
locationService.partial({ firstPanel: null }); |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
renderMixedPicker = () => { |
|
|
|
|
return ( |
|
|
|
|
<DataSourcePicker |
|
|
|
@ -289,15 +292,14 @@ export class QueryGroup extends PureComponent<Props, State> { |
|
|
|
|
current: this.props.options.dataSource, |
|
|
|
|
onChange: (ds: DataSourceInstanceSettings) => { |
|
|
|
|
this.onChangeDataSource(ds); |
|
|
|
|
this.setState({ isDataSourceModalOpen: false }); |
|
|
|
|
this.onCloseDataSourceModal(); |
|
|
|
|
}, |
|
|
|
|
}; |
|
|
|
|
const onDismiss = () => this.setState({ isDataSourceModalOpen: false }); |
|
|
|
|
|
|
|
|
|
return ( |
|
|
|
|
<> |
|
|
|
|
{isDataSourceModalOpen && config.featureToggles.advancedDataSourcePicker && ( |
|
|
|
|
<DataSourceModal {...commonProps} onDismiss={onDismiss}></DataSourceModal> |
|
|
|
|
<DataSourceModal {...commonProps} onDismiss={this.onCloseDataSourceModal}></DataSourceModal> |
|
|
|
|
)} |
|
|
|
|
<DataSourcePicker |
|
|
|
|
{...commonProps} |
|
|
|
|