ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jai...@apache.org
Subject ambari git commit: Revert "AMBARI-14095. Upgrade: second click shows diff results"
Date Tue, 01 Dec 2015 01:43:37 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk 24094e179 -> 278d4c9eb


Revert "AMBARI-14095. Upgrade: second click shows diff results"

This reverts commit b470e3e7d9cd78b747f6cc08e100e9a2b8b709fc.


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

Branch: refs/heads/trunk
Commit: 278d4c9ebe854ef66a323fef47f663eda809dca1
Parents: 24094e1
Author: Jaimin Jetly <jaimin@hortonworks.com>
Authored: Mon Nov 30 17:43:21 2015 -0800
Committer: Jaimin Jetly <jaimin@hortonworks.com>
Committed: Mon Nov 30 17:43:21 2015 -0800

----------------------------------------------------------------------
 ambari-web/app/assets/test/tests.js             |   1 -
 .../app/controllers/main/admin/kerberos.js      |   8 +-
 .../main/admin/stack_and_upgrade_controller.js  |  42 +--
 .../modal_popups/cluster_check_dialog.hbs       |  24 +-
 .../common/modal_popups/cluster_check_popup.js  | 107 ++++++--
 .../admin/stack_and_upgrade_controller_test.js  |   2 +-
 .../modal_popups/cluster_check_popup_test.js    | 271 -------------------
 7 files changed, 103 insertions(+), 352 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/278d4c9e/ambari-web/app/assets/test/tests.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/assets/test/tests.js b/ambari-web/app/assets/test/tests.js
