You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@streampipes.apache.org by ri...@apache.org on 2020/02/18 16:27:59 UTC

[incubator-streampipes] 04/04: STREAMPIPES-58: Minor bug fix in dashboard-panel module

This is an automated email from the ASF dual-hosted git repository.

riemer pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/incubator-streampipes.git

commit 9fda6c05c0a88e4058553f0992b85cc8b664f7f6
Author: Dominik Riemer <ri...@fzi.de>
AuthorDate: Tue Feb 18 13:39:58 2020 +0100

    STREAMPIPES-58: Minor bug fix in dashboard-panel module
---
 .../dashboard-v2/components/panel/dashboard-panel.component.ts    | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/ui/src/app/dashboard-v2/components/panel/dashboard-panel.component.ts b/ui/src/app/dashboard-v2/components/panel/dashboard-panel.component.ts
index e82b916..8b4895f 100644
--- a/ui/src/app/dashboard-v2/components/panel/dashboard-panel.component.ts
+++ b/ui/src/app/dashboard-v2/components/panel/dashboard-panel.component.ts
@@ -41,7 +41,7 @@ export class DashboardPanelComponent implements OnInit {
     protected subscription: Subscription;
 
     widgetIdsToRemove: Array<string> = [];
-    widgetsToUpdate: Array<DashboardWidget> = [];
+    widgetsToUpdate: Map<string, DashboardWidget> = new Map<string, DashboardWidget>();
 
     constructor(private dashboardService: DashboardService,
                 public dialog: MatDialog,
@@ -81,7 +81,7 @@ export class DashboardPanelComponent implements OnInit {
 
     updateDashboardAndCloseEditMode() {
         this.dashboardService.updateDashboard(this.dashboard).subscribe(result => {
-            if (this.widgetsToUpdate.length > 0) {
+            if (this.widgetsToUpdate.size > 0) {
                 forkJoin(this.prepareWidgetUpdates()).subscribe(result => {
                     this.closeEditModeAndReloadDashboard();
                 });
@@ -99,7 +99,7 @@ export class DashboardPanelComponent implements OnInit {
 
     prepareWidgetUpdates(): Array<Observable<any>> {
         let promises: Array<Observable<any>> = [];
-        this.widgetsToUpdate.forEach(widget => {
+        this.widgetsToUpdate.forEach((widget, key) => {
             promises.push(this.dashboardService.updateWidget(widget));
         })
 
@@ -117,7 +117,7 @@ export class DashboardPanelComponent implements OnInit {
     }
 
     updateAndQueueItemForDeletion(dashboardWidget: DashboardWidget) {
-        this.widgetsToUpdate.push(dashboardWidget);
+        this.widgetsToUpdate.set(dashboardWidget._id, dashboardWidget);
     }
 
     deleteWidgets() {