@esfaenza/dashboard-feature 11.2.7 → 11.2.8

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.
Files changed (38) hide show
  1. package/bundles/esfaenza-dashboard-feature.umd.js +68 -15
  2. package/bundles/esfaenza-dashboard-feature.umd.js.map +1 -1
  3. package/bundles/esfaenza-dashboard-feature.umd.min.js +1 -1
  4. package/bundles/esfaenza-dashboard-feature.umd.min.js.map +1 -1
  5. package/esfaenza-dashboard-feature.metadata.json +1 -1
  6. package/esm2015/lib/components/dashboard/dashboard.component.js +4 -3
  7. package/esm2015/lib/components/widgets/BaseWidgetComponent.js +7 -3
  8. package/esm2015/lib/components/widgets/IWidgetComponent.js +1 -1
  9. package/esm2015/lib/components/widgets/chart/jace-dsh-chart.component.js +5 -3
  10. package/esm2015/lib/components/widgets/counter/jace-dsh-counter.component.js +5 -3
  11. package/esm2015/lib/components/widgets/list/jace-dsh-list.component.js +5 -3
  12. package/esm2015/lib/components/widgets/multiprog/jace-dsh-multiprog.component.js +5 -3
  13. package/esm2015/lib/dashboard-feature.module.js +6 -1
  14. package/esm2015/lib/models/config/JaceDashboardConfig.js +6 -1
  15. package/esm2015/lib/models/externals/JaceWidgetInstanceDetail.js +1 -1
  16. package/esm2015/lib/models/externals/SaveJaceDashboardLayoutDTO.js +4 -1
  17. package/esm2015/lib/models/widgets/BaseJaceWidgetModel.js +4 -1
  18. package/esm2015/lib/models/widgets/IJaceWidgetModel.js +1 -1
  19. package/esm2015/lib/services/DashboardWidgetFactory.js +26 -2
  20. package/esm2015/lib/services/IDashboardFeatureDataService.js +1 -1
  21. package/esm2015/lib/services/dashboard-feature.service.js +5 -3
  22. package/fesm2015/esfaenza-dashboard-feature.js +70 -15
  23. package/fesm2015/esfaenza-dashboard-feature.js.map +1 -1
  24. package/lib/components/widgets/BaseWidgetComponent.d.ts +1 -1
  25. package/lib/components/widgets/IWidgetComponent.d.ts +2 -2
  26. package/lib/components/widgets/chart/jace-dsh-chart.component.d.ts +1 -1
  27. package/lib/components/widgets/counter/jace-dsh-counter.component.d.ts +1 -1
  28. package/lib/components/widgets/list/jace-dsh-list.component.d.ts +1 -1
  29. package/lib/components/widgets/multiprog/jace-dsh-multiprog.component.d.ts +1 -1
  30. package/lib/models/config/JaceDashboardConfig.d.ts +5 -0
  31. package/lib/models/externals/JaceWidgetInstanceDetail.d.ts +1 -0
  32. package/lib/models/externals/SaveJaceDashboardLayoutDTO.d.ts +1 -0
  33. package/lib/models/widgets/BaseJaceWidgetModel.d.ts +1 -0
  34. package/lib/models/widgets/IJaceWidgetModel.d.ts +20 -0
  35. package/lib/services/DashboardWidgetFactory.d.ts +24 -0
  36. package/lib/services/IDashboardFeatureDataService.d.ts +2 -2
  37. package/lib/services/dashboard-feature.service.d.ts +2 -2
  38. package/package.json +1 -1
@@ -356,8 +356,10 @@
356
356
  this.lastdate = "";
357
357
  this.chartName = "";
358
358
  }
359
- JaceChartWidgetComponent.prototype.setWidgetModel = function (widgetModel) {
359
+ JaceChartWidgetComponent.prototype.setWidgetModel = function (dshBackendId, widgetModel) {
360
360
  this.model = widgetModel;
361
+ if (this.model.backendid === undefined || this.model.backendid == "default_backend")
362
+ this.model.backendid = dshBackendId;
361
363
  this.refreshData();
362
364
  };
363
365
  JaceChartWidgetComponent.prototype.ngOnInit = function () { };
@@ -387,7 +389,7 @@
387
389
  pars[k] = this.model.options[k];
388
390
  }
389
391
  }
