HDFS-7986. Allow files / directories to be deleted from the NameNode UI. Contributed by Ravi Prakash.
This commit is contained in:
parent
559c09dc0e
commit
6c52be78a0
|
@ -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
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
|
|
|
@ -263,4 +263,7 @@ header.bs-docs-nav, header.bs-docs-nav .navbar-brand {
|
|||
|
||||
.dfshealth-node-legend li:before {
|
||||
padding-right: 5pt;
|
||||
}
|
||||
}
|
||||
|
||||
.explorer-entry .explorer-browse-links { cursor: pointer; }
|
||||
.explorer-entry .glyphicon-trash { cursor: pointer; }
|
||||
|
|
Loading…
Reference in New Issue