Skip to content

Commit a57d8ef

Browse files
committed
Add confirmation to reboot/reset buttons
1 parent 05b3976 commit a57d8ef

File tree

1 file changed

+31
-25
lines changed

1 file changed

+31
-25
lines changed

src/www/httpd/htdocs/js/modules/maintenance.js

Lines changed: 31 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -73,19 +73,22 @@ APP.maintenance = (function($) {
7373

7474
function rebootCamera() {
7575
$('#button-reboot').attr("disabled", true);
76-
$.ajax({
77-
type: "GET",
78-
url: 'cgi-bin/reboot.sh',
79-
dataType: "json",
80-
error: function(response) {
81-
console.log('error', response);
82-
$('#button-reboot').attr("disabled", false);
83-
},
84-
success: function(data) {
85-
setRebootStatus("Camera is rebooting.");
86-
waitForBoot();
87-
}
88-
});
76+
var x=confirm("Are you sure you want to reboot?");
77+
if (x) {
78+
$.ajax({
79+
type: "GET",
80+
url: 'cgi-bin/reboot.sh',
81+
dataType: "json",
82+
error: function(response) {
83+
console.log('error', response);
84+
$('#button-reboot').attr("disabled", false);
85+
},
86+
success: function(data) {
87+
setRebootStatus("Camera is rebooting.");
88+
waitForBoot();
89+
}
90+
});
91+
}
8992
}
9093

9194
function waitForBoot() {
@@ -108,18 +111,21 @@ APP.maintenance = (function($) {
108111

109112
function resetCamera() {
110113
$('#button-reset').attr("disabled", true);
111-
$.ajax({
112-
type: "GET",
113-
url: 'cgi-bin/reset.sh',
114-
dataType: "json",
115-
error: function(response) {
116-
console.log('error', response);
117-
$('#button-reset').attr("disabled", false);
118-
},
119-
success: function(data) {
120-
setResetStatus("Reset completed, reboot your camera.");
121-
}
122-
});
114+
var x=confirm("Are you sure you want to reset?");
115+
if (x) {
116+
$.ajax({
117+
type: "GET",
118+
url: 'cgi-bin/reset.sh',
119+
dataType: "json",
120+
error: function(response) {
121+
console.log('error', response);
122+
$('#button-reset').attr("disabled", false);
123+
},
124+
success: function(data) {
125+
setResetStatus("Reset completed, reboot your camera.");
126+
}
127+
});
128+
}
123129
}
124130

125131
function upgradeFirmware() {

0 commit comments

Comments
 (0)