Skip to content

Commit

Permalink
Add confirmation to reboot/reset buttons
Browse files Browse the repository at this point in the history
  • Loading branch information
roleoroleo committed Aug 30, 2021
1 parent 05b3976 commit a57d8ef
Showing 1 changed file with 31 additions and 25 deletions.
56 changes: 31 additions & 25 deletions src/www/httpd/htdocs/js/modules/maintenance.js
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand All @@ -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() {
Expand Down

0 comments on commit a57d8ef

Please sign in to comment.