HDFS-7779. Support changing ownership, group and replication in HDFS Web UI. Contributed by Ravi Prakash.

This commit is contained in:
Haohui Mai 2016-01-05 13:43:32 -08:00
parent 28bd138018
commit cea0972fa1
3 changed files with 38 additions and 3 deletions

View File

@ -1794,6 +1794,9 @@ Release 2.8.0 - UNRELEASED
HDFS-9552. Document types of permission checks performed for HDFS HDFS-9552. Document types of permission checks performed for HDFS
operations. (cnauroth) operations. (cnauroth)
HDFS-7779. Support changing ownership, group and replication in HDFS Web
UI. (Ravi Prakash via wheat9)
OPTIMIZATIONS OPTIMIZATIONS
HDFS-8026. Trace FSOutputSummer#writeChecksumChunks rather than HDFS-8026. Trace FSOutputSummer#writeChecksumChunks rather than

View File

@ -20,6 +20,7 @@
<head> <head>
<meta http-equiv="X-UA-Compatible" content="IE=9" /> <meta http-equiv="X-UA-Compatible" content="IE=9" />
<link rel="stylesheet" type="text/css" href="/static/bootstrap-3.0.2/css/bootstrap.min.css" /> <link rel="stylesheet" type="text/css" href="/static/bootstrap-3.0.2/css/bootstrap.min.css" />
<link rel="stylesheet" type="text/css" href="/static/bootstrap-3.0.2/css/bootstrap-editable.css"/>
<link rel="stylesheet" type="text/css" href="/static/hadoop.css" /> <link rel="stylesheet" type="text/css" href="/static/hadoop.css" />
<title>Browsing HDFS</title> <title>Browsing HDFS</title>
</head> </head>
@ -231,11 +232,11 @@
{type|helper_to_directory}{permission|helper_to_permission} {type|helper_to_directory}{permission|helper_to_permission}
{aclBit|helper_to_acl_bit} {aclBit|helper_to_acl_bit}
</span></td> </span></td>
<td>{owner}</td> <td><span class="explorer-owner-links">{owner}</span></td>
<td>{group}</td> <td><span class="explorer-group-links">{group}</span></td>
<td>{length|fmt_bytes}</td> <td>{length|fmt_bytes}</td>
<td>{#helper_date_tostring value="{modificationTime}"/}</td> <td>{#helper_date_tostring value="{modificationTime}"/}</td>
<td>{replication}</td> <td><span class="explorer-replication-links">{replication}</span></td>
<td>{blockSize|fmt_bytes}</td> <td>{blockSize|fmt_bytes}</td>
<td><a inode-type="{type}" class="explorer-browse-links">{pathSuffix}</a></td> <td><a inode-type="{type}" class="explorer-browse-links">{pathSuffix}</a></td>
<td><span class="glyphicon glyphicon-trash"></span></td> <td><span class="glyphicon glyphicon-trash"></span></td>
@ -262,6 +263,7 @@
</script> </script>
<script type="text/javascript" src="/static/jquery-1.10.2.min.js"> <script type="text/javascript" src="/static/jquery-1.10.2.min.js">
</script><script type="text/javascript" src="/static/bootstrap-3.0.2/js/bootstrap.min.js"> </script><script type="text/javascript" src="/static/bootstrap-3.0.2/js/bootstrap.min.js">
</script><script type="text/javascript" src="/static/bootstrap-3.0.2/js/bootstrap-editable.min.js">
</script><script type="text/javascript" src="/static/dust-full-2.0.0.min.js"> </script><script type="text/javascript" src="/static/dust-full-2.0.0.min.js">
</script><script type="text/javascript" src="/static/dust-helpers-1.1.1.min.js"> </script><script type="text/javascript" src="/static/dust-helpers-1.1.1.min.js">
</script><script type="text/javascript" src="/static/dfs-dust.js"> </script><script type="text/javascript" src="/static/dfs-dust.js">

View File

@ -211,6 +211,32 @@
}).error(network_error_handler(url)); }).error(network_error_handler(url));
} }
/**Use X-editable to make fields editable with a nice UI.
* elementType is the class of element(s) you want to make editable
* op is the WebHDFS operation that will be triggered
* parameter is (currently the 1) parameter which will be passed along with
* the value entered by the user
*/
function makeEditable(elementType, op, parameter) {
$(elementType).each(function(index, value) {
$(this).editable({
url: function(params) {
var inode_name = $(this).closest('tr').attr('inode-path');
var absolute_file_path = append_path(current_directory, inode_name);
var url = '/webhdfs/v1' + encode_path(absolute_file_path) + '?op=' +
op + '&' + parameter + '=' + encodeURIComponent(params.value);
return $.ajax(url, { type: 'PUT', })
.error(network_error_handler(url))
.success(function() {
browse_directory(current_directory);
});
},
error: function(response, newValue) {return "";}
});
});
}
function browse_directory(dir) { function browse_directory(dir) {
var HELPERS = { var HELPERS = {
'helper_date_tostring' : function (chunk, ctx, bodies, params) { 'helper_date_tostring' : function (chunk, ctx, bodies, params) {
@ -252,6 +278,10 @@
view_perm_details($(this), filename, abs_path, perms); view_perm_details($(this), filename, abs_path, perms);
}); });
makeEditable('.explorer-owner-links', 'SETOWNER', 'owner');
makeEditable('.explorer-group-links', 'SETOWNER', 'group');
makeEditable('.explorer-replication-links', 'SETREPLICATION', 'replication');
$('.explorer-entry .glyphicon-trash').click(function() { $('.explorer-entry .glyphicon-trash').click(function() {
var inode_name = $(this).closest('tr').attr('inode-path'); var inode_name = $(this).closest('tr').attr('inode-path');
var absolute_file_path = append_path(current_directory, inode_name); var absolute_file_path = append_path(current_directory, inode_name);