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/01/23 19:54:25 UTC

ambari git commit: Revert "AMBARI-7815. UI - prevent user from deleting host with not "DECOMMISSIONED" datanode/nodemanager. (akovalenko)"

Repository: ambari
Updated Branches:
  refs/heads/trunk b7613c0b3 -> 471b3c853


Revert "AMBARI-7815. UI - prevent user from deleting host with not "DECOMMISSIONED" datanode/nodemanager. (akovalenko)"


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

Branch: refs/heads/trunk
Commit: 471b3c853dd8fd925107cb004e47965343e4df2d
Parents: b7613c0
Author: Aleksandr Kovalenko <ak...@hortonworks.com>
Authored: Fri Jan 23 20:48:07 2015 +0200
Committer: Aleksandr Kovalenko <ak...@hortonworks.com>
Committed: Fri Jan 23 20:48:32 2015 +0200

----------------------------------------------------------------------
 ambari-web/app/controllers/main/host/details.js | 11 ++----
 ambari-web/app/messages.js                      |  3 +-
 .../details/raiseDeleteComponentErrorPopup.hbs  | 10 +++---
 .../test/controllers/main/host/details_test.js  | 38 +-------------------
 4 files changed, 10 insertions(+), 52 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/471b3c85/ambari-web/app/controllers/main/host/details.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/host/details.js b/ambari-web/app/controllers/main/host/details.js
index c62f70e..cc5b947 100644
--- a/ambari-web/app/controllers/main/host/details.js
+++ b/ambari-web/app/controllers/main/host/details.js
@@ -1511,7 +1511,6 @@ App.MainHostDetailsController = Em.Controller.extend({
       lastComponents: [],
       masterComponents: [],
       runningComponents: [],
-      notDecommissionedComponents: [],
       nonDeletableComponents: [],
       unknownComponents: []
     };
@@ -1537,9 +1536,6 @@ App.MainHostDetailsController = Em.Controller.extend({
         if (workStatus === App.HostComponentStatus.unknown) {
           container.unknownComponents.push(cInstance.get('displayName'));
         }
-        if (cInstance.get('adminState') === 'INSERVICE') {
-          container.notDecommissionedComponents.push(cInstance.get('displayName'));
-        }
       });
     }
     return container;
