ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From atk...@apache.org
Subject ambari git commit: AMBARI-20449 Upgrade pre-checks screen does not show CONFIG_MERGE warning. (atkach)
Date Wed, 15 Mar 2017 17:35:58 GMT
Repository: ambari
Updated Branches:
  refs/heads/branch-2.5 5e39f1bec -> 24952fa6a


AMBARI-20449 Upgrade pre-checks screen does not show CONFIG_MERGE warning. (atkach)


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

Branch: refs/heads/branch-2.5
Commit: 24952fa6af07573b60dccf5c10b8e6eaaca418b0
Parents: 5e39f1b
Author: Andrii Tkach <atkach@apache.org>
Authored: Tue Mar 14 21:10:33 2017 +0200
Committer: Andrii Tkach <atkach@apache.org>
Committed: Wed Mar 15 19:35:09 2017 +0200

----------------------------------------------------------------------
 .../main/admin/stack_and_upgrade_controller.js  |  7 ++-
 ambari-web/app/messages.js                      |  4 ++
 .../modal_popups/cluster_check_dialog.hbs       |  3 ++
 .../upgrade_configs_recommend_table.hbs         | 51 ++++++++++++++++++++
 .../common/modal_popups/cluster_check_popup.js  | 42 +++++++++-------
 .../admin/stack_and_upgrade_controller_test.js  | 19 ++++++++
 .../modal_popups/cluster_check_popup_test.js    | 33 +++++++------
 7 files changed, 124 insertions(+), 35 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/24952fa6/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 952021c..4fd6f79 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
