Browse Source

AMBARI-9690 Install Wizard, step 1: redundant base URL check for unselected OSes. (ababiichuk)

aBabiichuk 10 years ago
parent
commit
34b629e353

+ 6 - 0
ambari-web/app/styles/stack_versions.less

@@ -80,6 +80,12 @@
               a {
                 cursor: pointer;
                 text-decoration: none;
+                &.disabled-clear-button {
+                  cursor: default;
+                  .icon-remove-sign {
+                    cursor: default;
+                  }
+                }
               }
               .icon-remove-sign {
                 color: #808080;

+ 1 - 1
ambari-web/app/templates/wizard/step1.hbs

@@ -75,7 +75,7 @@
                         </div>
                         <div class="clear-td">
                           {{#if repository.clearAll}}
-                            <a {{action "clearGroupLocalRepository" repository target="view" }}>
+                            <a {{action "clearGroupLocalRepository" repository target="view" }} {{bindAttr class="operatingSystem.isSelected::disabled-clear-button"}}>
                               <i class="icon-remove-sign"></i>
                             </a>
                           {{/if}}

+ 3 - 0
ambari-web/app/views/wizard/step1_view.js

@@ -208,6 +208,9 @@ App.WizardStep1View = Em.View.extend({
    * @param {object} event
    */
   clearGroupLocalRepository: function (event) {
+    if (!event.context.get('isSelected')) {
+      return;
+    }
     event.context.set('baseUrl', '');
     event.context.set('validation', App.Repository.validation['PENDING']);
   },

+ 8 - 2
ambari-web/test/views/wizard/step1_view_test.js

@@ -590,12 +590,18 @@ describe('App.WizardStep1View', function () {
   });
 
   describe('#clearGroupLocalRepository', function () {
+    var context = {'group-number': 0, id: 'HDP-redhat5', repoId: 'HDP-redhat5', baseUrl: 'baseUrl', validation: 'validation'};
     it('should empty base url and validation', function () {
-      var event = {context: Em.Object.create({'group-number': 0, id: 'HDP-redhat5', repoId: 'HDP-redhat5', baseUrl: 'baseUrl', validation: 'validation'})};
+      var event = {context: Em.Object.create(context, {isSelected: true})};
       view.clearGroupLocalRepository(event);
       expect(event.context.get('baseUrl')).to.be.empty;
       expect(event.context.get('validation')).to.be.empty;
-
+    });
+    it('should do nothing if corresponding OS is not selected', function () {
+      var event = {context: Em.Object.create(context, {isSelected: false})};
+      view.clearGroupLocalRepository(event);
+      expect(event.context.get('baseUrl')).to.equal('baseUrl');
+      expect(event.context.get('validation')).to.equal('validation');
     });
   });