Explorar o código

AMBARI-9892 Exclude downgrading request from bgo popup. (ababiichuk)

aBabiichuk %!s(int64=10) %!d(string=hai) anos
pai
achega
087b990aaa

+ 1 - 1
ambari-web/app/controllers/global/background_operations_controller.js

@@ -196,7 +196,7 @@ App.BackgroundOperationsController = Em.Controller.extend({
    */
   isUpgradeRequest: function(request) {
     var context = Em.get(request, 'Requests.request_context');
-    return context ? context.toLowerCase().contains('upgrading') : false;
+    return context ? /(upgrading|downgrading)/.test(context.toLowerCase()) : false;
   },
   /**
    * Prepare, received from server, requests for host component popup

+ 4 - 0
ambari-web/test/controllers/global/background_operations_test.js

@@ -163,6 +163,10 @@ describe('App.BackgroundOperationsController', function () {
       expect(controller.isUpgradeRequest({Requests: {request_context: "UPGRADING"}})).to.be.true;
     });
 
+    it('defines if request is downgrade task (true - with uppercase)', function() {
+      expect(controller.isUpgradeRequest({Requests: {request_context: "downgrading"}})).to.be.true;
+    });
+
     it('defines if request is upgrade task (false)', function() {
       expect(controller.isUpgradeRequest({Requests: {request_context: "install"}})).to.be.false;
     });