Repository: ambari
Updated Branches:
  refs/heads/branch-2.6 bf3a485e4 -> 7d277acbd


AMBARI-21957. UI should handle rejection of PATCH VDF (alexantonenko)


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

Branch: refs/heads/branch-2.6
Commit: 7d277acbd87179d8721e3da5e50867fea11c2c4a
Parents: bf3a485
Author: Alex Antonenko <aantone...@hortonworks.com>
Authored: Thu Sep 14 22:13:05 2017 +0300
Committer: Alex Antonenko <aantone...@hortonworks.com>
Committed: Thu Sep 14 22:13:05 2017 +0300

----------------------------------------------------------------------
 .../main/admin/stack_and_upgrade_controller.js         | 13 +++++++++----
 .../main/admin/stack_and_upgrade_controller_test.js    | 13 ++++++++++---
 2 files changed, 19 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/7d277acb/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 59773a1..64f4e09 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
@@ -1710,7 +1710,7 @@ App.MainAdminStackAndUpgradeController = 
Em.Controller.extend(App.LocalStorage,
    * @param data
    * @method installStackVersionSuccess
    */
-  installRepoVersionError: function (data) {
+  installRepoVersionError: function (data, opt, params) {
     var header = 
Em.I18n.t('admin.stackVersions.upgrade.installPackage.fail.title');
     var body = "";
     if (data && data.responseText) {
@@ -1722,6 +1722,11 @@ App.MainAdminStackAndUpgradeController = 
Em.Controller.extend(App.LocalStorage,
     if (data && data.statusText === "timeout") {
       body = 
Em.I18n.t('admin.stackVersions.upgrade.installPackage.fail.timeout');
     }
+    var version = App.RepositoryVersion.find(params.id);
+    version.set('defaultStatus', 'INSTALL_FAILED');
+    if (version.get('stackVersion')) {
+      version.set('stackVersion.state', 'INSTALL_FAILED');
+    }
     App.showAlertPopup(header, body);
   },
 
@@ -1744,11 +1749,11 @@ App.MainAdminStackAndUpgradeController = 
Em.Controller.extend(App.LocalStorage,
     var lastRepoVersionInstall = 
App.router.get('backgroundOperationsController.services').find(function(request)
 {
       return request.get('name').startsWith('Install version');
     });
-    if (!requestIds ||
-      (lastRepoVersionInstall && 
!requestIds.contains(lastRepoVersionInstall.get('id')))) {
+    if (lastRepoVersionInstall &&
+      (!requestIds || !requestIds.contains(lastRepoVersionInstall.get('id')))) 
{
       requestIds = [lastRepoVersionInstall.get('id')];
     }
-    return requestIds;
+    return requestIds || [];
   },
 
   /**

http://git-wip-us.apache.org/repos/asf/ambari/blob/7d277acb/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 e1ca6252..3c81dda 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
@@ -3049,20 +3049,27 @@ describe('App.MainAdminStackAndUpgradeController', 
function() {
 
   describe("#installRepoVersionError()", function () {
     var header = 
Em.I18n.t('admin.stackVersions.upgrade.installPackage.fail.title');
+    var mock = Em.Object.create({
+      id: 1,
+      defaultStatus: 'NOT_REQUIRED',
+      stackVersion: {}
+    });
 
     beforeEach(function() {
       sinon.stub(App, 'showAlertPopup');
+      sinon.stub(App.RepositoryVersion, 'find').returns(mock);
     });
 
     afterEach(function() {
       App.showAlertPopup.restore();
+      App.RepositoryVersion.find.restore();
     });
 
     it("responseText is incorrect", function() {
       var data = {
         responseText: null
       };
-      controller.installRepoVersionError(data);
+      controller.installRepoVersionError(data, null, mock);
       expect(App.showAlertPopup.calledWith(header, "")).to.be.true;
     });
 
@@ -3071,7 +3078,7 @@ describe('App.MainAdminStackAndUpgradeController', 
function() {
         responseText: '',
         statusText: 'timeout'
       };
-      controller.installRepoVersionError(data);
+      controller.installRepoVersionError(data, null, mock);
       expect(App.showAlertPopup.calledWith(header, 
Em.I18n.t('admin.stackVersions.upgrade.installPackage.fail.timeout'))).to.be.true;
     });
 
@@ -3079,7 +3086,7 @@ describe('App.MainAdminStackAndUpgradeController', 
function() {
       var data = {
         responseText: '{"message":"msg"}'
       };
-      controller.installRepoVersionError(data);
+      controller.installRepoVersionError(data, null, mock);
       expect(App.showAlertPopup.calledWith(header, 'msg')).to.be.true;
     });
   });

Reply via email to