Skip to content

Commit 51f0ba4

Browse files
committed
Resolve npg green button
1 parent 8d1089d commit 51f0ba4

File tree

1 file changed

+24
-2
lines changed

1 file changed

+24
-2
lines changed

templates/index.html

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,15 +113,37 @@ <h1>Chords-Python Applications</h1>
113113
appButtonsDiv.classList.add('disabled-apps');
114114
}
115115
}
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);
116138

117139
function updateAppStatus() {
118140
fetch('/app_status')
119141
.then(response => response.json())
120142
.then(statuses => {
121143
const lslStarted = statuses.lsl_started || false;
122144
const npgStarted = statuses.npg_started || false;
123-
124-
updateButtons(lslStarted, npgStarted);
145+
console.log(npgStarted);
146+
updateButtons(lslStarted, npgStarted);
125147

126148
Object.keys(statuses).forEach(app => {
127149
const button = document.querySelector(`button[value="${app}"]`);

0 commit comments

Comments
 (0)