浏览代码

AMBARI-13842 Blank validation popup shown in some scenarios. (ababiichuk)

aBabiichuk 9 年之前
父节点
当前提交
6ee80e70ef

+ 34 - 28
ambari-web/app/mixins/common/serverValidator.js

@@ -412,36 +412,42 @@ App.ServerValidatorMixin = Em.Mixin.create({
       });
       });
     } else if (this.get('configValidationWarning') || this.get('configValidationError')) {
     } else if (this.get('configValidationWarning') || this.get('configValidationError')) {
       // Motivation: for server-side validation warnings and EVEN errors allow user to continue wizard
       // Motivation: for server-side validation warnings and EVEN errors allow user to continue wizard
-      return App.ModalPopup.show({
-        header: Em. I18n.t('installer.step7.popup.validation.warning.header'),
-        classNames: ['sixty-percent-width-modal','modal-full-width'],
-        primary: Em.I18n.t('common.proceedAnyway'),
-        primaryClass: 'btn-danger',
-        marginBottom: 200,
-        onPrimary: function () {
-          this.hide();
-          deferred.resolve();
-        },
-        onSecondary: function () {
-          this.hide();
-          deferred.reject("invalid_configs"); // message used to differentiate types of rejections.
-        },
-        onClose: function () {
-          this.hide();
-          deferred.reject("invalid_configs"); // message used to differentiate types of rejections.
-        },
-        bodyClass: Em.View.extend({
-          controller: self,
-          templateName: require('templates/common/modal_popups/config_recommendation_popup'),
-          serviceConfigs: function() {
-            if (this.get('controller.name') === 'mainServiceInfoConfigsController') {
-              return [this.get('controller.selectedService')];
-            } else {
-              return this.get('controller.stepConfigs');
-            }
-          }.property()
+      var stepConfigs = self.get('name') === 'mainServiceInfoConfigsController'
+        ? [self.get('selectedService')]
+        : self.get('stepConfigs');
+      var configsWithErrors = stepConfigs.some(function (step) {
+        return step.get('configs').some(function(c) {
+          return c.get('isVisible') && !c.get('hiddenBySection') && (c.get('warn') || c.get('error'));
         })
         })
       });
       });
+      if (configsWithErrors) {
+        return App.ModalPopup.show({
+          header: Em. I18n.t('installer.step7.popup.validation.warning.header'),
+          classNames: ['sixty-percent-width-modal','modal-full-width'],
+          primary: Em.I18n.t('common.proceedAnyway'),
+          primaryClass: 'btn-danger',
+          marginBottom: 200,
+          onPrimary: function () {
+            this.hide();
+            deferred.resolve();
+          },
+          onSecondary: function () {
+            this.hide();
+            deferred.reject("invalid_configs"); // message used to differentiate types of rejections.
+          },
+          onClose: function () {
+            this.hide();
+            deferred.reject("invalid_configs"); // message used to differentiate types of rejections.
+          },
+          bodyClass: Em.View.extend({
+            controller: self,
+            templateName: require('templates/common/modal_popups/config_recommendation_popup'),
+            serviceConfigs: stepConfigs
+          })
+        });
+      } else {
+        deferred.resolve();
+      }
     } else {
     } else {
       deferred.resolve();
       deferred.resolve();
     }
     }

+ 16 - 16
ambari-web/app/templates/common/modal_popups/config_recommendation_popup.hbs

@@ -30,20 +30,20 @@
     <tbody>
     <tbody>
       {{#each service in view.serviceConfigs}}
       {{#each service in view.serviceConfigs}}
         {{#each property in service.configs}}
         {{#each property in service.configs}}
-          {{#if property.warn}}
-            <tr>
-              <td>{{property.serviceName}}</td>
-              <td>{{property.name}}</td>
-              <td>{{property.value}}</td>
-              <td>
-                <div class="property-message">{{property.warnMessage}}</div>
-                <div class="property-description">{{property.description}}</div>
-              </td>
-            </tr>
-          {{/if}}
-          {{#if property.error}}
-            {{#if property.isVisible}}
-              {{#unless property.hiddenBySection}}
+          {{#if property.isVisible}}
+            {{#unless property.hiddenBySection}}
+              {{#if property.warn}}
+                <tr>
+                  <td>{{property.serviceName}}</td>
+                  <td>{{property.name}}</td>
+                  <td>{{property.value}}</td>
+                  <td>
+                    <div class="property-message">{{property.warnMessage}}</div>
+                    <div class="property-description">{{property.description}}</div>
+                  </td>
+                </tr>
+              {{/if}}
+              {{#if property.error}}
                 <tr>
                 <tr>
                   <td>{{property.serviceName}}</td>
                   <td>{{property.serviceName}}</td>
                   <td>{{property.name}}</td>
                   <td>{{property.name}}</td>
@@ -53,8 +53,8 @@
                     <div class="property-description">{{property.description}}</div>
                     <div class="property-description">{{property.description}}</div>
                   </td>
                   </td>
                 </tr>
                 </tr>
-              {{/unless}}
-            {{/if}}
+              {{/if}}
+            {{/unless}}
           {{/if}}
           {{/if}}
         {{/each}}
         {{/each}}
       {{/each}}
       {{/each}}