mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-08 06:00:51 -07:00
Alert if leaving settings without saving changes
This commit is contained in:
parent
663b9a610a
commit
363d1b07ca
1 changed files with 14 additions and 0 deletions
|
@ -2059,12 +2059,21 @@ $(document).ready(function() {
|
|||
});
|
||||
|
||||
// Global Variables
|
||||
settingsChanged = false;
|
||||
serverChanged = false;
|
||||
authChanged = false;
|
||||
httpChanged = false;
|
||||
monitorChanged = false;
|
||||
directoryChanged = false;
|
||||
|
||||
// Alert if leaving the page without saving changes to settings
|
||||
window.onbeforeunload = confirmExit;
|
||||
function confirmExit() {
|
||||
if (settingsChanged) {
|
||||
return "Settings were changed without saving!";
|
||||
}
|
||||
}
|
||||
|
||||
// Alert the user that their changes require a restart.
|
||||
function postSaveChecks() {
|
||||
if ((serverChanged && $('#monitoring_use_websocket').is(":checked")) || authChanged || httpChanged || monitorChanged || directoryChanged) {
|
||||
|
@ -2072,9 +2081,14 @@ $(document).ready(function() {
|
|||
}
|
||||
$("#http_hashed_password").val($("#http_hash_password").is(":checked") ? 1 : 0)
|
||||
getSchedulerTable();
|
||||
settingsChanged = false;
|
||||
}
|
||||
|
||||
var configForm = $("#configUpdate");
|
||||
configForm.change(function () {
|
||||
settingsChanged = true;
|
||||
});
|
||||
|
||||
function saveSettings() {
|
||||
if (configForm.parsley().validate()) {
|
||||
doAjaxCall('configUpdate', $(this), 'tabs', true, postSaveChecks);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue