You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ak...@apache.org on 2016/07/15 19:45:33 UTC
ambari git commit: AMBARI-17741 Upgrade is not available if
preUpgradeCheck feature is disabled (akovalenko)
Repository: ambari
Updated Branches:
refs/heads/trunk 27f6b17ca -> 51870ae74
AMBARI-17741 Upgrade is not available if preUpgradeCheck feature is disabled (akovalenko)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/51870ae7
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/51870ae7
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/51870ae7
Branch: refs/heads/trunk
Commit: 51870ae749910f8779a4af4ce235172059635203
Parents: 27f6b17
Author: Aleksandr Kovalenko <ak...@hortonworks.com>
Authored: Fri Jul 15 21:38:06 2016 +0300
Committer: Aleksandr Kovalenko <ak...@hortonworks.com>
Committed: Fri Jul 15 22:45:12 2016 +0300
----------------------------------------------------------------------
.../main/admin/stack_and_upgrade_controller.js | 11 +++-
.../admin/stack_upgrade/upgrade_options.hbs | 4 +-
.../admin/stack_and_upgrade_controller_test.js | 55 ++++++++++++++++++++
3 files changed, 67 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/51870ae7/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 e083f65..bbf7523 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
@@ -940,6 +940,7 @@ App.MainAdminStackAndUpgradeController = Em.Controller.extend(App.LocalStorage,
return self.get('upgradeMethods');
}.property().volatile(),
isInUpgradeWizard: isInUpgradeWizard,
+ showPreUpgradeChecks: App.get('supports.preUpgradeCheck') && !isInUpgradeWizard,
versionText: isInUpgradeWizard ? '' : Em.I18n.t('admin.stackVersions.version.upgrade.upgradeOptions.bodyMsg.version').format(version.get('displayName')),
selectMethod: function (event) {
if (isInUpgradeWizard || !event.context.get('allowed') || event.context.get('isPrecheckFailed')) return;
@@ -1015,7 +1016,15 @@ App.MainAdminStackAndUpgradeController = Em.Controller.extend(App.LocalStorage,
disablePrimary: function () {
if (isInUpgradeWizard) return false;
var selectedMethod = this.get('selectedMethod');
- return (selectedMethod ? (selectedMethod.get('isPrecheckFailed') || selectedMethod.get('isCheckRequestInProgress')) : true);
+ if (selectedMethod) {
+ if (App.get('supports.preUpgradeCheck')) {
+ return selectedMethod.get('isPrecheckFailed') || selectedMethod.get('isCheckRequestInProgress');
+ } else {
+ return false;
+ }
+ } else {
+ return true;
+ }
}.property('selectedMethod', 'selectedMethod.isPrecheckFailed', 'selectedMethod.isCheckRequestInProgress'),
onPrimary: function () {
this.hide();
http://git-wip-us.apache.org/repos/asf/ambari/blob/51870ae7/ambari-web/app/templates/main/admin/stack_upgrade/upgrade_options.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/main/admin/stack_upgrade/upgrade_options.hbs b/ambari-web/app/templates/main/admin/stack_upgrade/upgrade_options.hbs
index f5972bd..5369ebd 100644
--- a/ambari-web/app/templates/main/admin/stack_upgrade/upgrade_options.hbs
+++ b/ambari-web/app/templates/main/admin/stack_upgrade/upgrade_options.hbs
@@ -29,7 +29,7 @@
<div {{bindAttr class="method.icon :method-icon"}}></div>
<div class="method-name">{{method.displayName}}</div>
<div class="method-description">{{{method.description}}}</div>
- {{#unless view.isInUpgradeWizard}}
+ {{#if view.showPreUpgradeChecks}}
{{#if method.isCheckRequestInProgress}}
<div class="method-precheck-message checking">
{{view App.SpinnerView message="admin.stackVersions.version.upgrade.upgradeOptions.preCheck.msg.checking"}}
@@ -46,7 +46,7 @@
{{/if}}
</div>
{{/if}}
- {{/unless}}
+ {{/if}}
</div>
</div>
{{/each}}
http://git-wip-us.apache.org/repos/asf/ambari/blob/51870ae7/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 c78c35b..feaeafc 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
@@ -1012,6 +1012,61 @@ describe('App.MainAdminStackAndUpgradeController', function() {
});
+ describe('#popup.disablePrimary', function () {
+
+ beforeEach(function() {
+ this.mock = sinon.stub(App, 'get');
+ });
+
+ afterEach(function() {
+ App.get.restore();
+ });
+
+ it('should be disabled if no method is selected', function () {
+ expect(this.popup.get('disablePrimary')).to.be.true;
+ });
+
+ it('should be disabled if preupgradecheck is supproted and isPrecheckFailed is true', function () {
+ this.mock.returns(true);
+ this.popup.set('selectedMethod', Em.Object.create({
+ selected: true,
+ isPrecheckFailed: true,
+ isCheckRequestInProgress: false
+ }));
+
+ expect(this.popup.get('disablePrimary')).to.be.true;
+ });
+
+ it('should be disabled if preupgradecheck is supproted and isCheckRequestInProgress is true', function () {
+ this.popup.set('selectedMethod', Em.Object.create({
+ selected: true,
+ isPrecheckFailed: false,
+ isCheckRequestInProgress: true
+ }));
+ this.mock.returns(true);
+ expect(this.popup.get('disablePrimary')).to.be.true;
+ });
+
+ it('should be enabled with preupgrade check', function () {
+ this.popup.set('selectedMethod', Em.Object.create({
+ selected: true,
+ isPrecheckFailed: false,
+ isCheckRequestInProgress: false
+ }));
+ this.mock.returns(true);
+ expect(this.popup.get('disablePrimary')).to.be.false;
+ });
+
+ it('should be enabled without preupgrade check', function () {
+ this.popup.set('selectedMethod', Em.Object.create({
+ selected: true
+ }));
+ this.mock.returns(false);
+ expect(this.popup.get('disablePrimary')).to.be.false;
+ });
+
+ });
+
});
describe("NOT show confirmation popup on Downgrade", function() {