|
@@ -18,52 +18,19 @@
|
|
|
|
|
|
|
|
|
App.widgetLayoutMapper = App.QuickDataMapper.create({
|
|
|
- widgetLayoutModel: App.WidgetLayout,
|
|
|
- widgetModel: App.Widget,
|
|
|
- widgetLayoutConfig: {
|
|
|
- id: 'id',
|
|
|
- layout_name: 'layout_name',
|
|
|
- section_name: 'section_name',
|
|
|
- scope: 'scope',
|
|
|
- user: 'user_name',
|
|
|
- display_name: 'display_name',
|
|
|
- widgets_key: 'widgets',
|
|
|
+ model: App.WidgetLayout,
|
|
|
+
|
|
|
+ config: {
|
|
|
+ id: 'WidgetLayoutInfo.id',
|
|
|
+ layout_name: 'WidgetLayoutInfo.layout_name',
|
|
|
+ section_name: 'WidgetLayoutInfo.section_name',
|
|
|
+ scope: 'WidgetLayoutInfo.scope',
|
|
|
+ user: 'WidgetLayoutInfo.user_name',
|
|
|
+ display_name: 'WidgetLayoutInfo.display_name',
|
|
|
+ widgets_key: 'WidgetLayoutInfo.widgets',
|
|
|
widgets_type: 'array',
|
|
|
widgets: {
|
|
|
- item: 'id'
|
|
|
+ item: 'WidgetInfo.id'
|
|
|
}
|
|
|
- },
|
|
|
- widgetConfig: {
|
|
|
- id: 'id',
|
|
|
- widget_name: 'widget_name',
|
|
|
- default_order: 'default_order',
|
|
|
- widget_type: 'widget_type',
|
|
|
- display_name: 'display_name',
|
|
|
- time_created: 'time_created',
|
|
|
- author: 'author',
|
|
|
- properties: 'properties',
|
|
|
- metrics: 'metrics',
|
|
|
- values: 'values',
|
|
|
- description: 'description',
|
|
|
- scope: 'scope'
|
|
|
- },
|
|
|
-
|
|
|
-
|
|
|
- map: function(json) {
|
|
|
- var modelWidget = this.widgetModel;
|
|
|
- var modelWidgetLayout = this.widgetLayoutModel;
|
|
|
-
|
|
|
- var resultWidget = [];
|
|
|
- json.WidgetLayoutInfo.widgets.forEach(function(item, index) {
|
|
|
- item = item.WidgetInfo;
|
|
|
- item.metrics = JSON.parse(item.metrics);
|
|
|
- item.values = JSON.parse(item.values);
|
|
|
- resultWidget.push(this.parseIt(item, this.widgetConfig));
|
|
|
- json.WidgetLayoutInfo.widgets[index] = item;
|
|
|
- },this);
|
|
|
-
|
|
|
- var resultWidgetLayout = this.parseIt(json.WidgetLayoutInfo, this.widgetLayoutConfig);
|
|
|
- App.store.loadMany(modelWidget, resultWidget);
|
|
|
- App.store.load(modelWidgetLayout, resultWidgetLayout);
|
|
|
}
|
|
|
});
|