390
- this.dshService.GetWidgetData(this.model.name, pars).subscribe(function (data) {
392
+ this.dshService.GetWidgetData(this.model.backendid, this.model.name, pars).subscribe(function (data) {
391
393
  if (_this.model) {
392
394
  _this.model.setData(data);
393
395
  _this.chartName = _this.model.name;
@@ -432,8 +434,10 @@
432
434
  this.dataReady = false;
433
435
  this.lastdate = "";
434
436
  }
435
- JaceCounterWidgetComponent.prototype.setWidgetModel = function (widgetModel) {
437
+ JaceCounterWidgetComponent.prototype.setWidgetModel = function (dshBackendId, widgetModel) {
436
438
  this.model = widgetModel;
439
+ if (this.model.backendid === undefined || this.model.backendid == "default_backend")
440
+ this.model.backendid = dshBackendId;
437
441
  this.refreshData();
438
442
  };
439
443
  JaceCounterWidgetComponent.prototype.ngOnInit = function () { };
@@ -463,7 +467,7 @@
463
467
  pars[k] = this.model.options[k];
464
468
  }
465
469
  }
466
- this.dshService.GetWidgetData(this.model.name, pars).subscribe(function (data) {
470
+ this.dshService.GetWidgetData(this.model.backendid, this.model.name, pars).subscribe(function (data) {
467
471
  if (_this.model) {
468
472
  _this.model.setData(data);
469
473
  _this.dataReady = true;
@@ -509,8 +513,10 @@
509
513
  this.dataReady = false;
510
514
  this.lastdate = "";
511
515
  }
512
- JaceListWidgetComponent.prototype.setWidgetModel = function (widgetModel) {
516
+ JaceListWidgetComponent.prototype.setWidgetModel = function (dshBackendId, widgetModel) {
513
517
  this.model = widgetModel;
518
+ if (this.model.backendid === undefined || this.model.backendid == "default_backend")
519
+ this.model.backendid = dshBackendId;
514
520
  this.refreshData();
515
521
  };
516
522
  JaceListWidgetComponent.prototype.ngOnInit = function () { };
@@ -540,7 +546,7 @@
540
546
  pars[k] = this.model.options[k];
541
547
  }
542
548
  }
543
- this.dshService.GetWidgetData(this.model.name, pars).subscribe(function (data) {
549
+ this.dshService.GetWidgetData(this.model.backendid, this.model.name, pars).subscribe(function (data) {
544
550
  if (_this.model) {
545
551
  _this.model.setData(data);
546
552
  _this.dataReady = true;
@@ -597,8 +603,10 @@
597
603
  this.dataReady = false;
598
604
  this.lastdate = "";
599
605
  }
600
- JaceMultiprogWidgetComponent.prototype.setWidgetModel = function (widgetModel) {
606
+ JaceMultiprogWidgetComponent.prototype.setWidgetModel = function (dshBackendId, widgetModel) {
601
607
  this.model = widgetModel;
608
+ if (this.model.backendid === undefined || this.model.backendid == "default_backend")
609
+ this.model.backendid = dshBackendId;
602
610
  this.refreshData();
603
611
  };
604
612
  JaceMultiprogWidgetComponent.prototype.ngOnInit = function () { };
@@ -628,7 +636,7 @@
628
636
  pars[k] = this.model.options[k];
629
637
  }
630
638
  }
631
- this.dshService.GetWidgetData(this.model.name, pars).subscribe(function (data) {
639
+ this.dshService.GetWidgetData(this.model.backendid, this.model.name, pars).subscribe(function (data) {
632
640
  if (_this.model) {
633
641
  _this.model.setData(data);
634
642
  _this.dataReady = true;
@@ -667,11 +675,13 @@
667
675
 
668
676
  var BaseJaceWidgetModel = /** @class */ (function () {
669
677
  function BaseJaceWidgetModel() {
678
+ this.backendid = "default_backend";
670
679
  this.resizeEnabled = false;
671
680
  this.dataError = false;
672
681
  this.options = {};
673
682
  }
674
683
  BaseJaceWidgetModel.prototype.configureFromInstanceDetails = function (details) {
684
+ var _a;
675
685
  this.name = details.name;
676
686
  this.widgetType = details.type;
677
687
  this.title = details.title;
@@ -684,6 +694,7 @@
684
694
  this.options = details.options;
685
695
  this.dataError = details.queryerror;
686
696
  this.resizeEnabled = details.resizeenabled;
697
+ this.backendid = (_a = details.backendid) !== null && _a !== void 0 ? _a : "default_backend";
687
698
  };
688
699
  return BaseJaceWidgetModel;
689
700
  }());
@@ -846,6 +857,24 @@
846
857
  return DefaultDashboardModuleOptions;
847
858
  }());
848
859
 
860
+ /**NOTA
861
+ * per essere sicuro che la Factory venga creata dall'injector dei moduli lazy nel template di FE e quindi sappia come creare i componenti dinamici,
862
+ * al momento è dichiarata con provideIn: null in modo da 'costringere' ad esplicitarla nei provider del proprio modulo
863
+ * dove si vuole usare la dashboard
864
+ *
865
+ * @NgModule({
866
+ * imports: [...MODULES],
867
+ * declarations: [...COMPONENTS],
868
+ * providers: [
869
+ * // url backend per la dashboard
870
+ * { provide: DSH_BACKEND_URL, useValue: myconfig.BACKEND_URL},
871
+ * ==> DashboardWidgetFactory
872
+ * ]
873
+ * })
874
+ * export class MyLazyModule {}
875
+ *
876
+ * sperabilmente in futuro (ng12+ con Ivy) la si potrà dichiarare provideIn: root se si supera il problema dei componenti dinamici
877
+ */
849
878
  //singleton
850
879
  var DashboardWidgetFactory = /** @class */ (function () {
851
880
  //verione ng 13
@@ -862,6 +891,7 @@
862
891
  });
863
892
  }
864
893
  };
894
+ //TODO
865
895
  //versione ng 13+
866
896
  /* resolveComponent(type: string, vcr: ViewContainerRef): ComponentRef<IWidgetComponent> | null {
867
897
 
@@ -877,7 +907,12 @@
877
907
 
878
908
  return componentRef;
879
909
  } */
880
- //versione ng11
910
+ /**
911
+ * Versione ng11 della creazione dei componenti dinamici delle widget
912
+ * @param type
913
+ * @param vcr
914
+ * @returns
915
+ */
881
916
  DashboardWidgetFactory.prototype.resolveComponent = function (type, vcr) {
882
917
  if (!this.types)
883
918
  return null;
@@ -930,6 +965,7 @@
930
965
 
931
966
  var SaveJaceDashboardLayoutDTO = /** @class */ (function () {
932
967
  function SaveJaceDashboardLayoutDTO() {
968
+ this.backendid = "default_backend";
933
969
  }
934
970
  return SaveJaceDashboardLayoutDTO;
935
971
  }());
@@ -995,7 +1031,7 @@
995
1031
  };
996
1032
  DashboardComponent.prototype.reloadData = function () {
997
1033
  var _this = this;
998
- this.dshService.GetUserDashboard(this.Configuration.accountId, this.Configuration.dashboardName).subscribe(function (c) {
1034
+ this.dshService.GetUserDashboard(this.Configuration.backendId, this.Configuration.accountId, this.Configuration.dashboardName).subscribe(function (c) {
999
1035
  _this.dashboardLayout = c;
1000
1036
  _this.widgetDefinitions = c.widgets.map(function (i) {
1001
1037
  return _this.cmpFactory.resolveDefinition(i.type, i);
@@ -1012,6 +1048,7 @@
1012
1048
  if (!this.dashboardLayout)
1013
1049
  return;
1014
1050
  var dto = new SaveJaceDashboardLayoutDTO();
1051
+ dto.backendid = this.Configuration.backendId;
1015
1052
  dto.widgets = [];
1016
1053
  for (var index = 0; index < this.widgetDefinitions.length; index++) {
1017
1054
  var w = this.widgetDefinitions[index];
@@ -1056,7 +1093,7 @@
1056
1093
  if (_this.Configuration.showDateInput)
1057
1094
  componentRef.instance.DashboardDate = _this.dashboardDate;
1058
1095
  //setta il modello
1059
- componentRef.instance.setWidgetModel(widgetData);
1096
+ componentRef.instance.setWidgetModel(_this.Configuration.backendId, widgetData);
1060
1097
  //setta la callback per OnRemove
1061
1098
  var s = componentRef.instance.OnRemove.subscribe(function (name) { return _this.removeItem(name); });
1062
1099
  _this.trackedSubscriptions.push(s);
@@ -1105,8 +1142,9 @@
1105
1142
  this.http = http;
1106
1143
  this.backend = backend;
1107
1144
  }
1108
- DashboardFeatureAPIDataService.prototype.GetUserDashboard = function (idaccount, dashboardName) {
1145
+ DashboardFeatureAPIDataService.prototype.GetUserDashboard = function (backendid, idaccount, dashboardName) {
1109
1146
  var params = new http.HttpParams();
1147
+ params = params.append("backendid", backendid.toString());
1110
1148
  params = params.append("idaccount", idaccount.toString());
1111
1149
  params = params.append("name", dashboardName);
1112
1150
  return this.http.get(this.backend + Repository["GET_Dashboard_GetLayout"], params);
@@ -1114,8 +1152,9 @@
1114
1152
  DashboardFeatureAPIDataService.prototype.SaveUserDashboard = function (dto) {
1115
1153
  return this.http.post(this.backend + Repository["POST_Dashboard_SaveLayout"], dto);
1116
1154
  };
1117
- DashboardFeatureAPIDataService.prototype.GetWidgetData = function (name, options) {
1155
+ DashboardFeatureAPIDataService.prototype.GetWidgetData = function (backendid, name, options) {
1118
1156
  var params = new http.HttpParams();
1157
+ params = params.append("backendid", backendid.toString());
1119
1158
  params = params.append("name", name.toString());
1120
1159
  if (options && Object.keys(options).length != 0) {
1121
1160
  for (var index = 0; index < Object.keys(options).length; index++) {
@@ -1168,6 +1207,11 @@
1168
1207
  JaceChartWidgetComponent,
1169
1208
  JaceMultiprogWidgetComponent
1170
1209
  ];
1210
+ // NOTA
1211
+ // questa cosa è deprecata, ma serve perchè nel template di FE usiamo per adesso una versione di
1212
+ // compilatore (pre ng12 / pre Ivy) che altrimenti non riesce a capire come creare dinamicamente i componenti delle widget a runtime
1213
+ // se non sono dichiarati così (entrycomponent)
1214
+ // se una prossima widget di default usasse un componente di libreria esterno (es. una select, un pulsante), anche quello andrebbe dichiarato qui
1171
1215
  var ENTRY_COMPONENTS = [
1172
1216
  JaceListWidgetComponent,
1173
1217
  JaceCounterWidgetComponent,
@@ -1229,8 +1273,12 @@
1229
1273
  this.dataReady = false;
1230
1274
  this.lastdate = "";
1231
1275
  }
1232
- BaseWidgetComponent.prototype.setWidgetModel = function (widgetModel) {
1276
+ BaseWidgetComponent.prototype.setWidgetModel = function (dshBackendId, widgetModel) {
1233
1277
  this.model = widgetModel;
1278
+ if (dshBackendId != "default_backend") {
1279
+ if (this.model.backendid === undefined || this.model.backendid == "default_backend")
1280
+ this.model.backendid = dshBackendId;
1281
+ }
1234
1282
  this.refreshData();
1235
1283
  };
1236
1284
  BaseWidgetComponent.prototype.ngOnInit = function () { };
@@ -1265,7 +1313,7 @@
1265
1313
  }
1266
1314
  }
1267
1315
  this.prepareGetDataParameters(pars);
1268
- this.dshService.GetWidgetData(this.model.name, pars).subscribe(function (data) {
1316
+ this.dshService.GetWidgetData(this.model.backendid, this.model.name, pars).subscribe(function (data) {
1269
1317
  if (_this.model) {
1270
1318
  _this.model.setData(data);
1271
1319
  _this.dataReady = true;
@@ -1304,6 +1352,11 @@
1304
1352
  */
1305
1353
  var JaceDashboardConfig = /** @class */ (function () {
1306
1354
  function JaceDashboardConfig() {
1355
+ /**
1356
+ * Id del backend a cui verranno indirizzate le chiamate di questa dashboard.
1357
+ * Deve essere uno di quelli definiti in appsetting.json del FE nella sezione **Backends**.
1358
+ */
1359
+ this.backendId = "default_backend";
1307
1360
  /**
1308
1361
  * Se questa dashboard contiene widget che mostrano dati che dipendono dalla data corrente
1309
1362
  * mostra il controllo (datetimepicker) per variare la data in base a cui mostrare i dati.