Repository: hadoop Updated Branches: refs/heads/branch-2.8 f372d3faa -> 2aa99e6df
HDFS-7779. Support changing ownership, group and replication in HDFS Web 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/2aa99e6d Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/2aa99e6d Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/2aa99e6d Branch: refs/heads/branch-2.8 Commit: 2aa99e6df00883a3b0562ecf4e9a88343b334f48 Parents: f372d3f Author: Haohui Mai <whe...@apache.org> Authored: Tue Jan 5 13:43:32 2016 -0800 Committer: Haohui Mai <whe...@apache.org> Committed: Tue Jan 5 13:45:10 2016 -0800 ---------------------------------------------------------------------- hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt | 3 ++ .../src/main/webapps/hdfs/explorer.html | 8 ++++-- .../src/main/webapps/hdfs/explorer.js | 30 ++++++++++++++++++++ 3 files changed, 38 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hadoop/blob/2aa99e6d/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 4d9e99b..87f71de 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt +++ b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt @@ -869,6 +869,9 @@ Release 2.8.0 - UNRELEASED HDFS-8831. Trash Support for deletion in HDFS encryption zone. (xyao) + HDFS-7779. Support changing ownership, group and replication in HDFS Web + UI. (Ravi Prakash via wheat9) + OPTIMIZATIONS HDFS-8026. Trace FSOutputSummer#writeChecksumChunks rather than http://git-wip-us.apache.org/repos/asf/hadoop/blob/2aa99e6d/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 fb4397f..3fcacf9 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 @@ -20,6 +20,7 @@ <head> <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-editable.css"/> <link rel="stylesheet" type="text/css" href="/static/hadoop.css" /> <title>Browsing HDFS</title> </head> @@ -231,11 +232,11 @@ {type|helper_to_directory}{permission|helper_to_permission} {aclBit|helper_to_acl_bit} </span></td> - <td>{owner}</td> - <td>{group}</td> + <td><span class="explorer-owner-links">{owner}</span></td> + <td><span class="explorer-group-links">{group}</span></td> <td>{length|fmt_bytes}</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><a inode-type="{type}" class="explorer-browse-links">{pathSuffix}</a></td> <td><span class="glyphicon glyphicon-trash"></span></td> @@ -262,6 +263,7 @@ </script> <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-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-helpers-1.1.1.min.js"> </script><script type="text/javascript" src="/static/dfs-dust.js"> http://git-wip-us.apache.org/repos/asf/hadoop/blob/2aa99e6d/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 2931723..0c68209 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 @@ -211,6 +211,32 @@ }).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) { var HELPERS = { 'helper_date_tostring' : function (chunk, ctx, bodies, params) { @@ -252,6 +278,10 @@ 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() { var inode_name = $(this).closest('tr').attr('inode-path'); var absolute_file_path = append_path(current_directory, inode_name);