Add experiment move error handling to project show [SCI-6398] (#3776)

Co-authored-by: Anton <anton@scinote.net>
This commit is contained in:
aignatov-bio 2022-01-25 12:27:23 +01:00 committed by GitHub
parent 354bf4b808
commit 2e4f687d31
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -236,6 +236,22 @@
modal.on('hidden.bs.modal', function() {
$(this).remove();
});
validateMoveModal(modal)
}
function validateMoveModal(modal) {
if (modal[0].id.match(/move-experiment-modal-[0-9]*/)) {
let form = $(modal).find('form');
form.on('ajax:success', function(e, data) {
animateSpinner(form, true);
window.location.replace(data.path);
}).on('ajax:error', function(e, error) {
animateSpinner(form, false);
form.clearFormErrors();
let msg = JSON.parse(error.responseText);
renderFormError(e, form.find('#experiment_project_id'), msg.message.toString());
});
}
}