You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by zh...@apache.org on 2015/09/23 10:10:03 UTC
[05/50] [abbrv] hadoop git commit: HDFS-7986. Allow files /
directories to be deleted from the NameNode UI. Contributed by Ravi Prakash.
HDFS-7986. Allow files / directories to be deleted from the NameNode UI. Contributed by Ravi Prakash.
Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/6c52be78
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/6c52be78
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/6c52be78
Branch: refs/heads/HDFS-7966
Commit: 6c52be78a0c6d6d86444933c6b0734dfc2477c32
Parents: 559c09d
Author: Haohui Mai <wh...@apache.org>
Authored: Tue Sep 15 16:48:15 2015 -0700
Committer: Haohui Mai <wh...@apache.org>
Committed: Tue Sep 15 16:48:15 2015 -0700
----------------------------------------------------------------------
hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt | 3 ++
.../src/main/webapps/hdfs/explorer.html | 28 ++++++++++++++++--
.../src/main/webapps/hdfs/explorer.js | 31 +++++++++++++++++++-
.../src/main/webapps/static/hadoop.css | 5 +++-
4 files changed, 63 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hadoop/blob/6c52be78/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
index 4b310dd..a3b9b44 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
+++ b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
@@ -923,6 +923,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
http://git-wip-us.apache.org/repos/asf/hadoop/blob/6c52be78/hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/hdfs/explorer.html
----------------------------------------------------------------------
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 e805915..2fd7db6 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 @@
</div>
</div>
+ <div class="modal" id="delete-modal" tabindex="-1" role="dialog" aria-hidden="true">
+ <div class="modal-dialog">
+ <div class="modal-content">
+ <div class="modal-header">
+ <button type="button" class="close" data-dismiss="modal"
+ aria-hidden="true">×</button>
+ <h4 class="modal-title" id="delete-modal-title">Delete</h4>
+ </div>
+ <div class="modal-body">
+ <div class="panel-body">
+ <div id="delete-prompt"></div>
+ </div>
+ </div>
+ <div class="modal-footer">
+ <button type="button" class="btn" data-dismiss="modal">Cancel</button>
+ <button type="button" class="btn btn-success" id="delete-button"
+ data-complete-text="Deleting...">Delete</button>
+ </div>
+ </div>
+ </div>
+ </div>
+
<div class="row">
<div class="col-xs-11">
<form onsubmit="return false;">
@@ -159,11 +181,12 @@
<th>Replication</th>
<th>Block Size</th>
<th>Name</th>
+ <th>Delete</th>
</tr>
</thead>
<tbody>
{#FileStatus}
- <tr>
+ <tr inode-path="{pathSuffix}" class="explorer-entry">
<td>{type|helper_to_directory}{permission|helper_to_permission}{aclBit|helper_to_acl_bit}</td>
<td>{owner}</td>
<td>{group}</td>
@@ -171,7 +194,8 @@
<td>{#helper_date_tostring value="{modificationTime}"/}</td>
<td>{replication}</td>
<td>{blockSize|fmt_bytes}</td>
- <td><a style="cursor:pointer" inode-type="{type}" class="explorer-browse-links" inode-path="{pathSuffix}">{pathSuffix}</a></td>
+ <td><a inode-type="{type}" class="explorer-browse-links">{pathSuffix}</a></td>
+ <td><span class="glyphicon glyphicon-trash"></span></td>
</tr>
{/FileStatus}
</tbody>
http://git-wip-us.apache.org/repos/asf/hadoop/blob/6c52be78/hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/hdfs/explorer.js
----------------------------------------------------------------------
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 46f48b8..e469ead 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/<path>?op=DELETE&recursive=<true|false>
+ 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));
}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/6c52be78/hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/static/hadoop.css
----------------------------------------------------------------------
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 c13fe3f..e22611e 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; }