ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From alexantone...@apache.org
Subject ambari git commit: AMBARI-21957. UI should handle rejection of PATCH VDF (alexantonenko)
Date Thu, 14 Sep 2017 19:14:17 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk 3affda38d -> 95d6ff0b0


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/95d6ff0b
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/95d6ff0b
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/95d6ff0b

Branch: refs/heads/trunk
Commit: 95d6ff0b03582b0c4132ee8575d8f688e033c9ee
Parents: 3affda3
Author: Alex Antonenko <aantonenko@hortonworks.com>
Authored: Thu Sep 14 22:14:00 2017 +0300
Committer: Alex Antonenko <aantonenko@hortonworks.com>
Committed: Thu Sep 14 22:14:00 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/95d6ff0b/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 f968afa..acad53e 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
@@ -1732,7 +1732,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) {
@@ -1744,6 +1744,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);
   },
 
@@ -1766,11 +1771,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/95d6ff0b/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 e2f07fc..816604d 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
@@ -3054,20 +3054,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;
     });
 
@@ -3076,7 +3083,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;
     });
 
@@ -3084,7 +3091,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;
     });
   });


Mime
View raw message