You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ab...@apache.org on 2015/11/11 18:20:56 UTC

ambari git commit: AMBARI-13842 Blank validation popup shown in some scenarios. (ababiichuk)

Repository: ambari
Updated Branches:
  refs/heads/branch-2.1 e8f386b9c -> bbe2ec80d


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


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

Branch: refs/heads/branch-2.1
Commit: bbe2ec80dc5e4f808ef144d22180dffa1fbc3c0b
Parents: e8f386b
Author: aBabiichuk <ab...@cybervisiontech.com>
Authored: Wed Nov 11 19:17:13 2015 +0200
Committer: aBabiichuk <ab...@cybervisiontech.com>
Committed: Wed Nov 11 19:20:47 2015 +0200

----------------------------------------------------------------------
 ambari-web/app/mixins/common/serverValidator.js | 62 +++++++++++---------
 .../config_recommendation_popup.hbs             | 32 +++++-----
 2 files changed, 50 insertions(+), 44 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/bbe2ec80/ambari-web/app/mixins/common/serverValidator.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mixins/common/serverValidator.js b/ambari-web/app/mixins/common/serverValidator.js
index 4d22fdd..70d7579 100644
--- a/ambari-web/app/mixins/common/serverValidator.js
+++ b/ambari-web/app/mixins/common/serverValidator.js
@@ -417,36 +417,42 @@ App.ServerValidatorMixin = Em.Mixin.create({
       });
     } else if (this.get('configValidationWarning') || this.get('configValidationError')) {
       // 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 {
       deferred.resolve();
     }

http://git-wip-us.apache.org/repos/asf/ambari/blob/bbe2ec80/ambari-web/app/templates/common/modal_popups/config_recommendation_popup.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/common/modal_popups/config_recommendation_popup.hbs b/ambari-web/app/templates/common/modal_popups/config_recommendation_popup.hbs
index 4c057a7..f58e086 100644
--- a/ambari-web/app/templates/common/modal_popups/config_recommendation_popup.hbs
+++ b/ambari-web/app/templates/common/modal_popups/config_recommendation_popup.hbs
@@ -30,20 +30,20 @@
     <tbody>
       {{#each service in view.serviceConfigs}}
         {{#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>
                   <td>{{property.serviceName}}</td>
                   <td>{{property.name}}</td>
@@ -53,8 +53,8 @@
                     <div class="property-description">{{property.description}}</div>
                   </td>
                 </tr>
-              {{/unless}}
-            {{/if}}
+              {{/if}}
+            {{/unless}}
           {{/if}}
         {{/each}}
       {{/each}}