Browse Source

HUE-6274 [core] Listen to hashchange events on the current active app only

Enrico Berti 8 years ago
parent
commit
f966ed6

+ 5 - 1
apps/about/src/about/templates/admin_wizard.mako

@@ -254,7 +254,11 @@ ${ layout.menubar(section='quick_start') }
 
 </style>
 
-<script src="${ static('desktop/ext/js/routie-0.3.0.min.js') }" type="text/javascript" charset="utf-8"></script>
+<script src="${ static('desktop/js/hue.routie.js') }" type="text/javascript" charset="utf-8"></script>
+<script>
+  routie.setPathname('/about');
+</script>
+
 
 <script type="text/javascript">
 

+ 1 - 1
apps/beeswax/src/beeswax/templates/create_database.mako

@@ -30,7 +30,7 @@ ${ commonheader(_("Create database"), 'metastore', user, request) | n,unicode }
 ${layout.metastore_menubar()}
 
 <script src="${ static('desktop/ext/js/jquery/plugins/jquery-ui-1.10.4.custom.min.js') }"></script>
-<script src="${ static('desktop/ext/js/routie-0.3.0.min.js') }" type="text/javascript" charset="utf-8"></script>
+<script src="${ static('desktop/js/hue.routie.js') }" type="text/javascript" charset="utf-8"></script>
 <script src="${ static('desktop/ext/js/selectize.min.js') }"></script>
 <script src="${ static('metastore/js/metastore.ko.js') }"></script>
 <script src="${ static('desktop/js/ko.charts.js') }"></script>

+ 1 - 1
apps/beeswax/src/beeswax/templates/execute.mako

@@ -808,7 +808,7 @@ ${ commonshare() | n,unicode }
 
 <script src="${ static('desktop/js/hue.json.js') }" type="text/javascript" charset="utf-8"></script>
 <script src="${ static('desktop/ext/js/jquery/plugins/jquery-ui-1.10.4.custom.min.js') }" type="text/javascript" charset="utf-8"></script>
-<script src="${ static('desktop/ext/js/routie-0.3.0.min.js') }" type="text/javascript" charset="utf-8"></script>
+<script src="${ static('desktop/js/hue.routie.js') }" type="text/javascript" charset="utf-8"></script>
 <script src="${ static('desktop/js/sqlAutocompleter.js') }" type="text/javascript" charset="utf-8"></script>
 <script src="${ static('desktop/js/sqlAutocompleter2.js') }" type="text/javascript" charset="utf-8"></script>
 <script src="${ static('desktop/js/hdfsAutocompleter.js') }" type="text/javascript" charset="utf-8"></script>

+ 28 - 26
apps/filebrowser/src/filebrowser/templates/listdir_components.mako

