|
@@ -55,6 +55,13 @@ App.stackServiceMapper = App.QuickDataMapper.create({
|
|
|
}
|
|
|
},
|
|
|
|
|
|
+ mapStackServices: function(json) {
|
|
|
+ this.clearStackModels();
|
|
|
+ App.resetDsStoreTypeMap(App.StackServiceComponent);
|
|
|
+ App.resetDsStoreTypeMap(App.StackService);
|
|
|
+ this.map(json);
|
|
|
+ },
|
|
|
+
|
|
|
map: function (json) {
|
|
|
var model = this.get('model');
|
|
|
var result = [];
|
|
@@ -75,12 +82,25 @@ App.stackServiceMapper = App.QuickDataMapper.create({
|
|
|
result.push(this.parseIt(stackService, this.get('config')));
|
|
|
}
|
|
|
}, this);
|
|
|
- if (!$.mocho)
|
|
|
- App.store.commit();
|
|
|
App.store.loadMany(this.get('component_model'), stackServiceComponents);
|
|
|
App.store.loadMany(model, result);
|
|
|
},
|
|
|
|
|
|
+ /**
|
|
|
+ * Clean store from already loaded data.
|
|
|
+ **/
|
|
|
+ clearStackModels: function () {
|
|
|
+ var models = [App.StackServiceComponent, App.StackService];
|
|
|
+ models.forEach(function (model) {
|
|
|
+ var records = App.get('store').findAll(model).filterProperty('id');
|
|
|
+ records.forEach(function (rec) {
|
|
|
+ Ember.run(this, function () {
|
|
|
+ rec.deleteRecord();
|
|
|
+ });
|
|
|
+ }, this);
|
|
|
+ }, this);
|
|
|
+ },
|
|
|
+
|
|
|
rearrangeServicesForDisplayOrder: function (array, displayOrderArray) {
|
|
|
return array.sort(function (a, b) {
|
|
|
var aValue = displayOrderArray.indexOf(a.StackServices.service_name) != -1 ? displayOrderArray.indexOf(a.StackServices.service_name) : array.length;
|