You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by at...@apache.org on 2017/02/15 14:36:00 UTC
ambari git commit: AMBARI-20016 Hosts page moving through pages gets
progressively slower to the point of being unusable. (atkach)
Repository: ambari
Updated Branches:
refs/heads/trunk 141e88dd4 -> a1f23ad42
AMBARI-20016 Hosts page moving through pages gets progressively slower to the point of being unusable. (atkach)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/a1f23ad4
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/a1f23ad4
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/a1f23ad4
Branch: refs/heads/trunk
Commit: a1f23ad4284cff716b890392c4c22a16229e16ad
Parents: 141e88d
Author: Andrii Tkach <at...@apache.org>
Authored: Wed Feb 15 16:35:38 2017 +0200
Committer: Andrii Tkach <at...@apache.org>
Committed: Wed Feb 15 16:35:38 2017 +0200
----------------------------------------------------------------------
ambari-web/app/controllers/main.js | 5 +++
.../controllers/main/service/add_controller.js | 2 +-
.../service/manage_config_groups_controller.js | 14 +++----
.../app/controllers/wizard/step7_controller.js | 6 +--
.../mappers/alert_definition_summary_mapper.js | 4 --
.../app/mappers/alert_definitions_mapper.js | 15 ++++----
ambari-web/app/mappers/alert_groups_mapper.js | 3 +-
.../app/mappers/alert_instances_mapper.js | 2 +-
.../app/mappers/alert_notification_mapper.js | 2 +-
ambari-web/app/mappers/cluster_mapper.js | 2 +-
.../app/mappers/components_state_mapper.js | 6 +--
.../app/mappers/configs/config_groups_mapper.js | 4 +-
.../configs/service_config_version_mapper.js | 3 +-
ambari-web/app/mappers/configs/themes_mapper.js | 25 ++++--------
ambari-web/app/mappers/hosts_mapper.js | 10 ++---
ambari-web/app/mappers/quicklinks_mapper.js | 3 +-
.../app/mappers/repository_version_mapper.js | 9 ++---
ambari-web/app/mappers/root_service_mapper.js | 5 +--
ambari-web/app/mappers/server_data_mapper.js | 40 +++++++++++++++++++-
ambari-web/app/mappers/service_mapper.js | 3 +-
.../app/mappers/service_metrics_mapper.js | 20 +++++-----
ambari-web/app/mappers/stack_mapper.js | 9 ++---
ambari-web/app/mappers/stack_service_mapper.js | 6 +--
.../app/mappers/stack_upgrade_history_mapper.js | 3 +-
ambari-web/app/mappers/stack_version_mapper.js | 3 +-
ambari-web/app/mappers/target_cluster_mapper.js | 2 +-
ambari-web/app/mappers/users_mapper.js | 2 +-
ambari-web/app/mappers/widget_mapper.js | 3 +-
.../main/service/configs/config_overridable.js | 8 ++--
.../app/mixins/main/service/groups_mapping.js | 1 -
ambari-web/app/models/user.js | 2 +-
ambari-web/app/utils/http_client.js | 5 ---
ambari-web/test/controllers/main/admin_test.js | 8 ++--
.../test/controllers/main/host/details_test.js | 4 +-
.../main/service/add_controller_test.js | 4 +-
.../test/controllers/main/service/item_test.js | 2 +-
.../test/mappers/alert_groups_mapper_test.js | 4 +-
.../service/configs/config_overridable_test.js | 12 +++---
ambari-web/test/models/host_component_test.js | 2 +-
.../test/models/host_stack_version_test.js | 12 +++---
ambari-web/test/models/rack_test.js | 4 +-
ambari-web/test/models/stack_service_test.js | 2 +-
ambari-web/test/utils/http_client_test.js | 9 -----
43 files changed, 142 insertions(+), 148 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/a1f23ad4/ambari-web/app/controllers/main.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main.js b/ambari-web/app/controllers/main.js
index 87a483e..798115f 100644
--- a/ambari-web/app/controllers/main.js
+++ b/ambari-web/app/controllers/main.js
@@ -46,6 +46,11 @@ App.MainController = Em.Controller.extend({
* run all processes and cluster's data loading
*/
initialize: function(){
+ // Since we use only defaultTransaction, we can stub <code>removeCleanRecords</code> method,
+ // because it would remove from and add records to the same (default) transaction
+ App.store.defaultTransaction.reopen({
+ removeCleanRecords: Em.K
+ });
App.router.get('clusterController').loadClusterData();
},
http://git-wip-us.apache.org/repos/asf/ambari/blob/a1f23ad4/ambari-web/app/controllers/main/service/add_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/service/add_controller.js b/ambari-web/app/controllers/main/service/add_controller.js
index f312a5a..0989f76 100644
--- a/ambari-web/app/controllers/main/service/add_controller.js
+++ b/ambari-web/app/controllers/main/service/add_controller.js
@@ -198,7 +198,7 @@ App.AddServiceController = App.WizardController.extend(App.AddSecurityConfigs, {
}, this);
this.setDBProperty('services', services);
}
- App.store.commit();
+ App.store.fastCommit();
this.set('serviceToInstall', null);
this.set('content.services', stackServices);
var self = this;
http://git-wip-us.apache.org/repos/asf/ambari/blob/a1f23ad4/ambari-web/app/controllers/main/service/manage_config_groups_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/service/manage_config_groups_controller.js b/ambari-web/app/controllers/main/service/manage_config_groups_controller.js
index 4cf22d4..0df5dc5 100644
--- a/ambari-web/app/controllers/main/service/manage_config_groups_controller.js
+++ b/ambari-web/app/controllers/main/service/manage_config_groups_controller.js
@@ -679,7 +679,7 @@ App.ManageConfigGroupsController = Em.Controller.extend(App.ConfigOverridable, {
name: this.get('configGroupName'),
description: this.get('configGroupDesc')
});
- App.store.commit();
+ App.store.fastCommit();
this.hide();
}
});
@@ -745,7 +745,7 @@ App.ManageConfigGroupsController = Em.Controller.extend(App.ConfigOverridable, {
});
}
- App.store.load(App.ServiceConfigGroup, {
+ App.store.safeLoad(App.ServiceConfigGroup, {
id: newGroupId,
name: groupName,
description: this.get('configGroupDesc'),
@@ -758,11 +758,11 @@ App.ManageConfigGroupsController = Em.Controller.extend(App.ConfigOverridable, {
properties: duplicated ? properties : [],
is_temporary: true
});
- App.store.commit();
+ App.store.fastCommit();
var childConfigGroups = defaultConfigGroup.get('childConfigGroups').mapProperty('id');
childConfigGroups.push(newGroupId);
- App.store.load(App.ServiceConfigGroup, App.configGroupsMapper.generateDefaultGroup(self.get('serviceName'), defaultConfigGroup.get('hosts'), childConfigGroups));
- App.store.commit();
+ App.store.safeLoad(App.ServiceConfigGroup, App.configGroupsMapper.generateDefaultGroup(self.get('serviceName'), defaultConfigGroup.get('hosts'), childConfigGroups));
+ App.store.fastCommit();
self.get('configGroups').pushObject(App.ServiceConfigGroup.find(newGroupId));
this.hide();
}
@@ -853,9 +853,7 @@ App.ManageConfigGroupsController = Em.Controller.extend(App.ConfigOverridable, {
resetGroupChanges: function (originalGroups) {
if (this.get('subViewController.isHostsModified')) {
App.ServiceConfigGroup.find().clear();
- App.store.commit();
- App.store.loadMany(App.ServiceConfigGroup, originalGroups);
- App.store.commit();
+ App.store.safeLoadMany(App.ServiceConfigGroup, originalGroups);
}
},
http://git-wip-us.apache.org/repos/asf/ambari/blob/a1f23ad4/ambari-web/app/controllers/wizard/step7_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/wizard/step7_controller.js b/ambari-web/app/controllers/wizard/step7_controller.js
index 1d24ee3..0207e6b 100644
--- a/ambari-web/app/controllers/wizard/step7_controller.js
+++ b/ambari-web/app/controllers/wizard/step7_controller.js
@@ -670,7 +670,7 @@ App.WizardStep7Controller = Em.Controller.extend(App.ServerValidatorMixin, App.E
console.time('loadConfigGroups execution time: ');
this.loadConfigGroups(this.get('allSelectedServiceNames')).done(this.loadOverrides.bind(this));
} else {
- App.store.commit();
+ App.store.fastCommit();
App.configGroupsMapper.map(null, false, this.get('allSelectedServiceNames'));
this.onLoadOverrides();
}
@@ -1132,9 +1132,7 @@ App.WizardStep7Controller = Em.Controller.extend(App.ServerValidatorMixin, App.E
if (service.get('serviceName') === 'MISC') return;
var serviceRawGroups = serviceConfigGroups.filterProperty('service_name', service.serviceName);
if (serviceRawGroups.length) {
- App.store.commit();
- App.store.loadMany(App.ServiceConfigGroup, serviceRawGroups);
- App.store.commit();
+ App.store.safeLoadMany(App.ServiceConfigGroup, serviceRawGroups);
serviceRawGroups.forEach(function(item){
var modelGroup = App.ServiceConfigGroup.find(item.id);
modelGroup.set('properties', []);
http://git-wip-us.apache.org/repos/asf/ambari/blob/a1f23ad4/ambari-web/app/mappers/alert_definition_summary_mapper.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mappers/alert_definition_summary_mapper.js b/ambari-web/app/mappers/alert_definition_summary_mapper.js
index 8b59c7c..29f286e 100644
--- a/ambari-web/app/mappers/alert_definition_summary_mapper.js
+++ b/ambari-web/app/mappers/alert_definition_summary_mapper.js
@@ -114,10 +114,6 @@ App.alertDefinitionSummaryMapper = App.QuickDataMapper.create({
});
}
});
- if (!$.mocho) {
- //for some reasons this causing error in unit test
- App.store.commit();
- }
console.timeEnd('App.alertDefinitionSummaryMapper execution time');
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/a1f23ad4/ambari-web/app/mappers/alert_definitions_mapper.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mappers/alert_definitions_mapper.js b/ambari-web/app/mappers/alert_definitions_mapper.js
index c400b89..ca0ada6 100644
--- a/ambari-web/app/mappers/alert_definitions_mapper.js
+++ b/ambari-web/app/mappers/alert_definitions_mapper.js
@@ -228,16 +228,15 @@ App.alertDefinitionsMapper = App.QuickDataMapper.create({
});
// load all mapped data to model
- App.store.loadMany(this.get('reportModel'), alertReportDefinitions);
- App.store.loadMany(this.get('parameterModel'), parameters);
- App.store.loadMany(this.get('metricsSourceModel'), alertMetricsSourceDefinitions);
+ App.store.safeLoadMany(this.get('reportModel'), alertReportDefinitions);
+ App.store.safeLoadMany(this.get('parameterModel'), parameters);
+ App.store.safeLoadMany(this.get('metricsSourceModel'), alertMetricsSourceDefinitions);
this.setMetricsSourcePropertyLists(this.get('metricsSourceModel'), alertMetricsSourceDefinitions);
- App.store.loadMany(this.get('metricsUriModel'), alertMetricsUriDefinitions);
- App.store.loadMany(this.get('metricsAmsModel'), alertMetricsAmsDefinitions);
- // this loadMany takes too much time
- App.store.loadMany(this.get('model'), alertDefinitions);
+ App.store.safeLoadMany(this.get('metricsUriModel'), alertMetricsUriDefinitions);
+ App.store.safeLoadMany(this.get('metricsAmsModel'), alertMetricsAmsDefinitions);
+ // this safeLoadMany takes too much time
+ App.store.safeLoadMany(this.get('model'), alertDefinitions);
this.setAlertDefinitionsRawSourceData(rawSourceData);
- App.store.commit();
}
console.timeEnd('App.alertDefinitionsMapper execution time');
},
http://git-wip-us.apache.org/repos/asf/ambari/blob/a1f23ad4/ambari-web/app/mappers/alert_groups_mapper.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mappers/alert_groups_mapper.js b/ambari-web/app/mappers/alert_groups_mapper.js
index c079c21..1fd38f5 100644
--- a/ambari-web/app/mappers/alert_groups_mapper.js
+++ b/ambari-web/app/mappers/alert_groups_mapper.js
@@ -109,8 +109,7 @@ App.alertGroupsMapper = App.QuickDataMapper.create({
App.cache['previousAlertGroupsFullMap'] = groupsMap;
App.cache['alertNotificationsGroupsMap'] = alertNotificationsGroupsMap;
// initial load takes much more time than others, but it's OK (all data should be saved first time)
- App.store.loadMany(this.get('model'), alertGroups);
- App.store.commit();
+ App.store.safeLoadMany(this.get('model'), alertGroups);
console.timeEnd('App.alertGroupsMapper execution time');
}
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/a1f23ad4/ambari-web/app/mappers/alert_instances_mapper.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mappers/alert_instances_mapper.js b/ambari-web/app/mappers/alert_instances_mapper.js
index 269941b..f547642 100644
--- a/ambari-web/app/mappers/alert_instances_mapper.js
+++ b/ambari-web/app/mappers/alert_instances_mapper.js
@@ -71,7 +71,7 @@ App.alertInstanceMapper = App.QuickDataMapper.create({
model.find().clear();
}
- App.store.loadMany(model, alertInstances);
+ App.store.safeLoadMany(model, alertInstances);
console.timeEnd('App.alertInstanceMapper execution time');
}
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/a1f23ad4/ambari-web/app/mappers/alert_notification_mapper.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mappers/alert_notification_mapper.js b/ambari-web/app/mappers/alert_notification_mapper.js
index 9567c77..8c7f50f 100644
--- a/ambari-web/app/mappers/alert_notification_mapper.js
+++ b/ambari-web/app/mappers/alert_notification_mapper.js
@@ -61,7 +61,7 @@ App.alertNotificationMapper = App.QuickDataMapper.create({
notificationsAlertStates[item.AlertTarget.id] = item.AlertTarget.alert_states;
}, this);
- App.store.loadMany(this.get('model'), result);
+ App.store.safeLoadMany(this.get('model'), result);
App.cache['previousAlertNotificationsFullMap'] = notifications;
this._setPropertiesToEachModel('properties', notificationsProperties);
this._setPropertiesToEachModel('alertStates', notificationsAlertStates);
http://git-wip-us.apache.org/repos/asf/ambari/blob/a1f23ad4/ambari-web/app/mappers/cluster_mapper.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mappers/cluster_mapper.js b/ambari-web/app/mappers/cluster_mapper.js
index 5689867..d1aa63b 100644
--- a/ambari-web/app/mappers/cluster_mapper.js
+++ b/ambari-web/app/mappers/cluster_mapper.js
@@ -24,7 +24,7 @@ App.clusterMapper = App.QuickDataMapper.create({
if(json){
var result = json;
result = this.parseIt(result, this.config);
- App.store.load(this.get('model'), result);
+ App.store.safeLoad(this.get('model'), result);
var cluster = App.Cluster.find(result.id);
var clusterDesiredConfigs = [];
// Create desired_configs_array
http://git-wip-us.apache.org/repos/asf/ambari/blob/a1f23ad4/ambari-web/app/mappers/components_state_mapper.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mappers/components_state_mapper.js b/ambari-web/app/mappers/components_state_mapper.js
index 89d5af2..a7e6d60 100644
--- a/ambari-web/app/mappers/components_state_mapper.js
+++ b/ambari-web/app/mappers/components_state_mapper.js
@@ -214,9 +214,9 @@ App.componentsStateMapper = App.QuickDataMapper.create({
}
}, this);
}
- App.store.loadMany(this.clientModel, clients);
- App.store.loadMany(this.slaveModel, slaves);
- App.store.loadMany(this.masterModel, masters);
+ App.store.safeLoadMany(this.clientModel, clients);
+ App.store.safeLoadMany(this.slaveModel, slaves);
+ App.store.safeLoadMany(this.masterModel, masters);
if (hasNewComponents) {
App.get('router.clusterController').triggerQuickLinksUpdate();
http://git-wip-us.apache.org/repos/asf/ambari/blob/a1f23ad4/ambari-web/app/mappers/configs/config_groups_mapper.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mappers/configs/config_groups_mapper.js b/ambari-web/app/mappers/configs/config_groups_mapper.js
index fe3d7a1..e735d84 100644
--- a/ambari-web/app/mappers/configs/config_groups_mapper.js
+++ b/ambari-web/app/mappers/configs/config_groups_mapper.js
@@ -108,9 +108,7 @@ App.configGroupsMapper = App.QuickDataMapper.create({
configGroups.sort(function (configGroupA, configGroupB) {
return configGroupA.is_default || (configGroupA.name > configGroupB.name);
});
- App.store.commit();
- App.store.loadMany(this.get('model'), configGroups);
- App.store.commit();
+ App.store.safeLoadMany(this.get('model'), configGroups);
}
console.timeEnd('App.configGroupsMapper');
},
http://git-wip-us.apache.org/repos/asf/ambari/blob/a1f23ad4/ambari-web/app/mappers/configs/service_config_version_mapper.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mappers/configs/service_config_version_mapper.js b/ambari-web/app/mappers/configs/service_config_version_mapper.js
index 68bf235..e95c925 100644
--- a/ambari-web/app/mappers/configs/service_config_version_mapper.js
+++ b/ambari-web/app/mappers/configs/service_config_version_mapper.js
@@ -98,8 +98,7 @@ App.serviceConfigVersionsMapper = App.QuickDataMapper.create({
if (App.router.get('currentState.name') === 'configHistory') {
this.get('model').find().clear();
}
- App.store.commit();
- App.store.loadMany(this.get('model'), result);
+ App.store.safeLoadMany(this.get('model'), result);
console.timeEnd('App.serviceConfigVersionsMapper');
}
},
http://git-wip-us.apache.org/repos/asf/ambari/blob/a1f23ad4/ambari-web/app/mappers/configs/themes_mapper.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mappers/configs/themes_mapper.js b/ambari-web/app/mappers/configs/themes_mapper.js
index 8ad51bd..1e98b34 100644
--- a/ambari-web/app/mappers/configs/themes_mapper.js
+++ b/ambari-web/app/mappers/configs/themes_mapper.js
@@ -85,8 +85,7 @@ App.themesMapper = App.QuickDataMapper.create({
this.mapThemeWidgets(item);
}, this);
- App.store.commit();
- App.store.loadMany(this.get("tabModel"), tabs);
+ App.store.safeLoadMany(this.get("tabModel"), tabs);
this.generateAdvancedTabs(serviceNames);
console.timeEnd('App.themesMapper execution time');
},
@@ -136,9 +135,7 @@ App.themesMapper = App.QuickDataMapper.create({
var type = 'subsectionTab';
this.mapThemeConditions(subSectionTabConditions, type);
}
- App.store.commit();
- App.store.loadMany(this.get("subSectionTabModel"), subSectionTabs);
- App.store.commit();
+ App.store.safeLoadMany(this.get("subSectionTabModel"), subSectionTabs);
parsedSubSection.sub_section_tabs = subSectionTabs.mapProperty("id");
}
if (parsedSubSection['depends_on']) {
@@ -150,18 +147,14 @@ App.themesMapper = App.QuickDataMapper.create({
var type = 'subsection';
this.mapThemeConditions(subSectionConditions, type);
}
- App.store.commit();
- App.store.loadMany(this.get("subSectionModel"), subSections);
- App.store.commit();
+ App.store.safeLoadMany(this.get("subSectionModel"), subSections);
parsedSection.sub_sections = subSections.mapProperty("id");
}
sections.push(parsedSection);
}, this);
- App.store.commit();
- App.store.loadMany(this.get("sectionModel"), sections);
- App.store.commit();
+ App.store.safeLoadMany(this.get("sectionModel"), sections);
parsedTab.sections = sections.mapProperty("id");
}
@@ -283,8 +276,7 @@ App.themesMapper = App.QuickDataMapper.create({
configConditionsCopy.pushObject(configCondition);
}, this);
- App.store.loadMany(this.get("themeConditionModel"), configConditionsCopy);
- App.store.commit();
+ App.store.safeLoadMany(this.get("themeConditionModel"), configConditionsCopy);
},
/**
@@ -314,8 +306,7 @@ App.themesMapper = App.QuickDataMapper.create({
subSectionConditionsCopy.pushObject(subSectionCondition);
}, this);
}, this);
- App.store.loadMany(this.get("themeConditionModel"), subSectionConditionsCopy);
- App.store.commit();
+ App.store.safeLoadMany(this.get("themeConditionModel"), subSectionConditionsCopy);
},
/**
@@ -374,8 +365,6 @@ App.themesMapper = App.QuickDataMapper.create({
service_name: serviceName
});
});
- App.store.commit();
- App.store.loadMany(this.get("tabModel"), advancedTabs);
- App.store.commit();
+ App.store.safeLoadMany(this.get("tabModel"), advancedTabs);
}
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/a1f23ad4/ambari-web/app/mappers/hosts_mapper.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mappers/hosts_mapper.js b/ambari-web/app/mappers/hosts_mapper.js
index 3c7dd70..b64bd8d 100644
--- a/ambari-web/app/mappers/hosts_mapper.js
+++ b/ambari-web/app/mappers/hosts_mapper.js
@@ -213,15 +213,15 @@ App.hostsMapper = App.QuickDataMapper.create({
if (componentsIdMap[key]) componentsIdMap[key].display_name_advanced = App.HostComponent.find(key).get('displayNameAdvanced');
}
- App.store.commit();
- App.store.loadMany(App.HostStackVersion, stackVersions);
- App.store.loadMany(App.HostComponentLog, hostComponentLogs);
- App.store.loadMany(App.HostComponent, components);
//"itemTotal" present only for Hosts page request
if (!Em.isNone(json.itemTotal)) {
App.Host.find().clear();
+ App.HostComponent.find().clear();
}
- App.store.loadMany(App.Host, hostsWithFullInfo);
+ App.store.safeLoadMany(App.HostStackVersion, stackVersions);
+ App.store.safeLoadMany(App.HostComponentLog, hostComponentLogs);
+ App.store.safeLoadMany(App.HostComponent, components);
+ App.store.safeLoadMany(App.Host, hostsWithFullInfo);
var itemTotal = parseInt(json.itemTotal);
if (!isNaN(itemTotal)) {
App.router.set('mainHostController.filteredCount', itemTotal);
http://git-wip-us.apache.org/repos/asf/ambari/blob/a1f23ad4/ambari-web/app/mappers/quicklinks_mapper.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mappers/quicklinks_mapper.js b/ambari-web/app/mappers/quicklinks_mapper.js
index 6cb1fe0..6de9b34 100644
--- a/ambari-web/app/mappers/quicklinks_mapper.js
+++ b/ambari-web/app/mappers/quicklinks_mapper.js
@@ -43,8 +43,7 @@ App.quicklinksMapper = App.QuickDataMapper.create({
result.push(parseResult);
}, this);
- App.store.loadMany(this.get('model'), result);
- App.store.commit();
+ App.store.safeLoadMany(this.get('model'), result);
console.timeEnd('App.quicklinksMapper execution time');
}
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/a1f23ad4/ambari-web/app/mappers/repository_version_mapper.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mappers/repository_version_mapper.js b/ambari-web/app/mappers/repository_version_mapper.js
index 48e460b..8ef50db 100644
--- a/ambari-web/app/mappers/repository_version_mapper.js
+++ b/ambari-web/app/mappers/repository_version_mapper.js
@@ -152,11 +152,10 @@ App.repoVersionMapper = App.QuickDataMapper.create({
}
}, this);
}
- App.store.commit();
- App.store.loadMany(modelRepositories, resultRepo);
- App.store.loadMany(modelOperatingSystems, resultOS);
- App.store.loadMany(modelServices, resultService);
- App.store.loadMany(modelRepoVersions, resultRepoVersion);
+ App.store.safeLoadMany(modelRepositories, resultRepo);
+ App.store.safeLoadMany(modelOperatingSystems, resultOS);
+ App.store.safeLoadMany(modelServices, resultService);
+ App.store.safeLoadMany(modelRepoVersions, resultRepoVersion);
},
/**
http://git-wip-us.apache.org/repos/asf/ambari/blob/a1f23ad4/ambari-web/app/mappers/root_service_mapper.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mappers/root_service_mapper.js b/ambari-web/app/mappers/root_service_mapper.js
index 1e0e070..66a4849 100644
--- a/ambari-web/app/mappers/root_service_mapper.js
+++ b/ambari-web/app/mappers/root_service_mapper.js
@@ -51,8 +51,7 @@ App.rootServiceMapper = App.QuickDataMapper.create({
rootServiceComponents.push(this.parseIt(item.RootServiceComponents, this.configRootServiceComponents));
}, this);
rootService.components = rootServiceComponents;
- App.store.commit();
- App.store.loadMany(rootServiceComponentModel, rootServiceComponents);
- App.store.load(rootServiceModel, this.parseIt(rootService, this.configRootService));
+ App.store.safeLoadMany(rootServiceComponentModel, rootServiceComponents);
+ App.store.safeLoad(rootServiceModel, this.parseIt(rootService, this.configRootService));
}
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/a1f23ad4/ambari-web/app/mappers/server_data_mapper.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mappers/server_data_mapper.js b/ambari-web/app/mappers/server_data_mapper.js
index a99d8ae..8a32eb0 100644
--- a/ambari-web/app/mappers/server_data_mapper.js
+++ b/ambari-web/app/mappers/server_data_mapper.js
@@ -43,6 +43,42 @@ App.cache.clear = function () {
App.cache.clear = clear;
};
+App.store.reopen({
+ safeLoadMany: function(model, records) {
+ try {
+ this.loadMany(model, records);
+ } catch (e) {
+ console.debug('Resolve uncommitted records before load');
+ this.fastCommit();
+ this.loadMany(model, records);
+ }
+ },
+
+ safeLoad: function(model, record) {
+ try {
+ this.load(model, record);
+ } catch (e) {
+ console.debug('Resolve uncommitted record before load');
+ this.fastCommit();
+ this.load(model, record);
+ }
+ },
+
+ /**
+ * App.store.commit() - creates new transaction,
+ * and them move all records from old to new transactions which is expensive
+ *
+ * We should use only defaultTransaction,
+ * and then we can stub <code>removeCleanRecords</code> method,
+ * because it would remove from and add records to the same (default) transaction
+ */
+ fastCommit: function() {
+ console.time('store commit');
+ App.store.defaultTransaction.commit();
+ console.timeEnd('store commit');
+ }
+});
+
App.ServerDataMapper = Em.Object.extend({
jsonKey: false,
map: function (json) {
@@ -77,7 +113,7 @@ App.QuickDataMapper = App.ServerDataMapper.extend({
result.push(this.parseIt(item, this.config));
}, this);
- App.store.loadMany(this.get('model'), result);
+ App.store.safeLoadMany(this.get('model'), result);
}
},
@@ -144,7 +180,7 @@ App.QuickDataMapper = App.ServerDataMapper.extend({
*/
deleteRecord: function (item) {
item.deleteRecord();
- App.store.commit();
+ App.store.fastCommit();
item.get('stateManager').transitionTo('loading');
},
/**
http://git-wip-us.apache.org/repos/asf/ambari/blob/a1f23ad4/ambari-web/app/mappers/service_mapper.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mappers/service_mapper.js b/ambari-web/app/mappers/service_mapper.js
index 9a330f9..3523379 100644
--- a/ambari-web/app/mappers/service_mapper.js
+++ b/ambari-web/app/mappers/service_mapper.js
@@ -57,8 +57,7 @@ App.serviceMapper = App.QuickDataMapper.create({
return self.parseIt(item, self.get('config'));
});
parsedCacheServices = misc.sortByOrder(App.StackService.find().mapProperty('serviceName'), parsedCacheServices);
- App.store.loadMany(this.get('model'), parsedCacheServices);
- App.store.commit();
+ App.store.safeLoadMany(this.get('model'), parsedCacheServices);
this.set('initialAppLoad', true);
}
this.servicesLoading().done(function setMaintenanceState() {
http://git-wip-us.apache.org/repos/asf/ambari/blob/a1f23ad4/ambari-web/app/mappers/service_metrics_mapper.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mappers/service_metrics_mapper.js b/ambari-web/app/mappers/service_metrics_mapper.js
index c4f37df..87b6149 100644
--- a/ambari-web/app/mappers/service_metrics_mapper.js
+++ b/ambari-web/app/mappers/service_metrics_mapper.js
@@ -231,7 +231,7 @@ App.serviceMetricsMapper = App.QuickDataMapper.create({
}, this);
previousMasterComponentIds = hostComponents.mapProperty('id');
- App.store.loadMany(this.get('model3'), hostComponents);
+ App.store.safeLoadMany(this.get('model3'), hostComponents);
//parse service metrics from components
services.forEach(function (item) {
@@ -253,7 +253,7 @@ App.serviceMetricsMapper = App.QuickDataMapper.create({
result = misc.sortByOrder(stackServices, result);
//load services to model
- App.store.loadMany(this.get('model'), result);
+ App.store.safeLoadMany(this.get('model'), result);
// check for new components
if (lastKnownStatusesLength > 0) {
@@ -290,33 +290,33 @@ App.serviceMetricsMapper = App.QuickDataMapper.create({
if (item && item.ServiceInfo && item.ServiceInfo.service_name == "HDFS") {
finalJson = this.hdfsMapper(item);
finalJson.rand = Math.random();
- App.store.load(App.HDFSService, finalJson);
+ App.store.safeLoad(App.HDFSService, finalJson);
} else if (item && item.ServiceInfo && item.ServiceInfo.service_name == "HBASE") {
finalJson = this.hbaseMapper(item);
finalJson.rand = Math.random();
- App.store.load(App.HBaseService, finalJson);
+ App.store.safeLoad(App.HBaseService, finalJson);
} else if (item && item.ServiceInfo && item.ServiceInfo.service_name == "FLUME") {
finalJson = this.flumeMapper(item);
finalJson.rand = Math.random();
- App.store.loadMany(App.FlumeAgent, finalJson.agentJsons);
- App.store.load(App.FlumeService, finalJson);
+ App.store.safeLoadMany(App.FlumeAgent, finalJson.agentJsons);
+ App.store.safeLoad(App.FlumeService, finalJson);
} else if (item && item.ServiceInfo && item.ServiceInfo.service_name == "YARN") {
finalJson = this.yarnMapper(item);
finalJson.rand = Math.random();
- App.store.load(App.YARNService, finalJson);
+ App.store.safeLoad(App.YARNService, finalJson);
} else if (item && item.ServiceInfo && item.ServiceInfo.service_name == "MAPREDUCE2") {
finalJson = this.mapreduce2Mapper(item);
finalJson.rand = Math.random();
- App.store.load(App.MapReduce2Service, finalJson);
+ App.store.safeLoad(App.MapReduce2Service, finalJson);
} else if (item && item.ServiceInfo && item.ServiceInfo.service_name == "STORM") {
finalJson = this.stormMapper(item);
finalJson.rand = Math.random();
this.mapQuickLinks(finalJson, item);
- App.store.load(App.StormService, finalJson);
+ App.store.safeLoad(App.StormService, finalJson);
} else if (item && item.ServiceInfo && item.ServiceInfo.service_name == "RANGER") {
finalJson = this.rangerMapper(item);
finalJson.rand = Math.random();
- App.store.load(App.RangerService, finalJson);
+ App.store.safeLoad(App.RangerService, finalJson);
} else {
finalJson = this.parseIt(item, this.config);
finalJson.rand = Math.random();
http://git-wip-us.apache.org/repos/asf/ambari/blob/a1f23ad4/ambari-web/app/mappers/stack_mapper.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mappers/stack_mapper.js b/ambari-web/app/mappers/stack_mapper.js
index b1a5faf..4b6a6f8 100644
--- a/ambari-web/app/mappers/stack_mapper.js
+++ b/ambari-web/app/mappers/stack_mapper.js
@@ -141,10 +141,9 @@ App.stackMapper = App.QuickDataMapper.create({
stack.stack_services = servicesArray;
stack.operating_systems = operatingSystemsArray;
- App.store.commit();
- App.store.loadMany(modelRepo, resultRepo);
- App.store.loadMany(modelOS, resultOS);
- App.store.loadMany(modelServices, resultServices);
- App.store.load(modelStack, this.parseIt(stack, this.get('configStack')));
+ App.store.safeLoadMany(modelRepo, resultRepo);
+ App.store.safeLoadMany(modelOS, resultOS);
+ App.store.safeLoadMany(modelServices, resultServices);
+ App.store.safeLoad(modelStack, this.parseIt(stack, this.get('configStack')));
}
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/a1f23ad4/ambari-web/app/mappers/stack_service_mapper.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mappers/stack_service_mapper.js b/ambari-web/app/mappers/stack_service_mapper.js
index 21c4db9..4bda89d 100644
--- a/ambari-web/app/mappers/stack_service_mapper.js
+++ b/ambari-web/app/mappers/stack_service_mapper.js
@@ -122,8 +122,8 @@ App.stackServiceMapper = App.QuickDataMapper.create({
}
result.push(this.parseIt(stackService, this.get('config')));
}, this);
- App.store.loadMany(this.get('component_model'), stackServiceComponents);
- App.store.loadMany(model, result);
+ App.store.safeLoadMany(this.get('component_model'), stackServiceComponents);
+ App.store.safeLoadMany(model, result);
},
/**
@@ -136,7 +136,7 @@ App.stackServiceMapper = App.QuickDataMapper.create({
records.forEach(function (rec) {
Ember.run(this, function () {
rec.deleteRecord();
- App.store.commit();
+ App.store.fastCommit();
});
}, this);
}, this);
http://git-wip-us.apache.org/repos/asf/ambari/blob/a1f23ad4/ambari-web/app/mappers/stack_upgrade_history_mapper.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mappers/stack_upgrade_history_mapper.js b/ambari-web/app/mappers/stack_upgrade_history_mapper.js
index 823ae80..25e9d06 100644
--- a/ambari-web/app/mappers/stack_upgrade_history_mapper.js
+++ b/ambari-web/app/mappers/stack_upgrade_history_mapper.js
@@ -47,8 +47,7 @@ App.stackUpgradeHistoryMapper = App.QuickDataMapper.create({
result.push(parseResult);
}, this);
- App.store.loadMany(this.get('model'), result);
- App.store.commit();
+ App.store.safeLoadMany(this.get('model'), result);
App.set('isStackUpgradeHistoryLoaded',true);
}
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/a1f23ad4/ambari-web/app/mappers/stack_version_mapper.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mappers/stack_version_mapper.js b/ambari-web/app/mappers/stack_version_mapper.js
index bd37288..62187b0 100644
--- a/ambari-web/app/mappers/stack_version_mapper.js
+++ b/ambari-web/app/mappers/stack_version_mapper.js
@@ -82,7 +82,6 @@ App.stackVersionMapper = App.QuickDataMapper.create({
resultStack.push(this.parseIt(stack, this.get('modelStack')));
}, this);
}
- App.store.commit();
- App.store.loadMany(modelStackVerion, resultStack);
+ App.store.safeLoadMany(modelStackVerion, resultStack);
}
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/a1f23ad4/ambari-web/app/mappers/target_cluster_mapper.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mappers/target_cluster_mapper.js b/ambari-web/app/mappers/target_cluster_mapper.js
index f774213..29cb508 100644
--- a/ambari-web/app/mappers/target_cluster_mapper.js
+++ b/ambari-web/app/mappers/target_cluster_mapper.js
@@ -47,7 +47,7 @@ App.targetClusterMapper = App.QuickDataMapper.create({
clustersToDelete.forEach(function (name) {
this.deleteRecord(model.find().findProperty('name', name));
}, this);
- App.store.loadMany(model, result);
+ App.store.safeLoadMany(model, result);
}
}
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/a1f23ad4/ambari-web/app/mappers/users_mapper.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mappers/users_mapper.js b/ambari-web/app/mappers/users_mapper.js
index 80d7feb..896c043 100644
--- a/ambari-web/app/mappers/users_mapper.js
+++ b/ambari-web/app/mappers/users_mapper.js
@@ -43,7 +43,7 @@ App.usersMapper = App.QuickDataMapper.create({
item.Users.operator = self.isOperator(item.permissions);
item.Users.cluster_user = self.isClusterUser(item.permissions);
result.push(self.parseIt(item, self.config));
- App.store.loadMany(self.get('model'), result);
+ App.store.safeLoadMany(self.get('model'), result);
}
});
},
http://git-wip-us.apache.org/repos/asf/ambari/blob/a1f23ad4/ambari-web/app/mappers/widget_mapper.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mappers/widget_mapper.js b/ambari-web/app/mappers/widget_mapper.js
index 0991d4f..84cb757 100644
--- a/ambari-web/app/mappers/widget_mapper.js
+++ b/ambari-web/app/mappers/widget_mapper.js
@@ -51,8 +51,7 @@ App.widgetMapper = App.QuickDataMapper.create({
result.push(this.parseIt(item.WidgetInfo, this.config));
}, this);
- App.store.commit();
- App.store.loadMany(this.get('model'), result);
+ App.store.safeLoadMany(this.get('model'), result);
}
}
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/a1f23ad4/ambari-web/app/mixins/main/service/configs/config_overridable.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mixins/main/service/configs/config_overridable.js b/ambari-web/app/mixins/main/service/configs/config_overridable.js
index 93dea5f..c1d96dc 100644
--- a/ambari-web/app/mixins/main/service/configs/config_overridable.js
+++ b/ambari-web/app/mixins/main/service/configs/config_overridable.js
@@ -153,8 +153,8 @@ App.ConfigOverridable = Em.Mixin.create({
});
} else {
newConfigGroup.is_temporary = true;
- App.store.load(App.ServiceConfigGroup, newConfigGroup);
- App.store.commit();
+ App.store.safeLoad(App.ServiceConfigGroup, newConfigGroup);
+ App.store.fastCommit();
newConfigGroup = App.ServiceConfigGroup.find(newConfigGroup.id);
configGroups.pushObject(newConfigGroup);
self.persistConfigGroups();
@@ -281,8 +281,8 @@ App.ConfigOverridable = Em.Mixin.create({
postNewConfigurationGroupSuccess: function (response, opt, params) {
var modelData = params.modelData;
modelData.id = response.resources[0].ConfigGroup.id;
- App.store.load(App.ServiceConfigGroup, modelData);
- App.store.commit();
+ App.store.safeLoad(App.ServiceConfigGroup, modelData);
+ App.store.fastCommit();
App.ServiceConfigGroup.deleteTemporaryRecords();
},
http://git-wip-us.apache.org/repos/asf/ambari/blob/a1f23ad4/ambari-web/app/mixins/main/service/groups_mapping.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mixins/main/service/groups_mapping.js b/ambari-web/app/mixins/main/service/groups_mapping.js
index 0781aa3..6c166c8 100644
--- a/ambari-web/app/mixins/main/service/groups_mapping.js
+++ b/ambari-web/app/mixins/main/service/groups_mapping.js
@@ -58,7 +58,6 @@ App.GroupsMappingMixin = Em.Mixin.create(App.TrackRequestMixin, {
* @method saveConfigGroupsToModel
*/
saveConfigGroupsToModel: function (data, opt, params) {
- App.store.commit();
App.configGroupsMapper.map(data, false, params.serviceNames.split(','));
this.set('configGroupsAreLoaded', true);
params.dfd.resolve();
http://git-wip-us.apache.org/repos/asf/ambari/blob/a1f23ad4/ambari-web/app/models/user.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/models/user.js b/ambari-web/app/models/user.js
index 4dde8ec..5c14724 100644
--- a/ambari-web/app/models/user.js
+++ b/ambari-web/app/models/user.js
@@ -106,7 +106,7 @@ App.CreateUserForm = App.Form.extend({
});
if (this.get('className')) {
- App.store.load(this.get('className'), App.dateTime(), formValues);
+ App.store.safeLoad(this.get('className'), App.dateTime(), formValues);
}
this.set('result', 1);
http://git-wip-us.apache.org/repos/asf/ambari/blob/a1f23ad4/ambari-web/app/utils/http_client.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/http_client.js b/ambari-web/app/utils/http_client.js
index 9b8346c..0113679 100644
--- a/ambari-web/app/utils/http_client.js
+++ b/ambari-web/app/utils/http_client.js
@@ -85,11 +85,6 @@ App.HttpClient = Em.Object.create({
var timeout = setTimeout(function () {
if (xhr.readyState == 4) {
if (xhr.status == 200) {
- try {
- App.store.commit();
- } catch (err) {
- console.warn('App.store.commit error:', err);
- }
var response = $.parseJSON(xhr.responseText);
if (tmp_val.beforeMap) {
tmp_val.beforeMap.call(self, response);
http://git-wip-us.apache.org/repos/asf/ambari/blob/a1f23ad4/ambari-web/test/controllers/main/admin_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/admin_test.js b/ambari-web/test/controllers/main/admin_test.js
index b2828d0..d2b3e2a 100644
--- a/ambari-web/test/controllers/main/admin_test.js
+++ b/ambari-web/test/controllers/main/admin_test.js
@@ -35,7 +35,7 @@ describe('MainAdminController', function () {
it('Services do not match dependencies', function () {
App.Service.find().clear();
- App.store.load(App.Service, {
+ App.store.safeLoad(App.Service, {
id: 'HDFS',
service_name: 'HDFS'
});
@@ -47,21 +47,21 @@ describe('MainAdminController', function () {
expect(controller.get("isAccessAvailable")).to.be.false;
});
it('Only one YARN service installed', function () {
- App.store.load(App.Service, {
+ App.store.safeLoad(App.Service, {
id: 'YARN',
service_name: 'YARN'
});
expect(controller.get("isAccessAvailable")).to.be.false;
});
it('TEZ and YARN services installed', function () {
- App.store.load(App.Service, {
+ App.store.safeLoad(App.Service, {
id: 'TEZ',
service_name: 'TEZ'
});
expect(controller.get("isAccessAvailable")).to.be.false;
});
it('TEZ and YARN services, APP_TIMELINE_SERVER component installed', function () {
- App.store.load(App.HostComponent, {
+ App.store.safeLoad(App.HostComponent, {
id: 'APP_TIMELINE_SERVER_host1',
component_name: 'APP_TIMELINE_SERVER'
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/a1f23ad4/ambari-web/test/controllers/main/host/details_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/host/details_test.js b/ambari-web/test/controllers/main/host/details_test.js
index 17b1eec..c7e1808 100644
--- a/ambari-web/test/controllers/main/host/details_test.js
+++ b/ambari-web/test/controllers/main/host/details_test.js
@@ -850,7 +850,7 @@ describe('App.MainHostDetailsController', function () {
describe('#constructConfigUrlParams()', function () {
function loadService(serviceName) {
- App.store.load(App.Service, {
+ App.store.safeLoad(App.Service, {
id: serviceName,
service_name: serviceName
});
@@ -905,7 +905,7 @@ describe('App.MainHostDetailsController', function () {
App.HostComponent.find().clear();
App.propertyDidChange('isHaEnabled');
expect(controller.constructConfigUrlParams(data)).to.eql(['(type=core-site&tag=1)']);
- App.store.load(App.HostComponent, {
+ App.store.safeLoad(App.HostComponent, {
id: 'SECONDARY_NAMENODE_host1',
component_name: 'SECONDARY_NAMENODE'
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/a1f23ad4/ambari-web/test/controllers/main/service/add_controller_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/service/add_controller_test.js b/ambari-web/test/controllers/main/service/add_controller_test.js
index 715f46a..ffde1f7 100644
--- a/ambari-web/test/controllers/main/service/add_controller_test.js
+++ b/ambari-web/test/controllers/main/service/add_controller_test.js
@@ -317,7 +317,7 @@ describe('App.AddServiceController', function() {
mock.db = value;
});
sinon.stub(this.controller, 'hasDependentSlaveComponent');
- sinon.stub(App.store, 'commit', Em.K);
+ sinon.stub(App.store, 'fastCommit', Em.K);
this.mockStackService = sinon.stub(App.StackService, 'find');
this.mockService = sinon.stub(App.Service, 'find');
});
@@ -328,7 +328,7 @@ describe('App.AddServiceController', function() {
this.controller.hasDependentSlaveComponent.restore();
this.mockStackService.restore();
this.mockService.restore();
- App.store.commit.restore();
+ App.store.fastCommit.restore();
});
var tests = [
http://git-wip-us.apache.org/repos/asf/ambari/blob/a1f23ad4/ambari-web/test/controllers/main/service/item_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/service/item_test.js b/ambari-web/test/controllers/main/service/item_test.js
index 6430ab6..fff321c 100644
--- a/ambari-web/test/controllers/main/service/item_test.js
+++ b/ambari-web/test/controllers/main/service/item_test.js
@@ -347,7 +347,7 @@ describe('App.MainServiceItemController', function () {
});
it(test.m, function () {
if (!test.default) {
- App.store.load(App.Service, test.content);
+ App.store.safeLoad(App.Service, test.content);
}
mainServiceItemController.runSmokeTest({}).onPrimary();
expect(mainServiceItemController.runSmokeTestPrimary.calledOnce).to.equal(test.startSmoke);
http://git-wip-us.apache.org/repos/asf/ambari/blob/a1f23ad4/ambari-web/test/mappers/alert_groups_mapper_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/mappers/alert_groups_mapper_test.js b/ambari-web/test/mappers/alert_groups_mapper_test.js
index 9480e3d..60fee6f 100644
--- a/ambari-web/test/mappers/alert_groups_mapper_test.js
+++ b/ambari-web/test/mappers/alert_groups_mapper_test.js
@@ -87,7 +87,7 @@ describe('App.alertGroupsMapper', function () {
beforeEach(function () {
- sinon.stub(App.store, 'commit', Em.K);
+ sinon.stub(App.store, 'fastCommit', Em.K);
sinon.stub(App.store, 'loadMany', function (type, content) {
type.content = content;
});
@@ -99,7 +99,7 @@ describe('App.alertGroupsMapper', function () {
afterEach(function () {
- App.store.commit.restore();
+ App.store.fastCommit.restore();
App.store.loadMany.restore();
App.alertGroupsMapper.set('model', App.AlertGroup);
App.cache.previousAlertGroupsMap = {};
http://git-wip-us.apache.org/repos/asf/ambari/blob/a1f23ad4/ambari-web/test/mixins/main/service/configs/config_overridable_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/mixins/main/service/configs/config_overridable_test.js b/ambari-web/test/mixins/main/service/configs/config_overridable_test.js
index b1eb099..b562ffb 100644
--- a/ambari-web/test/mixins/main/service/configs/config_overridable_test.js
+++ b/ambari-web/test/mixins/main/service/configs/config_overridable_test.js
@@ -195,8 +195,8 @@ describe('App.ConfigOverridable', function () {
describe("#postNewConfigurationGroupSuccess()", function () {
beforeEach(function() {
- sinon.stub(App.store, 'load');
- sinon.stub(App.store, 'commit');
+ sinon.stub(App.store, 'safeLoad');
+ sinon.stub(App.store, 'fastCommit');
sinon.stub(App.ServiceConfigGroup, 'deleteTemporaryRecords');
configOverridable.postNewConfigurationGroupSuccess({
resources: [
@@ -211,16 +211,16 @@ describe('App.ConfigOverridable', function () {
afterEach(function() {
App.ServiceConfigGroup.deleteTemporaryRecords.restore();
- App.store.commit.restore();
- App.store.load.restore();
+ App.store.fastCommit.restore();
+ App.store.safeLoad.restore();
});
it("App.store.load should be called", function() {
- expect(App.store.load.calledWith(App.ServiceConfigGroup, {id: 'cg1'})).to.be.true;
+ expect(App.store.safeLoad.calledWith(App.ServiceConfigGroup, {id: 'cg1'})).to.be.true;
});
it("App.store.commit should be called", function() {
- expect(App.store.commit.calledOnce).to.be.true;
+ expect(App.store.fastCommit.calledOnce).to.be.true;
});
it("App.ServiceConfigGroup.deleteTemporaryRecords should be called", function() {
http://git-wip-us.apache.org/repos/asf/ambari/blob/a1f23ad4/ambari-web/test/models/host_component_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/models/host_component_test.js b/ambari-web/test/models/host_component_test.js
index d577005..5f4997d 100644
--- a/ambari-web/test/models/host_component_test.js
+++ b/ambari-web/test/models/host_component_test.js
@@ -21,7 +21,7 @@ require('models/host_component');
describe('App.HostComponent', function() {
- App.store.load(App.HostComponent, {
+ App.store.safeLoad(App.HostComponent, {
id: 'COMP_host',
component_name: 'COMP1'
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/a1f23ad4/ambari-web/test/models/host_stack_version_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/models/host_stack_version_test.js b/ambari-web/test/models/host_stack_version_test.js
index 702e284..014992d 100644
--- a/ambari-web/test/models/host_stack_version_test.js
+++ b/ambari-web/test/models/host_stack_version_test.js
@@ -62,7 +62,7 @@ describe('App.HostStackVersion', function () {
});
testCases.forEach(function (test) {
it('status is ' + test.status, function () {
- App.store.load(App.HostStackVersion, {
+ App.store.safeLoad(App.HostStackVersion, {
id: 1,
status: test.status
});
@@ -99,7 +99,7 @@ describe('App.HostStackVersion', function () {
});
testCases.forEach(function (test) {
it('status is ' + test.status, function () {
- App.store.load(App.HostStackVersion, {
+ App.store.safeLoad(App.HostStackVersion, {
id: 1,
status: test.status
});
@@ -113,14 +113,14 @@ describe('App.HostStackVersion', function () {
App.HostStackVersion.find().clear();
});
it("status is CURRENT", function () {
- App.store.load(App.HostStackVersion, {
+ App.store.safeLoad(App.HostStackVersion, {
id: 1,
status: 'CURRENT'
});
expect(App.HostStackVersion.find(1).get('isCurrent')).to.be.true;
});
it("status is not CURRENT", function () {
- App.store.load(App.HostStackVersion, {
+ App.store.safeLoad(App.HostStackVersion, {
id: 1,
status: 'INSTALLED'
});
@@ -133,14 +133,14 @@ describe('App.HostStackVersion', function () {
App.HostStackVersion.find().clear();
});
it("status is INSTALLING", function () {
- App.store.load(App.HostStackVersion, {
+ App.store.safeLoad(App.HostStackVersion, {
id: 1,
status: 'INSTALLING'
});
expect(App.HostStackVersion.find(1).get('isInstalling')).to.be.true;
});
it("status is not INSTALLING", function () {
- App.store.load(App.HostStackVersion, {
+ App.store.safeLoad(App.HostStackVersion, {
id: 1,
status: 'INSTALLED'
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/a1f23ad4/ambari-web/test/models/rack_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/models/rack_test.js b/ambari-web/test/models/rack_test.js
index a63eaba..8c664c8 100644
--- a/ambari-web/test/models/rack_test.js
+++ b/ambari-web/test/models/rack_test.js
@@ -28,7 +28,7 @@ describe('App.Rack', function () {
name: 'rack1'
};
- App.store.load(App.Rack, data);
+ App.store.safeLoad(App.Rack, data);
describe('#liveHostsCount', function () {
@@ -38,7 +38,7 @@ describe('App.Rack', function () {
});
it('rack1 has three live hosts', function () {
- App.store.load(App.Host, {
+ App.store.safeLoad(App.Host, {
id: 'host3',
host_name: 'host3',
health_status: 'HEALTHY'
http://git-wip-us.apache.org/repos/asf/ambari/blob/a1f23ad4/ambari-web/test/models/stack_service_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/models/stack_service_test.js b/ambari-web/test/models/stack_service_test.js
index bc101e0..2d76a8b 100644
--- a/ambari-web/test/models/stack_service_test.js
+++ b/ambari-web/test/models/stack_service_test.js
@@ -22,7 +22,7 @@ require('models/stack_service');
describe('App.StackService', function () {
- App.store.load(App.StackService, {
+ App.store.safeLoad(App.StackService, {
id: 'S1'
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/a1f23ad4/ambari-web/test/utils/http_client_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/utils/http_client_test.js b/ambari-web/test/utils/http_client_test.js
index 589c44e..48e26a9 100644
--- a/ambari-web/test/utils/http_client_test.js
+++ b/ambari-web/test/utils/http_client_test.js
@@ -272,7 +272,6 @@ describe('App.HttpClient', function () {
beforeEach(function () {
clock = sinon.useFakeTimers();
- sinon.stub(App.store, 'commit');
sinon.spy(xhr, 'abort');
sinon.spy(mapper, 'map');
sinon.spy(mock, 'errorHandler');
@@ -280,9 +279,6 @@ describe('App.HttpClient', function () {
sinon.spy(App.HttpClient, 'onReady');
xhr.readyState = item.readyState;
xhr.status = item.status;
- if (item.isCommitError) {
- App.store.commit.throws();
- }
App.HttpClient.onReady(xhr, null, ajaxOptions, mapper, mock.errorHandler, 'url');
clock.tick(10);
xhr.readyState = 4;
@@ -291,7 +287,6 @@ describe('App.HttpClient', function () {
afterEach(function () {
clock.restore();
- App.store.commit.restore();
xhr.abort.restore();
mapper.map.restore();
mock.errorHandler.restore();
@@ -299,10 +294,6 @@ describe('App.HttpClient', function () {
App.HttpClient.onReady.restore();
});
- it('App.store.commit call', function () {
- expect(App.store.commit.callCount).to.equal(item.commitCallCount);
- });
-
it('mapping data', function () {
expect(mapper.map.callCount).to.equal(item.mapCallCount);
});