[ 
https://issues.apache.org/jira/browse/HDFS-7986?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14744797#comment-14744797
 ] 

Haohui Mai commented on HDFS-7986:
----------------------------------

Thanks for the work.

{code}
+  <div class="modal" id="delete-modal" 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">&times;</button>
+          <h4 class="modal-title" id="delete-modal-title">Delete</h4>
+        </div>
+        <div class="modal-body">
+          <div class="panel-body">
+            <div id="delete-prompt"></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="delete-button"
+            data-complete-text="Deleting...">Delete</button>
+        </div>
+
+      </div>
+    </div>
+  </div>
{code}

Indentation is off.

{code}
+            <td><a style="cursor:pointer" inode-type="{type}" 
class="explorer-browse-links">{pathSuffix}</a></td>
+            <td><span class="glyphicon glyphicon-trash"></span></td>
{code}

When adding a new column, there should be an empty {{td}} in the  {{thead}} 
section as well.

{code}
+          <tr inode-path="{pathSuffix}">
-            <td><a style="cursor:pointer" inode-type="{type}" 
class="explorer-browse-links" inode-path="{pathSuffix}">{pathSuffix}</a></td>
+            <td><a style="cursor:pointer" inode-type="{type}" 
class="explorer-browse-links">{pathSuffix}</a></td>
+            <td><span class="glyphicon glyphicon-trash"></span></td>
+        $('.glyphicon-trash').click(function() {
+          var inode_name = $(this).closest('tr').attr('inode-path');
+          var absolute_file_path = append_path(current_directory, inode_name);
+          deletePath(inode_name, absolute_file_path);
+        })
{code}

Instead of having the styles embedded in the code, a cleaner approach is to 
give the {{tr}} element a class and put CSS on its children. For example:

{code}
 <tr inode-path="{pathSuffix}" class="explorer-entry">

.explorer-entry .explorer-browse-links { cursor: pointer; }
.explorer-entry .glyphicon-trash { cursor: pointer; }
$('.explorer-entry .glyphicon-trash').click(...
{code}

Nit:

{code}
deletePath()
{code}

It might make sense to use to the underscore, not the caml naming to make the 
styles consistent with other parts of the code.

{code}
+
+    $('#delete-modal').modal();
+
+  }
+
{code}

It'll look better to remove the empty lines.

> Allow files / directories to be deleted from the NameNode UI
> ------------------------------------------------------------
>
>                 Key: HDFS-7986
>                 URL: https://issues.apache.org/jira/browse/HDFS-7986
>             Project: Hadoop HDFS
>          Issue Type: Sub-task
>            Reporter: Ravi Prakash
>            Assignee: Ravi Prakash
>         Attachments: HDFS-7986.01.patch
>
>
> Users should be able to delete files or directories using the Namenode UI.
> I'm thinking there ought to be a confirmation dialog. For directories 
> recursive should be set to true. Initially there should be no option to 
> skipTrash.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to