ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From alexantone...@apache.org
Subject ambari git commit: AMBARI-10537. Service Actions menu: after page refresh, slaves rolling restart and download configs items appear with delay (alexantonenko)
Date Thu, 16 Apr 2015 17:50:26 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk d835f4485 -> 34e60b07f


AMBARI-10537. Service Actions menu: after page refresh, slaves rolling restart and download
configs items appear with delay (alexantonenko)


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

Branch: refs/heads/trunk
Commit: 34e60b07ff340f786b4e73a36959e6974d5bed8b
Parents: d835f44
Author: Alex Antonenko <hiveww@gmail.com>
Authored: Thu Apr 16 20:50:19 2015 +0300
Committer: Alex Antonenko <hiveww@gmail.com>
Committed: Thu Apr 16 20:50:19 2015 +0300

----------------------------------------------------------------------
 .../app/controllers/global/update_controller.js |  1 +
 ambari-web/app/controllers/main/service/item.js |  2 +
 ambari-web/app/routes/main.js                   |  1 +
 .../app/views/main/service/info/summary.js      |  4 --
 ambari-web/app/views/main/service/item.js       |  4 +-
 ambari-web/test/views/main/service/item_test.js | 50 ++++++++++++++++++++
 6 files changed, 57 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/34e60b07/ambari-web/app/controllers/global/update_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/global/update_controller.js b/ambari-web/app/controllers/global/update_controller.js
index 6b58ebd..f81a079 100644
--- a/ambari-web/app/controllers/global/update_controller.js
+++ b/ambari-web/app/controllers/global/update_controller.js
@@ -407,6 +407,7 @@ App.UpdateController = Em.Controller.extend({
     };
     App.HttpClient.get(servicesUrl, App.serviceMetricsMapper, {
       complete: function () {
+        App.set('router.mainServiceItemController.isServicesInfoLoaded', App.get('router.clusterController.isLoaded'));
         callback();
       }
     });

http://git-wip-us.apache.org/repos/asf/ambari/blob/34e60b07/ambari-web/app/controllers/main/service/item.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/service/item.js b/ambari-web/app/controllers/main/service/item.js
index 4518efb..3497be2 100644
--- a/ambari-web/app/controllers/main/service/item.js
+++ b/ambari-web/app/controllers/main/service/item.js
@@ -45,6 +45,8 @@ App.MainServiceItemController = Em.Controller.extend({
     }
   },
 
+  isServicesInfoLoaded: false,
+
   initHosts: function() {
     if (App.get('components.masters').length !== 0) {
       var self = this;

http://git-wip-us.apache.org/repos/asf/ambari/blob/34e60b07/ambari-web/app/routes/main.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/routes/main.js b/ambari-web/app/routes/main.js
index 4913733..3734653 100644
--- a/ambari-web/app/routes/main.js
+++ b/ambari-web/app/routes/main.js
@@ -614,6 +614,7 @@ module.exports = Em.Route.extend(App.RouterRedirections, {
         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/34e60b07/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 84638f5..af3e359 100644
--- a/ambari-web/app/views/main/service/info/summary.js
+++ b/ambari-web/app/views/main/service/info/summary.js
@@ -526,10 +526,6 @@ App.MainServiceInfoSummaryView = Em.View.extend(App.UserPref, {
     return gangliaUrl;
   }.property('App.router.clusterController.gangliaUrl', 'service.serviceName'),
 
-  willInsertElement: function () {
-    App.router.get('updateController').updateServiceMetric(Em.K);
-  },
-
   didInsertElement: function () {
     var svcName = this.get('service.serviceName');
     var isMetricsSupported = svcName != 'STORM' || App.get('isStormMetricsSupported');

http://git-wip-us.apache.org/repos/asf/ambari/blob/34e60b07/ambari-web/app/views/main/service/item.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/service/item.js b/ambari-web/app/views/main/service/item.js
index 485695d..1abac49 100644
--- a/ambari-web/app/views/main/service/item.js
+++ b/ambari-web/app/views/main/service/item.js
@@ -96,7 +96,7 @@ App.MainServiceItemView = Em.View.extend({
   isMaintenanceSet: false,
 
   observeMaintenance: function() {
-    if (!this.get('isMaintenanceSet')) {
+    if (!this.get('isMaintenanceSet') && this.get('controller.isServicesInfoLoaded'))
{
       this.observeMaintenanceOnce();
     }
     Em.run.once(this, 'clearIsMaintenanceSet');
@@ -257,12 +257,14 @@ App.MainServiceItemView = Em.View.extend({
     this.addObserver('controller.isStopDisabled', this, 'observeMaintenance');
     this.addObserver('controller.isClientsOnlyService', this, 'observeMaintenance');
     this.addObserver('controller.content.isRestartRequired', this, 'observeMaintenance');
+    this.addObserver('controller.isServicesInfoLoaded', this, 'observeMaintenance');
   },
 
   willDestroyElement: function() {
     this.removeObserver('controller.isStopDisabled', this, 'observeMaintenance');
     this.removeObserver('controller.isClientsOnlyService', this, 'observeMaintenance');
     this.removeObserver('controller.content.isRestartRequired', this, 'observeMaintenance');
+    this.removeObserver('controller.isServicesInfoLoaded', this, 'observeMaintenance');
   },
   service:function () {
     var svc = this.get('controller.content');

http://git-wip-us.apache.org/repos/asf/ambari/blob/34e60b07/ambari-web/test/views/main/service/item_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/main/service/item_test.js b/ambari-web/test/views/main/service/item_test.js
index 4805004..9e9e5df 100644
--- a/ambari-web/test/views/main/service/item_test.js
+++ b/ambari-web/test/views/main/service/item_test.js
@@ -66,6 +66,56 @@ describe('App.MainServiceItemView', function () {
 
   describe('#observeMaintenance', function () {
 
+    var cases = [
+      {
+        isMaintenanceSet: true,
+        isServicesInfoLoaded: true,
+        observeMaintenanceOnceCallCount: 0,
+        title: 'actions array set, services info loaded'
+      },
+      {
+        isMaintenanceSet: true,
+        isServicesInfoLoaded: false,
+        observeMaintenanceOnceCallCount: 0,
+        title: 'actions array set, services info not loaded'
+      },
+      {
+        isMaintenanceSet: false,
+        isServicesInfoLoaded: true,
+        observeMaintenanceOnceCallCount: 1,
+        title: 'actions array not set, services info loaded'
+      },
+      {
+        isMaintenanceSet: false,
+        isServicesInfoLoaded: false,
+        observeMaintenanceOnceCallCount: 0,
+        title: 'actions array not set, services info not loaded'
+      }
+    ];
+
+    beforeEach(function () {
+      sinon.stub(view, 'observeMaintenanceOnce', Em.K);
+    });
+
+    afterEach(function () {
+      view.observeMaintenanceOnce.restore();
+    });
+
+    cases.forEach(function (item) {
+      it(item.title, function () {
+        view.setProperties({
+          'isMaintenanceSet': item.isMaintenanceSet,
+          'controller.isServicesInfoLoaded': item.isServicesInfoLoaded
+        });
+        view.observeMaintenance();
+        expect(view.observeMaintenanceOnce.callCount).to.equal(item.observeMaintenanceOnceCallCount);
+      });
+    });
+
+  });
+
+  describe('#observeMaintenanceOnce', function () {
+
     var mastersExcludedCommands = {
         NAMENODE: ["DECOMMISSION", "REBALANCEHDFS"],
         RESOURCEMANAGER: ["DECOMMISSION", "REFRESHQUEUES"],


Mime
View raw message