@schneideress/dashboardframework 0.0.3 → 0.0.5

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.
@@ -16,54 +16,6 @@ var RaDashboardService = /** @class */ (function (_super) {
16
16
  function RaDashboardService(injector) {
17
17
  var _this = _super.call(this, injector, '') || this;
18
18
  _this.loadedScripts = [];
19
- _this.widgets = [
20
- {
21
- dashboardId: '1',
22
- id: '1',
23
- customTag: 'ra-test-widget',
24
- scriptUrl: './assets/ra-test-widget.bundle.js',
25
- title: 'Test Widget',
26
- widgetInstanceId: 1,
27
- widgetId: 1,
28
- position_x: 0,
29
- position_y: 0,
30
- width: 50,
31
- height: 20,
32
- widgetConfigInfo: {
33
- scriptPath: "./assets/ra-test-widget-config.bundle.js",
34
- configControlTag: "ra-test-widget-config",
35
- config: { country: 'All' }
36
- },
37
- widgetName: '',
38
- widgetTitle: 'Test Widget',
39
- dashboardAreaId: 1,
40
- dashboardAreaKey: '',
41
- dashboardName: ''
42
- },
43
- {
44
- dashboardId: '2',
45
- id: '2',
46
- customTag: 'ra-test-widget',
47
- scriptUrl: './assets/ra-test-widget.bundle.js',
48
- title: 'Test Widget',
49
- widgetInstanceId: 2,
50
- dashboardAreaKey: '',
51
- widgetId: 1,
52
- position_x: 0,
53
- position_y: 0,
54
- width: 50,
55
- height: 20,
56
- widgetConfigInfo: {
57
- scriptPath: "./assets/ra-test-widget-config.bundle.js",
58
- configControlTag: "ra-test-widget-config",
59
- config: { country: 'All' }
60
- },
61
- widgetName: '',
62
- widgetTitle: 'Test Widget',
63
- dashboardAreaId: 1,
64
- dashboardName: ''
65
- },
66
- ];
67
19
  return _this;
68
20
  }
69
21
  /*
@@ -130,32 +82,31 @@ var RaDashboardService = /** @class */ (function (_super) {
130
82
  return this.post(url, widgetInfo);
131
83
  };
132
84
  /**
133
- * @param {?} widgetInfo
85
+ * @param {?} widgetList
86
+ * @param {?} appConfig
134
87
  * @return {?}
135
88
  */
136
- RaDashboardService.prototype.getWidgetConfigInfo = /**
137
- * @param {?} widgetInfo
89
+ RaDashboardService.prototype.updateWidgets = /**
90
+ * @param {?} widgetList
91
+ * @param {?} appConfig
138
92
  * @return {?}
139
93
  */
140
- function (widgetInfo) {
141
- return of();
94
+ function (widgetList, appConfig) {
95
+ this.baseUrl = appConfig.apiBaseUrl;
96
+ /** @type {?} */
97
+ var url = 'widget/UpdateAreaWidgets';
98
+ return this.post(url, widgetList);
142
99
  };
143
100
  /**
144
- * @param {?} widgetId
101
+ * @param {?} widgetInfo
145
102
  * @return {?}
146
103
  */
147
- RaDashboardService.prototype.getWidgetById = /**
148
- * @param {?} widgetId
104
+ RaDashboardService.prototype.getWidgetConfigInfo = /**
105
+ * @param {?} widgetInfo
149
106
  * @return {?}
150
107
  */
151
- function (widgetId) {
152
- return this.widgets.filter((/**
153
- * @param {?} t
154
- * @return {?}
155
- */
156
- function (t) {
157
- t.widgetId == widgetId;
158
- }));
108
+ function (widgetInfo) {
109
+ return of();
159
110
  };
160
111
  /*
161
112
  * To update the configuration of a widget.
@@ -424,6 +375,8 @@ var RAEvent = {
424
375
  DashboardChanged: "dashboardChanged",
425
376
  /** triggers when user clicks the close button on library */
426
377
  WidgetLibraryCloseBtnClicked: "WidgetLibraryCloseBtnClicked",
378
+ /** triggers when user clicks on view dashboard*/
379
+ LoadDashboard: "LoadDashboard",
427
380
  };
428
381
  /** @enum {string} */
429
382
  var RAEventKey = {
@@ -555,7 +508,9 @@ var RADashboardArea = /** @class */ (function () {
555
508
  * @return {?}
556
509
  */
557
510
  function (item) {
511
+ console.log('in change call back');
558
512
  areaContext.setAreaHeight();
513
+ areaContext.updateWidgets();
559
514
  });
560
515
  };
561
516
  /**
@@ -595,6 +550,22 @@ var RADashboardArea = /** @class */ (function () {
595
550
  function () {
596
551
  this.conifgAddClick.unsubscribe();
597
552
  };
553
+ /**
554
+ * @return {?}
555
+ */
556
+ RADashboardArea.prototype.updateWidgets = /**
557
+ * @return {?}
558
+ */
559
+ function () {
560
+ console.log('in update widgets');
561
+ this.dashboardService.updateWidgets(this.mapGridsterListToObject(this.widgetList), this.appConfig).subscribe((/**
562
+ * @param {?} widgets
563
+ * @return {?}
564
+ */
565
+ function (widgets) {
566
+ }));
567
+ return true;
568
+ };
598
569
  /** To retrieve widgets based on userDashboardid and area name */
599
570
  /**
600
571
  * To retrieve widgets based on userDashboardid and area name
@@ -658,49 +629,6 @@ var RADashboardArea = /** @class */ (function () {
658
629
  }
659
630
  this.gridheight = areaHeight;
660
631
  };
661
- /**To map IwidgetInfo object to gridsterItem */
662
- /**
663
- * To map IwidgetInfo object to gridsterItem
664
- * @param {?} widget
665
- * @return {?}
666
- */
667
- RADashboardArea.prototype.mapObjectsToGridsterItem = /**
668
- * To map IwidgetInfo object to gridsterItem
669
- * @param {?} widget
670
- * @return {?}
671
- */
672
- function (widget) {
673
- /** @type {?} */
674
- var gridsterItem = (/** @type {?} */ ({
675
- cols: widget.width,
676
- rows: widget.height,
677
- x: widget.position_x,
678
- y: widget.position_y,
679
- widgetInfo: widget
680
- }));
681
- return gridsterItem;
682
- };
683
- /**
684
- * @param {?} widgetList
685
- * @return {?}
686
- */
687
- RADashboardArea.prototype.mapObjectListToGridsterItemList = /**
688
- * @param {?} widgetList
689
- * @return {?}
690
- */
691
- function (widgetList) {
692
- var _this = this;
693
- /** @type {?} */
694
- var widgetArray = Array();
695
- widgetList.forEach((/**
696
- * @param {?} widget
697
- * @return {?}
698
- */
699
- function (widget) {
700
- widgetArray.push(_this.mapObjectsToGridsterItem(widget));
701
- }));
702
- return widgetArray;
703
- };
704
632
  /** To remove a widget instance from dashboard and to save info in database */
705
633
  /**
706
634
  * To remove a widget instance from dashboard and to save info in database
@@ -766,6 +694,88 @@ var RADashboardArea = /** @class */ (function () {
766
694
  _this.setAreaHeight();
767
695
  }));
768
696
  };
697
+ /**To map IwidgetInfo object to gridsterItem */
698
+ /**
699
+ * To map IwidgetInfo object to gridsterItem
700
+ * @param {?} widget
701
+ * @return {?}
702
+ */
703
+ RADashboardArea.prototype.mapObjectsToGridsterItem = /**
704
+ * To map IwidgetInfo object to gridsterItem
705
+ * @param {?} widget
706
+ * @return {?}
707
+ */
708
+ function (widget) {
709
+ /** @type {?} */
710
+ var gridsterItem = (/** @type {?} */ ({
711
+ cols: widget.width,
712
+ rows: widget.height,
713
+ x: widget.position_x,
714
+ y: widget.position_y,
715
+ widgetInfo: widget
716
+ }));
717
+ return gridsterItem;
718
+ };
719
+ /**
720
+ * @param {?} widgetList
721
+ * @return {?}
722
+ */
723
+ RADashboardArea.prototype.mapObjectListToGridsterItemList = /**
724
+ * @param {?} widgetList
725
+ * @return {?}
726
+ */
727
+ function (widgetList) {
728
+ var _this = this;
729
+ /** @type {?} */
730
+ var widgetArray = Array();
731
+ widgetList.forEach((/**
732
+ * @param {?} widget
733
+ * @return {?}
734
+ */
735
+ function (widget) {
736
+ widgetArray.push(_this.mapObjectsToGridsterItem(widget));
737
+ }));
738
+ return widgetArray;
739
+ };
740
+ /**
741
+ * @param {?} widgetItem
742
+ * @return {?}
743
+ */
744
+ RADashboardArea.prototype.mapGridsterItemToObject = /**
745
+ * @param {?} widgetItem
746
+ * @return {?}
747
+ */
748
+ function (widgetItem) {
749
+ /** @type {?} */
750
+ var widget;
751
+ widget = widgetItem.widgetInfo;
752
+ widget.height = widgetItem.rows;
753
+ widget.width = widgetItem.cols;
754
+ widget.position_x = widgetItem.x;
755
+ widget.position_y = widgetItem.y;
756
+ return widget;
757
+ };
758
+ /**
759
+ * @param {?} widgetItemList
760
+ * @return {?}
761
+ */
762
+ RADashboardArea.prototype.mapGridsterListToObject = /**
763
+ * @param {?} widgetItemList
764
+ * @return {?}
765
+ */
766
+ function (widgetItemList) {
767
+ var _this = this;
768
+ /** @type {?} */
769
+ var widgetListArray = Array();
770
+ widgetItemList.forEach((/**
771
+ * @param {?} widget
772
+ * @return {?}
773
+ */
774
+ function (widget) {
775
+ widgetListArray.push(_this.mapGridsterItemToObject(widget));
776
+ }));
777
+ return widgetListArray;
778
+ };
769
779
  RADashboardArea.decorators = [
770
780
  { type: Component, args: [{
771
781
  selector: 'ra-dashboard-area',