From 161dae898fc2f45410825b2fcbcd76197dfd5d6b Mon Sep 17 00:00:00 2001 From: Haohui Mai Date: Tue, 24 Mar 2015 15:48:52 -0700 Subject: [PATCH] HDFS-7713. Implement mkdirs in the HDFS Web UI. Contributed by Ravi Prakash. --- hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt | 2 + .../src/main/webapps/hdfs/explorer.html | 55 +++++++++++++++++-- .../src/main/webapps/hdfs/explorer.js | 22 ++++++++ 3 files changed, 73 insertions(+), 6 deletions(-) diff --git a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt index 07c9c624751..bb9f7ff49ab 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt +++ b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt @@ -22,6 +22,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 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 7b340441b5f..cd6623cc97d 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 @@
-
-
-
-
+ + + +
+
+
+
+ + + + +
+
+
+
+ +
+
+
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 131b2aa64f2..5572880d184 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(); })();