Repository: ambari
Updated Branches:
  refs/heads/trunk 9c6ac14e9 -> 05b0d0b7e


AMBARI-10329. An error badge showing "0" appears after hitting Next on Select 
Stack page (alexantonenko)


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

Branch: refs/heads/trunk
Commit: 22fb15a0af9ad35daa966271007fbb50e8ada0ac
Parents: 9c6ac14
Author: Alex Antonenko <[email protected]>
Authored: Thu Apr 2 22:24:56 2015 +0300
Committer: Alex Antonenko <[email protected]>
Committed: Thu Apr 2 22:53:12 2015 +0300

----------------------------------------------------------------------
 ambari-web/app/templates/wizard/step1.hbs       |  3 +-
 ambari-web/app/views/wizard/step1_view.js       |  8 ++++++
 ambari-web/test/views/wizard/step1_view_test.js | 30 ++++++++++++++++++++
 3 files changed, 39 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/22fb15a0/ambari-web/app/templates/wizard/step1.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/wizard/step1.hbs 
b/ambari-web/app/templates/wizard/step1.hbs
index c64fe08..eca7b52 100644
--- a/ambari-web/app/templates/wizard/step1.hbs
+++ b/ambari-web/app/templates/wizard/step1.hbs
@@ -34,11 +34,10 @@
         <i {{bindAttr class=":pull-left :accordion-toggle 
view.isRLCollapsed:icon-caret-right:icon-caret-down"}}></i>
         <a class="accordion-toggle">
           {{t installer.step1.advancedRepo.title}}
-          {{#if view.isSubmitDisabled}}
+          {{#if view.showErrorsWarningCount}}
             <span class="badge badge-important">{{view.totalErrorCnt}}</span>
           {{/if}}
         </a>
-
       </div>
       <div class="accordion-body collapse in">
         <div class="accordion-inner">

http://git-wip-us.apache.org/repos/asf/ambari/blob/22fb15a0/ambari-web/app/views/wizard/step1_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/wizard/step1_view.js 
b/ambari-web/app/views/wizard/step1_view.js
index 6ae4823..60725f1 100644
--- a/ambari-web/app/views/wizard/step1_view.js
+++ b/ambari-web/app/views/wizard/step1_view.js
@@ -88,6 +88,14 @@ App.WizardStep1View = Em.View.extend({
   }.property('invalidFormatUrlExist', 'isNoOsChecked', 'invalidUrlExist', 
'controller.content.isCheckInProgress'),
 
   /**
+   * Enable error count badge
+   * @type {bool}
+   */
+  showErrorsWarningCount: function () {
+    return this.get('isSubmitDisabled') && !!this.get('totalErrorCnt');
+  }.property('isSubmitDisabled', 'totalErrorCnt'),
+
+  /**
    * Verify if some invalid repo-urls exist
    * @type {bool}
    */

http://git-wip-us.apache.org/repos/asf/ambari/blob/22fb15a0/ambari-web/test/views/wizard/step1_view_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/wizard/step1_view_test.js 
b/ambari-web/test/views/wizard/step1_view_test.js
index 4d827bd..76491a5 100644
--- a/ambari-web/test/views/wizard/step1_view_test.js
+++ b/ambari-web/test/views/wizard/step1_view_test.js
@@ -360,6 +360,36 @@ describe('App.WizardStep1View', function () {
     });
   });
 
+  describe('#showErrorsWarningCount', function() {
+    var tests = [
+      {
+        isSubmitDisabled: true,
+        totalErrorCnt: 0,
+        e: false
+      },
+      {
+        isSubmitDisabled: true,
+        totalErrorCnt: 1,
+        e: true
+      },
+      {
+        isSubmitDisabled: false,
+        totalErrorCnt: 0,
+        e: false
+      }
+    ];
+    tests.forEach(function(test) {
+      it(test.isSubmitDisabled.toString() + ' ' + 
test.totalErrorCnt.toString(), function () {
+        var view = App.WizardStep1View.create();
+        view.reopen({
+          isSubmitDisabled: test.isSubmitDisabled,
+          totalErrorCnt: test.totalErrorCnt
+        });
+        expect(view.get('showErrorsWarningCount')).to.equal(test.e);
+      })
+    });
+  });
+
   describe('#invalidUrlExist', function () {
     var tests = Em.A([
       {

Reply via email to