diff --git a/ui/src/app/data-explorer/components/data-view/data-view-designer-panel/data-settings/data-explorer-widget-data-settings.component.ts b/ui/src/app/data-explorer/components/data-view/data-view-designer-panel/data-settings/data-explorer-widget-data-settings.component.ts index c2de37bfd2..3a6c2e3f2b 100644 --- a/ui/src/app/data-explorer/components/data-view/data-view-designer-panel/data-settings/data-explorer-widget-data-settings.component.ts +++ b/ui/src/app/data-explorer/components/data-view/data-view-designer-panel/data-settings/data-explorer-widget-data-settings.component.ts @@ -239,7 +239,7 @@ export class DataExplorerWidgetDataSettingsComponent implements OnInit { } createDefaultWidget(): void { - if (this.dataConfig.sourceConfigs.length === 1) { + if (this.checkIfDefaultTableShouldBeShown()) { const fields = this.fieldProviderService.generateFieldLists( this.dataConfig.sourceConfigs, ); @@ -253,6 +253,16 @@ export class DataExplorerWidgetDataSettingsComponent implements OnInit { } } + /** + * This method checks if there is at least one data source and that no widget type is already configured. + */ + checkIfDefaultTableShouldBeShown(): boolean { + return ( + this.dataConfig.sourceConfigs.length === 1 && + !this.currentlyConfiguredWidget.widgetType + ); + } + removeSourceConfig(index: number) { this.dataConfig.sourceConfigs.splice(index, 1); }