diff --git a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt index bb57b07b2dd..44fb9852935 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt +++ b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt @@ -575,6 +575,9 @@ Release 2.8.0 - UNRELEASED HDFS-9082. Change the log level in WebHdfsFileSystem.initialize() from INFO to DEBUG. (Santhosh Nayak via cnauroth) + HDFS-7986. Allow files / directories to be deleted from the NameNode UI. + (Ravi Prakash via wheat9) + OPTIMIZATIONS HDFS-8026. Trace FSOutputSummer#writeChecksumChunks rather than diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/hdfs/explorer.html b/hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/hdfs/explorer.html index e8059154039..2fd7db6554e 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/hdfs/explorer.html +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/hdfs/explorer.html @@ -117,6 +117,28 @@ + +
@@ -159,11 +181,12 @@ Replication Block Size Name + Delete {#FileStatus} - + {type|helper_to_directory}{permission|helper_to_permission}{aclBit|helper_to_acl_bit} {owner} {group} @@ -171,7 +194,8 @@ {#helper_date_tostring value="{modificationTime}"/} {replication} {blockSize|fmt_bytes} - {pathSuffix} + {pathSuffix} + {/FileStatus} 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 46f48b8e10d..e469ead8d10 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 @@ -78,6 +78,29 @@ return data.RemoteException !== undefined ? data.RemoteException.message : ""; } + function delete_path(inode_name, absolute_file_path) { + $('#delete-modal-title').text("Delete - " + inode_name); + $('#delete-prompt').text("Are you sure you want to delete " + inode_name + + " ?"); + + $('#delete-button').click(function() { + // DELETE /webhdfs/v1/?op=DELETE&recursive= + var url = '/webhdfs/v1' + encode_path(absolute_file_path) + + '?op=DELETE' + '&recursive=true'; + + $.ajax(url, + { type: 'DELETE' + }).done(function(data) { + browse_directory(current_directory); + }).error(network_error_handler(url) + ).complete(function() { + $('#delete-modal').modal('hide'); + $('#delete-button').button('reset'); + }); + }) + $('#delete-modal').modal(); + } + function encode_path(abs_path) { abs_path = encodeURIComponent(abs_path); var re = /%2F/g; @@ -166,7 +189,7 @@ $('.explorer-browse-links').click(function() { var type = $(this).attr('inode-type'); - var path = $(this).attr('inode-path'); + var path = $(this).closest('tr').attr('inode-path'); var abs_path = append_path(current_directory, path); if (type == 'DIRECTORY') { browse_directory(abs_path); @@ -174,6 +197,12 @@ view_file_details(path, abs_path); } }); + + $('.explorer-entry .glyphicon-trash').click(function() { + var inode_name = $(this).closest('tr').attr('inode-path'); + var absolute_file_path = append_path(current_directory, inode_name); + delete_path(inode_name, absolute_file_path); + }) }); }).error(network_error_handler(url)); } diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/static/hadoop.css b/hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/static/hadoop.css index c13fe3f7b7e..e22611ef7fd 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/static/hadoop.css +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/static/hadoop.css @@ -263,4 +263,7 @@ header.bs-docs-nav, header.bs-docs-nav .navbar-brand { .dfshealth-node-legend li:before { padding-right: 5pt; -} \ No newline at end of file +} + +.explorer-entry .explorer-browse-links { cursor: pointer; } +.explorer-entry .glyphicon-trash { cursor: pointer; }