index 23460b7..f8d59f1 100644
--- a/ambari-web/app/assets/test/tests.js
+++ b/ambari-web/app/assets/test/tests.js
@@ -202,7 +202,6 @@ var files = [
   'test/views/common/widget/graph_widget_view_test',
   'test/views/common/widget/number_widget_view_test',
   'test/views/common/widget/gauge_widget_view_test',
-  'test/views/common/modal_popups/cluster_check_popup_test',
   'test/views/common/modal_popups/hosts_table_list_popup_test',
   'test/views/common/modal_popups/dependent_configs_list_popup_test',
   'test/views/main/admin_test',

http://git-wip-us.apache.org/repos/asf/ambari/blob/278d4c9e/ambari-web/app/controllers/main/admin/kerberos.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/admin/kerberos.js b/ambari-web/app/controllers/main/admin/kerberos.js
index ac2a332..57ee8c1 100644
--- a/ambari-web/app/controllers/main/admin/kerberos.js
+++ b/ambari-web/app/controllers/main/admin/kerberos.js
@@ -221,16 +221,10 @@ App.MainAdminKerberosController = App.KerberosWizardStep4Controller.extend({
   runSecurityCheckSuccess: function (data, opt, params) {
     //TODO correct check
     if (data.items.someProperty('UpgradeChecks.status', "FAIL")) {
-      var hasFails = data.items.someProperty('UpgradeChecks.status', 'FAIL');
       var header = Em.I18n.t('popup.clusterCheck.Security.header').format(params.label);
       var title = Em.I18n.t('popup.clusterCheck.Security.title');
       var alert = Em.I18n.t('popup.clusterCheck.Security.alert');
-      App.showClusterCheckPopup(data, {
-        header: header,
-        failTitle: title,
-        failAlert: alert,
-        noCallbackCondition: hasFails
-      });
+      App.showClusterCheckPopup(data, header, title, alert);
     } else {
       this.startKerberosWizard();
     }

http://git-wip-us.apache.org/repos/asf/ambari/blob/278d4c9e/ambari-web/app/controllers/main/admin/stack_and_upgrade_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/admin/stack_and_upgrade_controller.js b/ambari-web/app/controllers/main/admin/stack_and_upgrade_controller.js
index 7094d67..f331540 100644
--- a/ambari-web/app/controllers/main/admin/stack_and_upgrade_controller.js
+++ b/ambari-web/app/controllers/main/admin/stack_and_upgrade_controller.js
@@ -720,10 +720,8 @@ App.MainAdminStackAndUpgradeController = Em.Controller.extend(App.LocalStorage,
             configsMergeWarning = data.items.findProperty('UpgradeChecks.id', "CONFIG_MERGE"),
             configs = [];
           if (configsMergeWarning && Em.get(configsMergeWarning, 'UpgradeChecks.status')
=== 'WARNING') {
-            var popupData = {
-                items: data.items.rejectProperty('UpgradeChecks.id', 'CONFIG_MERGE')
-              },
-              configsMergeCheckData = Em.get(configsMergeWarning, 'UpgradeChecks.failed_detail');
+            data.items = data.items.rejectProperty('UpgradeChecks.id', 'CONFIG_MERGE');
+            var configsMergeCheckData = Em.get(configsMergeWarning, 'UpgradeChecks.failed_detail');
             if (configsMergeCheckData) {
               configs = configsMergeCheckData.map(function (item) {
                 var isDeprecated = Em.isNone(item.new_stack_value),
@@ -740,21 +738,12 @@ App.MainAdminStackAndUpgradeController = Em.Controller.extend(App.LocalStorage,
               });
             }
           }
-          App.showClusterCheckPopup(popupData, {
-            header: header,
-            failTitle: failTitle,
-            failAlert: failAlert,
-            warningTitle: warningTitle,
-            warningAlert: warningAlert,
-            primary: Em.I18n.t('admin.stackVersions.version.upgrade.upgradeOptions.preCheck.rerun'),
-            secondary: Em.I18n.t('common.cancel'),
-            callback: function () {
-              self.runPreUpgradeCheckOnly.call(self, {
-                value: version.get('repositoryVersion'),
-                label: version.get('displayName'),
-                type: event.context.get('type')
-              });
-            }
+          App.showPreUpgradeCheckPopup(data, header, failTitle, failAlert, warningTitle,
warningAlert, function () {
+            self.runPreUpgradeCheckOnly.call(self, {
+              value: version.get('repositoryVersion'),
+              label: version.get('displayName'),
+              type: event.context.get('type')
+            });
           }, configs, version.get('displayName'));
         }
       }),
@@ -969,8 +958,7 @@ App.MainAdminStackAndUpgradeController = Em.Controller.extend(App.LocalStorage,
     var self = this;
     if (data.items.someProperty('UpgradeChecks.status', 'FAIL') || data.items.someProperty('UpgradeChecks.status',
'WARNING')) {
       this.set('requestInProgress', false);
-      var hasFails = data.items.someProperty('UpgradeChecks.status', 'FAIL'),
-        header = Em.I18n.t('popup.clusterCheck.Upgrade.header').format(params.label),
+      var header = Em.I18n.t('popup.clusterCheck.Upgrade.header').format(params.label),
         failTitle = Em.I18n.t('popup.clusterCheck.Upgrade.fail.title'),
         failAlert = new Em.Handlebars.SafeString(Em.I18n.t('popup.clusterCheck.Upgrade.fail.alert')),
         warningTitle = Em.I18n.t('popup.clusterCheck.Upgrade.warning.title'),
@@ -996,16 +984,8 @@ App.MainAdminStackAndUpgradeController = Em.Controller.extend(App.LocalStorage,
           });
         }
       }
-      App.showClusterCheckPopup(data, {
-        header: header,
-        failTitle: failTitle,
-        failAlert: failAlert,
-        warningTitle: warningTitle,
-        warningAlert: warningAlert,
-        noCallbackCondition: hasFails,
-        callback: function () {
-          self.upgrade(params);
-        }
+      App.showClusterCheckPopup(data, header, failTitle, failAlert, warningTitle, warningAlert,
function () {
+        self.upgrade(params);
       }, configs, params.label);
     } else {
       this.upgrade(params);

http://git-wip-us.apache.org/repos/asf/ambari/blob/278d4c9e/ambari-web/app/templates/common/modal_popups/cluster_check_dialog.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/common/modal_popups/cluster_check_dialog.hbs b/ambari-web/app/templates/common/modal_popups/cluster_check_dialog.hbs
index 8fd2746..8767d70 100644
--- a/ambari-web/app/templates/common/modal_popups/cluster_check_dialog.hbs
+++ b/ambari-web/app/templates/common/modal_popups/cluster_check_dialog.hbs
@@ -20,14 +20,10 @@
     <i class="icon-ok"></i>&nbsp;<span>{{t admin.stackVersions.version.upgrade.upgradeOptions.preCheck.allPassed.msg}}</span>
   {{/if}}
   {{#if view.fails.length}}
-    {{#if view.failTitle}}
-      <h4>{{view.failTitle}}</h4>
-    {{/if}}
-    {{#if view.failAlert}}
-      <div class="alert alert-warning">
-        {{view.failAlert}}
-      </div>
-    {{/if}}
+    <h4>{{view.failTitle}}</h4>
+    <div class="alert alert-warning">
+      {{view.failAlert}}
+    </div>
     <div class="limited-height-2">
       {{#each item in view.fails}}
         <i class="icon-remove"></i>&nbsp;<span>{{item.UpgradeChecks.check}}</span>
@@ -36,14 +32,10 @@
     </div>
   {{/if}}
   {{#if view.warnings.length}}
-    {{#if view.warningTitle}}
-      <h4>{{view.warningTitle}}</h4>
-    {{/if}}
-    {{#if view.warningAlert}}
-      <div class="alert alert-warning">
-        {{view.warningAlert}}
-      </div>
-    {{/if}}
+    <h4>{{view.warningTitle}}</h4>
+    <div class="alert alert-warning">
+      {{view.warningAlert}}
+    </div>
     <div class="limited-height-2">
       {{#each item in view.warnings}}
         <i class="icon-warning-sign"></i>&nbsp;<span>{{item.UpgradeChecks.check}}</span>

http://git-wip-us.apache.org/repos/asf/ambari/blob/278d4c9e/ambari-web/app/views/common/modal_popups/cluster_check_popup.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/common/modal_popups/cluster_check_popup.js b/ambari-web/app/views/common/modal_popups/cluster_check_popup.js
index 54f20ba..681c807 100644
--- a/ambari-web/app/views/common/modal_popups/cluster_check_popup.js
+++ b/ambari-web/app/views/common/modal_popups/cluster_check_popup.js
@@ -22,33 +22,30 @@ var App = require('app');
  * popup to display requirements that are not met
  * for current action
  * @param data
- * @param popup
+ * @param header
+ * @param failTitle
+ * @param failAlert
+ * @param warningTitle
+ * @param warningAlert
+ * @param callback
  * @param configs
  * @param upgradeVersion
  * @returns {*|void}
  */
-App.showClusterCheckPopup = function (data, popup, configs, upgradeVersion) {
+App.showClusterCheckPopup = function (data, header, failTitle, failAlert, warningTitle, warningAlert,
callback, configs, upgradeVersion) {
   var fails = data.items.filterProperty('UpgradeChecks.status', 'FAIL'),
     warnings = data.items.filterProperty('UpgradeChecks.status', 'WARNING'),
     hasConfigsMergeConflicts = !!(configs && configs.length),
-    primary,
-    secondary,
-    popupBody;
-  popup = popup || {};
-  primary = Em.isNone(popup.primary) ?
-    (fails.length ? Em.I18n.t('common.dismiss') : Em.I18n.t('common.proceedAnyway')) : popup.primary;
-  secondary = Em.isNone(popup.secondary) ? (fails.length ? false : Em.I18n.t('common.cancel'))
: popup.secondary;
-  popupBody = {
-    failTitle: popup.failTitle,
-    failAlert: popup.failAlert,
-    warningTitle: popup.warningTitle,
-    warningAlert: popup.warningAlert,
-    templateName: require('templates/common/modal_popups/cluster_check_dialog'),
-    fails: fails,
-    warnings: warnings,
-    hasConfigsMergeConflicts: hasConfigsMergeConflicts,
-    isAllPassed: !fails.length && !warnings.length && !hasConfigsMergeConflicts
-  };
+    popupBody = {
+      failTitle: failTitle,
+      failAlert: failAlert,
+      warningTitle: warningTitle,
+      warningAlert: warningAlert,
+      templateName: require('templates/common/modal_popups/cluster_check_dialog'),
+      fails: fails,
+      warnings: warnings,
+      hasConfigsMergeConflicts: hasConfigsMergeConflicts
+    };
   if (hasConfigsMergeConflicts) {
     popupBody.configsMergeTable = Em.View.extend({
       templateName: require('templates/main/admin/stack_upgrade/upgrade_configs_merge_table'),
@@ -61,15 +58,75 @@ App.showClusterCheckPopup = function (data, popup, configs, upgradeVersion)
{
     });
   }
   return App.ModalPopup.show({
-    primary: primary,
-    secondary: secondary,
-    header: popup.header,
+    primary: fails.length ? Em.I18n.t('common.dismiss') : Em.I18n.t('common.proceedAnyway'),
+    secondary: fails.length ? false : Em.I18n.t('common.cancel'),
+    header: header,
+    classNames: ['cluster-check-popup'],
+    bodyClass: Em.View.extend(popupBody),
+    onPrimary: function () {
+      if (!fails.length && callback) {
+        callback();
+      }
+      this._super();
+    },
+    didInsertElement: function () {
+      this._super();
+      this.fitHeight();
+    }
+  });
+};
+
+
+/**
+ * popup to display requirements that are not met
+ * for current action
+ * @param data
+ * @param header
+ * @param failTitle
+ * @param failAlert
+ * @param warningTitle
+ * @param warningAlert
+ * @param callback
+ * @param configs
+ * @param upgradeVersion
+ * @returns {*|void}
+ */
+App.showPreUpgradeCheckPopup = function (data, header, failTitle, failAlert, warningTitle,
warningAlert, callback, configs, upgradeVersion) {
+  var fails = data.items.filterProperty('UpgradeChecks.status', 'FAIL'),
+    warnings = data.items.filterProperty('UpgradeChecks.status', 'WARNING'),
+    hasConfigsMergeConflicts = !!(configs && configs.length),
+    popupBody = {
+      failTitle: failTitle,
+      failAlert: failAlert,
+      warningTitle: warningTitle,
+      warningAlert: warningAlert,
+      templateName: require('templates/common/modal_popups/cluster_check_dialog'),
+      fails: fails,
+      warnings: warnings,
+      hasConfigsMergeConflicts: hasConfigsMergeConflicts,
+      isAllPassed: !fails.length && !warnings.length && !hasConfigsMergeConflicts.length
+    };
+  if (hasConfigsMergeConflicts) {
+    popupBody.configsMergeTable = Em.View.extend({
+      templateName: require('templates/main/admin/stack_upgrade/upgrade_configs_merge_table'),
+      configs: configs,
+      didInsertElement: function () {
+        App.tooltip($('.recommended-value'), {
+          title: upgradeVersion
+        });
+      }
+    });
+  }
+  return App.ModalPopup.show({
+    primary: Em.I18n.t('admin.stackVersions.version.upgrade.upgradeOptions.preCheck.rerun'),
+    secondary: Em.I18n.t('common.cancel'),
+    header: header,
     classNames: ['cluster-check-popup'],
     bodyClass: Em.View.extend(popupBody),
     onPrimary: function () {
       this._super();
-      if (!popup.noCallbackCondition && popup.callback) {
-        popup.callback();
+      if (callback) {
+        callback();
       }
     },
     didInsertElement: function () {

http://git-wip-us.apache.org/repos/asf/ambari/blob/278d4c9e/ambari-web/test/controllers/main/admin/stack_and_upgrade_controller_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/admin/stack_and_upgrade_controller_test.js b/ambari-web/test/controllers/main/admin/stack_and_upgrade_controller_test.js
index b9c7cb7..65739cd 100644
--- a/ambari-web/test/controllers/main/admin/stack_and_upgrade_controller_test.js
+++ b/ambari-web/test/controllers/main/admin/stack_and_upgrade_controller_test.js
@@ -454,7 +454,7 @@ describe('App.MainAdminStackAndUpgradeController', function() {
         expect(controller.upgrade.callCount).to.equal(item.upgradeCalledCount);
         expect(App.showClusterCheckPopup.callCount).to.equal(item.showClusterCheckPopupCalledCount);
         if (item.check.id == 'CONFIG_MERGE') {
-          expect(App.showClusterCheckPopup.firstCall.args[2]).to.eql(item.configs);
+          expect(App.showClusterCheckPopup.firstCall.args[7]).to.eql(item.configs);
         }
       });
     });

http://git-wip-us.apache.org/repos/asf/ambari/blob/278d4c9e/ambari-web/test/views/common/modal_popups/cluster_check_popup_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/common/modal_popups/cluster_check_popup_test.js b/ambari-web/test/views/common/modal_popups/cluster_check_popup_test.js
deleted file mode 100644
index 7f02730..0000000
--- a/ambari-web/test/views/common/modal_popups/cluster_check_popup_test.js
+++ /dev/null
@@ -1,271 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-var App = require('app');
-require('views/common/modal_popups/cluster_check_popup');
-
-describe('App.showClusterCheckPopup', function () {
-
-  var isCallbackExecuted,
-    callback = function () {
-      isCallbackExecuted = true;
-    },
-    cases = [
-      {
-        inputData: {
-          data: {
-            items: [
-              {
-                UpgradeChecks: {
-                  id: 'p0',
-                  status: 'PASS'
-                }
-              },
-              {
-                UpgradeChecks: {
-                  id: 'p1',
-                  status: 'PASS'
-                }
-              }
-            ]
-          }
-        },
-        result: {
-          primary: Em.I18n.t('common.proceedAnyway'),
-          secondary: Em.I18n.t('common.cancel'),
-          header: '&nbsp;'
-        },
-        bodyResult: {
-          failTitle: undefined,
-          failAlert: undefined,
-          warningTitle: undefined,
-          warningAlert: undefined,
-          fails: [],
-          warnings: [],
-          hasConfigsMergeConflicts: false,
-          isAllPassed: true
-        },
-        isCallbackExecuted: false,
-        title: 'no fails, no warnings, no popup customization'
-      },
-      {
-        inputData: {
-          data: {
-            items: [
-              {
-                UpgradeChecks: {
-                  id: 'w0',
-                  status: 'WARNING'
-                }
-              },
-              {
-                UpgradeChecks: {
-                  id: 'w1',
-                  status: 'WARNING'
-                }
-              }
-            ]
-          },
-          popup: {
-            header: 'checks',
-            failTitle: 'fail',
-            failAlert: 'something has failed',
-            warningTitle: 'warning',
-            warningAlert: 'something is not good',
-            callback: callback
-          }
-        },
-        result: {
-          primary: Em.I18n.t('common.proceedAnyway'),
-          secondary: Em.I18n.t('common.cancel'),
-          header: 'checks'
-        },
-        bodyResult: {
-          failTitle: 'fail',
-          failAlert: 'something has failed',
-          warningTitle: 'warning',
-          warningAlert: 'something is not good',
-          fails: [],
-          warnings: [
-            {
-              UpgradeChecks: {
-                id: 'w0',
-                status: 'WARNING'
-              }
-            },
-            {
-              UpgradeChecks: {
-                id: 'w1',
-                status: 'WARNING'
-              }
-            }
-          ],
-          hasConfigsMergeConflicts: false,
-          isAllPassed: false
-        },
-        isCallbackExecuted: true,
-        title: 'no fails, default buttons, callback executed'
-      },
-      {
-        inputData: {
-          data: {
-            items: [
-              {
-                UpgradeChecks: {
-                  id: 'f0',
-                  status: 'FAIL'
-                }
-              },
-              {
-                UpgradeChecks: {
-                  id: 'f1',
-                  status: 'FAIL'
-                }
-              }
-            ]
-          },
-          popup: {
-            callback: callback,
-            noCallbackCondition: true
-          }
-        },
-        result: {
-          primary: Em.I18n.t('common.dismiss'),
-          secondary: false,
-          header: '&nbsp;'
-        },
-        bodyResult: {
-          failTitle: undefined,
-          failAlert: undefined,
-          warningTitle: undefined,
-          warningAlert: undefined,
-          fails: [
-            {
-              UpgradeChecks: {
-                id: 'f0',
-                status: 'FAIL'
-              }
-            },
-            {
-              UpgradeChecks: {
-                id: 'f1',
-                status: 'FAIL'
-              }
-            }
-          ],
-          warnings: [],
-          hasConfigsMergeConflicts: false,
-          isAllPassed: false
-        },
-        isCallbackExecuted: false,
-        title: 'fails detected, default buttons, callback not executed'
-      },
-      {
-        inputData: {
-          data: {
-            items: [
-              {
-                UpgradeChecks: {
-                  id: 'p0',
-                  status: 'PASS'
-                }
-              },
-              {
-                UpgradeChecks: {
-                  id: 'p1',
-                  status: 'PASS'
-                }
-              }
-            ]
-          },
-          popup: {
-            primary: 'ok',
-            secondary: 'cancel'
-          },
-          configs: [
-            {
-              name: 'c0'
-            },
-            {
-              name: 'c1'
-            }
-          ],
-          upgradeVersion: 'HDP-2.3.0.0'
-        },
-        result: {
-          primary: 'ok',
-          secondary: 'cancel',
-          header: '&nbsp;'
-        },
-        bodyResult: {
-          failTitle: undefined,
-          failAlert: undefined,
-          warningTitle: undefined,
-          warningAlert: undefined,
-          fails: [],
-          warnings: [],
-          hasConfigsMergeConflicts: true,
-          isAllPassed: false
-        },
-        configsResult: [
-          {
-            name: 'c0'
-          },
-          {
-            name: 'c1'
-          }
-        ],
-        isCallbackExecuted: false,
-        title: 'configs merge conflicts detected, custom buttons'
-      }
-    ];
-
-  beforeEach(function () {
-    isCallbackExecuted = false;
-    sinon.stub(App, 'tooltip', Em.K);
-  });
-
-  afterEach(function () {
-    App.tooltip.restore();
-  });
-
-  cases.forEach(function (item) {
-    it(item.title, function () {
-      var popup = App.showClusterCheckPopup(item.inputData.data, item.inputData.popup, item.inputData.configs,
item.inputData.upgradeVersion),
-        popupBody = popup.bodyClass.create();
-      popup.onPrimary();
-      Em.keys(item.result).forEach(function (key) {
-        expect(popup[key]).to.equal(item.result[key]);
-      });
-      Em.keys(item.bodyResult).forEach(function (key) {
-        expect(popupBody[key]).to.eql(item.bodyResult[key]);
-      });
-      expect(isCallbackExecuted).to.equal(item.isCallbackExecuted);
-      if (item.bodyResult.hasConfigsMergeConflicts) {
-        var configsMergeTable = popupBody.configsMergeTable.create();
-        configsMergeTable.didInsertElement();
-        expect(configsMergeTable.configs).to.eql(item.configsResult);
-        expect(App.tooltip.calledOnce).to.be.true;
-        expect(App.tooltip.firstCall.args[1].title).to.equal(item.inputData.upgradeVersion);
-      } else {
-        expect(App.tooltip.calledOnce).to.be.false;
-      }
-    });
-  });
-
-});


Mime
View raw message