clippy happier

This commit is contained in:
2025-05-07 00:00:21 +02:00
parent a401d4de7b
commit 26da6b39cc
17 changed files with 234 additions and 236 deletions

View File

@@ -1,4 +1,3 @@
import { deepEqual } from 'fast-equals';
declare var PUBLIC_URL: string;
@@ -8,7 +7,7 @@ document.body.innerHTML = require('./main.html') as string;
import { TimeView } from "./timeview";
import { PlantView, PlantViews } from "./plant";
import { PlantViews } from "./plant";
import { NetworkConfigView } from "./network";
import { NightLampView } from "./nightlightview";
import { TankConfigView } from "./tankview";
@@ -261,7 +260,6 @@ export class Controller {
configChanged() {
const current = controller.getConfig();
var pretty = JSON.stringify(current, undefined, 0);
var initial = JSON.stringify(this.initialConfig, undefined, 0);
controller.submitView.setJson(pretty);
if (deepEqual(current, controller.initialConfig)) {
@@ -307,7 +305,7 @@ export class Controller {
})
.then(response => response.text())
.then(
text => {
_ => {
clearTimeout(timerId);
controller.progressview.removeProgress("test_pump");
}
@@ -507,3 +505,16 @@ controller.populateTimezones().then(_ => {
controller.progressview.removeProgress("rebooting");
window.addEventListener("beforeunload", (event) => {
const currentConfig = controller.getConfig();
// Check if the current state differs from the initial configuration
if (!deepEqual(currentConfig, controller.initialConfig)) {
const confirmationMessage = "You have unsaved changes. Are you sure you want to leave this page?";
// Standard behavior for displaying the confirmation dialog
event.preventDefault();
event.returnValue = confirmationMessage; // This will trigger the browser's default dialog
return confirmationMessage;
}
});