From 410d0319cf72b9b5f3807c522237f52121d98cd5 Mon Sep 17 00:00:00 2001 From: Brahma Reddy Battula Date: Wed, 8 Nov 2017 14:41:16 +0530 Subject: [PATCH] HDFS-12788. Reset the upload button when file upload fails. Contributed by Brahma Reddy Battula --- .../hadoop-hdfs/src/main/webapps/hdfs/explorer.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) 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 dae35196cf..ed1f832d50 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 @@ -440,22 +440,29 @@ }).complete(function(data) { numCompleted++; if(numCompleted == files.length) { - $('#modal-upload-file').modal('hide'); - $('#modal-upload-file-button').button('reset'); + reset_upload_button(); browse_directory(current_directory); } }).error(function(jqXHR, textStatus, errorThrown) { numCompleted++; + reset_upload_button(); show_err_msg("Couldn't upload the file " + file.file.name + ". "+ errorThrown); }); }).error(function(jqXHR, textStatus, errorThrown) { numCompleted++; + reset_upload_button(); show_err_msg("Couldn't find datanode to write file. " + errorThrown); }); })(); } }); + //Reset the upload button + function reset_upload_button() { + $('#modal-upload-file').modal('hide'); + $('#modal-upload-file-button').button('reset'); + } + //Store the list of files which have been checked into session storage function store_selected_files(current_directory) { sessionStorage.setItem("source_directory", current_directory);