Browse Source

HUE-2699 [fb] Do not show an error if JB is not reachable

Check on the response text if the error comes from JB
Enrico Berti 10 years ago
parent
commit
c4bd326b84

+ 1 - 1
apps/filebrowser/src/filebrowser/templates/listdir_components.mako

@@ -1831,7 +1831,7 @@ from django.utils.translation import ugettext as _
 
       $.ajaxSetup({
         error:function (x, e) {
-          if (x.status == 500) {
+          if (x.status == 500 && x.responseText.indexOf("jobbrowser") == -1) {
             $(document).trigger("error", "${_('There was a problem with your request.')}");
             $("#hueBreadcrumbText").blur();
           }

+ 3 - 3
desktop/core/src/desktop/templates/common_header.mako

@@ -248,7 +248,7 @@ from django.utils.translation import ugettext as _
 
       % if 'jobbrowser' in apps:
       var JB_CHECK_INTERVAL_IN_MILLIS = 30000;
-      window.setTimeout(checkJobBrowserStatus, 10);
+      var checkJobBrowserStatusIdx = window.setTimeout(checkJobBrowserStatus, 10);
 
       function checkJobBrowserStatus(){
         $.getJSON("/${apps['jobbrowser'].display_name}/?format=json&state=running&user=${user.username}", function(data){
@@ -260,9 +260,9 @@ from django.utils.translation import ugettext as _
               $("#jobBrowserCount").addClass("hide");
             }
           }
-          window.setTimeout(checkJobBrowserStatus, JB_CHECK_INTERVAL_IN_MILLIS);
+          checkJobBrowserStatusIdx = window.setTimeout(checkJobBrowserStatus, JB_CHECK_INTERVAL_IN_MILLIS);
         }).fail(function () {
-          window.clearTimeout(checkJobBrowserStatus);
+          window.clearTimeout(checkJobBrowserStatusIdx);
         });
       }
       % endif