You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ak...@apache.org on 2015/03/19 15:49:07 UTC

ambari git commit: AMBARI-10130. Add ability to change rack directly in hosts table. (akovalenko)

Repository: ambari
Updated Branches:
  refs/heads/trunk 8ced13165 -> d461e3330


AMBARI-10130. Add ability to change rack directly in hosts table. (akovalenko)


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

Branch: refs/heads/trunk
Commit: d461e3330e011eb5f59092a61f0284124967ed04
Parents: 8ced131
Author: Aleksandr Kovalenko <ak...@hortonworks.com>
Authored: Thu Mar 19 16:04:07 2015 +0200
Committer: Aleksandr Kovalenko <ak...@hortonworks.com>
Committed: Thu Mar 19 16:04:07 2015 +0200

----------------------------------------------------------------------
 ambari-web/app/controllers/main/host.js       | 12 +++++++++++
 ambari-web/app/styles/application.less        |  4 ++++
 ambari-web/app/templates/main/host.hbs        |  4 +++-
 ambari-web/test/controllers/main/host_test.js | 24 ++++++++++++++++++++++
 4 files changed, 43 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/d461e333/ambari-web/app/controllers/main/host.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/host.js b/ambari-web/app/controllers/main/host.js
index 96fb23b..9d8f9c4 100644
--- a/ambari-web/app/controllers/main/host.js
+++ b/ambari-web/app/controllers/main/host.js
@@ -948,6 +948,18 @@ App.MainHostController = Em.ArrayController.extend(App.TableServerMixin, {
       }
     });
   },
+
+  /**
+   * Call <code>setRackInfo</code> function to show Set Rack Id popup
+   * @param data
+   */
+  setRackId: function (data) {
+    var rack = data.context.get('rack');
+    var hosts = [data.context];
+    var operationData = {message: Em.I18n.t('hosts.host.details.setRackId')};
+    hostsManagement.setRackInfo(operationData, hosts, rack);
+  },
+
   /**
    * associations between host property and column index
    * @type {Array}

http://git-wip-us.apache.org/repos/asf/ambari/blob/d461e333/ambari-web/app/styles/application.less
----------------------------------------------------------------------
diff --git a/ambari-web/app/styles/application.less b/ambari-web/app/styles/application.less
index b617a6a..0466f59 100644
--- a/ambari-web/app/styles/application.less
+++ b/ambari-web/app/styles/application.less
@@ -2870,6 +2870,10 @@ table.graphs {
 	thead {
       background: none repeat scroll 0 0 #F8F8F8;
     }
+
+    .set-rack-id {
+      text-decoration: none;
+    }
   }
 
   .status-dot-position {

http://git-wip-us.apache.org/repos/asf/ambari/blob/d461e333/ambari-web/app/templates/main/host.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/main/host.hbs b/ambari-web/app/templates/main/host.hbs
index ac219c7..0d1d068 100644
--- a/ambari-web/app/templates/main/host.hbs
+++ b/ambari-web/app/templates/main/host.hbs
@@ -129,7 +129,9 @@
           </td>
           <td class="host-ip">{{host.ip}}</td>
           {{#if App.supports.setRackId}}
-            <td>{{host.rack}}</td>
+            <td>
+              {{host.rack}} <a class="set-rack-id" {{action setRackId host target="controller"}}><i class="icon-pencil"></i></a>
+            </td>
           {{/if}}
           <td class="cores-formatted">{{host.coresFormatted}}</td>
           <td class="memory-formatted">{{host.memoryFormatted}}</td>

http://git-wip-us.apache.org/repos/asf/ambari/blob/d461e333/ambari-web/test/controllers/main/host_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/host_test.js b/ambari-web/test/controllers/main/host_test.js
index cb55bb4..8922f9f 100644
--- a/ambari-web/test/controllers/main/host_test.js
+++ b/ambari-web/test/controllers/main/host_test.js
@@ -18,6 +18,7 @@
 
 var App = require('app');
 var validator = require('utils/validator');
+var hostsManagement = require('utils/hosts');
 require('utils/batch_scheduled_requests');
 require('controllers/main/host');
 require('mappers/server_data_mapper');
@@ -241,4 +242,27 @@ describe('MainHostController', function () {
 
   });
 
+  describe('#setRackId', function () {
+
+    beforeEach(function () {
+      sinon.stub(hostsManagement, 'setRackInfo', Em.K);
+
+    });
+
+    afterEach(function () {
+      hostsManagement.setRackInfo.restore();
+    });
+
+    it('should call setRackInfo with appropriate arguments', function () {
+      var mockedHost = Em.Object.create({
+        rack: 'rackId'
+      });
+      hostController.setRackId({
+        context: mockedHost
+      });
+      expect(hostsManagement.setRackInfo.calledWith({message: Em.I18n.t('hosts.host.details.setRackId')}, [mockedHost], 'rackId')).to.be.true;
+    });
+
+  });
+
 });