@@ -113,15 +113,37 @@ <h1>Chords-Python Applications</h1>
113
113
appButtonsDiv . classList . add ( 'disabled-apps' ) ;
114
114
}
115
115
}
116
+
117
+ function checkStatus ( ) {
118
+ fetch ( "/app_status" )
119
+ . then ( response => response . json ( ) )
120
+ . then ( data => {
121
+ const npgButton = document . getElementById ( "start_npg_button" ) ;
122
+
123
+ if ( data . npg_started ) {
124
+ npgButton . classList . remove ( "npg-not-running" ) ;
125
+ npgButton . classList . add ( "npg-running" ) ;
126
+ npgButton . textContent = "NPG Stream Running" ;
127
+ npgButton . disabled = true ;
128
+ } else {
129
+ npgButton . classList . remove ( "npg-running" ) ;
130
+ npgButton . classList . add ( "npg-not-running" ) ;
131
+ npgButton . textContent = "Start NPG Stream" ;
132
+ npgButton . disabled = false ;
133
+ }
134
+ } ) ;
135
+ }
136
+
137
+ setInterval ( checkStatus , 20 ) ;
116
138
117
139
function updateAppStatus ( ) {
118
140
fetch ( '/app_status' )
119
141
. then ( response => response . json ( ) )
120
142
. then ( statuses => {
121
143
const lslStarted = statuses . lsl_started || false ;
122
144
const npgStarted = statuses . npg_started || false ;
123
-
124
- updateButtons ( lslStarted , npgStarted ) ;
145
+ console . log ( npgStarted ) ;
146
+ updateButtons ( lslStarted , npgStarted ) ;
125
147
126
148
Object . keys ( statuses ) . forEach ( app => {
127
149
const button = document . querySelector ( `button[value="${ app } "]` ) ;
0 commit comments