certtools / intelmq-manager

IntelMQ Manager is a graphical interface to manage configurations for IntelMQ framework.
https://docs.intelmq.org/latest/user/manager/
102 stars 56 forks source link

Warn if user leaves Configuration tab with unsaved changes #212

Closed ghost closed 3 years ago

ghost commented 4 years ago

Once the user made some changes on the Configurations tab, the "save configuration" link starts blinking. But the user can still leave the page without saving unintentionally.

Additionally to the blinking link, we can add an alert box in page leave to warn the user directly like many webpages do it for unsaved form data.

Example JS code:

window.addEventListener("beforeunload", function(event) {
    // Cancel the event.
    event.preventDefault();
    // Chrome requires returnValue to be set.
    // https://developer.mozilla.org/en-US/docs/Web/API/Window/beforeunload_event#Examples
    event.returnValue = '';
}

Should only be executed when there is an actual change.