@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.
@@ -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.
@@ -461,6 +412,8 @@
461
412
  DashboardChanged: "dashboardChanged",
462
413
  /** triggers when user clicks the close button on library */
463
414
  WidgetLibraryCloseBtnClicked: "WidgetLibraryCloseBtnClicked",
415
+ /** triggers when user clicks on view dashboard*/
416
+ LoadDashboard: "LoadDashboard",
464
417
  };
465
418
  /** @enum {string} */
466
419
  var RAEventKey = {
@@ -592,7 +545,9 @@
592
545
  * @return {?}
593
546
  */
594
547
  function (item) {
548
+ console.log('in change call back');
595
549
  areaContext.setAreaHeight();
550
+ areaContext.updateWidgets();
596
551
  });
597
552
  };
598
553
  /**
@@ -632,6 +587,22 @@
632
587
  function () {
633
588
  this.conifgAddClick.unsubscribe();
634
589
  };
590
+ /**
591
+ * @return {?}
592
+ */
593
+ RADashboardArea.prototype.updateWidgets = /**
594
+ * @return {?}
595
+ */
596
+ function () {
597
+ console.log('in update widgets');
598
+ this.dashboardService.updateWidgets(this.mapGridsterListToObject(this.widgetList), this.appConfig).subscribe((/**
599
+ * @param {?} widgets
600
+ * @return {?}
601
+ */
602
+ function (widgets) {
603
+ }));
604
+ return true;
605
+ };
635
606
  /** To retrieve widgets based on userDashboardid and area name */
636
607
  /**
637
608
  * To retrieve widgets based on userDashboardid and area name
@@ -695,49 +666,6 @@
695
666
  }
696
667
  this.gridheight = areaHeight;
697
668
  };
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
669
  /** To remove a widget instance from dashboard and to save info in database */
742
670
  /**
743
671
  * To remove a widget instance from dashboard and to save info in database
@@ -803,6 +731,88 @@
803
731
  _this.setAreaHeight();
804
732
  }));
805
733
  };
734
+ /**To map IwidgetInfo object to gridsterItem */
735
+ /**
736
+ * To map IwidgetInfo object to gridsterItem
737
+ * @param {?} widget
738
+ * @return {?}
739
+ */
740
+ RADashboardArea.prototype.mapObjectsToGridsterItem = /**
741
+ * To map IwidgetInfo object to gridsterItem
742
+ * @param {?} widget
743
+ * @return {?}
744
+ */
745
+ function (widget) {
746
+ /** @type {?} */
747
+ var gridsterItem = (/** @type {?} */ ({
748
+ cols: widget.width,
749
+ rows: widget.height,
750
+ x: widget.position_x,
751
+ y: widget.position_y,
752
+ widgetInfo: widget
753
+ }));
754
+ return gridsterItem;
755
+ };
756
+ /**
757
+ * @param {?} widgetList
758
+ * @return {?}
759
+ */
760
+ RADashboardArea.prototype.mapObjectListToGridsterItemList = /**
761
+ * @param {?} widgetList
762
+ * @return {?}
763
+ */
764
+ function (widgetList) {
765
+ var _this = this;
766
+ /** @type {?} */
767
+ var widgetArray = Array();
768
+ widgetList.forEach((/**
769
+ * @param {?} widget
770
+ * @return {?}
771
+ */
772
+ function (widget) {
773
+ widgetArray.push(_this.mapObjectsToGridsterItem(widget));
774
+ }));
775
+ return widgetArray;
776
+ };
777
+ /**
778
+ * @param {?} widgetItem
779
+ * @return {?}
780
+ */
781
+ RADashboardArea.prototype.mapGridsterItemToObject = /**
782
+ * @param {?} widgetItem
783
+ * @return {?}
784
+ */
785
+ function (widgetItem) {
786
+ /** @type {?} */
787
+ var widget;
788
+ widget = widgetItem.widgetInfo;
789
+ widget.height = widgetItem.rows;
790
+ widget.width = widgetItem.cols;
791
+ widget.position_x = widgetItem.x;
792
+ widget.position_y = widgetItem.y;
793
+ return widget;
794
+ };
795
+ /**
796
+ * @param {?} widgetItemList
797
+ * @return {?}
798
+ */
799
+ RADashboardArea.prototype.mapGridsterListToObject = /**
800
+ * @param {?} widgetItemList
801
+ * @return {?}
802
+ */
803
+ function (widgetItemList) {
804
+ var _this = this;
805
+ /** @type {?} */
806
+ var widgetListArray = Array();
807
+ widgetItemList.forEach((/**
808
+ * @param {?} widget
809
+ * @return {?}
810
+ */
811
+ function (widget) {
812
+ widgetListArray.push(_this.mapGridsterItemToObject(widget));
813
+ }));
814
+ return widgetListArray;
815
+ };
806
816
  RADashboardArea.decorators = [
807
817
  { type: core.Component, args: [{
808
818
  selector: 'ra-dashboard-area',