ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From atk...@apache.org
Subject ambari git commit: AMBARI-9042 Failed, redundant requests after refresh on services page. (atkach)
Date Thu, 08 Jan 2015 17:15:40 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk a49cf5858 -> 2f32fb329


AMBARI-9042 Failed, redundant requests after refresh on services page. (atkach)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/2f32fb32
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/2f32fb32
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/2f32fb32

Branch: refs/heads/trunk
Commit: 2f32fb329c6497e7025196092a886242e9e0cc31
Parents: a49cf58
Author: Andrii Tkach <atkach@hortonworks.com>
Authored: Thu Jan 8 16:39:59 2015 +0200
Committer: Andrii Tkach <atkach@hortonworks.com>
Committed: Thu Jan 8 19:15:25 2015 +0200

----------------------------------------------------------------------
 ambari-web/app/app.js                           |  2 +-
 ambari-web/app/routes/main.js                   |  1 -
 .../service/info/summary/master_components.hbs  |  2 +-
 .../app/views/main/service/info/summary.js      |  6 +++-
 .../app/views/main/service/services/hdfs.js     | 32 ++++++++------------
 ambari-web/test/app_test.js                     |  4 +--
 .../test/controllers/main/host/details_test.js  |  8 ++---
 7 files changed, 25 insertions(+), 30 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/2f32fb32/ambari-web/app/app.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/app.js b/ambari-web/app/app.js
