@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.
@@ -53,54 +53,6 @@
53
53
  function RaDashboardService(injector) {
54
54
  var _this = _super.call(this, injector, '') || this;
55
55
  _this.loadedScripts = [];
56
- _this.widgets = [
57
- {
58
- dashboardId: '1',
59
- id: '1',
60
- customTag: 'ra-test-widget',
61
- scriptUrl: './assets/ra-test-widget.bundle.js',
62
- title: 'Test Widget',
63
- widgetInstanceId: 1,
64
- widgetId: 1,
65
- position_x: 0,
66
- position_y: 0,
67
- width: 50,
68
- height: 20,
69
- widgetConfigInfo: {
70
- scriptPath: "./assets/ra-test-widget-config.bundle.js",
71
- configControlTag: "ra-test-widget-config",
72
- config: { country: 'All' }
73
- },
74
- widgetName: '',
75
- widgetTitle: 'Test Widget',
76
- dashboardAreaId: 1,
77
- dashboardAreaKey: '',
78
- dashboardName: ''
79
- },
80
- {
81
- dashboardId: '2',
82
- id: '2',
83
- customTag: 'ra-test-widget',
84
- scriptUrl: './assets/ra-test-widget.bundle.js',
85
- title: 'Test Widget',
86
- widgetInstanceId: 2,
87
- dashboardAreaKey: '',
88
- widgetId: 1,
89
- position_x: 0,
90
- position_y: 0,
91
- width: 50,
92
- height: 20,
93
- widgetConfigInfo: {
94
- scriptPath: "./assets/ra-test-widget-config.bundle.js",
95
- configControlTag: "ra-test-widget-config",
96
- config: { country: 'All' }
97
- },
98
- widgetName: '',
99
- widgetTitle: 'Test Widget',
100
- dashboardAreaId: 1,
101
- dashboardName: ''
102
- },
103
- ];
104
56
  return _this;
105
57
  }
106
58
  /*
@@ -167,32 +119,31 @@
167
119
  return this.post(url, widgetInfo);
168
120
  };
169
121
  /**
170
- * @param {?} widgetInfo
122
+ * @param {?} widgetList
123
+ * @param {?} appConfig
171
124
  * @return {?}
172
125
  */
173
- RaDashboardService.prototype.getWidgetConfigInfo = /**
174
- * @param {?} widgetInfo
126
+ RaDashboardService.prototype.updateWidgets = /**
127
+ * @param {?} widgetList
128
+ * @param {?} appConfig
175
129
  * @return {?}
176
130
  */
177
- function (widgetInfo) {
178
- return rxjs.of();
131
+ function (widgetList, appConfig) {
132
+ this.baseUrl = appConfig.apiBaseUrl;
133
+ /** @type {?} */
134
+ var url = 'widget/UpdateAreaWidgets';
135
+ return this.post(url, widgetList);
179
136
  };
180
137
  /**
181
- * @param {?} widgetId
138
+ * @param {?} widgetInfo
182
139
  * @return {?}
183
140
  */
184
- RaDashboardService.prototype.getWidgetById = /**
185
- * @param {?} widgetId
141
+ RaDashboardService.prototype.getWidgetConfigInfo = /**
142
+ * @param {?} widgetInfo
186
143
  * @return {?}
187
144
  */
188
- function (widgetId) {
189
- return this.widgets.filter((/**
190
- * @param {?} t
191
- * @return {?}
192
- */
193
- function (t) {
194
- t.widgetId == widgetId;
195
- }));
145
+ function (widgetInfo) {
146
+ return rxjs.of();
196
147
  };
197
148
  /*
198
149
  * To update the configuration of a widget.
@@ -592,7 +543,9 @@
592
543
  * @return {?}
593
544
  */
594
545
  function (item) {
546
+ console.log('in change call back');
595
547
  areaContext.setAreaHeight();
548
+ areaContext.updateWidgets();
596
549
  });
597
550
  };
598
551
  /**
@@ -632,6 +585,22 @@
632
585
  function () {
633
586
  this.conifgAddClick.unsubscribe();
634
587
  };
588
+ /**
589
+ * @return {?}
590
+ */
591
+ RADashboardArea.prototype.updateWidgets = /**
592
+ * @return {?}
593
+ */
594
+ function () {
595
+ console.log('in update widgets');
596
+ this.dashboardService.updateWidgets(this.mapGridsterListToObject(this.widgetList), this.appConfig).subscribe((/**
597
+ * @param {?} widgets
598
+ * @return {?}
599
+ */
600
+ function (widgets) {
601
+ }));
602
+ return true;
603
+ };
635
604
  /** To retrieve widgets based on userDashboardid and area name */
