Repository: ambari
Updated Branches:
  refs/heads/branch-2.5 2ec423c2a -> b3bb57c6a


AMBARI-20229 Entries in columns ‘Current Value’ and ‘Resulting Value’ 
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/b3bb57c6
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/b3bb57c6
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/b3bb57c6

Branch: refs/heads/branch-2.5
Commit: b3bb57c6ae769385709434928e6acc76dce66777
Parents: 2ec423c
Author: Denys Buzhor <bde...@hortonworks.com>
Authored: Tue Feb 28 12:03:13 2017 +0200
Committer: Denys Buzhor <bde...@hortonworks.com>
Committed: Tue Feb 28 15:24:09 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/b3bb57c6/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 44faf4d..952021c 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
@@ -935,10 +935,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,
@@ -946,8 +949,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/b3bb57c6/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 9e04214..7944e2a 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
@@ -2138,6 +2138,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'
       }
     ];
 

Reply via email to