index b2143fe..2f12795 100644
--- a/ambari-web/app/app.js
+++ b/ambari-web/app/app.js
@@ -144,7 +144,7 @@ module.exports = Em.Application.create({
   isHaEnabled: function () {
     var isHDFSInstalled = App.Service.find().findProperty('serviceName','HDFS');
     return !!isHDFSInstalled && !this.HostComponent.find().someProperty('componentName',
'SECONDARY_NAMENODE');
-  }.property('router.clusterController.isLoaded', 'isStackServicesLoaded'),
+  }.property('router.clusterController.isLoaded', 'router.clusterController.dataLoadList.serviceMetrics'),
 
   /**
    * If ResourceManager High Availability is enabled

http://git-wip-us.apache.org/repos/asf/ambari/blob/2f32fb32/ambari-web/app/routes/main.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/routes/main.js b/ambari-web/app/routes/main.js
index fdaedd0..71446bb 100644
--- a/ambari-web/app/routes/main.js
+++ b/ambari-web/app/routes/main.js
@@ -554,7 +554,6 @@ module.exports = Em.Route.extend({
         route: '/summary',
         connectOutlets: function (router, context) {
           var item = router.get('mainServiceItemController.content');
-          router.get('updateController').updateServiceMetric(Em.K);
           //if service is not existed then route to default service
           if (item.get('isLoaded')) {
             router.get('mainServiceItemController').connectOutlet('mainServiceInfoSummary',
item);

http://git-wip-us.apache.org/repos/asf/ambari/blob/2f32fb32/ambari-web/app/templates/main/service/info/summary/master_components.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/main/service/info/summary/master_components.hbs b/ambari-web/app/templates/main/service/info/summary/master_components.hbs
index 762ba3a..90b97e5 100644
--- a/ambari-web/app/templates/main/service/info/summary/master_components.hbs
+++ b/ambari-web/app/templates/main/service/info/summary/master_components.hbs
@@ -17,7 +17,7 @@
 }}
 <tr class="hidden"><td></td></tr>
 {{#each comp in view.mastersComp}}
-  <tr {{bindAttr class="comp.isZkfc:component-small"}}>
+  <tr {{bindAttr class="comp.isSubComponent:component-small"}}>
     <td>
       <a href="#" {{action showDetails comp.host}} title="{{unbound comp.host.publicHostName}}"
rel="UsageTooltip">
         {{#if comp.displayNameAdvanced}}

http://git-wip-us.apache.org/repos/asf/ambari/blob/2f32fb32/ambari-web/app/views/main/service/info/summary.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/service/info/summary.js b/ambari-web/app/views/main/service/info/summary.js
index 2a4e76d..cf40900 100644
--- a/ambari-web/app/views/main/service/info/summary.js
+++ b/ambari-web/app/views/main/service/info/summary.js
@@ -474,7 +474,11 @@ App.MainServiceInfoSummaryView = Em.View.extend(App.UserPref, {
     return gangliaUrl;
   }.property('App.router.clusterController.gangliaUrl', 'service.serviceName'),
 
-  didInsertElement:function () {
+  willInsertElement: function () {
+    App.router.get('updateController').updateServiceMetric(Em.K);
+  },
+
+  didInsertElement: function () {
     var svcName = this.get('service.serviceName');
     if (svcName) {
       this.constructGraphObjects(App.service_graph_config[svcName.toLowerCase()]);

http://git-wip-us.apache.org/repos/asf/ambari/blob/2f32fb32/ambari-web/app/views/main/service/services/hdfs.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/service/services/hdfs.js b/ambari-web/app/views/main/service/services/hdfs.js
index 4b544f4..c6565d1 100644
--- a/ambari-web/app/views/main/service/services/hdfs.js
+++ b/ambari-web/app/views/main/service/services/hdfs.js
@@ -43,28 +43,20 @@ App.MainDashboardServiceHdfsView = App.MainDashboardServiceView.extend({
     },
     templateName: require('templates/main/service/info/summary/master_components'),
     mastersComp: function() {
-      if (App.get('isHaEnabled')) {
-        // return all Namenodes followed by its ZKFC
-        var namenodes = this.get('parentView.service.hostComponents').filter(function(comp){
-          return comp.get('isMaster') && comp.get('componentName') !== 'JOURNALNODE';
-        });
-        var zkfcs = this.get('parentView.service.hostComponents').filter(function(comp){
-          return comp.get('componentName') == 'ZKFC';
-        });
-        var nnZkfc = [];
-        namenodes.forEach( function(namenode) {
-          nnZkfc.push(namenode);
-          var zkfc = zkfcs.findProperty('host.publicHostName', namenode.get('host.publicHostName'));
+      var masterComponents = [];
+      var zkfcs = this.get('parentView.service.hostComponents').filterProperty('componentName',
'ZKFC');
+
+      this.get('parentView.service.hostComponents').forEach(function (comp) {
+        if (comp.get('isMaster') && comp.get('componentName') !== 'JOURNALNODE')
{
+          masterComponents.push(comp);
+          var zkfc = zkfcs.findProperty('hostName', comp.get('hostName'));
           if (zkfc) {
-            nnZkfc.push(zkfc.set('isZkfc', true));
+            zkfc.set('isSubComponent', true);
+            masterComponents.push(zkfc);
           }
-        });
-        return nnZkfc;
-      } else {
-        return this.get('parentView.service.hostComponents').filter(function(comp){
-          return comp.get('isMaster') && comp.get('componentName') !== 'JOURNALNODE';
-        });
-      }
+        }
+      });
+      return masterComponents;
     }.property('parentView.service.hostComponents.length')
   }),
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/2f32fb32/ambari-web/test/app_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/app_test.js b/ambari-web/test/app_test.js
index 2b4e8db..115797c 100644
--- a/ambari-web/test/app_test.js
+++ b/ambari-web/test/app_test.js
@@ -168,15 +168,15 @@ describe('App', function () {
     });
 
     it('if hadoop stack version higher than 2 then isHaEnabled should be true', function
() {
-      App.set('isStackServicesLoaded', true);
+      App.propertyDidChange('isHaEnabled');
       expect(App.get('isHaEnabled')).to.equal(true);
-      App.set('isStackServicesLoaded', false);
     });
     it('if cluster has SECONDARY_NAMENODE then isHaEnabled should be false', function ()
{
       App.store.load(App.HostComponent, {
         id: 'SECONDARY_NAMENODE',
         component_name: 'SECONDARY_NAMENODE'
       });
+      App.propertyDidChange('isHaEnabled');
       expect(App.get('isHaEnabled')).to.equal(false);
     });
   });

http://git-wip-us.apache.org/repos/asf/ambari/blob/2f32fb32/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 277c7e7..acd9b27 100644
--- a/ambari-web/test/controllers/main/host/details_test.js
+++ b/ambari-web/test/controllers/main/host/details_test.js
@@ -634,9 +634,8 @@ describe('App.MainHostDetailsController', function () {
       });
       var data = {Clusters: {desired_configs: {'core-site': {tag: 1}}}};
       App.HostComponent.find().clear();
-      App.set('isStackServicesLoaded', true);
+      App.propertyDidChange('isHaEnabled');
       expect(controller.constructConfigUrlParams(data)).to.eql(['(type=core-site&tag=1)']);
-      App.set('isStackServicesLoaded', false);
       App.store.load(App.HostComponent, {
         id: 'SECONDARY_NAMENODE_host1',
         component_name: 'SECONDARY_NAMENODE'
@@ -648,6 +647,7 @@ describe('App.MainHostDetailsController', function () {
         id: 'HBASE',
         service_name: 'HBASE'
       });
+      App.propertyDidChange('isHaEnabled');
       var data = {Clusters: {desired_configs: {'hbase-site': {tag: 1}}}};
       expect(controller.constructConfigUrlParams(data)).to.eql(['(type=hbase-site&tag=1)']);
       App.Service.find().clear();
@@ -770,7 +770,7 @@ describe('App.MainHostDetailsController', function () {
         id: 'HDFS',
         service_name: 'HDFS'
       });
-      App.set('isStackServicesLoaded', true);
+      App.propertyDidChange('isHaEnabled');
       expect(controller.setZKConfigs(configs, 'host1:2181', [])).to.be.true;
       expect(configs).to.eql({"core-site": {
         "ha.zookeeper.quorum": "host1:2181"
@@ -779,7 +779,7 @@ describe('App.MainHostDetailsController', function () {
         id: 'SECONDARY_NAMENODE_host1',
         component_name: 'SECONDARY_NAMENODE'
       });
-      App.set('isStackServicesLoaded', false);
+      App.propertyDidChange('isHaEnabled');
     });
     it('hbase-site is present', function () {
       var configs = {'hbase-site': {}};


Mime
View raw message