You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by al...@apache.org on 2015/06/14 00:03:16 UTC
ambari git commit: AMBARI-11904. RU: does not warn on warning
prerequisites (alexantonenko)
Repository: ambari
Updated Branches:
refs/heads/branch-2.1 4605864b1 -> d537d4a48
AMBARI-11904. RU: does not warn on warning prerequisites (alexantonenko)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/d537d4a4
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/d537d4a4
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/d537d4a4
Branch: refs/heads/branch-2.1
Commit: d537d4a483e8bb4841abaeeee2d3a4cab0eb459f
Parents: 4605864
Author: Alex Antonenko <hi...@gmail.com>
Authored: Sat Jun 13 20:12:35 2015 +0300
Committer: Alex Antonenko <hi...@gmail.com>
Committed: Sun Jun 14 01:03:10 2015 +0300
----------------------------------------------------------------------
ambari-web/app/assets/test/tests.js | 1 -
.../main/admin/stack_and_upgrade_controller.js | 41 ++++++---
ambari-web/app/messages.js | 9 +-
ambari-web/app/styles/application.less | 6 ++
ambari-web/app/styles/common.less | 3 -
.../modal_popups/cluster_check_dialog.hbs | 33 +++++--
.../upgrade_configs_merge_popup.hbs | 45 ----------
.../upgrade_configs_merge_table.hbs | 46 ++++++++++
ambari-web/app/views.js | 1 -
.../common/modal_popups/cluster_check_popup.js | 53 +++++++++---
.../modal_popups/upgrade_configs_merge_popup.js | 63 --------------
.../admin/stack_and_upgrade_controller_test.js | 85 ++++++++++++------
.../upgrade_configs_merge_popup_test.js | 91 --------------------
13 files changed, 214 insertions(+), 263 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/d537d4a4/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 04903e6..7b894b7 100644
--- a/ambari-web/app/assets/test/tests.js
+++ b/ambari-web/app/assets/test/tests.js
@@ -192,7 +192,6 @@ var files = ['test/init_model_test',
'test/views/common/progress_bar_view_test',
'test/views/common/widget/graph_widget_view_test',
'test/views/common/modal_popups/hosts_table_list_popup_test',
- 'test/views/common/modal_popups/upgrade_configs_merge_popup_test',
'test/views/main/admin_test',
'test/views/main/dashboard_test',
'test/views/main/menu_test',
http://git-wip-us.apache.org/repos/asf/ambari/blob/d537d4a4/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 ac8f8cf..6b4b8b1 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
@@ -465,19 +465,38 @@ App.MainAdminStackAndUpgradeController = Em.Controller.extend(App.LocalStorage,
* @returns {App.ModalPopup|undefined}
*/
runPreUpgradeCheckSuccess: function (data, opt, params) {
- if (data.items.someProperty('UpgradeChecks.status', "FAIL")) {
- this.set('requestInProgress', false);
- var header = Em.I18n.t('popup.clusterCheck.Upgrade.header').format(params.label);
- var title = Em.I18n.t('popup.clusterCheck.Upgrade.title');
- var alert = Em.I18n.t('popup.clusterCheck.Upgrade.alert');
- App.showClusterCheckPopup(data, header, title, alert);
- } else if (data.items.someProperty('UpgradeChecks.id', "CONFIG_MERGE") && Em.get(data.items.findProperty('UpgradeChecks.id', "CONFIG_MERGE"), 'UpgradeChecks.status') == 'WARNING') {
- var self = this,
- configsMergeCheckData = Em.get(data.items.findProperty('UpgradeChecks.id', "CONFIG_MERGE"), 'UpgradeChecks.failed_detail');
+ var self = this;
+ if (data.items.someProperty('UpgradeChecks.status', 'FAIL') || data.items.someProperty('UpgradeChecks.status', 'WARNING')) {
this.set('requestInProgress', false);
- App.showUpgradeConfigsMergePopup(configsMergeCheckData, params.label, function () {
+ 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'),
+ warningAlert = new Em.Handlebars.SafeString(Em.I18n.t('popup.clusterCheck.Upgrade.warning.alert')),
+ configsMergeWarning = data.items.findProperty('UpgradeChecks.id', "CONFIG_MERGE"),
+ configs = [];
+ if (configsMergeWarning && Em.get(configsMergeWarning, 'UpgradeChecks.status') === 'WARNING') {
+ 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),
+ willBeRemoved = Em.isNone(item.result_value);
+ return {
+ type: item.type,
+ name: item.property,
+ currentValue: item.current,
+ recommendedValue: isDeprecated ? Em.I18n.t('popup.clusterCheck.Upgrade.configsMerge.deprecated') : item.new_stack_value,
+ isDeprecated: isDeprecated,
+ resultingValue: willBeRemoved ? Em.I18n.t('popup.clusterCheck.Upgrade.configsMerge.willBeRemoved') : item.result_value,
+ willBeRemoved: willBeRemoved
+ };
+ });
+ }
+ }
+ 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/d537d4a4/ambari-web/app/messages.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/messages.js b/ambari-web/app/messages.js
index 7c2e3d1..33b5cb8 100644
--- a/ambari-web/app/messages.js
+++ b/ambari-web/app/messages.js
@@ -340,9 +340,12 @@ Em.I18n.translations = {
'popup.clusterCheck.failedOn': 'Failed on: ',
'popup.clusterCheck.reason': 'Reason: ',
'popup.clusterCheck.Upgrade.header': 'Upgrade to {0}',
- 'popup.clusterCheck.Upgrade.title': 'Upgrade Requirements Not Met',
- 'popup.clusterCheck.Upgrade.alert': 'You must meet the following requirements before you can proceed with rolling upgrade.',
- 'popup.clusterCheck.Upgrade.configsMerge.subtitle': 'As part of Rolling Upgrade, the following configuration properties will be automatically set to the resulting values shown.',
+ 'popup.clusterCheck.Upgrade.fail.title': 'Requirements',
+ 'popup.clusterCheck.Upgrade.fail.alert': 'You <strong>must</strong> meet these requirements before you can proceed.',
+ 'popup.clusterCheck.Upgrade.warning.title': 'Warnings',
+ 'popup.clusterCheck.Upgrade.warning.alert': 'Correcting the warnings are not required but are <strong>recommended</strong>.',
+ 'popup.clusterCheck.Upgrade.configsMerge.title': 'Configuration Changes',
+ 'popup.clusterCheck.Upgrade.configsMerge.alert': 'During upgrade, the following configuration changes will be applied.',
'popup.clusterCheck.Upgrade.configsMerge.configType': 'Config Type',
'popup.clusterCheck.Upgrade.configsMerge.propertyName': 'Property Name',
'popup.clusterCheck.Upgrade.configsMerge.currentValue': 'Current Value',
http://git-wip-us.apache.org/repos/asf/ambari/blob/d537d4a4/ambari-web/app/styles/application.less
----------------------------------------------------------------------
diff --git a/ambari-web/app/styles/application.less b/ambari-web/app/styles/application.less
index 50eaa0f..736ee09 100644
--- a/ambari-web/app/styles/application.less
+++ b/ambari-web/app/styles/application.less
@@ -5767,3 +5767,9 @@ input[type="radio"].align-checkbox, input[type="checkbox"].align-checkbox {
font-weight: normal;
}
}
+
+#pre-upgrade-check {
+ .icon-warning-sign {
+ color: @health-status-yellow;
+ }
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/d537d4a4/ambari-web/app/styles/common.less
----------------------------------------------------------------------
diff --git a/ambari-web/app/styles/common.less b/ambari-web/app/styles/common.less
index 1a8bbda..64bfde3 100644
--- a/ambari-web/app/styles/common.less
+++ b/ambari-web/app/styles/common.less
@@ -336,9 +336,6 @@
width: 950px;
margin-left: -475px;
}
- .icon-info-sign {
- color: @blue;
- }
.configs-table {
table-layout: fixed;
font-size: 0.95em;
http://git-wip-us.apache.org/repos/asf/ambari/blob/d537d4a4/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 7390aaa..38160ac 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
@@ -16,14 +16,31 @@
* limitations under the License.
}}
<div id="pre-upgrade-check">
- <h4>{{view.title}}</h4>
- <div class="alert alert-warning">
- {{view.alert}}
- </div>
- <div class="limited-height-2">
- {{#each item in view.checks}}
+ {{#if view.fails.length}}
+ <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> <span>{{item.UpgradeChecks.check}}</span>
<pre>{{t popup.clusterCheck.reason}}{{item.UpgradeChecks.reason}}<br/>{{t popup.clusterCheck.failedOn}}{{item.UpgradeChecks.failed_on}}</pre>
- {{/each}}
- </div>
+ {{/each}}
+ </div>
+ {{/if}}
+ {{#if view.warnings.length}}
+ <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> <span>{{item.UpgradeChecks.check}}</span>
+ <pre>{{t popup.clusterCheck.reason}}{{item.UpgradeChecks.reason}}<br/>{{t popup.clusterCheck.failedOn}}{{item.UpgradeChecks.failed_on}}</pre>
+ {{/each}}
+ </div>
+ {{/if}}
+ {{#if view.hasConfigsMergeConflicts}}
+ {{view view.configsMergeTable}}
+ {{/if}}
</div>
http://git-wip-us.apache.org/repos/asf/ambari/blob/d537d4a4/ambari-web/app/templates/common/modal_popups/upgrade_configs_merge_popup.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/common/modal_popups/upgrade_configs_merge_popup.hbs b/ambari-web/app/templates/common/modal_popups/upgrade_configs_merge_popup.hbs
deleted file mode 100644
index 722e4c5..0000000
--- a/ambari-web/app/templates/common/modal_popups/upgrade_configs_merge_popup.hbs
+++ /dev/null
@@ -1,45 +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.
-}}
-
-<div>
- <i class="icon-info-sign"></i> <span>{{t popup.clusterCheck.Upgrade.configsMerge.subtitle}}</span>
-</div>
-<div class="limited-height-2">
- <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><span class="recommended-value">{{t popup.clusterCheck.Upgrade.configsMerge.recommendedValue}}</span></th>
- <th>{{t popup.clusterCheck.Upgrade.configsMerge.resultingValue}}</th>
- </tr>
- </thead>
- <tbody>
- {{#each view.configs}}
- <tr>
- <td>{{type}}</td>
- <td>{{name}}</td>
- <td>{{currentValue}}</td>
- <td {{bindAttr class="isDeprecated:no-value"}}>{{recommendedValue}}</td>
- <td {{bindAttr class="willBeRemoved:no-value"}}>{{resultingValue}}</td>
- </tr>
- {{/each}}
- </tbody>
- </table>
-</div>
http://git-wip-us.apache.org/repos/asf/ambari/blob/d537d4a4/ambari-web/app/templates/main/admin/stack_upgrade/upgrade_configs_merge_table.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/main/admin/stack_upgrade/upgrade_configs_merge_table.hbs b/ambari-web/app/templates/main/admin/stack_upgrade/upgrade_configs_merge_table.hbs
new file mode 100644
index 0000000..a8cd899
--- /dev/null
+++ b/ambari-web/app/templates/main/admin/stack_upgrade/upgrade_configs_merge_table.hbs
@@ -0,0 +1,46 @@
+{{!
+* 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>{{t popup.clusterCheck.Upgrade.configsMerge.title}}</h4>
+<div class="alert alert-warning">
+ {{t popup.clusterCheck.Upgrade.configsMerge.alert}}
+</div>
+<div class="limited-height-2">
+ <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><span class="recommended-value">{{t popup.clusterCheck.Upgrade.configsMerge.recommendedValue}}</span></th>
+ <th>{{t popup.clusterCheck.Upgrade.configsMerge.resultingValue}}</th>
+ </tr>
+ </thead>
+ <tbody>
+ {{#each view.configs}}
+ <tr>
+ <td>{{type}}</td>
+ <td>{{name}}</td>
+ <td>{{currentValue}}</td>
+ <td {{bindAttr class="isDeprecated:no-value"}}>{{recommendedValue}}</td>
+ <td {{bindAttr class="willBeRemoved:no-value"}}>{{resultingValue}}</td>
+ </tr>
+ {{/each}}
+ </tbody>
+ </table>
+</div>
http://git-wip-us.apache.org/repos/asf/ambari/blob/d537d4a4/ambari-web/app/views.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views.js b/ambari-web/app/views.js
index 8c15020..d796441 100644
--- a/ambari-web/app/views.js
+++ b/ambari-web/app/views.js
@@ -34,7 +34,6 @@ require('views/common/modal_popups/cluster_check_popup');
require('views/common/modal_popups/invalid_KDC_popup');
require('views/common/modal_popups/dependent_configs_list_popup');
require('views/common/modal_popups/select_groups_popup');
-require('views/common/modal_popups/upgrade_configs_merge_popup');
require('views/common/editable_list');
require('views/common/rolling_restart_view');
require('views/common/select_custom_date_view');
http://git-wip-us.apache.org/repos/asf/ambari/blob/d537d4a4/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 73dd274..d4907ed 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
@@ -23,20 +23,51 @@ var App = require('app');
* for current action
* @param data
* @param header
- * @param title
- * @param alert
+ * @param failTitle
+ * @param failAlert
+ * @param warningTitle
+ * @param warningAlert
+ * @param callback
+ * @param configs
+ * @param upgradeVersion
* @returns {*|void}
*/
-App.showClusterCheckPopup = function (data, header, title, alert) {
+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),
+ 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'),
+ configs: configs,
+ didInsertElement: function () {
+ App.tooltip($('.recommended-value'), {
+ title: upgradeVersion
+ });
+ }
+ });
+ }
return App.ModalPopup.show({
- primary: Em.I18n.t('common.dismiss'),
- secondary: false,
+ primary: fails.length ? Em.I18n.t('common.dismiss') : Em.I18n.t('common.proceedAnyway'),
+ secondary: fails.length ? false : Em.I18n.t('common.cancel'),
header: header,
- bodyClass: Em.View.extend({
- title: title,
- alert: alert,
- templateName: require('templates/common/modal_popups/cluster_check_dialog'),
- checks: data.items.filterProperty('UpgradeChecks.status', "FAIL")
- })
+ classNames: hasConfigsMergeConflicts ? ['configs-merge-warnings'] : [],
+ bodyClass: Em.View.extend(popupBody),
+ onPrimary: function () {
+ if (!fails.length && callback) {
+ callback();
+ }
+ this._super();
+ }
});
};
http://git-wip-us.apache.org/repos/asf/ambari/blob/d537d4a4/ambari-web/app/views/common/modal_popups/upgrade_configs_merge_popup.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/common/modal_popups/upgrade_configs_merge_popup.js b/ambari-web/app/views/common/modal_popups/upgrade_configs_merge_popup.js
deleted file mode 100644
index 68a1b2f..0000000
--- a/ambari-web/app/views/common/modal_popups/upgrade_configs_merge_popup.js
+++ /dev/null
@@ -1,63 +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');
-
-/**
- * Popup with configs merge warnings from Rolling Upgrade prerequisite checks
- * @param conflicts
- * @param version
- * @param callback
- * @returns {App.ModalPopup}
- */
-App.showUpgradeConfigsMergePopup = function (conflicts, version, callback) {
- var configs = conflicts.map(function (item) {
- var isDeprecated = Em.isNone(item.new_stack_value),
- willBeRemoved = Em.isNone(item.result_value);
- return {
- type: item.type,
- name: item.property,
- currentValue: item.current,
- recommendedValue: isDeprecated ? Em.I18n.t('popup.clusterCheck.Upgrade.configsMerge.deprecated') : item.new_stack_value,
- isDeprecated: isDeprecated,
- resultingValue: willBeRemoved ? Em.I18n.t('popup.clusterCheck.Upgrade.configsMerge.willBeRemoved') : item.result_value,
- willBeRemoved: willBeRemoved
- };
- });
- return App.ModalPopup.show({
- classNames: ['configs-merge-warnings'],
- primary: Em.I18n.t('common.proceedAnyway'),
- secondary: Em.I18n.t('form.cancel'),
- header: Em.I18n.t('popup.clusterCheck.Upgrade.header').format(version),
- bodyClass: Em.View.extend({
- templateName: require('templates/common/modal_popups/upgrade_configs_merge_popup'),
- configs: configs,
- didInsertElement: function () {
- App.tooltip($('.recommended-value'), {
- title: version
- });
- }
- }),
- onPrimary: function () {
- if (callback) {
- callback();
- }
- this._super();
- }
- });
-};
http://git-wip-us.apache.org/repos/asf/ambari/blob/d537d4a4/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 4177619..9450884 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
@@ -262,9 +262,8 @@ describe('App.MainAdminStackAndUpgradeController', function() {
"check_type": "SERVICE"
},
showClusterCheckPopupCalledCount: 1,
- showUpgradeConfigsMergePopupCalledCount: 0,
upgradeCalledCount: 0,
- title: 'error popup is displayed is errors are present'
+ title: 'popup is displayed if fails are present'
},
{
check: {
@@ -272,29 +271,64 @@ describe('App.MainAdminStackAndUpgradeController', function() {
"status": "WARNING",
"reason": "Conflict",
"failed_on": [],
- "failed_detail": [],
+ "failed_detail": [
+ {
+ type: 't0',
+ property: 'p0',
+ current: 'c0',
+ new_stack_value: 'n0',
+ result_value: 'n0'
+ },
+ {
+ type: 't1',
+ property: 'p1',
+ current: 'c1',
+ new_stack_value: null,
+ result_value: 'c1'
+ },
+ {
+ type: 't2',
+ property: 'p2',
+ current: 'c2',
+ new_stack_value: null,
+ result_value: null
+ }
+ ],
"check_type": "CLUSTER",
"id": "CONFIG_MERGE"
},
- showClusterCheckPopupCalledCount: 0,
- showUpgradeConfigsMergePopupCalledCount: 1,
+ showClusterCheckPopupCalledCount: 1,
upgradeCalledCount: 0,
- title: 'warnings popup is displayed if configs merge conflicts are present'
- },
- {
- check: {
- "check": "Configuration Merge Check",
- "status": "PASS",
- "reason": "",
- "failed_on": [],
- "failed_detail": [],
- "check_type": "CLUSTER",
- "id": "CONFIG_MERGE"
- },
- showClusterCheckPopupCalledCount: 0,
- showUpgradeConfigsMergePopupCalledCount: 0,
- upgradeCalledCount: 1,
- title: 'upgrade is started if configs merge conflicts are absent'
+ configs: [
+ {
+ type: 't0',
+ name: 'p0',
+ currentValue: 'c0',
+ recommendedValue: 'n0',
+ resultingValue: 'n0',
+ isDeprecated: false,
+ willBeRemoved: false
+ },
+ {
+ type: 't1',
+ name: 'p1',
+ currentValue: 'c1',
+ recommendedValue: Em.I18n.t('popup.clusterCheck.Upgrade.configsMerge.deprecated'),
+ resultingValue: 'c1',
+ isDeprecated: true,
+ willBeRemoved: false
+ },
+ {
+ type: 't2',
+ name: 'p2',
+ currentValue: 'c2',
+ recommendedValue: Em.I18n.t('popup.clusterCheck.Upgrade.configsMerge.deprecated'),
+ resultingValue: Em.I18n.t('popup.clusterCheck.Upgrade.configsMerge.willBeRemoved'),
+ isDeprecated: true,
+ willBeRemoved: true
+ }
+ ],
+ title: 'popup is displayed if warnings are present; configs merge conflicts'
},
{
check: {
@@ -305,19 +339,16 @@ describe('App.MainAdminStackAndUpgradeController', function() {
"check_type": "SERVICE"
},
showClusterCheckPopupCalledCount: 0,
- showUpgradeConfigsMergePopupCalledCount: 0,
upgradeCalledCount: 1,
- title: 'upgrade is started if errors and configs merge conflicts are absent'
+ title: 'upgrade is started if fails and warnings are absent'
}
];
beforeEach(function () {
sinon.stub(App, 'showClusterCheckPopup', Em.K);
- sinon.stub(App, 'showUpgradeConfigsMergePopup', Em.K);
sinon.stub(controller, 'upgrade', Em.K);
});
afterEach(function () {
App.showClusterCheckPopup.restore();
- App.showUpgradeConfigsMergePopup.restore();
controller.upgrade.restore();
});
cases.forEach(function (item) {
@@ -335,7 +366,9 @@ describe('App.MainAdminStackAndUpgradeController', function() {
);
expect(controller.upgrade.callCount).to.equal(item.upgradeCalledCount);
expect(App.showClusterCheckPopup.callCount).to.equal(item.showClusterCheckPopupCalledCount);
- expect(App.showUpgradeConfigsMergePopup.callCount).to.equal(item.showUpgradeConfigsMergePopupCalledCount);
+ if (item.check.id == 'CONFIG_MERGE') {
+ expect(App.showClusterCheckPopup.firstCall.args[7]).to.eql(item.configs);
+ }
});
});
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/d537d4a4/ambari-web/test/views/common/modal_popups/upgrade_configs_merge_popup_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/common/modal_popups/upgrade_configs_merge_popup_test.js b/ambari-web/test/views/common/modal_popups/upgrade_configs_merge_popup_test.js
deleted file mode 100644
index 292060d..0000000
--- a/ambari-web/test/views/common/modal_popups/upgrade_configs_merge_popup_test.js
+++ /dev/null
@@ -1,91 +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/upgrade_configs_merge_popup');
-
-describe('App.showUpgradeConfigsMergePopup', function () {
-
- var conflicts = [
- {
- type: 't0',
- property: 'p0',
- current: 'c0',
- new_stack_value: 'n0',
- result_value: 'n0'
- },
- {
- type: 't1',
- property: 'p1',
- current: 'c1',
- new_stack_value: null,
- result_value: 'c1'
- },
- {
- type: 't2',
- property: 'p2',
- current: 'c2',
- new_stack_value: null,
- result_value: null
- }
- ],
- version = 'HDP-2.3.0.0-1111',
- result = [
- {
- type: 't0',
- name: 'p0',
- currentValue: 'c0',
- recommendedValue: 'n0',
- resultingValue: 'n0',
- isDeprecated: false,
- willBeRemoved: false
- },
- {
- type: 't1',
- name: 'p1',
- currentValue: 'c1',
- recommendedValue: Em.I18n.t('popup.clusterCheck.Upgrade.configsMerge.deprecated'),
- resultingValue: 'c1',
- isDeprecated: true,
- willBeRemoved: false
- },
- {
- type: 't2',
- name: 'p2',
- currentValue: 'c2',
- recommendedValue: Em.I18n.t('popup.clusterCheck.Upgrade.configsMerge.deprecated'),
- resultingValue: Em.I18n.t('popup.clusterCheck.Upgrade.configsMerge.willBeRemoved'),
- isDeprecated: true,
- willBeRemoved: true
- }
- ],
- isPrimaryCalled = false,
- primary = function () {
- isPrimaryCalled = true;
- };
-
- it('popup with configs merge warnings', function () {
- var popup = App.showUpgradeConfigsMergePopup(conflicts, version , primary);
- expect(popup.get('header')).to.equal(Em.I18n.t('popup.clusterCheck.Upgrade.header').format(version));
- expect(popup.get('bodyClass').create().get('configs')).to.eql(result);
- popup.onPrimary();
- expect(isPrimaryCalled).to.be.true;
- });
-
-});