AMBARI-22116. You should not be able to 'Ignore and Proceed' to finalize (alexantonenko)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/05c7067a Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/05c7067a Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/05c7067a Branch: refs/heads/branch-feature-AMBARI-14714 Commit: 05c7067a3560eebc257213691c0a947c9626f8f5 Parents: b4c8e84 Author: Alex Antonenko <aantone...@hortonworks.com> Authored: Tue Oct 3 15:03:08 2017 +0300 Committer: Alex Antonenko <aantone...@hortonworks.com> Committed: Tue Oct 3 15:03:08 2017 +0300 ---------------------------------------------------------------------- .../stack_upgrade/stack_upgrade_wizard.hbs | 2 +- .../admin/stack_upgrade/upgrade_wizard_view.js | 12 +++++++++++ .../stack_upgrade/upgrade_wizard_view_test.js | 22 ++++++++++++++++++++ 3 files changed, 35 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/05c7067a/ambari-web/app/templates/main/admin/stack_upgrade/stack_upgrade_wizard.hbs ---------------------------------------------------------------------- diff --git a/ambari-web/app/templates/main/admin/stack_upgrade/stack_upgrade_wizard.hbs b/ambari-web/app/templates/main/admin/stack_upgrade/stack_upgrade_wizard.hbs index 7ab43b4..332594e 100644 --- a/ambari-web/app/templates/main/admin/stack_upgrade/stack_upgrade_wizard.hbs +++ b/ambari-web/app/templates/main/admin/stack_upgrade/stack_upgrade_wizard.hbs @@ -123,7 +123,7 @@ <button class="btn btn-danger" {{bindAttr disabled="controller.requestInProgress"}} {{action confirmDowngrade view.failedItem target="controller"}}>{{t common.downgrade}}</button> {{/if}} - {{#if view.failedItem.skippable}} + {{#if view.canSkipFailedItem}} <button class="btn btn-warning" {{bindAttr disabled="controller.requestInProgress"}} {{action continue view.failedItem target="view"}}>{{t admin.stackUpgrade.dialog.continue}}</button> {{/if}} http://git-wip-us.apache.org/repos/asf/ambari/blob/05c7067a/ambari-web/app/views/main/admin/stack_upgrade/upgrade_wizard_view.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/views/main/admin/stack_upgrade/upgrade_wizard_view.js b/ambari-web/app/views/main/admin/stack_upgrade/upgrade_wizard_view.js index 89c54ce..e1689c2 100644 --- a/ambari-web/app/views/main/admin/stack_upgrade/upgrade_wizard_view.js +++ b/ambari-web/app/views/main/admin/stack_upgrade/upgrade_wizard_view.js @@ -118,6 +118,18 @@ App.upgradeWizardView = Em.View.extend({ }.property('activeGroup.upgradeItems.@each.status'), /** + * can skip failed item or not + * @type {boolean} + */ + canSkipFailedItem: function () { + var failedItem = this.get('failedItem'); + var associatedVersion = this.get('controller.upgradeData.Upgrade.associated_version'); + var version = associatedVersion && App.RepositoryVersion.find().findProperty('repositoryVersion', associatedVersion); + var isPatchOrMaint = version && ( version.get('isPatch') || version.get('isMaint') ); + return failedItem && failedItem.get('skippable') && !isPatchOrMaint; + }.property('failedItem'), + + /** * upgrade doesn't have any failed or manual or running item * @type {boolean} */ http://git-wip-us.apache.org/repos/asf/ambari/blob/05c7067a/ambari-web/test/views/main/admin/stack_upgrade/upgrade_wizard_view_test.js ---------------------------------------------------------------------- diff --git a/ambari-web/test/views/main/admin/stack_upgrade/upgrade_wizard_view_test.js b/ambari-web/test/views/main/admin/stack_upgrade/upgrade_wizard_view_test.js index a303e60..0107975 100644 --- a/ambari-web/test/views/main/admin/stack_upgrade/upgrade_wizard_view_test.js +++ b/ambari-web/test/views/main/admin/stack_upgrade/upgrade_wizard_view_test.js @@ -915,4 +915,26 @@ describe('App.upgradeWizardView', function () { }); }); + describe("#canSkipFailedItem()", function() { + beforeEach(function () { + view.reopen({'failedItem': Em.Object.create({skippable: true}) }); + view.set('controller.upgradeData.Upgrade', {associated_version: '2.1.1'}); + }) + it("Should return true if can not find upgrade", function () { + view.propertyDidChange('canSkipFailedItem'); + expect(view.get('canSkipFailedItem')).to.be.true + }); + + it("Should return false if upgrade is patch or maint", function () { + var findResult = [Em.Object.create({repositoryVersion: '2.1.1', isPatch: true})]; + sinon.stub(App.RepositoryVersion, 'find', function(){ + return findResult; + }); + view.propertyDidChange('canSkipFailedItem'); + expect(view.get('canSkipFailedItem')).to.be.false; + App.RepositoryVersion.find.restore(); + }); + + }); + });