DS Picker: Do not create extra history entries for panel onboarding (#68227)

This commit is contained in:
Ivan Ortega Alba 2023-05-10 18:57:10 +02:00 committed by GitHub
parent c67bafbd5a
commit 0565c3440f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -65,7 +65,7 @@ export class QueryGroup extends PureComponent<Props, State> {
querySubscription: Unsubscribable | null = null; querySubscription: Unsubscribable | null = null;
state: State = { state: State = {
isDataSourceModalOpen: false, isDataSourceModalOpen: !!locationService.getSearchObject().firstPanel,
isLoadingHelp: false, isLoadingHelp: false,
helpContent: null, helpContent: null,
isPickerOpen: false, isPickerOpen: false,
@ -87,6 +87,11 @@ export class QueryGroup extends PureComponent<Props, State> {
}); });
this.setNewQueriesAndDatasource(options); this.setNewQueriesAndDatasource(options);
// Clean up the first panel flag since the modal is now open
if (!!locationService.getSearchObject().firstPanel) {
locationService.partial({ firstPanel: null }, true);
}
} }
componentWillUnmount() { componentWillUnmount() {
@ -117,14 +122,12 @@ export class QueryGroup extends PureComponent<Props, State> {
datasource, datasource,
...q, ...q,
})); }));
this.setState({ this.setState({
queries, queries,
dataSource: ds, dataSource: ds,
dsSettings, dsSettings,
defaultDataSource, defaultDataSource,
// TODO: Detect the first panel added into a new dashboard better.
// This is flaky in case the UID is generated differently
isDataSourceModalOpen: !!locationService.getSearchObject().firstPanel,
}); });
} catch (error) { } catch (error) {
console.log('failed to load data source', error); console.log('failed to load data source', error);
@ -261,7 +264,6 @@ export class QueryGroup extends PureComponent<Props, State> {
onCloseDataSourceModal = () => { onCloseDataSourceModal = () => {
this.setState({ isDataSourceModalOpen: false }); this.setState({ isDataSourceModalOpen: false });
locationService.partial({ firstPanel: null });
}; };
renderMixedPicker = () => { renderMixedPicker = () => {