From 55230acdb1f14ec4b74ed321bf0db55c53fd3ce2 Mon Sep 17 00:00:00 2001 From: Philipp Zehnder Date: Thu, 19 Dec 2024 16:51:59 +0100 Subject: [PATCH] fix(#3380): Fix editing of data views (#3381) --- .../data-explorer-widget-data-settings.component.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) 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); }