Browse Source

HUE-6644 [frontend] Show file chooser Home breadcrumb in case of error too

Enrico Berti 8 years ago
parent
commit
f3622b4
1 changed files with 24 additions and 23 deletions
  1. 24 23
      desktop/core/src/desktop/static/desktop/js/jquery.filechooser.js

+ 24 - 23
desktop/core/src/desktop/static/desktop/js/jquery.filechooser.js

@@ -187,7 +187,31 @@
         'height': '260px',
         'overflow-y': 'auto'
       });
+      var $homeBreadcrumb = $("<ul>").addClass("hue-breadcrumbs").css({
+        'padding': '0',
+        'marginLeft': '0',
+        'float': 'left',
+        'white-space': 'nowrap'
+      });
+      var _home = $("<li>");
+      var _homelink = $("<a>").addClass("nounderline").html('<i class="fa fa-home"></i> ' + _parent.options.labels.HOME).css("cursor", "pointer").click(function () {
+        _parent.navigateTo("/?default_to_home");
+      });
+
+      if (_parent.options.fsSelected === 's3a') {
+        _homelink = $("<a>").addClass("nounderline muted").html('<i class="fa fa-cubes"></i> ').css("cursor", "pointer").click(function () {
+          _parent.navigateTo("S3A://");
+        });
+      }
+
+      _homelink.appendTo(_home);
+      _home.appendTo($homeBreadcrumb);
+
+      $("<span>").addClass("divider").css("margin-right", "20px").appendTo(_home);
+
       if (data.error || (data.title != null && data.title == "Error")) {
+        $homeBreadcrumb.appendTo($(_parent.element).find('.filechooser-tree'));
+        $("<div class='clearfix'>").appendTo($(_parent.element).find('.filechooser-tree'));
         var _errorMsg = $("<div>").addClass("alert").addClass("alert-error").text(data.message ? data.message : data.error);
         _errorMsg.appendTo($(_parent.element).find('.filechooser-tree'));
         var _previousLink = $("<a>").addClass("btn").text(_parent.options.labels.BACK).click(function () {
@@ -262,13 +286,6 @@
 
         $search.appendTo($(_parent.element).find('.filechooser-tree'));
 
-        var $homeBreadcrumb = $("<ul>").addClass("hue-breadcrumbs").css({
-          'padding': '0',
-          'marginLeft': '0',
-          'float': 'left',
-          'white-space': 'nowrap'
-        });
-
         var $scrollingBreadcrumbs = $("<ul>").addClass("hue-breadcrumbs editable-breadcrumbs").css({
           'padding': '0',
           'marginLeft': '10px',
@@ -281,22 +298,6 @@
           'white-space': 'nowrap'
         });
 
-        var _home = $("<li>");
-        var _homelink = $("<a>").addClass("nounderline").html('<i class="fa fa-home"></i> ' + _parent.options.labels.HOME).css("cursor", "pointer").click(function () {
-          _parent.navigateTo("/?default_to_home");
-        });
-
-        if (_parent.options.fsSelected === 's3a') {
-          _homelink = $("<a>").addClass("nounderline muted").html('<i class="fa fa-cubes"></i> ').css("cursor", "pointer").click(function () {
-            _parent.navigateTo("S3A://");
-          });
-        }
-
-        _homelink.appendTo(_home);
-
-        $("<span>").addClass("divider").css("margin-right", "20px").appendTo(_home);
-        _home.appendTo($homeBreadcrumb);
-
         if (_parent.options.showExtraHome) {
           var _extraHome = $("<li>");
           var _extraHomelink = $("<a>").addClass("nounderline").html('<i class="fa ' + _parent.options.extraHomeProperties.icon + '"></i> ' + _parent.options.extraHomeProperties.label).css("cursor", "pointer").click(function () {