@schneideress/dashboardframework 20.0.2 → 20.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -164,6 +164,8 @@ var RAEvent;
164
164
  RAEvent["SnapShotClick"] = "SnapShotClick";
165
165
  /** Event on emission report snapshot selected from list*/
166
166
  RAEvent["SnapShotSelected"] = "SnapShotSelected";
167
+ /** Event to update widget count */
168
+ RAEvent["UpdateWidgetCount"] = "UpdateWidgetCount";
167
169
  })(RAEvent || (RAEvent = {}));
168
170
  var RAEventKey;
169
171
  (function (RAEventKey) {
@@ -4015,7 +4017,7 @@ class RAWidgetContainer {
4015
4017
  this.setInapplicableFilters(undefined, this.data.widgetInfo.widgetInstanceId);
4016
4018
  }
4017
4019
  else {
4018
- widgetContainerContext.notifier.notify('error', " " + this.translateService.translate('FailedToRemoveWidget') + " (" + this.translateService.translate('Common.' + this.data.widgetInfo.widgetTitle, true) + ")!");
4020
+ widgetContainerContext.notifier.notify('error', " " + this.translateService.translate('Dashboard.FailedToRemoveWidget') + " (" + this.translateService.translate('Common.' + this.data.widgetInfo.widgetTitle, true) + ")!");
4019
4021
  }
4020
4022
  });
4021
4023
  }
@@ -4783,6 +4785,7 @@ class RADashboardArea {
4783
4785
  this.hasGird = false;
4784
4786
  this.initialWidgetCount = 10;
4785
4787
  this.currentLoadingCount = 0;
4788
+ this.isSiteDetailDashboard = false;
4786
4789
  this.downloadDatastreamLimit = 200;
4787
4790
  this.reportDatastreamLimit = 50;
4788
4791
  this.widgetHeight = 2;
@@ -5077,6 +5080,7 @@ class RADashboardArea {
5077
5080
  isIndicatorDashboard: this.isIndicatorDashboard
5078
5081
  };
5079
5082
  let _the = this;
5083
+ this.isSiteDetailDashboard = this.dashboardInfo?.templateName === 'Site Detail';
5080
5084
  this.dashboardService.getWidgetsByDashboardArea(widgetInfo, this.appConfig).subscribe(widgets => {
5081
5085
  _the.widgetList = [];
5082
5086
  this.userWidgets = widgets;
@@ -5088,6 +5092,8 @@ class RADashboardArea {
5088
5092
  if (settings && settings.isPAMWidget)
5089
5093
  this.PAMWidgets.push(element.widgetInstanceId);
5090
5094
  }
5095
+ if (this.isSiteDetailDashboard)
5096
+ element.templateSettings = JSON.stringify(this.dashboardInfo?.templateConfig?.widget);
5091
5097
  });
5092
5098
  this.checkPAMWidgets();
5093
5099
  if (this.dashboardInfo?.isReport && widgets && widgets.length > this.reportDatastreamLimit) {
@@ -5103,8 +5109,15 @@ class RADashboardArea {
5103
5109
  else {
5104
5110
  this.showDownloadOnlyState = false;
5105
5111
  this.showEmptyDashboard = true;
5106
- this.raDashboardEventBus.publish(RAEvent.HideDashboardBanner, this.showEmptyDashboard);
5112
+ if (this.isSiteDetailDashboard) {
5113
+ this.showDownloadOnlyState = false;
5114
+ this.showEmptyDashboard = false;
5115
+ }
5116
+ else {
5117
+ this.raDashboardEventBus.publish(RAEvent.HideDashboardBanner, this.showEmptyDashboard);
5118
+ }
5107
5119
  }
5120
+ this.raDashboardEventBus.publish(RAEvent.UpdateWidgetCount, this.userWidgets.length);
5108
5121
  });
5109
5122
  }
5110
5123
  /** To set Area(Gridster) height dynamically as widgets are added/removed */
@@ -5120,7 +5133,12 @@ class RADashboardArea {
5120
5133
  if (this.options.api) {
5121
5134
  curRowHeight = this.options.api.getCurrentRowHeight();
5122
5135
  }
5123
- this.showEmptyDashboard = this.userWidgets.length > 0 ? false : true;
5136
+ if (this.isSiteDetailDashboard) {
5137
+ this.showEmptyDashboard = false;
5138
+ }
5139
+ else {
5140
+ this.showEmptyDashboard = this.userWidgets.length === 0;
5141
+ }
5124
5142
  this.widgetList.forEach((t) => {
5125
5143
  let currentHeight = t.y + t.rows;
5126
5144
  if (currentHeight > areaScrollHeight) {
@@ -5176,9 +5194,13 @@ class RADashboardArea {
5176
5194
  }
5177
5195
  }
5178
5196
  this.showEmptyDashboard = this.userWidgets.length > 0 ? false : true;
5179
- if (this.showEmptyDashboard == true) {
5197
+ if (this.showEmptyDashboard == true && !this.isSiteDetailDashboard) {
5180
5198
  this.raDashboardEventBus.publish(RAEvent.HideDashboardBanner, this.showEmptyDashboard);
5181
5199
  }
5200
+ if (this.isSiteDetailDashboard) {
5201
+ this.raDashboardEventBus.publish(RAEvent.UpdateWidgetCount, -1);
5202
+ this.raDashboardEventBus.publish(RAEvent.RearrangeClicked, true);
5203
+ }
5182
5204
  }
5183
5205
  /**To rearrange widgets position in the dashboard, compactLeft&Up,compactLeft,compactUp,etc*/
5184
5206
  rearrangeWidgets() {
@@ -5219,6 +5241,8 @@ class RADashboardArea {
5219
5241
  data.dashboardId = this.userDashboardId;
5220
5242
  this.ngxService.start();
5221
5243
  this.dashboardService.addWidget(data, this.appConfig).subscribe(widget => {
5244
+ if (this.isSiteDetailDashboard)
5245
+ widget.templateSettings = JSON.stringify(this.dashboardInfo?.templateConfig?.widget);
5222
5246
  this.userWidgets.push(widget);
5223
5247
  let gridsterItem = this.responsiveService.getGridsterItem(widget);
5224
5248
  this.widgetList.push(gridsterItem);