This is an automated email from the ASF dual-hosted git repository.

ishanbha pushed a commit to branch branch-feature-AMBARI-14714-ui
in repository https://gitbox.apache.org/repos/asf/ambari.git


The following commit(s) were added to refs/heads/branch-feature-AMBARI-14714-ui 
by this push:
     new 95d5d19  [AMBARI-22872] Register/Confirm Host for modular deployment. 
(#225)
95d5d19 is described below

commit 95d5d19446904af78e0d020d3218ae286daceaab
Author: Ishan Bhatt <[email protected]>
AuthorDate: Thu Feb 1 09:25:29 2018 -0800

    [AMBARI-22872] Register/Confirm Host for modular deployment. (#225)
    
    * [AMBARI-22872] Register/Confirm Host for modular deployment.
    
    * Moved removeselectedhost function to the view and added a few tests
    
    * Minor tweaks
---
 .../app/controllers/wizard/step3_controller.js     |  10 -
 ambari-web/app/messages.js                         |   7 +-
 ambari-web/app/styles/wizard.less                  |  56 +++---
 ambari-web/app/templates/common/pagination.hbs     |   2 +-
 ambari-web/app/templates/wizard/step3.hbs          | 209 +++++++++++----------
 ambari-web/app/views/wizard/step3_view.js          |  15 +-
 ambari-web/test/controllers/wizard/step3_test.js   |  23 ---
 ambari-web/test/views/wizard/step3_view_test.js    |  46 +++++
 8 files changed, 197 insertions(+), 171 deletions(-)

diff --git a/ambari-web/app/controllers/wizard/step3_controller.js 
b/ambari-web/app/controllers/wizard/step3_controller.js
index 9a11e29..f4c9039 100644
--- a/ambari-web/app/controllers/wizard/step3_controller.js
+++ b/ambari-web/app/controllers/wizard/step3_controller.js
@@ -331,16 +331,6 @@ App.WizardStep3Controller = 
App.WizardStepController.extend(App.ReloadPopupMixin
   },
 
   /**
-   * Remove selected hosts (click-handler)
-   * @return App.ModalPopup
-   * @method removeSelectedHosts
-   */
-  removeSelectedHosts: function () {
-    var selectedHosts = this.get('hosts').filterProperty('isChecked', true);
-    return this.removeHosts(selectedHosts);
-  },
-
-  /**
    * Show popup with the list of hosts which are selected
    * @return App.ModalPopup
    * @method selectedHostsPopup
diff --git a/ambari-web/app/messages.js b/ambari-web/app/messages.js
index acf2a00..b7f7cfa 100644
--- a/ambari-web/app/messages.js
+++ b/ambari-web/app/messages.js
@@ -821,8 +821,7 @@ Em.I18n.translations = {
   'installer.step2.refresh.table': 'REFRESH TABLE',
 
   'installer.step3.header':'Confirm Hosts',
-  'installer.step3.body':'Registering your hosts.<br>' +
-    'Please confirm the host list and remove any hosts that you do not want to 
include in the cluster.',
+  'installer.step3.body':'Registering your hosts. Please confirm the host list 
and remove any hosts that you do not want to include in the cluster.',
   'installer.step3.hostLog.popup.header':'Registration log for {0}',
   'installer.step3.hosts.remove.popup.header':'Remove Hosts',
   'installer.step3.hosts.remove.popup.body':'Are you sure you want to remove 
the selected host(s)?',
@@ -942,8 +941,6 @@ Em.I18n.translations = {
   'installer.step3.warning.registeredHosts': '{0} Other Registered Hosts',
   'installer.step3.warning.loading':'Please wait while the hosts are being 
checked for potential problems...',
   'installer.step3.registeredHostsPopup': 'These are the hosts that have 
registered with the server, but do not appear in the list of hosts that you are 
adding.',
-  'installer.step3.removeSelected':'Remove Selected',
-  'installer.step3.retryFailed':'Retry Failed',
   'installer.step3.hosts.status.registering':'Registering',
   'installer.step3.hosts.status.installing':'Installing',
   'installer.step3.hosts.bootLog.failed':'\nRegistration with the server 
failed.',
@@ -3200,7 +3197,7 @@ Em.I18n.translations = {
   'tableView.filters.all': 'All',
   'tableView.filters.filtered': 'Filtered',
   'tableView.filters.clearFilters': 'Clear filters',
-  'tableView.filters.itemsPerPage': 'Items per page:',
+  'tableView.filters.rowsPerPage': 'Rows per page:',
   'tableView.filters.paginationInfo': '{0} - {1} of {2}',
   'tableView.filters.clearAllFilters': 'clear filters',
   'tableView.filters.showAll': 'Show All',
diff --git a/ambari-web/app/styles/wizard.less 
b/ambari-web/app/styles/wizard.less
index 0209589..b18e95d 100644
--- a/ambari-web/app/styles/wizard.less
+++ b/ambari-web/app/styles/wizard.less
@@ -236,45 +236,18 @@
     }
 
     #host-filter {
-
-      ul {
-        margin: 3px;
-        font-size: 12px;
-        li.filter-status.active a {
-          text-decoration: none;
-          color: #fff;
-        }
-        li.filter-status.active,
-        li.filter-status.active:hover {
-          background-color: #666;
-          box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.15), 0 1px 2px rgba(0, 
0, 0, 0.05);
-          border-radius: 5px;
-        }
-        li.filter-status:hover {
-          background-color: #d8d8d8;
-          border-radius: 5px;
-        }
-        li.divider {
-          color: #666;
-          padding: 4px 2px;
-        }
-        li {
-          list-style: none;
-          display: block;
-          float: left;
-          padding: 4px;
-          a {
-            text-decoration: underline;
-          }
-        }
-        li.first {
-          font-weight: bold;
-        }
+      padding-top: 5px;
+      .nav-tabs > li.active > a, .nav-tabs > li.active > a:hover, .nav-tabs > 
li.active > a:focus {
+        background-color: transparent;
       }
     }
     .progress {
       margin-bottom: 0;
     }
+    .pre-scrollable {
+      float: left;
+      max-height: 440px;
+    }
     #confirm-hosts-table {
       td.host {
         max-width: 290px;
@@ -290,6 +263,19 @@
       #display-action {
         visibility:visible;
       }
+      .step3-table-progress {
+        .progress {
+          height: 8px;
+          margin: 5px 5px 5px 0;
+          border-radius: 2px;
+          width: 80%;
+        }
+      }
+      .step3-table-action {
+        .icon {
+          color: #999;
+        }
+      }
     }
     #warningsSection {
       margin: 0px 10px;
@@ -1027,4 +1013,4 @@
 
 .filter-input {
   margin: 15px;
-}
\ No newline at end of file
+}
diff --git a/ambari-web/app/templates/common/pagination.hbs 
b/ambari-web/app/templates/common/pagination.hbs
index f5b4fc2..2b30267 100644
--- a/ambari-web/app/templates/common/pagination.hbs
+++ b/ambari-web/app/templates/common/pagination.hbs
@@ -17,7 +17,7 @@
 }}
 
 <div class="pagination-block-item">
-  {{t tableView.filters.itemsPerPage}}
+  {{t tableView.filters.rowsPerPage}}
   {{view view.rowsPerPageSelectView 
selectionBinding="view.dataView.displayLength" data-qa="pagination-select"}}
 </div>
 <div class="pagination-block-item">{{view.dataView.paginationInfo}}</div>
diff --git a/ambari-web/app/templates/wizard/step3.hbs 
b/ambari-web/app/templates/wizard/step3.hbs
index 0221d86..cd200a5 100644
--- a/ambari-web/app/templates/wizard/step3.hbs
+++ b/ambari-web/app/templates/wizard/step3.hbs
@@ -19,137 +19,154 @@
 <div id="confirm-hosts" class="wizard-content col-md-9">
   <h4 class="step-title">{{t installer.step3.header}}</h4>
   {{#if isSaved}}
-  <div class="alert alert-warning" role="alert"><strong>{{t 
common.warning}}:</strong> {{t installer.warning.changes}}</div>
+    <div class="alert alert-warning" role="alert"><strong>{{t 
common.warning}}:</strong> {{t installer.warning.changes}}</div>
   {{/if}}
 
   <div class="panel panel-default">
     <div class="panel-body">
       <p class="step-description" {{QAAttr "step3-description"}}>{{t 
installer.step3.body}}</p>
+      <div class="panel-heading compact-panel-heading">
         <div class="button-section">
-          {{#unless view.noHostsSelected}}
-            <button class="btn btn-primary" {{action removeSelectedHosts 
target="controller"}} {{QAAttr "remove-selected-button"}}>
-              <i class="glyphicon glyphicon-trash glyphicon-white"></i>
-              <span class="hidden-sm">{{t 
installer.step3.removeSelected}}</span>
+          <div class="pull-right btn-group">
+            <button class="dropdown-toggle btn btn-default" 
data-toggle="dropdown" href="#">
+              {{t common.actions}}
+              &nbsp;
+              <i class="caret"></i>
             </button>
-          {{/unless}}
-          {{#unless isRetryDisabled}}
-            <button class="btn btn-primary" {{action retrySelectedHosts 
target="view"}} {{QAAttr "retry-failed-button"}}>
-              <i class="glyphicon glyphicon-repeat glyphicon-white"></i>
-              <span class="hidden-sm">{{t installer.step3.retryFailed}}</span>
-            </button>
-          {{/unless}}
-
-          <div id="host-filter" class="pull-right">
-            <ul class="clearfix">
-              <li class="first">{{t common.show}}:</li>
+            <ul class="dropdown-menu">
+              <li {{bindAttr class="view.noHostsSelected:disabled"}}>
+                <a {{bindAttr class="view.noHostsSelected:disabled"}} {{action 
removeSelectedHosts target="view"}}
+                  {{QAAttr "remove-selected-button"}}>
+                  <i class="glyphicon glyphicon-trash"></i>&nbsp;
+                  {{t common.remove}}
+                </a>
+              </li>
+              <li {{bindAttr class="isRetryDisabled:disabled"}}>
+                <a {{bindAttr class="isRetryDisabled:disabled"}} {{action 
retrySelectedHosts target="view"}}
+                  {{QAAttr "retry-failed-button"}}>
+                  <i class="glyphicon glyphicon-repeat"></i>&nbsp;
+                  {{t common.retry }}
+                </a>
+              </li>
+            </ul>
+          </div>
+          <div id="host-filter" class="pull-left">
+            <ul class="nav nav-tabs">
               {{#each category in view.categories}}
                 <li {{bindAttr class=":filter-status category.itemClass"}}>
-                  <a {{action selectCategory category target="view"}} {{QAAttr 
"hosts-filter-{category.hostsBootStatus}"}} href="#">
+                  <a {{action selectCategory category target="view"}} {{QAAttr 
"hosts-filter-{category.hostsBootStatus}"}}
+                          href="#">
                     {{category.label}}
                   </a>
                 </li>
-                {{#unless category.last}}
-                  <li class="divider">|</li>
-                {{/unless}}
+                &nbsp;
               {{/each}}
             </ul>
           </div>
         </div>
         <div class="clearfix"></div>
-        <div class="pre-scrollable col-sm-12" style="max-height: 440px;"></div>
-        <table id="confirm-hosts-table" class="table table-hover" {{QAAttr 
"confirm-hosts-table"}}>
-          <thead>
-          <tr>
-            <th class="col-md-5" {{QAAttr 
"confirm-hosts-table-heading-cell"}}>{{t common.host}}</th>
-            <!-- retrieved from local storage initially -->
-            <th class="col-md-2" {{QAAttr 
"confirm-hosts-table-heading-cell"}}>{{t common.progress}}</th>
-            <th class="col-md-2" {{QAAttr 
"confirm-hosts-table-heading-cell"}}>{{t common.status}}</th>
-            <!-- given by the parsing function that parses data from bootstrap 
call, dynamically assign the color -->
-            <th class="col-md-2" {{QAAttr 
"confirm-hosts-table-heading-cell"}}>{{t common.action}}</th>
-            <!-- trash icon -->
-            <!-- retry icon -->
-            <th {{QAAttr "confirm-hosts-table-heading-cell"}}>
-              {{view App.CheckboxView checkedBinding="view.pageChecked"}}
-            </th>
-          </tr>
-          </thead>
-          <tbody {{QAAttr "confirm-hosts-table-body"}}>
-          {{#if view.pageContent}}
-            {{#each host in view.pageContent}}
-              {{#view App.WizardHostView categoryBinding="controller.category" 
hostInfoBinding="host" data-qa="confirm-hosts-table-body-row"}}
-                <td class="host" {{QAAttr "confirm-hosts-table-body-cell"}}>
-                  <span title="{{unbound host.name}}" class="trim_hostname" 
{{QAAttr "confirm-hosts-table-host-name"}}>{{host.name}}</span>
-                </td>
-                <td class="step3-table-progress" {{QAAttr 
"confirm-hosts-table-body-cell"}}>
-                  <div class="progress">
-                    <div {{bindAttr class="host.bootBarColor 
host.isBootDone::progress-bar-striped host.isBootDone::active :progress-bar"}}
-                      {{QAAttr "{host.bootBarColor}"}}
-                      style="width:100%">
+      </div>
+      <div class="panel-body">
+        <div class="pre-scrollable col-sm-12">
+          <table id="confirm-hosts-table" class="table table-hover" {{QAAttr 
"confirm-hosts-table"}}>
+            <thead>
+            <tr>
+              <th {{QAAttr "confirm-hosts-table-heading-cell"}}>
+                {{view App.CheckboxView checkedBinding="view.pageChecked"}}
+              </th>
+              <th class="col-md-6" {{QAAttr 
"confirm-hosts-table-heading-cell"}}>{{t common.host}}</th>
+              <!-- retrieved from local storage initially -->
+              <th class="col-md-3" {{QAAttr 
"confirm-hosts-table-heading-cell"}}>{{t common.progress}}</th>
+              <th class="col-md-2" {{QAAttr 
"confirm-hosts-table-heading-cell"}}>{{t common.status}}</th>
+              <!-- given by the parsing function that parses data from 
bootstrap call, dynamically assign the color -->
+              <th class="col-md-2" {{QAAttr 
"confirm-hosts-table-heading-cell"}}>{{t common.action}}</th>
+              <!-- trash icon -->
+              <!-- retry icon -->
+            </tr>
+            </thead>
+            <tbody {{QAAttr "confirm-hosts-table-body"}}>
+            {{#if view.pageContent}}
+              {{#each host in view.pageContent}}
+                {{#view App.WizardHostView 
categoryBinding="controller.category" hostInfoBinding="host" 
data-qa="confirm-hosts-table-body-row"}}
+                  <td class="step3-table-checkbox" {{QAAttr 
"confirm-hosts-table-body-cell"}}>
+                    {{view App.CheckboxView checkedBinding="host.isChecked" 
labelIdentifier="select-host-checkbox"}}
+                  </td>
+                  <td class="host" {{QAAttr "confirm-hosts-table-body-cell"}}>
+                    <span title="{{unbound host.name}}"
+                          class="trim_hostname" {{QAAttr 
"confirm-hosts-table-host-name"}}>{{host.name}}</span>
+                  </td>
+                  <td class="step3-table-progress" {{QAAttr 
"confirm-hosts-table-body-cell"}}>
+                    <div class="progress">
+                      <div {{bindAttr class="host.bootBarColor 
host.isBootDone::progress-bar-striped host.isBootDone::active :progress-bar"}}
+                        {{QAAttr "{host.bootBarColor}"}}
+                              style="width:100%">
+                      </div>
                     </div>
-                  </div>
-                </td>
-                <td class="step3-table-status" {{QAAttr 
"confirm-hosts-table-body-cell"}}>
-                  <a href="javascript:void(null)" data-toggle="modal" {{action 
hostLogPopup host target="controller"}} {{QAAttr "host-status-link"}}>
-                    <span {{bindAttr class="host.bootStatusColor"}} {{QAAttr 
"host-status-{host.bootStatus}"}}>{{host.bootStatusForDisplay}}</span>
-                  </a>
-                </td>
-                <td class="step3-table-action" {{QAAttr 
"confirm-hosts-table-body-cell"}}>
-                  <a class="action" id="display-action" href="#" {{action 
remove target="view"}} {{bindAttr disabled="isBackDisabled"}} {{QAAttr 
"remove-host-button"}}>
-                    <i class="glyphicon glyphicon-trash" {{translateAttr 
title="common.remove"}}></i>
-                  </a>
-                </td>
-                <td class="step3-table-checkbox" {{QAAttr 
"confirm-hosts-table-body-cell"}}>
-                  {{view App.CheckboxView checkedBinding="host.isChecked" 
labelIdentifier="select-host-checkbox"}}
+                  </td>
+                  <td class="step3-table-status" {{QAAttr 
"confirm-hosts-table-body-cell"}}>
+                    <a href="javascript:void(null)"
+                       data-toggle="modal" {{action hostLogPopup host 
target="controller"}} {{QAAttr "host-status-link"}}>
+                      <span {{bindAttr class="host.bootStatusColor"}} {{QAAttr 
"host-status-{host.bootStatus}"}}>{{host.bootStatusForDisplay}}</span>
+                    </a>
+                  </td>
+                  <td class="step3-table-action" {{QAAttr 
"confirm-hosts-table-body-cell"}}>
+                    <a class="action" id="display-action"
+                       href="#" {{action remove target="view"}} {{bindAttr 
disabled="isBackDisabled"}} {{QAAttr "remove-host-button"}}>
+                      <i class="icon icon-remove-sign" {{translateAttr 
title="common.remove"}}></i>
+                    </a>
+                  </td>
+                {{/view}}
+              {{/each}}
+            {{else}}
+              <tr {{QAAttr "confirm-hosts-table-body-row"}}>
+                <td class="step3-table-no-hosts" colspan="5" {{QAAttr 
"confirm-hosts-table-body-cell"}}>
+                  {{t hosts.table.noHosts}}
                 </td>
-              {{/view}}
-            {{/each}}
-          {{else}}
-            <tr {{QAAttr "confirm-hosts-table-body-row"}}>
-              <td class="step3-table-no-hosts" colspan="5" {{QAAttr 
"confirm-hosts-table-body-cell"}}>
-                {{t hosts.table.noHosts}}
-              </td>
-            </tr>
-          {{/if}}
-          </tbody>
-          <tfoot>
+              </tr>
+            {{/if}}
+            </tbody>
+            <tfoot>
             <tr>
               <td colspan="5">
                 {{view App.PaginationView}}
               </td>
             </tr>
-          </tfoot>
-        </table>
-        <div id="warningsSection">
-          {{#if hasMoreRegisteredHosts}}
-            <div {{bindAttr class=":alert :alert-warning"}} {{QAAttr 
"alert-warning"}}>
-              <a href="#" {{action registeredHostsPopup target="controller"}} 
{{QAAttr "alert-link"}}><span {{QAAttr 
"other-hosts-link"}}>{{view.registeredHostsMessage}}</span></a>
-            </div>
-          {{/if}}
-          {{#unless disableHostCheck}}
-            <div {{bindAttr class=":alert :alert-warning view.status 
isWarningsBoxVisible::hidden"}} {{QAAttr "{view.status}"}}>
-              {{view.message}}
-              <a href="#" {{action hostWarningsPopup warnings 
target="controller"}} {{QAAttr "alert-link"}}>{{view.linkText}}</a>
-              {{#unless isBootstrapFailed}}
-                {{#unless isWarningsLoaded}}
-                  {{view App.SpinnerView data-qa="spinner"}}
-                {{/unless}}
-              {{/unless}}
-            </div>
-          {{/unless}}
+            </tfoot>
+          </table>
         </div>
       </div>
+      <div id="warningsSection">
+        {{#if hasMoreRegisteredHosts}}
+          <div {{bindAttr class=":alert :alert-warning"}} {{QAAttr 
"alert-warning"}}>
+            <a href="#" {{action registeredHostsPopup target="controller"}} 
{{QAAttr "alert-link"}}><span {{QAAttr 
"other-hosts-link"}}>{{view.registeredHostsMessage}}</span></a>
+          </div>
+        {{/if}}
+        {{#unless disableHostCheck}}
+          <div {{bindAttr class=":alert :alert-warning view.status 
isWarningsBoxVisible::hidden"}} {{QAAttr "{view.status}"}}>
+            {{view.message}}
+            <a href="#" {{action hostWarningsPopup warnings 
target="controller"}} {{QAAttr "alert-link"}}>{{view.linkText}}</a>
+            {{#unless isBootstrapFailed}}
+              {{#unless isWarningsLoaded}}
+                {{view App.SpinnerView data-qa="spinner"}}
+              {{/unless}}
+            {{/unless}}
+          </div>
+        {{/unless}}
+      </div>
     </div>
+  </div>
 </div>
-
 <div class="wizard-footer col-md-12">
   <div class="btn-area">
-    <button type="button" class="btn btn-default pull-left installer-back-btn" 
{{bindAttr disabled="isBackButtonDisabled"}} {{action back}} {{QAAttr 
"wizard-back"}}>
+    <button type="button"
+            class="btn btn-default pull-left installer-back-btn" {{bindAttr 
disabled="isBackButtonDisabled"}} {{action back}} {{QAAttr "wizard-back"}}>
       &larr; {{t common.back}}
       {{#if App.router.backBtnClickInProgress}}
         {{view App.SpinnerView tagName="span" 
classNames="service-button-spinner"}}
       {{/if}}
     </button>
-    <button type="button" class="btn btn-success pull-right" {{bindAttr 
disabled="isNextButtonDisabled"}} {{action submit target="controller"}} 
{{QAAttr "wizard-next"}}>
+    <button type="button"
+            class="btn btn-success pull-right" {{bindAttr 
disabled="isNextButtonDisabled"}} {{action submit target="controller"}} 
{{QAAttr "wizard-next"}}>
       {{#if App.router.nextBtnClickInProgress}}
         {{view App.SpinnerView tagName="span" 
classNames="service-button-spinner"}}
       {{/if}}
diff --git a/ambari-web/app/views/wizard/step3_view.js 
b/ambari-web/app/views/wizard/step3_view.js
index 3249b24..f61e59d 100644
--- a/ambari-web/app/views/wizard/step3_view.js
+++ b/ambari-web/app/views/wizard/step3_view.js
@@ -95,7 +95,7 @@ App.WizardStep3View = App.TableView.extend({
       this.categoryObject.create({value: 
Em.I18n.t('installer.step3.hosts.status.installing'), hostsBootStatus: 
'RUNNING'}),
       this.categoryObject.create({value: 
Em.I18n.t('installer.step3.hosts.status.registering'), hostsBootStatus: 
'REGISTERING'}),
       this.categoryObject.create({value: Em.I18n.t('common.success'), 
hostsBootStatus: 'REGISTERED' }),
-      this.categoryObject.create({value: Em.I18n.t('common.fail'), 
hostsBootStatus: 'FAILED', last: true })
+      this.categoryObject.create({value: Em.I18n.t('common.failed'), 
hostsBootStatus: 'FAILED', last: true })
     ];
   }.property(),
 
@@ -163,6 +163,19 @@ App.WizardStep3View = App.TableView.extend({
   },
 
   /**
+   * Remove selected hosts (click-handler)
+   * @return App.ModalPopup
+   * @method removeSelectedHosts
+   */
+  removeSelectedHosts: function () {
+    if(!this.get('noHostsSelected')) {
+      var selectedHosts = this.get('content').filterProperty('isChecked', 
true);
+      return this.get('controller').removeHosts(selectedHosts);
+    }
+    return false;
+  },
+
+  /**
    * Update <code>registeredHostsMessage</code> according to 
<code>controller.registeredHots.length</code>
    * @method setRegisteredHosts
    */
diff --git a/ambari-web/test/controllers/wizard/step3_test.js 
b/ambari-web/test/controllers/wizard/step3_test.js
index b8bc794..a1bab21 100644
--- a/ambari-web/test/controllers/wizard/step3_test.js
+++ b/ambari-web/test/controllers/wizard/step3_test.js
@@ -380,29 +380,6 @@ describe('App.WizardStep3Controller', function () {
 
   });
 
-  describe('#removeSelectedHosts', function () {
-
-    beforeEach(function () {
-      sinon.stub(c, 'removeHosts', Em.K);
-    });
-
-    afterEach(function () {
-      c.removeHosts.restore();
-    });
-
-    it('should remove selected hosts', function () {
-      c.set('hosts', [
-        {isChecked: true, name: 'c1'},
-        {isChecked: false, name: 'c2'}
-      ]);
-      c.removeSelectedHosts();
-      expect(c.removeHosts.calledWith([
-        {isChecked: true, name: 'c1'}
-      ])).to.be.true;
-    });
-
-  });
-
   describe('#selectedHostsPopup', function () {
 
     beforeEach(function () {
diff --git a/ambari-web/test/views/wizard/step3_view_test.js 
b/ambari-web/test/views/wizard/step3_view_test.js
index 46ed1d3..7d28fa3 100644
--- a/ambari-web/test/views/wizard/step3_view_test.js
+++ b/ambari-web/test/views/wizard/step3_view_test.js
@@ -340,6 +340,52 @@ describe('App.WizardStep3View', function () {
     });
   });
 
+  describe('#removeSelectedHosts', function () {
+
+    beforeEach(function () {
+      v = App.WizardStep3View.create({
+        controller: Em.Object.create({
+          removeHosts: Em.K
+        }),
+        content: [
+          {isChecked: true, name: 'c1'},
+          {isChecked: false, name: 'c2'}
+        ]
+      });
+      sinon.spy(v.get('controller'), 'removeHosts');
+      sinon.stub(v, '$').returns({
+        on: Em.K
+      });
+    });
+
+    afterEach(function() {
+      v.get('controller').removeHosts.restore();
+      v.$.restore();
+    });
+
+    it('should remove selected hosts', function () {
+      v.set('noHostsSelected', false);
+      v.removeSelectedHosts();
+      expect(v.get('controller').removeHosts.calledWith([
+        {isChecked: true, name: 'c1'}
+      ])).to.be.true;
+    });
+
+    it('should not remove host not selected', function () {
+      v.set('noHostsSelected', false);
+      v.removeSelectedHosts();
+      expect(v.get('controller').removeHosts.calledWith([
+        {isChecked: false, name: 'c2'}
+      ])).to.be.false;
+    });
+
+    it('should not remove any host', function () {
+      v.set('noHostsSelected', true);
+      expect(v.removeSelectedHosts()).to.equal(false);
+    });
+
+  });
+
   describe('#selectCategory', function() {
     var tests = Em.A(['ALL','RUNNING','REGISTERING','REGISTERED','FAILED']);
     tests.forEach(function(test) {

-- 
To stop receiving notification emails like this one, please contact
[email protected].

Reply via email to