@@ -938,12 +938,11 @@ App.MainAdminStackAndUpgradeController = Em.Controller.extend(App.LocalStorage,
         configs = configsMergeCheckData.reduce(function (allConfigs, item) {
           var isDeprecated = Em.isNone(item.new_stack_value),
             willBeRemoved = Em.isNone(item.result_value);
-          if (!isDeprecated && !willBeRemoved && Em.compare(item.current,
item.result_value) === 0) {
-            return allConfigs;
-          }
+
           return allConfigs.concat({
             type: item.type,
             name: item.property,
+            wasModified: (!isDeprecated && !willBeRemoved && Em.compare(item.current,
item.result_value) === 0),
             currentValue: item.current,
             recommendedValue: isDeprecated ? Em.I18n.t('popup.clusterCheck.Upgrade.configsMerge.deprecated')
: item.new_stack_value,
             isDeprecated: isDeprecated,
@@ -1077,7 +1076,7 @@ App.MainAdminStackAndUpgradeController = Em.Controller.extend(App.LocalStorage,
                 type: event.context.get('type')
               });
             }
-          }, configs, version.get('displayName'));
+          }, configs);
         }
       }),
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/24952fa6/ambari-web/app/messages.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/messages.js b/ambari-web/app/messages.js
index bc40a26..a2a9d60 100644
--- a/ambari-web/app/messages.js
+++ b/ambari-web/app/messages.js
@@ -443,6 +443,10 @@ Em.I18n.translations = {
   'popup.clusterCheck.Upgrade.configsMerge.resultingValue': 'Resulting Value',
   'popup.clusterCheck.Upgrade.configsMerge.deprecated': 'Property is deprecated',
   'popup.clusterCheck.Upgrade.configsMerge.willBeRemoved': 'Will be removed',
+  'popup.clusterCheck.Upgrade.configsRecommend.alert': 'We\'ve detected the need to update
the following properties,' +
+  ' but cannot do so automatically since they have been customized.  Please review these
properties manually,' +
+  ' and update the properties manually where necessary.',
+  'popup.clusterCheck.Upgrade.configsRecommend.title': 'Recommended Configuration Changes:
Manual Review',
   'popup.clusterCheck.Security.header': 'Enable Security',
   'popup.clusterCheck.Security.title': 'Security Requirements Not Met',
   'popup.clusterCheck.Security.alert': 'You must meet the following requirements before you
can enable security.',

http://git-wip-us.apache.org/repos/asf/ambari/blob/24952fa6/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 766c6e6..edc852e 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
@@ -73,4 +73,7 @@
   {{#if view.hasConfigsMergeConflicts}}
     {{view view.configsMergeTable}}
   {{/if}}
+  {{#if view.hasConfigsRecommendations}}
+      {{view view.configsRecommendTable}}
+  {{/if}}
 </div>

http://git-wip-us.apache.org/repos/asf/ambari/blob/24952fa6/ambari-web/app/templates/main/admin/stack_upgrade/upgrade_configs_recommend_table.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/main/admin/stack_upgrade/upgrade_configs_recommend_table.hbs
b/ambari-web/app/templates/main/admin/stack_upgrade/upgrade_configs_recommend_table.hbs
new file mode 100644
index 0000000..8df3327
--- /dev/null
+++ b/ambari-web/app/templates/main/admin/stack_upgrade/upgrade_configs_recommend_table.hbs
@@ -0,0 +1,51 @@
+{{!
+* 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.
+}}
+
+<h4 class="configurations-changes-header">{{t popup.clusterCheck.Upgrade.configsRecommend.title}}</h4>
+<a {{action openConfigsInNewWindow view.configs target="App.router.mainAdminStackAndUpgradeController"}}
{{translateAttr title="common.openNewWindow"}} class="pull-right open-in-new-window" href="#">
+  <i class="icon-external-link"></i> <span id="i18n-34">{{t common.open}}</span>
+</a>
+<div class="alert alert-warning">
+  {{t popup.clusterCheck.Upgrade.configsRecommend.alert}}
+</div>
+<div class="configs-table-header">
+  <table class="configs-table table table-striped">
+    <thead>
+    <tr>
+      <th>{{t popup.clusterCheck.Upgrade.configsMerge.configType}}</th>
+      <th>{{t popup.clusterCheck.Upgrade.configsMerge.propertyName}}</th>
+      <th>{{t popup.clusterCheck.Upgrade.configsMerge.currentValue}}</th>
+      <th>{{t popup.clusterCheck.Upgrade.configsMerge.recommendedValue}}</th>
+    </tr>
+    </thead>
+  </table>
+</div>
+<div class="limited-height-2">
+  <table class="configs-table table table-striped">
+    <tbody>
+    {{#each view.configs}}
+      <tr>
+        <td>{{type}}</td>
+        <td>{{name}}</td>
+        <td>{{currentValue}}</td>
+        <td {{bindAttr class="willBeRemoved:no-value"}}>{{recommendedValue}}</td>
+      </tr>
+    {{/each}}
+    </tbody>
+  </table>
+</div>

http://git-wip-us.apache.org/repos/asf/ambari/blob/24952fa6/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 a2f6f83..2fcd8e9 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
@@ -24,14 +24,14 @@ var App = require('app');
  * @param data
  * @param popup
  * @param configs
- * @param upgradeVersion
  * @returns {*|void}
  */
-App.showClusterCheckPopup = function (data, popup, configs, upgradeVersion) {
+App.showClusterCheckPopup = function (data, popup, configs) {
   var fails = data.items.filterProperty('UpgradeChecks.status', 'FAIL'),
     warnings = data.items.filterProperty('UpgradeChecks.status', 'WARNING'),
     bypass = data.items.filterProperty('UpgradeChecks.status', 'BYPASS'),
-    hasConfigsMergeConflicts = !!(configs && configs.length),
+    configsMergeConflicts = configs ? configs.filterProperty('wasModified', false) : [],
+    configsRecommendations = configs ? configs.filterProperty('wasModified', true) : [],
     primary,
     secondary,
     popupBody;
@@ -48,20 +48,14 @@ App.showClusterCheckPopup = function (data, popup, configs, upgradeVersion)
{
     fails: fails,
     bypass: bypass, // errors that can be bypassed
     warnings: warnings,
-    hasConfigsMergeConflicts: hasConfigsMergeConflicts,
-    isAllPassed: !fails.length && !warnings.length && !bypass.length &&
!hasConfigsMergeConflicts
+    hasConfigsMergeConflicts: configsMergeConflicts.length > 0,
+    hasConfigsRecommendations: configsRecommendations.length > 0,
+    configsMergeTable: App.getMergeConflictsView(configsMergeConflicts),
+    configsRecommendTable: App.getNewStackRecommendationsView(configsRecommendations),
+    isAllPassed: !fails.length && !warnings.length && !bypass.length
+    && !configsMergeConflicts.length && !configsRecommendations.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: primary,
     secondary: secondary,
@@ -79,4 +73,18 @@ App.showClusterCheckPopup = function (data, popup, configs, upgradeVersion)
{
       this.fitHeight();
     }
   });
-};
\ No newline at end of file
+};
+
+App.getMergeConflictsView = function (configs) {
+  return Em.View.extend({
+    templateName: require('templates/main/admin/stack_upgrade/upgrade_configs_merge_table'),
+    configs: configs
+  });
+};
+
+App.getNewStackRecommendationsView = function (configs) {
+  return Em.View.extend({
+    templateName: require('templates/main/admin/stack_upgrade/upgrade_configs_recommend_table'),
+    configs: configs
+  });
+};

http://git-wip-us.apache.org/repos/asf/ambari/blob/24952fa6/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 7944e2a..186456a 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
@@ -464,6 +464,7 @@ describe('App.MainAdminStackAndUpgradeController', function() {
             recommendedValue: 'n0',
             resultingValue: 'n0',
             isDeprecated: false,
+            wasModified: false,
             willBeRemoved: false
           },
           {
@@ -473,6 +474,7 @@ describe('App.MainAdminStackAndUpgradeController', function() {
             recommendedValue: Em.I18n.t('popup.clusterCheck.Upgrade.configsMerge.deprecated'),
             resultingValue: 'c1',
             isDeprecated: true,
+            wasModified: false,
             willBeRemoved: false
           },
           {
@@ -482,6 +484,7 @@ describe('App.MainAdminStackAndUpgradeController', function() {
             recommendedValue: Em.I18n.t('popup.clusterCheck.Upgrade.configsMerge.deprecated'),
             resultingValue: Em.I18n.t('popup.clusterCheck.Upgrade.configsMerge.willBeRemoved'),
             isDeprecated: true,
+            wasModified: false,
             willBeRemoved: true
           }
         ],
@@ -2116,6 +2119,7 @@ describe('App.MainAdminStackAndUpgradeController', function() {
             recommendedValue: 'n0',
             isDeprecated: false,
             resultingValue: 'r0',
+            wasModified: false,
             willBeRemoved: false
           },
           {
@@ -2125,6 +2129,7 @@ describe('App.MainAdminStackAndUpgradeController', function() {
             recommendedValue: 'n1',
             isDeprecated: false,
             resultingValue: Em.I18n.t('popup.clusterCheck.Upgrade.configsMerge.willBeRemoved'),
+            wasModified: false,
             willBeRemoved: true
           },
           {
@@ -2134,6 +2139,7 @@ describe('App.MainAdminStackAndUpgradeController', function() {
             recommendedValue: Em.I18n.t('popup.clusterCheck.Upgrade.configsMerge.deprecated'),
             isDeprecated: true,
             resultingValue: 'r2',
+            wasModified: false,
             willBeRemoved: false
           }
         ],
@@ -2181,6 +2187,7 @@ describe('App.MainAdminStackAndUpgradeController', function() {
             recommendedValue: 'n0',
             isDeprecated: false,
             resultingValue: 'r0',
+            wasModified: false,
             willBeRemoved: false
           },
           {
@@ -2190,6 +2197,7 @@ describe('App.MainAdminStackAndUpgradeController', function() {
             recommendedValue: 'n1',
             isDeprecated: false,
             resultingValue: Em.I18n.t('popup.clusterCheck.Upgrade.configsMerge.willBeRemoved'),
+            wasModified: false,
             willBeRemoved: true
           },
           {
@@ -2199,7 +2207,18 @@ describe('App.MainAdminStackAndUpgradeController', function() {
             recommendedValue: Em.I18n.t('popup.clusterCheck.Upgrade.configsMerge.deprecated'),
             isDeprecated: true,
             resultingValue: 'r2',
+            wasModified: false,
             willBeRemoved: false
+          },
+          {
+            "currentValue": "c3",
+            "isDeprecated": false,
+            "name": "p3",
+            "recommendedValue": "c2",
+            "resultingValue": "c3",
+            "type": "t3",
+            "wasModified": true,
+            "willBeRemoved": false
           }
         ],
         title: 'should skip warning when current and result_value are the same'

http://git-wip-us.apache.org/repos/asf/ambari/blob/24952fa6/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
index 71e602a..da4c714 100644
--- 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
@@ -199,13 +199,14 @@ describe('App.showClusterCheckPopup', function () {
           },
           configs: [
             {
-              name: 'c0'
+              name: 'c0',
+              wasModified: false
             },
             {
-              name: 'c1'
+              name: 'c1',
+              wasModified: true
             }
-          ],
-          upgradeVersion: 'HDP-2.3.0.0'
+          ]
         },
         result: {
           primary: 'ok',
@@ -220,14 +221,19 @@ describe('App.showClusterCheckPopup', function () {
           fails: [],
           warnings: [],
           hasConfigsMergeConflicts: true,
+          hasConfigsRecommendations: true,
           isAllPassed: false
         },
         configsResult: [
           {
-            name: 'c0'
-          },
+            name: 'c0',
+            wasModified: false
+          }
+        ],
+        configRecommendResult: [
           {
-            name: 'c1'
+            name: 'c1',
+            wasModified: true
           }
         ],
         isCallbackExecuted: false,
@@ -252,7 +258,7 @@ describe('App.showClusterCheckPopup', function () {
       var popupBody;
 
       beforeEach(function () {
-        popup = App.showClusterCheckPopup(item.inputData.data, item.inputData.popup, item.inputData.configs,
item.inputData.upgradeVersion);
+        popup = App.showClusterCheckPopup(item.inputData.data, item.inputData.popup, item.inputData.configs);
         popupBody = popup.bodyClass.create();
         popup.onPrimary();
       });
@@ -280,15 +286,14 @@ describe('App.showClusterCheckPopup', function () {
       if (item.bodyResult.hasConfigsMergeConflicts) {
         it('hasConfigsMergeConflicts = true', function () {
           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 {
-        it('App.tooltip is not called', function () {
-          expect(App.tooltip.called).to.be.false;
+
+      if (item.bodyResult.hasConfigsRecommendations) {
+        it('hasConfigsRecommendations = true', function () {
+          var configsRecommendTable = popupBody.configsRecommendTable.create();
+          expect(configsRecommendTable.configs).to.eql(item.configRecommendResult);
         });
       }
 


Mime
View raw message