Updated Branches: refs/heads/trunk 70980847a -> 305c934f5
AMBARI-3950 Avoid loading extra host-components collections. (atkach) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/305c934f Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/305c934f Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/305c934f Branch: refs/heads/trunk Commit: 305c934f55c22365d8ef68eb0256bce720e32135 Parents: 7098084 Author: atkach <[email protected]> Authored: Tue Dec 3 12:20:10 2013 +0200 Committer: atkach <[email protected]> Committed: Tue Dec 3 12:20:10 2013 +0200 ---------------------------------------------------------------------- ambari-web/app/controllers/main.js | 13 +++++++------ .../app/controllers/main/service/info/configs.js | 2 +- ambari-web/app/mappers/service_mapper.js | 6 +----- ambari-web/app/mappers/status_mapper.js | 12 +----------- ambari-web/app/models/service.js | 2 -- 5 files changed, 10 insertions(+), 25 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/305c934f/ambari-web/app/controllers/main.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/controllers/main.js b/ambari-web/app/controllers/main.js index beb0110..457eb8b 100644 --- a/ambari-web/app/controllers/main.js +++ b/ambari-web/app/controllers/main.js @@ -44,7 +44,6 @@ App.MainController = Em.Controller.extend({ */ initialize: function(){ App.router.get('clusterController').loadClusterData(); - this.startPolling(); }, dataLoading: function () { @@ -63,11 +62,13 @@ App.MainController = Em.Controller.extend({ return dfd.promise(); }, - startPolling: function(){ - App.router.get('updateController').set('isWorking', true); - App.router.get('backgroundOperationsController').set('isWorking', true); - App.router.get('clusterController').set('isWorking', true); - }, + startPolling: function () { + if (App.router.get('clusterController.isLoaded')) { + App.router.get('updateController').set('isWorking', true); + App.router.get('backgroundOperationsController').set('isWorking', true); + App.router.get('clusterController').set('isWorking', true); + } + }.observes('App.router.clusterController.isLoaded'), stopPolling: function(){ App.router.get('updateController').set('isWorking', false); App.router.get('backgroundOperationsController').set('isWorking', false); http://git-wip-us.apache.org/repos/asf/ambari/blob/305c934f/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 516b362..1284106 100644 --- a/ambari-web/app/controllers/main/service/info/configs.js +++ b/ambari-web/app/controllers/main/service/info/configs.js @@ -677,7 +677,7 @@ App.MainServiceInfoConfigsController = Em.Controller.extend({ var componentCount = 0; var hostToIndexMap = {}; services.forEach(function (service) { - var hostComponents = (status == App.HostComponentStatus.started) ? service.get('runningHostComponents') : service.get('unknownHostComponents'); + var hostComponents = service.get('hostComponents').filterProperty('workStatus', status); if (hostComponents != null) { hostComponents.forEach(function (hc) { var hostName = hc.get('host.publicHostName'); http://git-wip-us.apache.org/repos/asf/ambari/blob/305c934f/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 d65cc03..7c58ce4 100644 --- a/ambari-web/app/mappers/service_mapper.js +++ b/ambari-web/app/mappers/service_mapper.js @@ -27,9 +27,7 @@ App.servicesMapper = App.QuickDataMapper.create({ work_status: 'ServiceInfo.state', $rand: Math.random(), $alerts: [ 1, 2, 3 ], - host_components: 'host_components', - running_host_components: 'running_host_components', - unknown_host_components: 'unknown_host_components' + host_components: 'host_components' }, hdfsConfig: { version: 'nameNodeComponent.host_components[0].metrics.dfs.namenode.Version', @@ -189,8 +187,6 @@ App.servicesMapper = App.QuickDataMapper.create({ //service can have zero number of host-components if (serviceData) { item.host_components = serviceData.host_components; - item.running_host_components = serviceData.running_host_components; - item.unknown_host_components = serviceData.unknown_host_components; item.host_components.sort(); } http://git-wip-us.apache.org/repos/asf/ambari/blob/305c934f/ambari-web/app/mappers/status_mapper.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/mappers/status_mapper.js b/ambari-web/app/mappers/status_mapper.js index cc33fd1..45fd23f 100644 --- a/ambari-web/app/mappers/status_mapper.js +++ b/ambari-web/app/mappers/status_mapper.js @@ -68,20 +68,10 @@ App.statusMapper = App.QuickDataMapper.create({ //host-component to service relations if (!hostComponentsOnService[service]) { hostComponentsOnService[service] = { - host_components: [], - running_host_components: [], - unknown_host_components: [] + host_components: [] }; } - if (host_component.HostRoles.state === App.HostComponentStatus.started) { - hostComponentsOnService[service].running_host_components.push(host_component.id); - } - if (host_component.HostRoles.state === App.HostComponentStatus.unknown) { - hostComponentsOnService[service].unknown_host_components.push(host_component.id); - } hostComponentsOnService[service].host_components.push(host_component.id); - - }, this); /** * updating relation between Host and his host-components http://git-wip-us.apache.org/repos/asf/ambari/blob/305c934f/ambari-web/app/models/service.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/models/service.js b/ambari-web/app/models/service.js index 0e53378..7afd28f 100644 --- a/ambari-web/app/models/service.js +++ b/ambari-web/app/models/service.js @@ -30,8 +30,6 @@ App.Service = DS.Model.extend({ quickLinks: DS.hasMany('App.QuickLinks'), hostComponents: DS.hasMany('App.HostComponent'), serviceConfigsTemplate: App.config.get('preDefinedServiceConfigs'), - runningHostComponents: DS.hasMany('App.HostComponent'), - unknownHostComponents: DS.hasMany('App.HostComponent'), // Instead of making healthStatus a computed property that listens on [email protected], // we are creating a separate observer _updateHealthStatus. This is so that healthStatus is updated
