@@ -72,9 +72,9 @@ APP.maintenance = (function($) {
72
72
}
73
73
74
74
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 ) ;
78
78
$ . ajax ( {
79
79
type : "GET" ,
80
80
url : 'cgi-bin/reboot.sh' ,
@@ -86,6 +86,9 @@ APP.maintenance = (function($) {
86
86
success : function ( data ) {
87
87
setRebootStatus ( "Camera is rebooting." ) ;
88
88
waitForBoot ( ) ;
89
+ } ,
90
+ complete : function ( ) {
91
+ $ ( '#button-reboot' ) . attr ( "disabled" , false ) ;
89
92
}
90
93
} ) ;
91
94
}
@@ -110,20 +113,22 @@ APP.maintenance = (function($) {
110
113
}
111
114
112
115
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 ) ;
116
119
$ . ajax ( {
117
120
type : "GET" ,
118
121
url : 'cgi-bin/reset.sh' ,
119
122
dataType : "json" ,
120
123
error : function ( response ) {
121
124
console . log ( 'error' , response ) ;
122
- $ ( '#button-reset' ) . attr ( "disabled" , false ) ;
123
125
} ,
124
126
success : function ( data ) {
125
127
setResetStatus ( "Reset completed, reboot your camera." ) ;
126
128
}
129
+ complete : funtion ( ) {
130
+ $ ( '#button-reset' ) . attr ( "disabled" , false ) ;
131
+ }
127
132
} ) ;
128
133
}
129
134
}
@@ -136,11 +141,13 @@ APP.maintenance = (function($) {
136
141
url : 'cgi-bin/fw_upgrade.sh?get=upgrade' ,
137
142
error : function ( response ) {
138
143
console . log ( 'error' , response ) ;
139
- $ ( '#button-upgrade' ) . attr ( "disabled" , false ) ;
140
144
} ,
141
145
success : function ( response ) {
142
146
setFwStatus ( response ) ;
143
147
waitForUpgrade ( ) ;
148
+ } ,
149
+ complete : function ( ) {
150
+ $ ( '#button-upgrade' ) . attr ( "disabled" , false ) ;
144
151
}
145
152
} ) ;
146
153
}
0 commit comments