@@ -185,32 +185,6 @@ function updateMetrics() {
185185 } ) ;
186186}
187187
188- function showQueryLoggingButton ( state ) {
189- if ( state ) {
190- $ ( "#loggingButton" ) . addClass ( "btn-warning" ) ;
191- $ ( "#loggingButton" ) . removeClass ( "btn-success" ) ;
192- $ ( "#loggingButton" ) . text ( "Disable query logging" ) ;
193- $ ( "#loggingButton" ) . data ( "state" , "enabled" ) ;
194- } else {
195- $ ( "#loggingButton" ) . addClass ( "btn-success" ) ;
196- $ ( "#loggingButton" ) . removeClass ( "btn-warning" ) ;
197- $ ( "#loggingButton" ) . text ( "Enable query logging" ) ;
198- $ ( "#loggingButton" ) . data ( "state" , "disabled" ) ;
199- }
200- }
201-
202- function getLoggingButton ( ) {
203- $ . ajax ( {
204- url : document . body . dataset . apiurl + "/config/dns/queryLogging" ,
205- } )
206- . done ( data => {
207- showQueryLoggingButton ( data . config . dns . queryLogging ) ;
208- } )
209- . fail ( data => {
210- apiFailure ( data ) ;
211- } ) ;
212- }
213-
214188$ ( ".confirm-restartdns" ) . confirm ( {
215189 text :
216190 "Are you sure you want to send a restart command to your DNS server?<br><br>" +
@@ -284,47 +258,9 @@ $(".confirm-flusharp").confirm({
284258 dialogClass : "modal-dialog" ,
285259} ) ;
286260
287- $ ( "#loggingButton" ) . confirm ( {
288- text :
289- "Are you sure you want to switch query logging mode?<br><br>" +
290- "<strong>This will restart the DNS server.</strong><br>" +
291- "As consequence of this action, your DNS cache will be cleared and you may temporarily lose your internet connection.<br>" +
292- "Furthermore, you will be logged out of the web interface." ,
293- title : "Confirmation required" ,
294- confirm ( ) {
295- const data = { config : { } } ;
296- data . config . dns = { } ;
297- data . config . dns . queryLogging = $ ( "#loggingButton" ) . data ( "state" ) !== "enabled" ;
298- $ . ajax ( {
299- url : document . body . dataset . apiurl + "/config/dns/queryLogging" ,
300- type : "PATCH" ,
301- dataType : "json" ,
302- processData : false ,
303- contentType : "application/json; charset=utf-8" ,
304- data : JSON . stringify ( data ) ,
305- } )
306- . done ( data => {
307- showQueryLoggingButton ( data . config . dns . queryLogging ) ;
308- } )
309- . fail ( data => {
310- apiFailure ( data ) ;
311- } ) ;
312- } ,
313- cancel ( ) {
314- // nothing to do
315- } ,
316- confirmButton : "Yes, change query logging" ,
317- cancelButton : "No, go back" ,
318- post : true ,
319- confirmButtonClass : "btn-danger" ,
320- cancelButtonClass : "btn-default" ,
321- dialogClass : "modal-dialog" ,
322- } ) ;
323-
324261$ ( ( ) => {
325262 updateHostInfo ( ) ;
326263 updateMetrics ( ) ;
327- getLoggingButton ( ) ;
328264
329265 const ctx = document . getElementById ( "cachePieChart" ) . getContext ( "2d" ) ;
330266 cachePieChart = new Chart ( ctx , {
0 commit comments