HDFS-14198. Upload and Create button doesn't get enabled after getting reset. Contrib...
authorSurendra Singh Lilhore <surendralilhore@apache.org>
Fri, 11 Jan 2019 09:06:55 +0000 (14:36 +0530)
committerSurendra Singh Lilhore <surendralilhore@apache.org>
Fri, 11 Jan 2019 09:06:55 +0000 (14:36 +0530)
hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/hdfs/explorer.html
hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/hdfs/explorer.js

index 9ddb597..88cf183 100644 (file)
       <div class="col-xs-2 col-md-2">
         <button type="button" class="btn btn-default" data-toggle="modal"
           aria-label="New Directory" data-target="#btn-create-directory"
-          title="Create Directory">
+          title="Create Directory" id="btn-create-dir">
             <span class="glyphicon glyphicon-folder-open"></span>
         </button>
         <button type="button" class="btn btn-default" data-toggle="modal"
-          data-target="#modal-upload-file" title="Upload Files">
+          data-target="#modal-upload-file" title="Upload Files" id="btn-upload-files">
             <span class="glyphicon glyphicon-cloud-upload"></span>
         </button>
         <button class="btn btn-default dropdown-toggle" type="button"
index 898b1f3..0520192 100644 (file)
     });
   })
 
+  $('#btn-upload-files').click(function() {
+        $('#modal-upload-file-button').prop('disabled', true).button('reset');
+        $('#modal-upload-file-input').val(null);
+      });
+
+  $('#btn-create-dir').click(function() {
+        $('#btn-create-directory-send').prop('disabled', true).button('reset');
+        $('#new_directory').val(null);
+      });
+
+  $('#modal-upload-file-input').change(function() {
+      if($('#modal-upload-file-input').prop('files').length >0) {
+         $('#modal-upload-file-button').prop('disabled', false);
+        }
+      else {
+        $('#modal-upload-file-button').prop('disabled', true);
+        }
+      });
+
+  $('#new_directory').on('keyup keypress blur change',function() {
+      if($('#new_directory').val() == '' ||  $('#new_directory').val() == null) {
+         $('#btn-create-directory-send').prop('disabled', true);
+        }
+      else {
+         $('#btn-create-directory-send').prop('disabled', false);
+        }
+      });
+
   $('#modal-upload-file-button').click(function() {
     $(this).prop('disabled', true);
     $(this).button('complete');