Skip to content

Commit 63bfdde

Browse files
authored
Merge pull request #961 from 0zLloen/patch-1
Re-enable buttons on cancel click maintenance.js
2 parents 42e806b + 2675c0a commit 63bfdde

File tree

1 file changed

+15
-8
lines changed

1 file changed

+15
-8
lines changed

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

+15-8
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,9 @@ APP.maintenance = (function($) {
7272
}
7373

7474
function rebootCamera() {
75-
$('#button-reboot').attr("disabled", true);
76-
var x=confirm("Are you sure you want to reboot?");
77-
if (x) {
75+
var confirmation = confirm("Are you sure you want to reboot?");
76+
if (confirmation) {
77+
$('#button-reboot').attr("disabled", true);
7878
$.ajax({
7979
type: "GET",
8080
url: 'cgi-bin/reboot.sh',
@@ -86,6 +86,9 @@ APP.maintenance = (function($) {
8686
success: function(data) {
8787
setRebootStatus("Camera is rebooting.");
8888
waitForBoot();
89+
},
90+
complete: function() {
91+
$('#button-reboot').attr("disabled", false);
8992
}
9093
});
9194
}
@@ -110,20 +113,22 @@ APP.maintenance = (function($) {
110113
}
111114

112115
function resetCamera() {
113-
$('#button-reset').attr("disabled", true);
114-
var x=confirm("Are you sure you want to reset?");
115-
if (x) {
116+
var confirmation = confirm("Are you sure you want to reset?");
117+
if (confirmation) {
118+
$('#button-reset').attr("disabled", true);
116119
$.ajax({
117120
type: "GET",
118121
url: 'cgi-bin/reset.sh',
119122
dataType: "json",
120123
error: function(response) {
121124
console.log('error', response);
122-
$('#button-reset').attr("disabled", false);
123125
},
124126
success: function(data) {
125127
setResetStatus("Reset completed, reboot your camera.");
126128
}
129+
complete: funtion() {
130+
$('#button-reset').attr("disabled", false);
131+
}
127132
});
128133
}
129134
}
@@ -136,11 +141,13 @@ APP.maintenance = (function($) {
136141
url: 'cgi-bin/fw_upgrade.sh?get=upgrade',
137142
error: function(response) {
138143
console.log('error', response);
139-
$('#button-upgrade').attr("disabled", false);
140144
},
141145
success: function(response) {
142146
setFwStatus(response);
143147
waitForUpgrade();
148+
},
149+
complete: function () {
150+
$('#button-upgrade').attr("disabled", false);
144151
}
145152
});
146153
}

0 commit comments

Comments
 (0)