From 5e3f3fa7294be55e6ce59f721c521245bb66af0d Mon Sep 17 00:00:00 2001 From: Jan Schneider Date: Wed, 28 Feb 2018 01:28:42 +0100 Subject: [PATCH] Prevent to move userfs twice --- addon/www/index.html | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/addon/www/index.html b/addon/www/index.html index 1d56602..ad56c2f 100644 --- a/addon/www/index.html +++ b/addon/www/index.html @@ -375,19 +375,21 @@ along with this program. If not, see . return true; }, onApprove: function() { - moving_userfs_to_device = true; display_message('warning', i18next.t('moving_userfs'), 300000); - rest('POST', '/move_userfs_to_device', JSON.stringify({"target_device":target_device}), - function(data) { - moving_userfs_to_device = false; - display_message('success', i18next.t('userfs_moved'), 120000); - rest('POST', '/system_reboot'); - }, - function(xhr, ajaxOptions, thrownError) { - moving_userfs_to_device = false; - default_error_callback(xhr, ajaxOptions, thrownError); - } - ); + if (!moving_userfs_to_device) { + rest('POST', '/move_userfs_to_device', JSON.stringify({"target_device":target_device}), + function(data) { + moving_userfs_to_device = false; + display_message('success', i18next.t('userfs_moved'), 120000); + rest('POST', '/system_reboot'); + }, + function(xhr, ajaxOptions, thrownError) { + moving_userfs_to_device = false; + default_error_callback(xhr, ajaxOptions, thrownError); + } + ); + } + moving_userfs_to_device = true; } }) .modal('show');