HDFS-5934. New Namenode UI back button doesn't work as expected. Contributed by Travis Thompson

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1568165 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Brandon Li 2014-02-13 23:47:11 +00:00
parent 9d89fb8ca1
commit 2ccc1daacf
3 changed files with 47 additions and 11 deletions

View File

@ -441,7 +441,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

View File

@ -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();
});
})();

View File

@ -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 = '<p>Failed to retreive data from ' + url + ', cause: ' + err + '</p>';
@ -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();