Skip to content

Commit f7a94ec

Browse files
author
Inigo Goiri
committed
HDFS-15239. Add button to go to the parent directory in the explorer. Contributed by hemanthboyina.
1 parent 696a663 commit f7a94ec

File tree

4 files changed

+26
-4
lines changed

4 files changed

+26
-4
lines changed

hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/webapps/router/explorer.html

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ <h4 class="modal-title" id="delete-modal-title">Delete</h4>
172172
</div>
173173

174174
<div class="row">
175-
<div class="col-xs-10 col-md-10">
175+
<div class="col-xs-9 col-md-9">
176176
<form onsubmit="return false;">
177177
<div class="input-group">
178178
<input type="text" class="form-control" id="directory"/>
@@ -182,7 +182,7 @@ <h4 class="modal-title" id="delete-modal-title">Delete</h4>
182182
</div>
183183
</form>
184184
</div>
185-
<div class="col-xs-2 col-md-2">
185+
<div class="col-xs-3 col-md-3">
186186
<button type="button" class="btn btn-default" data-toggle="modal"
187187
aria-label="New Directory" data-target="#btn-create-directory"
188188
title="Create Directory" id="btn-create-dir">
@@ -199,6 +199,10 @@ <h4 class="modal-title" id="delete-modal-title">Delete</h4>
199199
<li><a id="explorer-cut">Cut</a></li>
200200
<li><a id="explorer-paste">Paste</a></li>
201201
</ul>
202+
<button type="button" class="btn btn-default" data-toggle="modal"
203+
aria-label="Parent Directory" title="Parent Directory" id="parentDir">
204+
<span class="glyphicon glyphicon-level-up"></span>
205+
</button>
202206
</div>
203207
</div>
204208

hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/webapps/router/explorer.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -377,6 +377,13 @@
377377
}
378378

379379

380+
$('#parentDir').click(function () {
381+
var current = current_directory;
382+
var lastIndex = current.lastIndexOf('/');
383+
var parent = current.substr(0, lastIndex);
384+
browse_directory(parent);
385+
})
386+
380387
function init() {
381388
dust.loadSource(dust.compile($('#tmpl-explorer').html(), 'explorer'));
382389
dust.loadSource(dust.compile($('#tmpl-block-info').html(), 'block-info'));

hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/hdfs/explorer.html

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ <h4 class="modal-title" id="delete-modal-title">Delete</h4>
172172
</div>
173173

174174
<div class="row">
175-
<div class="col-xs-10 col-md-10">
175+
<div class="col-xs-9 col-md-9">
176176
<form onsubmit="return false;">
177177
<div class="input-group">
178178
<input type="text" class="form-control" id="directory"/>
@@ -182,7 +182,7 @@ <h4 class="modal-title" id="delete-modal-title">Delete</h4>
182182
</div>
183183
</form>
184184
</div>
185-
<div class="col-xs-2 col-md-2">
185+
<div class="col-xs-3 col-md-3">
186186
<button type="button" class="btn btn-default" data-toggle="modal"
187187
aria-label="New Directory" data-target="#btn-create-directory"
188188
title="Create Directory" id="btn-create-dir">
@@ -199,6 +199,10 @@ <h4 class="modal-title" id="delete-modal-title">Delete</h4>
199199
<li><a id="explorer-cut">Cut</a></li>
200200
<li><a id="explorer-paste">Paste</a></li>
201201
</ul>
202+
<button type="button" class="btn btn-default" data-toggle="modal"
203+
aria-label="Parent Directory" title="Parent Directory" id="parentDir">
204+
<span class="glyphicon glyphicon-level-up"></span>
205+
</button>
202206
</div>
203207
</div>
204208

hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/hdfs/explorer.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -376,6 +376,13 @@
376376
}).fail(network_error_handler(url));
377377
}
378378

379+
$('#parentDir').click(function () {
380+
var current = current_directory;
381+
var lastIndex = current.lastIndexOf('/');
382+
var parent = current.substr(0, lastIndex);
383+
browse_directory(parent);
384+
})
385+
379386

380387
function init() {
381388
dust.loadSource(dust.compile($('#tmpl-explorer').html(), 'explorer'));

0 commit comments

Comments
 (0)