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 2021/08/11 09:49:56 UTC

[incubator-streampipes] 03/03: [STREAMPIPES-402] Properly reload widgets when different dashboards are selected

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

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

commit cc11279a913dcf9ec628282781d559d4b1481cea
Author: Dominik Riemer <ri...@fzi.de>
AuthorDate: Wed Aug 11 11:49:41 2021 +0200

    [STREAMPIPES-402] Properly reload widgets when different dashboards are selected
---
 .../grid/data-explorer-dashboard-grid.component.ts   | 20 +++++++++++---------
 ui/src/app/data-explorer/data-explorer.component.ts  |  1 -
 2 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/ui/src/app/data-explorer/components/grid/data-explorer-dashboard-grid.component.ts b/ui/src/app/data-explorer/components/grid/data-explorer-dashboard-grid.component.ts
index 2ff5aa1..1c9ddf2 100644
--- a/ui/src/app/data-explorer/components/grid/data-explorer-dashboard-grid.component.ts
+++ b/ui/src/app/data-explorer/components/grid/data-explorer-dashboard-grid.component.ts
@@ -31,14 +31,12 @@ import { GridsterItemComponent, GridType } from 'angular-gridster2';
 import { GridsterInfo } from '../../../dashboard/models/gridster-info.model';
 import { IDataViewDashboardConfig, } from '../../models/dataview-dashboard.model';
 import { DataViewDataExplorerService } from '../../services/data-view-data-explorer.service';
-import { RefreshDashboardService } from '../../services/refresh-dashboard.service';
 import { ResizeService } from '../../services/resize.service';
 import {
   DataExplorerWidgetModel,
   DataLakeMeasure
 } from '../../../core-model/gen/streampipes-model';
 import { Tuple2 } from '../../../core-model/base/Tuple2';
-import { DatalakeRestService } from '../../../core-services/datalake/datalake-rest.service';
 import { Dashboard, DashboardItem, TimeSettings } from '../../../dashboard/models/dashboard.model';
 
 @Component({
@@ -51,11 +49,10 @@ export class DataExplorerDashboardGridComponent implements OnInit, OnChanges {
   @Input()
   editMode: boolean;
 
-  @Input()
-  dashboard: Dashboard;
+  _dashboard: Dashboard;
 
-  configuredWidgets: Map<String, DataExplorerWidgetModel> = new Map<String, DataExplorerWidgetModel>();
-  dataLakeMeasures: Map<String, DataLakeMeasure> = new Map<String, DataLakeMeasure>();
+  configuredWidgets: Map<string, DataExplorerWidgetModel> = new Map<string, DataExplorerWidgetModel>();
+  dataLakeMeasures: Map<string, DataLakeMeasure> = new Map<string, DataLakeMeasure>();
 
   /**
    * This is the date range (start, end) to view the data and is set in data-explorer.ts
@@ -73,9 +70,7 @@ export class DataExplorerDashboardGridComponent implements OnInit, OnChanges {
   @ViewChildren(GridsterItemComponent) gridsterItemComponents: QueryList<GridsterItemComponent>;
 
   constructor(private resizeService: ResizeService,
-              private dataViewDataExplorerService: DataViewDataExplorerService,
-              private refreshDashboardService: RefreshDashboardService,
-              private datalakeRestService: DatalakeRestService) {
+              private dataViewDataExplorerService: DataViewDataExplorerService) {
 
   }
 
@@ -106,10 +101,17 @@ export class DataExplorerDashboardGridComponent implements OnInit, OnChanges {
         window.dispatchEvent(new Event('resize'));
       })
     };
+  }
 
+  @Input() set dashboard(dashboard: Dashboard) {
+    this._dashboard = dashboard;
     this.loadWidgetConfigs();
   }
 
+  get dashboard() {
+    return this._dashboard;
+  }
+
   loadWidgetConfigs() {
     this.dashboard.widgets.forEach(widget => {
       this.loadWidgetConfig(widget.id);
diff --git a/ui/src/app/data-explorer/data-explorer.component.ts b/ui/src/app/data-explorer/data-explorer.component.ts
index 37a79e8..cc431d11 100644
--- a/ui/src/app/data-explorer/data-explorer.component.ts
+++ b/ui/src/app/data-explorer/data-explorer.component.ts
@@ -70,7 +70,6 @@ export class DataExplorerComponent implements OnInit {
       this.dashboardTabSelected = true;
       this.applyTimeSettings(this.dataViewDashboards[(index - 1)]);
       this.selectedDataViewDashboard = this.dataViewDashboards[(index - 1)];
-      console.log(this.selectedDataViewDashboard);
     }
   }