Repository: hadoop Updated Branches: refs/heads/trunk a16bfff71 -> e38ef70fb
HDFS-7713. Implement mkdirs in the 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/e38ef70f Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/e38ef70f Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/e38ef70f Branch: refs/heads/trunk Commit: e38ef70fbc60f062992c834b1cca6e9ba4baef6e Parents: a16bfff Author: Haohui Mai <whe...@apache.org> Authored: Tue Mar 24 15:48:52 2015 -0700 Committer: Haohui Mai <whe...@apache.org> Committed: Tue Mar 24 15:48:52 2015 -0700 ---------------------------------------------------------------------- hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt | 2 + .../src/main/webapps/hdfs/explorer.html | 53 ++++++++++++++++++-- .../src/main/webapps/hdfs/explorer.js | 22 ++++++++ 3 files changed, 72 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hadoop/blob/e38ef70f/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 4ec0891..5ade5fb 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt +++ b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt @@ -335,6 +335,8 @@ Release 2.8.0 - UNRELEASED HDFS-7854. Separate class DataStreamer out of DFSOutputStream. (Li Bo via jing9) + HDFS-7713. Implement mkdirs in the HDFS Web UI. (Ravi Prakash via wheat9) + OPTIMIZATIONS BUG FIXES http://git-wip-us.apache.org/repos/asf/hadoop/blob/e38ef70f/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 7b34044..cd6623c 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 @@ -87,13 +87,56 @@ <button type="button" class="close" onclick="$('#alert-panel').hide();">×</button> <div class="alert-body" id="alert-panel-body"></div> </div> + + <div class="modal" id="btn-create-directory" 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">Create Directory</h4> + </div> + <div class="modal-body"> + <div class="form-group"> + <div class="input-group"> + <span class="input-group-addon" id="new_directory_pwd"></span> + <input type="text" class="form-control" id="new_directory" + placeholder="New Directory Name" /> + </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="btn-create-directory-send" data-complete-text="Creating..."> + Create + </button> + </div> + </div> + </div> + </div> + <div class="row"> - <form onsubmit="return false;"> - <div class="input-group"><input type="text" class="form-control" id= - "directory" /> <span class="input-group-btn"><button class="btn btn-default" - type="submit" id="btn-nav-directory"><span class="input-group-btn">Go!</span></button></span></div> - </form> + <div class="col-xs-11"> + <form onsubmit="return false;"> + <div class="input-group"> + <input type="text" class="form-control" id="directory"/> + <span class="input-group-btn"> + <button class="btn btn-default" type="button" id="btn-nav-directory">Go!</button> + </span> + </div> + </form> + </div> + <div class="col-xs-1"> + <button type="button" class="btn btn-default" data-toggle="modal" + aria-label="New Directory" data-target="#btn-create-directory" + title="Create Directory"> + <span class="glyphicon glyphicon-folder-open"></span> + </button> </div> + </div> + <br /> <div id="panel"></div> http://git-wip-us.apache.org/repos/asf/hadoop/blob/e38ef70f/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 131b2aa..5572880 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 @@ -193,5 +193,27 @@ } } + $('#btn-create-directory').on('show.bs.modal', function(event) { + var modal = $(this) + $('#new_directory_pwd').html(current_directory); + }); + + $('#btn-create-directory-send').click(function () { + $(this).prop('disabled', true); + $(this).button('complete'); + + var url = '/webhdfs/v1' + encode_path(append_path(current_directory, + $('#new_directory').val())) + '?op=MKDIRS'; + + $.ajax(url, { type: 'PUT' } + ).done(function(data) { + browse_directory(current_directory); + }).error(network_error_handler(url) + ).complete(function() { + $('#btn-create-directory').modal('hide'); + $('#btn-create-directory-send').button('reset'); + }); + }) + init(); })();