@schneideress/dashboardframework 0.0.3 → 0.0.4

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.
@@ -555,7 +506,9 @@ var RADashboardArea = /** @class */ (function () {
555
506
  * @return {?}
556
507
  */
557
508
  function (item) {
509
+ console.log('in change call back');
558
510
  areaContext.setAreaHeight();
511
+ areaContext.updateWidgets();
559
512
  });
560
513
  };
561
514
  /**
@@ -595,6 +548,22 @@ var RADashboardArea = /** @class */ (function () {
595
548
  function () {
596
549
  this.conifgAddClick.unsubscribe();
597
550
  };
551
+ /**
552
+ * @return {?}
553
+ */
554
+ RADashboardArea.prototype.updateWidgets = /**
555
+ * @return {?}
556
+ */
557
+ function () {
558
+ console.log('in update widgets');
559
+ this.dashboardService.updateWidgets(this.mapGridsterListToObject(this.widgetList), this.appConfig).subscribe((/**
560
+ * @param {?} widgets
561
+ * @return {?}
562
+ */
563
+ function (widgets) {
564
+ }));
565
+ return true;
566
+ };
598
567
  /** To retrieve widgets based on userDashboardid and area name */
599
568
  /**
600
569
  * To retrieve widgets based on userDashboardid and area name
@@ -658,49 +627,6 @@ var RADashboardArea = /** @class */ (function () {
658
627
  }
659
628
  this.gridheight = areaHeight;
660
629
  };
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
630
  /** To remove a widget instance from dashboard and to save info in database */
705
631
  /**
706
632
  * To remove a widget instance from dashboard and to save info in database
@@ -766,6 +692,88 @@ var RADashboardArea = /** @class */ (function () {
766
692
  _this.setAreaHeight();
767
693
  }));
768
694
  };
695
+ /**To map IwidgetInfo object to gridsterItem */
696
+ /**
697
+ * To map IwidgetInfo object to gridsterItem
698
+ * @param {?} widget
699
+ * @return {?}
700
+ */
701
+ RADashboardArea.prototype.mapObjectsToGridsterItem = /**
702
+ * To map IwidgetInfo object to gridsterItem
703
+ * @param {?} widget
704
+ * @return {?}
705
+ */
706
+ function (widget) {
707
+ /** @type {?} */
708
+ var gridsterItem = (/** @type {?} */ ({
709
+ cols: widget.width,
710
+ rows: widget.height,
711
+ x: widget.position_x,
712
+ y: widget.position_y,
713
+ widgetInfo: widget
714
+ }));
715
+ return gridsterItem;
716
+ };
717
+ /**
718
+ * @param {?} widgetList
719
+ * @return {?}
720
+ */
721
+ RADashboardArea.prototype.mapObjectListToGridsterItemList = /**
722
+ * @param {?} widgetList
723
+ * @return {?}
724
+ */
725
+ function (widgetList) {
726
+ var _this = this;
727
+ /** @type {?} */
728
+ var widgetArray = Array();
729
+ widgetList.forEach((/**
730
+ * @param {?} widget
731
+ * @return {?}
732
+ */
733
+ function (widget) {
734
+ widgetArray.push(_this.mapObjectsToGridsterItem(widget));
735
+ }));
736
+ return widgetArray;
737
+ };
738
+ /**
739
+ * @param {?} widgetItem
740
+ * @return {?}
741
+ */
742
+ RADashboardArea.prototype.mapGridsterItemToObject = /**
743
+ * @param {?} widgetItem
744
+ * @return {?}
745
+ */
746
+ function (widgetItem) {
747
+ /** @type {?} */
748
+ var widget;
749
+ widget = widgetItem.widgetInfo;
750
+ widget.height = widgetItem.rows;
751
+ widget.width = widgetItem.cols;
752
+ widget.position_x = widgetItem.x;
753
+ widget.position_y = widgetItem.y;
754
+ return widget;
755
+ };
756
+ /**
757
+ * @param {?} widgetItemList
758
+ * @return {?}
759
+ */
760
+ RADashboardArea.prototype.mapGridsterListToObject = /**
761
+ * @param {?} widgetItemList
762
+ * @return {?}
763
+ */
764
+ function (widgetItemList) {
765
+ var _this = this;
766
+ /** @type {?} */
767
+ var widgetListArray = Array();
768
+ widgetItemList.forEach((/**
769
+ * @param {?} widget
770
+ * @return {?}
771
+ */
772
+ function (widget) {
773
+ widgetListArray.push(_this.mapGridsterItemToObject(widget));
774
+ }));
775
+ return widgetListArray;
776
+ };
769
777
  RADashboardArea.decorators = [
770
778
  { type: Component, args: [{
771
779
  selector: 'ra-dashboard-area',