From a57d8ef801f4274977bbf66371d85cf247be1355 Mon Sep 17 00:00:00 2001 From: roleo Date: Mon, 30 Aug 2021 15:22:22 +0200 Subject: [PATCH] Add confirmation to reboot/reset buttons --- .../httpd/htdocs/js/modules/maintenance.js | 56 ++++++++++--------- 1 file changed, 31 insertions(+), 25 deletions(-) diff --git a/src/www/httpd/htdocs/js/modules/maintenance.js b/src/www/httpd/htdocs/js/modules/maintenance.js index c7a6411..fb1bfaa 100644 --- a/src/www/httpd/htdocs/js/modules/maintenance.js +++ b/src/www/httpd/htdocs/js/modules/maintenance.js @@ -73,19 +73,22 @@ APP.maintenance = (function($) { function rebootCamera() { $('#button-reboot').attr("disabled", true); - $.ajax({ - type: "GET", - url: 'cgi-bin/reboot.sh', - dataType: "json", - error: function(response) { - console.log('error', response); - $('#button-reboot').attr("disabled", false); - }, - success: function(data) { - setRebootStatus("Camera is rebooting."); - waitForBoot(); - } - }); + var x=confirm("Are you sure you want to reboot?"); + if (x) { + $.ajax({ + type: "GET", + url: 'cgi-bin/reboot.sh', + dataType: "json", + error: function(response) { + console.log('error', response); + $('#button-reboot').attr("disabled", false); + }, + success: function(data) { + setRebootStatus("Camera is rebooting."); + waitForBoot(); + } + }); + } } function waitForBoot() { @@ -108,18 +111,21 @@ APP.maintenance = (function($) { function resetCamera() { $('#button-reset').attr("disabled", true); - $.ajax({ - type: "GET", - url: 'cgi-bin/reset.sh', - dataType: "json", - error: function(response) { - console.log('error', response); - $('#button-reset').attr("disabled", false); - }, - success: function(data) { - setResetStatus("Reset completed, reboot your camera."); - } - }); + var x=confirm("Are you sure you want to reset?"); + if (x) { + $.ajax({ + type: "GET", + url: 'cgi-bin/reset.sh', + dataType: "json", + error: function(response) { + console.log('error', response); + $('#button-reset').attr("disabled", false); + }, + success: function(data) { + setResetStatus("Reset completed, reboot your camera."); + } + }); + } } function upgradeFirmware() {