Skip to content

Commit

Permalink
Call miqCheckForChanges before changing tabs.
Browse files Browse the repository at this point in the history
This will force user to save any unsaved changes in the form before changing the tab.

Issue #6213
  • Loading branch information
h-kataria committed Nov 19, 2019
1 parent 966a6c6 commit e11a7df
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions app/assets/javascripts/miq_application.js
Expand Up @@ -902,12 +902,16 @@ function miq_tabs_init(id, url, parms) {
return sum + '&' + key + '=' + value;
}, '?tab_id=' + currTabTarget);

miqObserveRequest(url + urlParams, {beforeSend: true})
.catch(function(err) {
add_flash(__('Error requesting data from server'), 'error');
console.log(err);
return Promise.reject(err);
});
if (miqCheckForChanges()) {
miqObserveRequest(url + urlParams, {beforeSend: true})
.catch(function (err) {
add_flash(__('Error requesting data from server'), 'error');
console.log(err);
return Promise.reject(err);
});
} else {
return false;
}
}
});

Expand Down

0 comments on commit e11a7df

Please sign in to comment.