@@ -74,6 +74,7 @@ jQuery(document).ready(function () {
74
74
backendStatus = true ;
75
75
} ,
76
76
complete : function ( ) {
77
+ toggleOnBackendStatus ( backendStatus ) ;
77
78
setTimeout ( loadSubButtons , 800 ) ;
78
79
}
79
80
} ) ;
@@ -89,21 +90,25 @@ jQuery(document).ready(function () {
89
90
window . setInterval ( function ( ) { checkBackendStatus ( ) ; } , 15000 ) ;
90
91
91
92
// Check if buttons should be enabled or disabled
92
- // Execute code to show or hide status enable disable buttons
93
- var buttonsDisabled = false ;
94
- window . setInterval ( function ( ) {
95
- if ( ! backendStatus && ! buttonsDisabled ) {
96
- $ ( "#back_end_down_warning" ) . show ( ) ;
97
- $ ( ".hidden_by_default" ) . show ( ) ;
98
- buttonsDisabled = true ;
99
- toggleButtonsDisabled ( buttonsDisabled ) ;
100
- } else if ( backendStatus && buttonsDisabled ) {
101
- $ ( "#back_end_down_warning" ) . hide ( ) ;
102
- buttonsDisabled = false ;
103
- toggleButtonsDisabled ( buttonsDisabled ) ;
93
+ // Toggle warning text on and off
94
+ // Check backend status to shrink or increase space for warning to show
95
+ function toggleOnBackendStatus ( backendStatus ) {
96
+ if ( ! backendStatus && ! $ ( "#back_end_down_warning" ) . is ( ":visible" ) ) {
97
+ $ ( "#subTitle" ) . parent ( ) . removeClass ( "col-md-9" ) ;
98
+ $ ( "#btnEIContainer" ) . parent ( ) . removeClass ( "col-md-3" ) ;
99
+ $ ( "#subTitle" ) . parent ( ) . addClass ( "col-md-4" ) ;
100
+ $ ( "#btnEIContainer" ) . parent ( ) . addClass ( "col-md-2" ) ;
101
+ }
102
+ if ( backendStatus && $ ( "#back_end_down_warning" ) . is ( ":visible" ) ) {
103
+ $ ( "#subTitle" ) . parent ( ) . removeClass ( "col-md-4" ) ;
104
+ $ ( "#btnEIContainer" ) . parent ( ) . removeClass ( "col-md-2" ) ;
105
+ $ ( "#subTitle" ) . parent ( ) . addClass ( "col-md-9" ) ;
106
+ $ ( "#btnEIContainer" ) . parent ( ) . addClass ( "col-md-3" ) ;
104
107
reload_table ( ) ;
105
108
}
106
- } , 1000 ) ;
109
+ $ ( "#back_end_down_warning" ) . toggle ( ! backendStatus ) ;
110
+ toggleButtonsDisabled ( ! backendStatus ) ;
111
+ }
107
112
108
113
// Check if EI Backend Server is online when Status Connection button is pressed.
109
114
$ ( "#btnEIConnection" ) . click ( function ( ) {
@@ -381,7 +386,7 @@ jQuery(document).ready(function () {
381
386
"targets" : [ 0 ] ,
382
387
"orderable" : false ,
383
388
"className" : "control" ,
384
- "data" :"subscriptionName" ,
389
+ "data" : "subscriptionName" ,
385
390
"render" : function ( data , type , row , meta ) {
386
391
return '' ;
387
392
}
@@ -460,6 +465,9 @@ jQuery(document).ready(function () {
460
465
$ ( "#check-all" ) . click ( function ( ) {
461
466
$ ( ".data-check" ) . prop ( 'checked' , $ ( this ) . prop ( 'checked' ) ) ;
462
467
} ) ;
468
+ $ ( ".control" ) . click ( function ( ) {
469
+ setTimeout ( function ( ) { toggleOnBackendStatus ( backendStatus ) ; } , 50 ) ;
470
+ } ) ;
463
471
}
464
472
} ) ;
465
473
} ;
0 commit comments