principal-dashboard-lib-v2 0.0.39 → 0.0.40

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.
@@ -43,6 +43,20 @@
43
43
  this.detailRowRequest = null;
44
44
  this.openSmallTable$ = this.openSmallTable.asObservable();
45
45
  }
46
+ // the host may pass the day's data as a JSON string or as an already-parsed object
47
+ PrincipalDashboardLibV2Service.prototype.parseData = function (res) {
48
+ if (!res)
49
+ return null;
50
+ if (typeof res !== 'string')
51
+ return res;
52
+ try {
53
+ return JSON.parse(res);
54
+ }
55
+ catch (e) {
56
+ console.error('principal-dashboard: could not parse data', e);
57
+ return null;
58
+ }
59
+ };
46
60
  PrincipalDashboardLibV2Service.prototype.genarateResourseReqiuredData = function (data) {
47
61
  this.isResoureMetaDataReady.next(false);
48
62
  var resourceMetadataMatrix = new Array();
@@ -903,7 +917,7 @@
903
917
  };
904
918
 
905
919
  // Generated by scripts/lib-version.js from the library's package.json. Do not edit by hand.
906
- var LIB_VERSION = '0.0.39';
920
+ var LIB_VERSION = '0.0.40';
907
921
 
908
922
  var ChartheaderComponent = /** @class */ (function () {
909
923
  function ChartheaderComponent(pdService) {
@@ -1337,7 +1351,7 @@
1337
1351
  this.myDataList = document.getElementById('pd-xmlData');
1338
1352
  // let parse = new DOMParser();
1339
1353
  if (response) {
1340
- this.myXmlData = JSON.parse(response);
1354
+ this.myXmlData = this.pdService.parseData(response);
1341
1355
  }
1342
1356
  if (this.myXmlData) {
1343
1357
  this.currentdataList = this.pdService.genarateUserReqiuredData(this.myXmlData);
@@ -2775,7 +2789,7 @@
2775
2789
  // currentResoursedataList:any;
2776
2790
  HeaderComponent.prototype.loadData = function (response) {
2777
2791
  if (response) {
2778
- this.mydata = JSON.parse(response);
2792
+ this.mydata = this.pdService.parseData(response);
2779
2793
  if (this.mydata) {
2780
2794
  //get current data list
2781
2795
  var genarateUserReqiuredData = this.excelService.genarateUserReqiuredData_Excel(this.mydata);
@@ -2850,7 +2864,7 @@
2850
2864
  // let parse = new DOMParser();
2851
2865
  // this.myXmlData = parse.parseFromString(response, 'application/xml');
2852
2866
  if (response) {
2853
- this.myXmlData = JSON.parse(response);
2867
+ this.myXmlData = this.pdService.parseData(response);
2854
2868
  if (this.myXmlData) {
2855
2869
  // get current data list
2856
2870
  //console.log("AAA myXmlData-->>",this.myXmlData)
@@ -3067,8 +3081,7 @@
3067
3081
  Object.defineProperty(FullTableViewComponent.prototype, "data", {
3068
3082
  set: function (res) {
3069
3083
  if (res !== null) {
3070
- console.log('newtable', JSON.parse(res));
3071
- this.jsonResponse = JSON.parse(res);
3084
+ this.jsonResponse = this.pdService.parseData(res);
3072
3085
  // rebuild rows when new data arrives (date change / refresh)
3073
3086
  if (this.isInitialized) {
3074
3087
  this.loadUserData();
@@ -3399,7 +3412,7 @@
3399
3412
  set: function (res) {
3400
3413
  if (res !== null) {
3401
3414
  //console.log('smallTable',JSON.parse(res));
3402
- this.jsonResponse = JSON.parse(res);
3415
+ this.jsonResponse = this.pdService.parseData(res);
3403
3416
  }
3404
3417
  },
3405
3418
  enumerable: false,
@@ -3992,7 +4005,9 @@
3992
4005
  Object.defineProperty(InsightsComponent.prototype, "data", {
3993
4006
  set: function (res) {
3994
4007
  if (res) {
3995
- this.build(typeof res === 'string' ? JSON.parse(res) : res);
4008
+ var json = this.pdService.parseData(res);
4009
+ if (json)
4010
+ this.build(json);
3996
4011
  }
3997
4012
  },
3998
4013
  enumerable: false,