Repository: ambari Updated Branches: refs/heads/branch-1.6.1 367435610 -> a06704bb9
AMBARI-6252 Service Configs page loads too slow on 2k node cluster [patch 2] . (Buzhor Denys via ababiichuk) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/a06704bb Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/a06704bb Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/a06704bb Branch: refs/heads/branch-1.6.1 Commit: a06704bb9beae346103e52e4105bd5f96a435830 Parents: 3674356 Author: aBabiichuk <ababiic...@cybervisiontech.com> Authored: Tue Jun 24 17:12:51 2014 +0300 Committer: aBabiichuk <ababiic...@cybervisiontech.com> Committed: Tue Jun 24 17:12:51 2014 +0300 ---------------------------------------------------------------------- .../controllers/global/cluster_controller.js | 20 -------------------- .../controllers/main/service/info/configs.js | 10 +++++----- ambari-web/app/utils/config.js | 13 +++++++++++-- 3 files changed, 16 insertions(+), 27 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/a06704bb/ambari-web/app/controllers/global/cluster_controller.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/controllers/global/cluster_controller.js b/ambari-web/app/controllers/global/cluster_controller.js index b52cbe4..723a998 100644 --- a/ambari-web/app/controllers/global/cluster_controller.js +++ b/ambari-web/app/controllers/global/cluster_controller.js @@ -233,32 +233,12 @@ App.ClusterController = Em.Controller.extend({ }.property('App.router.updateController.isUpdated', 'dataLoadList.serviceMetrics'), /** - * Get all host names. We have many places where we need it. - **/ - loadAllHostNames: function () { - App.ajax.send({ - sender: this, - name: 'cluster.fields', - data: { - fields: ['hosts'], - clusterName: App.get('clusterName') - }, - success: 'loadAllHostNamesSuccess' - }); - }, - - loadAllHostNamesSuccess: function(response) { - App.cache['HostsList'] = response.hosts.mapProperty('Hosts.host_name'); - }, - /** - * * load all data and update load status */ loadClusterData: function () { var self = this; this.loadAmbariProperties(); this.loadAmbariViews(); - this.loadAllHostNames(); if (!this.get('clusterName')) { return; } http://git-wip-us.apache.org/repos/asf/ambari/blob/a06704bb/ambari-web/app/controllers/main/service/info/configs.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/controllers/main/service/info/configs.js b/ambari-web/app/controllers/main/service/info/configs.js index f7d4fbd..b494af4 100644 --- a/ambari-web/app/controllers/main/service/info/configs.js +++ b/ambari-web/app/controllers/main/service/info/configs.js @@ -224,9 +224,9 @@ App.MainServiceInfoConfigsController = Em.Controller.extend({ var serviceName = this.get('content.serviceName'); console.debug("loadServiceConfigs(): data=", data); // Create default configuration group - var defaultConfigGroupHosts = App.cache['HostsList']; var selectedConfigGroup; var siteToTagMap = {}; + var hostsLength = App.router.get('mainHostController.hostsCountMap.TOTAL'); serviceConfigsDef.sites.forEach(function(siteName){ if(data.Clusters.desired_configs[siteName]){ siteToTagMap[siteName] = data.Clusters.desired_configs[siteName].tag; @@ -253,9 +253,7 @@ App.MainServiceInfoConfigsController = Em.Controller.extend({ hosts: groupHosts, configSiteTags: [] }); - groupHosts.forEach(function (host) { - defaultConfigGroupHosts = defaultConfigGroupHosts.without(host); - }, this); + hostsLength -= groupHosts.length; item.desired_configs.forEach(function (config) { newConfigGroup.configSiteTags.push(App.ConfigSiteTag.create({ site: config.type, @@ -276,7 +274,9 @@ App.MainServiceInfoConfigsController = Em.Controller.extend({ name: App.Service.DisplayNames[serviceName] + " Default", description: "Default cluster level " + serviceName + " configuration", isDefault: true, - hosts: defaultConfigGroupHosts, + hosts: { + length: hostsLength + }, parentConfigGroup: null, service: this.get('content'), serviceName: serviceName, http://git-wip-us.apache.org/repos/asf/ambari/blob/a06704bb/ambari-web/app/utils/config.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/utils/config.js b/ambari-web/app/utils/config.js index 2238b72..9037061 100644 --- a/ambari-web/app/utils/config.js +++ b/ambari-web/app/utils/config.js @@ -1292,12 +1292,21 @@ App.config = Em.Object.create({ }.property('selectedConfigGroup'), onPrimary: function () { var newGroup = this.get('selectedConfigGroup'); - selectedGroup.get('hosts').removeObject(hostName); + if (selectedGroup.get('isDefault')) { + selectedGroup.set('hosts.length', selectedGroup.get('hosts.length') - 1) + } else { + selectedGroup.get('hosts').removeObject(hostName); + } if (!selectedGroup.get('isDefault')) { self.updateConfigurationGroup(selectedGroup, function () { }, Em.K); } - newGroup.get('hosts').pushObject(hostName); + + if (newGroup.get('isDefault')) { + newGroup.set('hosts.length', newGroup.get('hosts.length') + 1) + } else { + newGroup.get('hosts').pushObject(hostName); + } callback(newGroup); if (!newGroup.get('isDefault')) { self.updateConfigurationGroup(newGroup, function () {