diff --git a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt index 0b6e999751c..5c29398ab50 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt +++ b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt @@ -101,7 +101,10 @@ Release 2.4.0 - UNRELEASED HDFS-5913. Nfs3Utils#getWccAttr() should check attr parameter against null (brandonli) - + + HDFS-5934. New Namenode UI back button doesn't work as expected + (Travis Thompson via brandonli) + Release 2.3.1 - UNRELEASED INCOMPATIBLE CHANGES diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/hdfs/dfshealth.js b/hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/hdfs/dfshealth.js index 946d21815da..3ab21548f58 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/hdfs/dfshealth.js +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/hdfs/dfshealth.js @@ -166,14 +166,29 @@ $('#ui-tabs a[href="#tab-snapshot"]').click(load_snapshot_info); - var hash = window.location.hash; - if (hash === "#tab-datanode") { - load_datanode_info(); - } else if (hash === "#tab-snapshot") { - load_snapshot_info(); - } else if (hash === "#tab-startup-progress") { - load_startup_progress(); - } else { - load_overview(); + function load_page() { + var hash = window.location.hash; + switch(hash) { + case "#tab-datanode": + load_datanode_info(); + break; + case "#tab-snapshot": + load_snapshot_info(); + break; + case "#tab-startup-progress": + load_startup_progress(); + break; + case "#tab-overview": + load_overview(); + break; + default: + window.location.hash = "tab-overview"; + break; + } } + load_page(); + + $(window).bind('hashchange', function () { + load_page(); + }); })(); diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/hdfs/explorer.js b/hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/hdfs/explorer.js index 1aa0c39079b..9d1ca663527 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/hdfs/explorer.js +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/hdfs/explorer.js @@ -52,6 +52,18 @@ $('#alert-panel').show(); } + $(window).bind('hashchange', function () { + $('#alert-panel').hide(); + + var dir = window.location.hash.slice(1); + if(dir == "") { + dir = "/"; + } + if(current_directory != dir) { + browse_directory(dir); + } + }); + function network_error_handler(url) { return function (jqxhr, text, err) { var msg = '

Failed to retreive data from ' + url + ', cause: ' + err + '

'; @@ -145,6 +157,7 @@ current_directory = dir; $('#directory').val(dir); + window.location.hash = dir; dust.render('explorer', base.push(d), function(err, out) { $('#panel').html(out); @@ -169,7 +182,12 @@ var b = function() { browse_directory($('#directory').val()); }; $('#btn-nav-directory').click(b); - browse_directory('/'); + var dir = window.location.hash.slice(1); + if(dir == "") { + window.location.hash = "/"; + } else { + browse_directory(dir); + } } init();