You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by db...@apache.org on 2017/02/28 13:23:55 UTC

ambari git commit: AMBARI-20229 Entries in columns ‘Current Value’ and ‘Resulting Value’ are same in Upgrade pre-checks screen (dbuzhor)

Repository: ambari
Updated Branches:
  refs/heads/trunk d5efb7727 -> 910da3d5d


AMBARI-20229 Entries in columns \u2018Current Value\u2019 and \u2018Resulting Value\u2019 are same in Upgrade pre-checks screen (dbuzhor)


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

Branch: refs/heads/trunk
Commit: 910da3d5d1e3ccff19ba2bb18095e8afa9026ce7
Parents: d5efb77
Author: Denys Buzhor <bd...@hortonworks.com>
Authored: Tue Feb 28 12:06:41 2017 +0200
Committer: Denys Buzhor <bd...@hortonworks.com>
Committed: Tue Feb 28 15:23:02 2017 +0200

----------------------------------------------------------------------
 .../main/admin/stack_and_upgrade_controller.js  | 11 ++--
 .../admin/stack_and_upgrade_controller_test.js  | 65 ++++++++++++++++++++
 2 files changed, 72 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/910da3d5/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 35b2ecc..a760f0c 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
@@ -963,10 +963,13 @@ App.MainAdminStackAndUpgradeController = Em.Controller.extend(App.LocalStorage,
     if (configsMergeWarning && Em.get(configsMergeWarning, 'UpgradeChecks.status') === 'WARNING') {
       var configsMergeCheckData = Em.get(configsMergeWarning, 'UpgradeChecks.failed_detail');
       if (configsMergeCheckData && Em.isArray(configsMergeCheckData)) {
-        configs = configsMergeCheckData.map(function (item) {
+        configs = configsMergeCheckData.reduce(function (allConfigs, item) {
           var isDeprecated = Em.isNone(item.new_stack_value),
             willBeRemoved = Em.isNone(item.result_value);
-          return {
+          if (!isDeprecated && !willBeRemoved && Em.compare(item.current, item.result_value) === 0) {
+            return allConfigs;
+          }
+          return allConfigs.concat({
             type: item.type,
             name: item.property,
             currentValue: item.current,
@@ -974,8 +977,8 @@ App.MainAdminStackAndUpgradeController = Em.Controller.extend(App.LocalStorage,
             isDeprecated: isDeprecated,
             resultingValue: willBeRemoved ? Em.I18n.t('popup.clusterCheck.Upgrade.configsMerge.willBeRemoved') : item.result_value,
             willBeRemoved: willBeRemoved
-          };
-        });
+          });
+        }, []);
       }
     }
     return configs;

http://git-wip-us.apache.org/repos/asf/ambari/blob/910da3d5/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 8bb6e0d..1d88913 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
@@ -2114,6 +2114,71 @@ describe('App.MainAdminStackAndUpgradeController', function() {
           }
         ],
         title: 'normal case'
+      },
+      {
+        configsMergeWarning: {
+          UpgradeChecks: {
+            status: 'WARNING',
+            failed_detail: [
+              {
+                type: 't0',
+                property: 'p0',
+                current: 'c0',
+                new_stack_value: 'n0',
+                result_value: 'r0'
+              },
+              {
+                type: 't1',
+                property: 'p1',
+                current: 'c1',
+                new_stack_value: 'n1'
+              },
+              {
+                type: 't2',
+                property: 'p2',
+                current: 'c2',
+                result_value: 'r2'
+              },
+              {
+                type: 't3',
+                property: 'p3',
+                current: 'c3',
+                new_stack_value: 'c2',
+                result_value: 'c3'
+              }
+            ]
+          }
+        },
+        configs: [
+          {
+            type: 't0',
+            name: 'p0',
+            currentValue: 'c0',
+            recommendedValue: 'n0',
+            isDeprecated: false,
+            resultingValue: 'r0',
+            willBeRemoved: false
+          },
+          {
+            type: 't1',
+            name: 'p1',
+            currentValue: 'c1',
+            recommendedValue: 'n1',
+            isDeprecated: false,
+            resultingValue: Em.I18n.t('popup.clusterCheck.Upgrade.configsMerge.willBeRemoved'),
+            willBeRemoved: true
+          },
+          {
+            type: 't2',
+            name: 'p2',
+            currentValue: 'c2',
+            recommendedValue: Em.I18n.t('popup.clusterCheck.Upgrade.configsMerge.deprecated'),
+            isDeprecated: true,
+            resultingValue: 'r2',
+            willBeRemoved: false
+          }
+        ],
+        title: 'should skip warning when current and result_value are the same'
       }
     ];