@@ -2571,38 +2571,40 @@ from filebrowser.conf import ENABLE_EXTRACT_UPLOADED_ARCHIVE
       });
 
       $(window).bind("hashchange", function () {
-        var targetPath = "";
-        var hash = window.location.hash.substring(1);
-        if (hash.search(/(<([^>]+)>)/ig) > -1) {
-          hash = encodeURI(hash);
-        }
+        if (window.location.pathname.indexOf('/filebrowser') > -1) {
+          var targetPath = "";
+          var hash = window.location.hash.substring(1);
+          if (hash.search(/(<([^>]+)>)/ig) > -1) {
+            hash = encodeURI(hash);
+          }
 
-        if (hash != null && hash != "") {
-          addPathToHistory(hash);
+          if (hash != null && hash != "") {
+            addPathToHistory(hash);
 
-          targetPath = "${url('filebrowser.views.view', path='')}";
-          if (hash.indexOf("!!") != 0) {
-            targetPath += stripHashes(hash);
-          }
-          else {
-            targetPath = viewModel.targetPath() + hash;
+            targetPath = "${url('filebrowser.views.view', path='')}";
+            if (hash.indexOf("!!") != 0) {
+              targetPath += stripHashes(hash);
+            }
+            else {
+              targetPath = viewModel.targetPath() + hash;
+            }
+            if (targetPath.indexOf("!!") > -1) {
+              viewModel.targetPageNum(targetPath.substring(targetPath.indexOf("!!") + 2) * 1)
+              targetPath = targetPath.substring(0, targetPath.indexOf("!!"));
+            }
+            else {
+              viewModel.targetPageNum(1)
+            }
           }
-          if (targetPath.indexOf("!!") > -1) {
-            viewModel.targetPageNum(targetPath.substring(targetPath.indexOf("!!") + 2) * 1)
-            targetPath = targetPath.substring(0, targetPath.indexOf("!!"));
+          if (window.location.href.indexOf("#") == -1) {
+            viewModel.targetPageNum(1);
+            targetPath = "${current_request_path | n,unicode }";
           }
-          else {
-            viewModel.targetPageNum(1)
+          if (targetPath != "") {
+            viewModel.targetPath(targetPath);
+            viewModel.retrieveData();
           }
         }
-        if (window.location.href.indexOf("#") == -1) {
-          viewModel.targetPageNum(1);
-          targetPath = "${current_request_path | n,unicode }";
-        }
-        if (targetPath != "") {
-          viewModel.targetPath(targetPath);
-          viewModel.retrieveData();
-        }
       });
 
       $(".actionbar").data("originalWidth", $(".actionbar").width());

+ 4 - 1
apps/hbase/src/hbase/templates/app.mako

@@ -2556,7 +2556,10 @@ ${ commonheader(None, "hbase", user, request) | n,unicode }
 </script>
 
 <script src="${ static('desktop/ext/js/datatables-paging-0.1.js') }" type="text/javascript" charset="utf-8"></script>
-<script src="${ static('desktop/ext/js/routie-0.3.0.min.js') }" type="text/javascript" charset="utf-8"></script>
+<script src="${ static('desktop/js/hue.routie.js') }" type="text/javascript" charset="utf-8"></script>
+<script>
+  routie.setPathname('/hbase');
+</script>
 <script src="${ static('desktop/ext/js/mustache.js') }" type="text/javascript" charset="utf-8"></script>
 
 <script src="${ static('desktop/js/ace/ace.js') }"></script>

+ 1 - 1
apps/jobsub/src/jobsub/templates/designs.mako

@@ -28,7 +28,7 @@ ${ commonheader(None, "jobsub", user, request) | n,unicode }
 <link rel="stylesheet" href="${ static('jobsub/css/jobsub.css') }">
 
 <script src="${ static('desktop/ext/js/mustache.js') }" type="text/javascript" charset="utf-8"></script>
-<script src="${ static('desktop/ext/js/routie-0.3.0.min.js') }" type="text/javascript" charset="utf-8"></script>
+<script src="${ static('desktop/js/hue.routie.js') }" type="text/javascript" charset="utf-8"></script>
 <script src="${ static('desktop/ext/js/datatables-paging-0.1.js') }" type="text/javascript" charset="utf-8"></script>
 <script src="${ static('oozie/js/workflow.models.js') }" type="text/javascript" charset="utf-8"></script>
 <script src="${ static('oozie/js/workflow.node-fields.js') }" type="text/javascript" charset="utf-8"></script>

+ 3 - 1
apps/metastore/src/metastore/static/metastore/js/metastore.ko.js

@@ -136,7 +136,9 @@ var MetastoreViewModel = (function () {
     self.loadURL();
 
     window.onpopstate = function () {
-      self.loadURL();
+      if (window.location.pathname.indexOf('/metastore') > -1) {
+        self.loadURL();
+      }
     };
 
     self.databasesBreadcrumb = function () {

+ 1 - 1
apps/oozie/src/oozie/templates/editor/create_coordinator.mako

@@ -40,7 +40,7 @@ ${ layout.menubar(section='coordinators') }
   }
 </style>
 
-<script src="${ static('desktop/ext/js/routie-0.3.0.min.js') }" type="text/javascript" charset="utf-8"></script>
+<script src="${ static('desktop/js/hue.routie.js') }" type="text/javascript" charset="utf-8"></script>
 
 <div class="container-fluid">
   <div class="row-fluid">

+ 1 - 1
apps/oozie/src/oozie/templates/editor/edit_bundle.mako

@@ -43,7 +43,7 @@ ${ layout.menubar(section='bundles') }
   }
 </style>
 
-<script src="${ static('desktop/ext/js/routie-0.3.0.min.js') }" type="text/javascript" charset="utf-8"></script>
+<script src="${ static('desktop/js/hue.routie.js') }" type="text/javascript" charset="utf-8"></script>
 
 
 <div class="container-fluid">

+ 1 - 1
apps/oozie/src/oozie/templates/editor/edit_coordinator.mako

@@ -45,7 +45,7 @@ ${ layout.menubar(section='coordinators') }
   }
 </style>
 
-<script src="${ static('desktop/ext/js/routie-0.3.0.min.js') }" type="text/javascript" charset="utf-8"></script>
+<script src="${ static('desktop/js/hue.routie.js') }" type="text/javascript" charset="utf-8"></script>
 
 
 <div class="container-fluid">

+ 1 - 1
apps/oozie/src/oozie/templates/editor/edit_workflow.mako

@@ -443,7 +443,7 @@ ${ layout.menubar(section='workflows') }
 <script src="${ static('desktop/ext/js/codemirror-closetag.js') }"></script>
 
 <script src="${ static('desktop/ext/js/jquery/plugins/jquery-ui-1.10.4.custom.min.js') }" type="text/javascript" charset="utf-8"></script>
-<script src="${ static('desktop/ext/js/routie-0.3.0.min.js') }" type="text/javascript" charset="utf-8"></script>
+<script src="${ static('desktop/js/hue.routie.js') }" type="text/javascript" charset="utf-8"></script>
 <script src="${ static('desktop/ext/js/datatables-paging-0.1.js') }" type="text/javascript" charset="utf-8"></script>
 
 <link rel="stylesheet" href="${ static('oozie/css/workflow.css') }">

+ 1 - 1
apps/pig/src/pig/templates/app.mako

@@ -736,7 +736,7 @@ ${ commonshare() | n,unicode }
 <script src="${ static('pig/js/pig.ko.js') }" type="text/javascript" charset="utf-8"></script>
 <script src="${ static('desktop/js/share.vm.js') }" type="text/javascript" charset="utf-8"></script>
 
-<script src="${ static('desktop/ext/js/routie-0.3.0.min.js') }" type="text/javascript" charset="utf-8"></script>
+<script src="${ static('desktop/js/hue.routie.js') }" type="text/javascript" charset="utf-8"></script>
 <script src="${ static('desktop/ext/js/codemirror-3.11.js') }"></script>
 <script src="${ static('desktop/js/codemirror-pig.js') }"></script>
 <script src="${ static('desktop/js/codemirror-show-hint.js') }"></script>

+ 3 - 1
apps/security/src/security/templates/hdfs.mako

@@ -370,7 +370,9 @@ ${ tree.import_templates(itemClick='$root.assist.setPath', iconClick='$root.assi
     });
 
     window.onpopstate = function() {
-      viewModel.assist.path(window.location.hash.substr(1));
+      if (window.location.pathname.indexOf('/security') > -1) {
+        viewModel.assist.path(window.location.hash.substr(1));
+      }
     };
 
     $("#bulkActionsModal").modal({

+ 7 - 4
apps/security/src/security/templates/hive.mako

@@ -560,13 +560,14 @@ ${ layout.menubar(section='hive1') }
 ${ tree.import_templates(itemClick='$root.assist.setPath', iconClick='$root.assist.togglePath', itemSelected='$root.assist.path() == path()', styleModifier='withPrivileges', iconModifier=treeIcons, anchorProperty='path', itemChecked='isChecked', styleModifierPullRight=withPrivilegesPullRight) }
 
 
-<script src="${ static('desktop/ext/js/routie-0.3.0.min.js') }" type="text/javascript" charset="utf-8"></script>
+<script src="${ static('desktop/js/hue.routie.js') }" type="text/javascript" charset="utf-8"></script>
+<script>
+  routie.setPathname('/security');
+</script>
 
 <script src="${ static('security/js/hive.ko.js') }" type="text/javascript" charset="utf-8"></script>
-
 <script src="${ static('desktop/js/jquery.filechooser.js') }" type="text/javascript" charset="utf-8"></script>
 
-
 <script type="text/javascript">
 
     ko.options.deferUpdates = true;
@@ -704,7 +705,9 @@ ${ tree.import_templates(itemClick='$root.assist.setPath', iconClick='$root.assi
       });
 
       window.onpopstate = function() {
-        viewModel.assist.path(viewModel.getPathHash());
+        if (window.location.pathname.indexOf('/security') > -1) {
+          viewModel.assist.path(viewModel.getPathHash());
+        }
       };
 
       $("#createRoleModal").modal({

+ 7 - 3
apps/security/src/security/templates/sentry.mako

@@ -617,10 +617,12 @@ ${ layout.menubar(section=component) }
 ${ tree.import_templates(itemClick='$root.assist.setPath', iconClick='$root.assist.togglePath', itemSelected='$root.assist.path() == path()', styleModifier='withPrivileges', iconModifier=treeIcons, anchorProperty='path', itemChecked='isChecked', styleModifierPullRight=withPrivilegesPullRight) }
 
 
-<script src="${ static('desktop/ext/js/routie-0.3.0.min.js') }" type="text/javascript" charset="utf-8"></script>
+<script src="${ static('desktop/js/hue.routie.js') }" type="text/javascript" charset="utf-8"></script>
+<script>
+  routie.setPathname('/security');
+</script>
 
 <script src="${ static('security/js/sentry.ko.js') }" type="text/javascript" charset="utf-8"></script>
-
 <script src="${ static('desktop/js/jquery.filechooser.js') }" type="text/javascript" charset="utf-8"></script>
 
 
@@ -760,7 +762,9 @@ ${ tree.import_templates(itemClick='$root.assist.setPath', iconClick='$root.assi
       });
 
       window.onpopstate = function() {
-        viewModel.assist.path(viewModel.getPathHash());
+        if (window.location.pathname.indexOf('/security') > -1) {
+          viewModel.assist.path(viewModel.getPathHash());
+        }
       };
 
       $("#createRoleModal").modal({

+ 4 - 1
apps/sqoop/src/sqoop/templates/app.mako

@@ -681,7 +681,10 @@ ${ commonheader(None, "sqoop", user, request) | n,unicode }
 </script>
 
 <script src="${ static('desktop/ext/js/datatables-paging-0.1.js') }" type="text/javascript" charset="utf-8"></script>
-<script src="${ static('desktop/ext/js/routie-0.3.0.min.js') }" type="text/javascript" charset="utf-8"></script>
+<script src="${ static('desktop/js/hue.routie.js') }" type="text/javascript" charset="utf-8"></script>
+<script>
+  routie.setPathname('/sqoop');
+</script>
 <script src="${ static('desktop/ext/js/bootstrap-editable.min.js') }"></script>
 <script src="${ static('desktop/js/ko.editable.js') }"></script>
 <script src="${ static('sqoop/js/cclass.js') }" type="text/javascript" charset="utf-8"></script>

+ 5 - 1
apps/useradmin/src/useradmin/templates/change_password.mako

@@ -65,7 +65,11 @@ ${ layout.menubar(section='users') }
   </div>
 </div>
 
-<script src="${ static('desktop/ext/js/routie-0.3.0.min.js') }" type="text/javascript" charset="utf-8"></script>
+<script src="${ static('desktop/js/hue.routie.js') }" type="text/javascript" charset="utf-8"></script>
+<script>
+  routie.setPathname('/useradmin');
+</script>
+
 
 <script type="text/javascript">
 

+ 4 - 1
apps/useradmin/src/useradmin/templates/edit_user.mako

@@ -113,7 +113,10 @@ ${ layout.menubar(section='users') }
   </div>
 </div>
 
-<script src="${ static('desktop/ext/js/routie-0.3.0.min.js') }" type="text/javascript" charset="utf-8"></script>
+<script src="${ static('desktop/js/hue.routie.js') }" type="text/javascript" charset="utf-8"></script>
+<script>
+  routie.setPathname('/useradmin');
+</script>
 
 <script type="text/javascript">
 

File diff suppressed because it is too large
+ 0 - 7
desktop/core/src/desktop/static/desktop/ext/js/routie-0.3.0.min.js


+ 249 - 0
desktop/core/src/desktop/static/desktop/js/hue.routie.js

@@ -0,0 +1,249 @@
+// Licensed to Cloudera, Inc. under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  Cloudera, Inc. licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+//
+// THIS IS A MODIFIED VERSION OF THE PLUGIN
+// it has an extra pathname to "pause" hashchange events when the app is not loaded currently on Hue 4
+//
+// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+/*!
+ * routie - a tiny hash router
+ * v0.3.2
+ * http://projects.jga.me/routie
+ * copyright Greg Allen 2016
+ * MIT License
+*/
+var Routie = function(w, isModule) {
+
+  var routes = [];
+  var pathname = '';
+  var map = {};
+  var reference = "routie";
+  var oldReference = w[reference];
+
+  var Route = function(path, name) {
+    this.name = name;
+    this.path = path;
+    this.keys = [];
+    this.fns = [];
+    this.params = {};
+    this.regex = pathToRegexp(this.path, this.keys, false, false);
+
+  };
+
+  Route.prototype.addHandler = function(fn) {
+    this.fns.push(fn);
+  };
+
+  Route.prototype.removeHandler = function(fn) {
+    for (var i = 0, c = this.fns.length; i < c; i++) {
+      var f = this.fns[i];
+      if (fn == f) {
+        this.fns.splice(i, 1);
+        return;
+      }
+    }
+  };
+
+  Route.prototype.run = function(params) {
+    for (var i = 0, c = this.fns.length; i < c; i++) {
+      this.fns[i].apply(this, params);
+    }
+  };
+
+  Route.prototype.match = function(path, params){
+    var m = this.regex.exec(path);
+
+    if (!m) return false;
+
+
+    for (var i = 1, len = m.length; i < len; ++i) {
+      var key = this.keys[i - 1];
+
+      var val = ('string' == typeof m[i]) ? decodeURIComponent(m[i]) : m[i];
+
+      if (key) {
+        this.params[key.name] = val;
+      }
+      params.push(val);
+    }
+
+    return true;
+  };
+
+  Route.prototype.toURL = function(params) {
+    var path = this.path;
+    for (var param in params) {
+      path = path.replace('/:'+param, '/'+params[param]);
+    }
+    path = path.replace(/\/:.*\?/g, '/').replace(/\?/g, '');
+    if (path.indexOf(':') != -1) {
+      throw new Error('missing parameters for url: '+path);
+    }
+    return path;
+  };
+
+  var pathToRegexp = function(path, keys, sensitive, strict) {
+    if (path instanceof RegExp) return path;
+    if (path instanceof Array) path = '(' + path.join('|') + ')';
+    path = path
+      .concat(strict ? '' : '/?')
+      .replace(/\/\(/g, '(?:/')
+      .replace(/\+/g, '__plus__')
+      .replace(/(\/)?(\.)?:(\w+)(?:(\(.*?\)))?(\?)?/g, function(_, slash, format, key, capture, optional){
+        keys.push({ name: key, optional: !! optional });
+        slash = slash || '';
+        return '' + (optional ? '' : slash) + '(?:' + (optional ? slash : '') + (format || '') + (capture || (format && '([^/.]+?)' || '([^/]+?)')) + ')' + (optional || '');
+      })
+      .replace(/([\/.])/g, '\\$1')
+      .replace(/__plus__/g, '(.+)')
+      .replace(/\*/g, '(.*)');
+    return new RegExp('^' + path + '$', sensitive ? '' : 'i');
+  };
+
+  var addHandler = function(path, fn) {
+    var s = path.split(' ');
+    var name = (s.length == 2) ? s[0] : null;
+    path = (s.length == 2) ? s[1] : s[0];
+
+    if (!map[path]) {
+      map[path] = new Route(path, name);
+      routes.push(map[path]);
+    }
+    map[path].addHandler(fn);
+  };
+
+  var routie = function(path, fn) {
+    if (typeof fn == 'function') {
+      addHandler(path, fn);
+      routie.reload();
+    } else if (typeof path == 'object') {
+      for (var p in path) {
+        addHandler(p, path[p]);
+      }
+      routie.reload();
+    } else if (typeof fn === 'undefined') {
+      routie.navigate(path);
+    }
+  };
+
+  routie.setPathname = function(name) {
+    pathname = name;
+  }
+
+  routie.lookup = function(name, obj) {
+    for (var i = 0, c = routes.length; i < c; i++) {
+      var route = routes[i];
+      if (route.name == name) {
+        return route.toURL(obj);
+      }
+    }
+  };
+
+  routie.remove = function(path, fn) {
+    var route = map[path];
+    if (!route)
+      return;
+    route.removeHandler(fn);
+  };
+
+  routie.removeAll = function() {
+    map = {};
+    routes = [];
+  };
+
+  routie.navigate = function(path, options) {
+    options = options || {};
+    var silent = options.silent || false;
+
+    if (silent) {
+      removeListener();
+    }
+    setTimeout(function() {
+      window.location.hash = path;
+
+      if (silent) {
+        setTimeout(function() {
+          addListener();
+        }, 1);
+      }
+
+    }, 1);
+  };
+
+  routie.noConflict = function() {
+    w[reference] = oldReference;
+    return routie;
+  };
+
+  var getHash = function() {
+    return window.location.hash.substring(1);
+  };
+
+  var checkRoute = function(hash, route) {
+    var params = [];
+    if (route.match(hash, params)) {
+      route.run(params);
+      return true;
+    }
+    return false;
+  };
+
+  var hashChanged = routie.reload = function() {
+    if (pathname === '' || window.location.pathname.indexOf(pathname) > -1) {
+      console.log('ahsh cahgne or path', pathname)
+      var hash = getHash();
+      for (var i = 0, c = routes.length; i < c; i++) {
+        var route = routes[i];
+        if (checkRoute(hash, route)) {
+          return;
+        }
+      }
+    }
+  };
+
+  var addListener = function() {
+    if (w.addEventListener) {
+      w.addEventListener('hashchange', hashChanged, false);
+    } else {
+      w.attachEvent('onhashchange', hashChanged);
+    }
+  };
+
+  var removeListener = function() {
+    if (w.removeEventListener) {
+      w.removeEventListener('hashchange', hashChanged);
+    } else {
+      w.detachEvent('onhashchange', hashChanged);
+    }
+  };
+  addListener();
+
+  if (isModule){
+    return routie;
+  } else {
+    w[reference] = routie;
+  }
+
+};
+
+if (typeof module == 'undefined'){
+  Routie(window);
+} else {
+  module.exports = Routie(window,true);
+}

+ 18 - 16
desktop/core/src/desktop/templates/common_home.mako

@@ -89,23 +89,25 @@
       var viewModel = new HomeViewModel(options);
 
       var loadUrlParam = function () {
-        if (location.getParameter('uuid')) {
-          viewModel.openUuid(location.getParameter('uuid'));
-        } else if (location.getParameter('path')) {
-          viewModel.openPath(location.getParameter('path'));
-        } else if (viewModel.activeEntry() && viewModel.activeEntry().loaded()) {
-          var rootEntry = viewModel.activeEntry();
-          while (rootEntry && ! rootEntry.isRoot()) {
-            rootEntry = rootEntry.parent;
-          }
-          viewModel.activeEntry(rootEntry);
-        } else {
-          viewModel.activeEntry().load(function () {
-            if (viewModel.activeEntry().entries().length === 1 && viewModel.activeEntry().entries()[0].definition().type === 'directory') {
-              viewModel.activeEntry(viewModel.activeEntry().entries()[0]);
-              viewModel.activeEntry().load();
+        if (window.location.pathname.indexOf('/home') > -1) {
+          if (location.getParameter('uuid')) {
+            viewModel.openUuid(location.getParameter('uuid'));
+          } else if (location.getParameter('path')) {
+            viewModel.openPath(location.getParameter('path'));
+          } else if (viewModel.activeEntry() && viewModel.activeEntry().loaded()) {
+            var rootEntry = viewModel.activeEntry();
+            while (rootEntry && !rootEntry.isRoot()) {
+              rootEntry = rootEntry.parent;
             }
-          });
+            viewModel.activeEntry(rootEntry);
+          } else {
+            viewModel.activeEntry().load(function () {
+              if (viewModel.activeEntry().entries().length === 1 && viewModel.activeEntry().entries()[0].definition().type === 'directory') {
+                viewModel.activeEntry(viewModel.activeEntry().entries()[0]);
+                viewModel.activeEntry().load();
+              }
+            });
+          }
         }
       };
       window.onpopstate = loadUrlParam;

+ 4 - 1
desktop/libs/indexer/src/indexer/templates/collections.mako

@@ -501,7 +501,10 @@ ${ commonheader(_('Search Indexes'), "indexer", user, request, "90px") | n,unico
 
 <script src="${ static('desktop/ext/chosen/chosen.jquery.min.js') }" type="text/javascript" charset="utf-8"></script>
 <script src="${ static('desktop/ext/js/jquery/plugins/jquery-ui-1.10.4.custom.min.js') }" type="text/javascript" charset="utf-8"></script>
-<script src="${ static('desktop/ext/js/routie-0.3.0.min.js') }" type="text/javascript" charset="utf-8"></script>
+<script src="${ static('desktop/js/hue.routie.js') }" type="text/javascript" charset="utf-8"></script>
+<script>
+  routie.setPathname('/indexer');
+</script>
 <script src="${ static('desktop/ext/js/knockout-sortable.min.js') }" type="text/javascript" charset="utf-8"></script>
 <script src="${ static('indexer/js/lib.js') }" type="text/javascript" charset="utf-8"></script>
 <script src="${ static('indexer/js/collections.js') }" type="text/javascript" charset="utf-8"></script>

Some files were not shown because too many files changed in this diff