636
605
  /**
637
606
  * To retrieve widgets based on userDashboardid and area name
@@ -695,49 +664,6 @@
695
664
  }
696
665
  this.gridheight = areaHeight;
697
666
  };
698
- /**To map IwidgetInfo object to gridsterItem */
699
- /**
700
- * To map IwidgetInfo object to gridsterItem
701
- * @param {?} widget
702
- * @return {?}
703
- */
704
- RADashboardArea.prototype.mapObjectsToGridsterItem = /**
705
- * To map IwidgetInfo object to gridsterItem
706
- * @param {?} widget
707
- * @return {?}
708
- */
709
- function (widget) {
710
- /** @type {?} */
711
- var gridsterItem = (/** @type {?} */ ({
712
- cols: widget.width,
713
- rows: widget.height,
714
- x: widget.position_x,
715
- y: widget.position_y,
716
- widgetInfo: widget
717
- }));
718
- return gridsterItem;
719
- };
720
- /**
721
- * @param {?} widgetList
722
- * @return {?}
723
- */
724
- RADashboardArea.prototype.mapObjectListToGridsterItemList = /**
725
- * @param {?} widgetList
726
- * @return {?}
727
- */
728
- function (widgetList) {
729
- var _this = this;
730
- /** @type {?} */
731
- var widgetArray = Array();
732
- widgetList.forEach((/**
733
- * @param {?} widget
734
- * @return {?}
735
- */
736
- function (widget) {
737
- widgetArray.push(_this.mapObjectsToGridsterItem(widget));
738
- }));
739
- return widgetArray;
740
- };
741
667
  /** To remove a widget instance from dashboard and to save info in database */
742
668
  /**
743
669
  * To remove a widget instance from dashboard and to save info in database
@@ -803,6 +729,88 @@
803
729
  _this.setAreaHeight();
804
730
  }));
805
731
  };
732
+ /**To map IwidgetInfo object to gridsterItem */
733
+ /**
734
+ * To map IwidgetInfo object to gridsterItem
735
+ * @param {?} widget
736
+ * @return {?}
737
+ */
738
+ RADashboardArea.prototype.mapObjectsToGridsterItem = /**
739
+ * To map IwidgetInfo object to gridsterItem
740
+ * @param {?} widget
741
+ * @return {?}
742
+ */
743
+ function (widget) {
744
+ /** @type {?} */
745
+ var gridsterItem = (/** @type {?} */ ({
746
+ cols: widget.width,
747
+ rows: widget.height,
748
+ x: widget.position_x,
749
+ y: widget.position_y,
750
+ widgetInfo: widget
751
+ }));
752
+ return gridsterItem;
753
+ };
754
+ /**
755
+ * @param {?} widgetList
756
+ * @return {?}
757
+ */
758
+ RADashboardArea.prototype.mapObjectListToGridsterItemList = /**
759
+ * @param {?} widgetList
760
+ * @return {?}
761
+ */
762
+ function (widgetList) {
763
+ var _this = this;
764
+ /** @type {?} */
765
+ var widgetArray = Array();
766
+ widgetList.forEach((/**
767
+ * @param {?} widget
768
+ * @return {?}
769
+ */
770
+ function (widget) {
771
+ widgetArray.push(_this.mapObjectsToGridsterItem(widget));
772
+ }));
773
+ return widgetArray;
774
+ };
775
+ /**
776
+ * @param {?} widgetItem
777
+ * @return {?}
778
+ */
779
+ RADashboardArea.prototype.mapGridsterItemToObject = /**
780
+ * @param {?} widgetItem
781
+ * @return {?}
782
+ */
783
+ function (widgetItem) {
784
+ /** @type {?} */
785
+ var widget;
786
+ widget = widgetItem.widgetInfo;
787
+ widget.height = widgetItem.rows;
788
+ widget.width = widgetItem.cols;
789
+ widget.position_x = widgetItem.x;
790
+ widget.position_y = widgetItem.y;
791
+ return widget;
792
+ };
793
+ /**
794
+ * @param {?} widgetItemList
795
+ * @return {?}
796
+ */
797
+ RADashboardArea.prototype.mapGridsterListToObject = /**
798
+ * @param {?} widgetItemList
799
+ * @return {?}
800
+ */
801
+ function (widgetItemList) {
802
+ var _this = this;
803
+ /** @type {?} */
804
+ var widgetListArray = Array();
805
+ widgetItemList.forEach((/**
806
+ * @param {?} widget
807
+ * @return {?}
808
+ */
809
+ function (widget) {
810
+ widgetListArray.push(_this.mapGridsterItemToObject(widget));
811
+ }));
812
+ return widgetListArray;
813
+ };
806
814
  RADashboardArea.decorators = [
807
815
  { type: core.Component, args: [{
808
816
  selector: 'ra-dashboard-area',