Prevent to move userfs twice

This commit is contained in:
Jan Schneider 2018-02-28 01:28:42 +01:00
parent d0186f7a8f
commit 5e3f3fa729
1 changed files with 14 additions and 12 deletions

View File

@ -375,19 +375,21 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
return true; return true;
}, },
onApprove: function() { onApprove: function() {
moving_userfs_to_device = true;
display_message('warning', i18next.t('moving_userfs'), 300000); display_message('warning', i18next.t('moving_userfs'), 300000);
rest('POST', '/move_userfs_to_device', JSON.stringify({"target_device":target_device}), if (!moving_userfs_to_device) {
function(data) { rest('POST', '/move_userfs_to_device', JSON.stringify({"target_device":target_device}),
moving_userfs_to_device = false; function(data) {
display_message('success', i18next.t('userfs_moved'), 120000); moving_userfs_to_device = false;
rest('POST', '/system_reboot'); display_message('success', i18next.t('userfs_moved'), 120000);
}, rest('POST', '/system_reboot');
function(xhr, ajaxOptions, thrownError) { },
moving_userfs_to_device = false; function(xhr, ajaxOptions, thrownError) {
default_error_callback(xhr, ajaxOptions, thrownError); moving_userfs_to_device = false;
} default_error_callback(xhr, ajaxOptions, thrownError);
); }
);
}
moving_userfs_to_device = true;
} }
}) })
.modal('show'); .modal('show');