@@ -1558,7 +1554,7 @@ App.MainHostDetailsController = Em.Controller.extend({
     } else if (container.nonDeletableComponents.length > 0) {
       this.raiseDeleteComponentsError(container.nonDeletableComponents, 'nonDeletableList');
       return;
-    } else if (container.runningComponents.length + container.notDecommissionedComponents.length > 0) {
+    } else if (container.runningComponents.length > 0) {
       this.raiseDeleteComponentsError(container.runningComponents, 'runningList');
       return;
     }
@@ -1574,7 +1570,7 @@ App.MainHostDetailsController = Em.Controller.extend({
 
   /**
    * Show popup with info about reasons why host can't be deleted
-   * @param {Array} components
+   * @param {string[]} components
    * @param {string} type
    * @method raiseDeleteComponentsError
    */
@@ -1590,8 +1586,7 @@ App.MainHostDetailsController = Em.Controller.extend({
         return this.get('components').join(", ");
       }.property(),
       componentsBody: function () {
-        var componentsLength = this.get('components.length');
-        return componentsLength ? Em.I18n.t('hosts.cant.do.popup.' + type + '.body').format(this.get('components').length) : '';
+        return Em.I18n.t('hosts.cant.do.popup.' + type + '.body').format(this.get('components').length);
       }.property(),
       componentsBodyEnd: function () {
         if (this.get('showBodyEnd')) {

http://git-wip-us.apache.org/repos/asf/ambari/blob/471b3c85/ambari-web/app/messages.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/messages.js b/ambari-web/app/messages.js
index 44081c0..cb67812 100644
--- a/ambari-web/app/messages.js
+++ b/ambari-web/app/messages.js
@@ -2117,7 +2117,8 @@ Em.I18n.translations = {
   'hosts.cant.do.popup.masterList.body.end':'To delete this host, you must first move all the master components listed above to another host.',
   'hosts.cant.do.popup.nonDeletableList.body':'Deletion of the following {0} components is not supported. ',
   'hosts.cant.do.popup.runningList.body':'This host cannot be deleted since the following components are running:',
-  'hosts.cant.do.popup.runningList.body.end': 'If this host has a DataNode or NodeManager, it should be decommissioned first to prevent data loss.',
+  'hosts.cant.do.popup.runningList.body.end':'To delete this host, you must first stop all the running components listed above. ' +
+    'If this host has a DataNode, it should be decommissioned first to prevent data loss.',
   'hosts.add.header':'Add Host Wizard',
   'hosts.add.exit.header':'Exit',
   'hosts.add.exit.body':'Do you really want to exit Add Host Wizard?',

http://git-wip-us.apache.org/repos/asf/ambari/blob/471b3c85/ambari-web/app/templates/main/host/details/raiseDeleteComponentErrorPopup.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/main/host/details/raiseDeleteComponentErrorPopup.hbs b/ambari-web/app/templates/main/host/details/raiseDeleteComponentErrorPopup.hbs
index 88c0447..46129aa 100644
--- a/ambari-web/app/templates/main/host/details/raiseDeleteComponentErrorPopup.hbs
+++ b/ambari-web/app/templates/main/host/details/raiseDeleteComponentErrorPopup.hbs
@@ -20,13 +20,11 @@
   <div class="warning">
   <i class="icon-warning-sign"></i> <strong>{{componentsBody}}</strong>
   </div>
-  {{#if components.length}}
-    <div class="row-fluid">
-      <div class="tinyoffset span10 warning-list">
-        {{componentsStr}}
-      </div>
+  <div class="row-fluid">
+    <div class="tinyoffset span10 warning-list">
+    {{componentsStr}}
     </div>
-  {{/if}}
+  </div>
 
 {{#if showBodyEnd}}
   <div class="warning-details">{{{componentsBodyEnd}}}</div>

http://git-wip-us.apache.org/repos/asf/ambari/blob/471b3c85/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 1bd8350..0b2f572 100644
--- a/ambari-web/test/controllers/main/host/details_test.js
+++ b/ambari-web/test/controllers/main/host/details_test.js
@@ -1428,7 +1428,6 @@ describe('App.MainHostDetailsController', function () {
       lastComponents: [],
       masterComponents: [],
       runningComponents: [],
-      notDecommissionedComponents: [],
       nonDeletableComponents: [],
       unknownComponents: []
     };
@@ -1506,38 +1505,6 @@ describe('App.MainHostDetailsController', function () {
       expect(controller.getHostComponentsInfo().runningComponents).to.eql(['ZK1']);
       App.HostComponent.find.restore();
     });
-    it('content.hostComponents has notDecommissioned running component', function () {
-      sinon.stub(App.HostComponent, 'find', function() {
-        return [{
-          id: 'DATANODE_host1',
-          componentName: 'DATANODE'
-        }];
-      });
-      controller.set('content', {hostComponents: [Em.Object.create({
-        componentName: 'DATANODE',
-        workStatus: 'STARTED',
-        displayName: 'DataNode',
-        adminState: 'INSERVICE'
-      })]});
-      expect(controller.getHostComponentsInfo().notDecommissionedComponents).to.eql(['DataNode']);
-      App.HostComponent.find.restore();
-    });
-    it('content.hostComponents has notDecommissioned running component', function () {
-      sinon.stub(App.HostComponent, 'find', function() {
-        return [{
-          id: 'DATANODE_host1',
-          componentName: 'DATANODE'
-        }];
-      });
-      controller.set('content', {hostComponents: [Em.Object.create({
-        componentName: 'DATANODE',
-        workStatus: 'INSTALLED',
-        displayName: 'DataNode',
-        adminState: 'INSERVICE'
-      })]});
-      expect(controller.getHostComponentsInfo().notDecommissionedComponents).to.eql(['DataNode']);
-      App.HostComponent.find.restore();
-    });
     it('content.hostComponents has non-deletable component', function () {
       sinon.stub(App.HostComponent, 'find', function () {
         return [
@@ -1618,8 +1585,7 @@ describe('App.MainHostDetailsController', function () {
       controller.set('mockHostComponentsInfo', {
         masterComponents: [],
         nonDeletableComponents: [],
-        runningComponents: [{}],
-        notDecommissionedComponents: []
+        runningComponents: [{}]
       });
       controller.validateAndDeleteHost();
       expect(controller.raiseDeleteComponentsError.calledWith([{}], 'runningList')).to.be.true;
@@ -1629,7 +1595,6 @@ describe('App.MainHostDetailsController', function () {
         masterComponents: [],
         nonDeletableComponents: [],
         runningComponents: [],
-        notDecommissionedComponents: [],
         unknownComponents: [],
         lastComponents: [],
         zkServerInstalled: true
@@ -1644,7 +1609,6 @@ describe('App.MainHostDetailsController', function () {
         masterComponents: [],
         nonDeletableComponents: [],
         runningComponents: [],
-        notDecommissionedComponents: [],
         unknownComponents: [],
         lastComponents: [],
         zkServerInstalled: false