ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nc...@apache.org
Subject [10/32] ambari git commit: AMBARI-20449 Upgrade pre-checks screen does not show CONFIG_MERGE warning. (atkach)
Date Thu, 16 Mar 2017 20:01:46 GMT
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/8b2565ae
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/8b2565ae
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/8b2565ae

Branch: refs/heads/branch-feature-AMBARI-12556
Commit: 8b2565ae872ed16da3f36d7f620ae7c2c128695f
Parents: d16d18d
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:25:25 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  | 39 +++++++++------
 .../admin/stack_and_upgrade_controller_test.js  | 19 ++++++++
 .../modal_popups/cluster_check_popup_test.js    | 33 +++++++------
 7 files changed, 123 insertions(+), 33 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/8b2565ae/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 270c5c5..238b4bc 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
@@ -976,12 +976,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,
@@ -1126,7 +1125,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/8b2565ae/ambari-web/app/messages.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/messages.js b/ambari-web/app/messages.js
index 1a26516..c9926e6 100644
--- a/ambari-web/app/messages.js
+++ b/ambari-web/app/messages.js
@@ -457,6 +457,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/8b2565ae/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 79e1de5..83a57a6 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/8b2565ae/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/8b2565ae/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 a613f4b..bef3c90 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
@@ -28,14 +28,14 @@ function mapUpgradeChecks(items) {
  * @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;
   popup = popup || {};
@@ -68,17 +68,12 @@ App.showClusterCheckPopup = function (data, popup, configs, upgradeVersion)
{
       warnings: mapUpgradeChecks(warnings),
       fails: mapUpgradeChecks(fails),
       bypass: mapUpgradeChecks(bypass), // errors that can be bypassed
-      hasConfigsMergeConflicts: hasConfigsMergeConflicts,
-      isAllPassed: !fails.length && !warnings.length && !bypass.length &&
!hasConfigsMergeConflicts,
-      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
-          });
-        }
-      })
+      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
     }),
     onPrimary: function () {
       this._super();
@@ -91,4 +86,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/8b2565ae/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 1d88913..e696bb1 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
           }
         ],
@@ -2092,6 +2095,7 @@ describe('App.MainAdminStackAndUpgradeController', function() {
             recommendedValue: 'n0',
             isDeprecated: false,
             resultingValue: 'r0',
+            wasModified: false,
             willBeRemoved: false
           },
           {
@@ -2101,6 +2105,7 @@ describe('App.MainAdminStackAndUpgradeController', function() {
             recommendedValue: 'n1',
             isDeprecated: false,
             resultingValue: Em.I18n.t('popup.clusterCheck.Upgrade.configsMerge.willBeRemoved'),
+            wasModified: false,
             willBeRemoved: true
           },
           {
@@ -2110,6 +2115,7 @@ describe('App.MainAdminStackAndUpgradeController', function() {
             recommendedValue: Em.I18n.t('popup.clusterCheck.Upgrade.configsMerge.deprecated'),
             isDeprecated: true,
             resultingValue: 'r2',
+            wasModified: false,
             willBeRemoved: false
           }
         ],
@@ -2157,6 +2163,7 @@ describe('App.MainAdminStackAndUpgradeController', function() {
             recommendedValue: 'n0',
             isDeprecated: false,
             resultingValue: 'r0',
+            wasModified: false,
             willBeRemoved: false
           },
           {
@@ -2166,6 +2173,7 @@ describe('App.MainAdminStackAndUpgradeController', function() {
             recommendedValue: 'n1',
             isDeprecated: false,
             resultingValue: Em.I18n.t('popup.clusterCheck.Upgrade.configsMerge.willBeRemoved'),
+            wasModified: false,
             willBeRemoved: true
           },
           {
@@ -2175,7 +2183,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/8b2565ae/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 d70379b..8fa3480 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
@@ -207,13 +207,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',
@@ -228,14 +229,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,
@@ -260,7 +266,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();
       });
@@ -288,15 +294,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