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-8972 UI should react instantly on control buttons click. (atkach)
Date Fri, 02 Jan 2015 13:19:41 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk 6298e8043 -> 16d0a86c1


AMBARI-8972 UI should react instantly on control buttons click. (atkach)


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

Branch: refs/heads/trunk
Commit: 16d0a86c1a2a7d830aa9bc745cd5c996b8703380
Parents: 6298e80
Author: Andrii Tkach <atkach@hortonworks.com>
Authored: Fri Jan 2 14:58:43 2015 +0200
Committer: Andrii Tkach <atkach@hortonworks.com>
Committed: Fri Jan 2 15:19:35 2015 +0200

----------------------------------------------------------------------
 .../admin/stack_upgrade/upgrade_group_view.js     |  6 ++++--
 .../stack_upgrade/upgrade_group_view_test.js      | 18 +++++++++++++++---
 2 files changed, 19 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/16d0a86c/ambari-web/app/views/main/admin/stack_upgrade/upgrade_group_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/admin/stack_upgrade/upgrade_group_view.js b/ambari-web/app/views/main/admin/stack_upgrade/upgrade_group_view.js
index e19aab8..92bc291 100644
--- a/ambari-web/app/views/main/admin/stack_upgrade/upgrade_group_view.js
+++ b/ambari-web/app/views/main/admin/stack_upgrade/upgrade_group_view.js
@@ -101,7 +101,7 @@ App.upgradeGroupView = Em.View.extend({
    * @param status
    */
   setUpgradeItemStatus: function(item, status) {
-    App.ajax.send({
+    return App.ajax.send({
       name: 'admin.upgrade.upgradeItem.setState',
       sender: this,
       data: {
@@ -110,7 +110,9 @@ App.upgradeGroupView = Em.View.extend({
         groupId: item.get('group_id'),
         status: status
       }
-    });
+    }).done(function () {
+        item.set('status', status);
+      });
   },
 
   /**

http://git-wip-us.apache.org/repos/asf/ambari/blob/16d0a86c/ambari-web/test/views/main/admin/stack_upgrade/upgrade_group_view_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/main/admin/stack_upgrade/upgrade_group_view_test.js b/ambari-web/test/views/main/admin/stack_upgrade/upgrade_group_view_test.js
index f59b9b0..249764f 100644
--- a/ambari-web/test/views/main/admin/stack_upgrade/upgrade_group_view_test.js
+++ b/ambari-web/test/views/main/admin/stack_upgrade/upgrade_group_view_test.js
@@ -214,13 +214,24 @@ describe('App.upgradeGroupView', function () {
 
   describe("#setUpgradeItemStatus()", function () {
     before(function () {
-      sinon.stub(App.ajax, 'send', Em.K);
+      sinon.stub(App.ajax, 'send', function () {
+        return {
+          done: function (callback) {
+            callback();
+          }
+        }
+      });
     });
     after(function () {
       App.ajax.send.restore();
     });
     it("", function () {
-      view.setUpgradeItemStatus(Em.Object.create({request_id: 1, stage_id: 1, group_id: 1}),
'PENDING');
+      var item = Em.Object.create({
+        request_id: 1,
+        stage_id: 1,
+        group_id: 1
+      })
+      view.setUpgradeItemStatus(item, 'PENDING');
       expect(App.ajax.send.getCall(0).args[0]).to.eql({
         name: 'admin.upgrade.upgradeItem.setState',
         sender: view,
@@ -230,7 +241,8 @@ describe('App.upgradeGroupView', function () {
           groupId: 1,
           status: 'PENDING'
         }
-      })
+      });
+      expect(item.get('status')).to.equal('PENDING');
     });
   });
 


Mime
View raw message