HDFS-14198. Upload and Create button doesn't get enabled after getting reset. Contributed by Ayush Saxena.

This commit is contained in:
Surendra Singh Lilhore 2019-01-11 14:36:55 +05:30
parent d4ca907da6
commit 9aeaaa0479
2 changed files with 30 additions and 2 deletions

View File

@ -184,11 +184,11 @@
<div class="col-xs-2 col-md-2"> <div class="col-xs-2 col-md-2">
<button type="button" class="btn btn-default" data-toggle="modal" <button type="button" class="btn btn-default" data-toggle="modal"
aria-label="New Directory" data-target="#btn-create-directory" 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> <span class="glyphicon glyphicon-folder-open"></span>
</button> </button>
<button type="button" class="btn btn-default" data-toggle="modal" <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> <span class="glyphicon glyphicon-cloud-upload"></span>
</button> </button>
<button class="btn btn-default dropdown-toggle" type="button" <button class="btn btn-default dropdown-toggle" type="button"

View File

@ -405,6 +405,34 @@
}); });
}) })
$('#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() { $('#modal-upload-file-button').click(function() {
$(this).prop('disabled', true); $(this).prop('disabled', true);
$(this).button('complete'); $(this).button('complete');