coffee/return
This commit is contained in:
@@ -21,7 +21,24 @@ gebId("ip_global").innerText = esp_conn_infos.ip_global
|
||||
gebId("ip_local").innerText = esp_conn_infos.ip_local
|
||||
gebId("valid_connection").innerText = esp_conn_infos.connection_valid
|
||||
gebId("last_seen").innerText = esp_conn_infos.last_seen
|
||||
|
||||
machienReady = gebId("machine-ready-butt")
|
||||
makeCoffee = gebId("make-coffee-butt")
|
||||
if(machine.status == "OFF"){
|
||||
gebId("machine-status").innerText = "AUS";
|
||||
gebId("machine-status-butt").classList.add("initBackRed");
|
||||
}
|
||||
if(machine.berror){
|
||||
gebId("machine-error-butt").classList.add("initBackRed");
|
||||
gebId("machiene-error-text").innerText = machine.error;
|
||||
}
|
||||
if(machine.ready && machine.state == "ON" && !machine.berror && esp_conn_infos.connection_valid){
|
||||
makeCoffee.classList.remove("deniePress");
|
||||
}
|
||||
if(machine.ready){
|
||||
machienReady.classList.remove("initBackRed");
|
||||
machienReady.classList.add("initBackGreen");
|
||||
gebId("machiene-ready-text").innerText = "Bereit";
|
||||
}
|
||||
if (esp_conn_infos.connection_valid) {
|
||||
gebId("validButt").classList.add("deniePress");
|
||||
gebId("machine-status-butt").classList.remove("deniePress");
|
||||
@@ -34,7 +51,33 @@ if (water.fill < 20) {
|
||||
if (beans.fill < 20) {
|
||||
gebId("beans-fill").parentElement.classList.add("blink-orange");
|
||||
}
|
||||
//all there given if generated html manipulations are not else-ed because the else condition is always in the dafult.
|
||||
//If later information is changed and should manipulate the html, it will come through socketio.js
|
||||
switch (machine.state) {
|
||||
case "ON":
|
||||
gebId("machine-status").innerText = "AN";
|
||||
gebId("machine-status-butt").classList.remove("blink-orange");
|
||||
gebId("machine-status-butt").classList.remove("initBackRed");
|
||||
gebId("machine-status-butt").classList.add("initBackGreen");
|
||||
break;
|
||||
case "PENDING":
|
||||
gebId("machine-status").innerText = "WARTEN";
|
||||
gebId("machine-status-butt").classList.add("blink-orange");
|
||||
gebId("machine-status-butt").classList.remove("initBackRed");
|
||||
gebId("machine-status-butt").classList.remove("initBackGreen");
|
||||
break;
|
||||
case "OFF":
|
||||
gebId("machine-status").innerText = "AUS";
|
||||
gebId("machine-status-butt").classList.remove("blink-orange");
|
||||
gebId("machine-status-butt").classList.add("initBackRed");
|
||||
gebId("machine-status-butt").classList.remove("initBackGreen");
|
||||
break;
|
||||
|
||||
default:
|
||||
gebId("machine-status").innerText = "UNBEKANNT";
|
||||
gebId("machine-status-butt").classList.add("initBackRed");
|
||||
}
|
||||
// All there
|
||||
function toggleMachine() {
|
||||
if (gebId("machine-status-butt").classList.contains("deniePress")){
|
||||
return;
|
||||
|
||||
@@ -15,6 +15,30 @@ socket.on('static_data', (data) => {
|
||||
gebId("ip_local").innerText = data.esp_conn_infos.ip_local
|
||||
gebId("valid_connection").innerText = data.esp_conn_infos.connection_valid
|
||||
gebId("last_seen").innerText = data.esp_conn_infos.last_seen
|
||||
switch (data.machine.state) {
|
||||
case "ON":
|
||||
gebId("machine-status").innerText = "AN";
|
||||
gebId("machine-status-butt").classList.remove("blink-orange");
|
||||
gebId("machine-status-butt").classList.remove("initBackRed");
|
||||
gebId("machine-status-butt").classList.add("initBackGreen");
|
||||
break;
|
||||
case "PENDING":
|
||||
gebId("machine-status").innerText = "WARTEN";
|
||||
gebId("machine-status-butt").classList.add("blink-orange");
|
||||
gebId("machine-status-butt").classList.remove("initBackRed");
|
||||
gebId("machine-status-butt").classList.remove("initBackGreen");
|
||||
break;
|
||||
case "OFF":
|
||||
gebId("machine-status").innerText = "AUS";
|
||||
gebId("machine-status-butt").classList.remove("blink-orange");
|
||||
gebId("machine-status-butt").classList.add("initBackRed");
|
||||
gebId("machine-status-butt").classList.remove("initBackGreen");
|
||||
break;
|
||||
|
||||
default:
|
||||
gebId("machine-status").innerText = "UNBEKANNT";
|
||||
gebId("machine-status-butt").classList.add("initBackRed");
|
||||
}
|
||||
if (data.water.fill < 20) {
|
||||
gebId("water-fill").parentElement.classList.add("blink-orange");
|
||||
}else {
|
||||
@@ -34,4 +58,28 @@ socket.on('static_data', (data) => {
|
||||
gebId("infoMain").classList.add("blink-orange");
|
||||
gebId("machine-status-butt").classList.add("deniePress");
|
||||
}
|
||||
if(data.machine.berror){
|
||||
gebId("machine-error-butt").classList.add("initBackRed");
|
||||
gebId("machiene-error-text").innerText = machine.error;
|
||||
}
|
||||
else {
|
||||
gebId("machine-error-butt").classList.remove("initBackRed");
|
||||
gebId("machiene-error-text").innerText = "";
|
||||
}
|
||||
machienReady = gebId("machine-ready-butt")
|
||||
makeCoffee = gebId("make-coffee-butt")
|
||||
if(data.machine.ready && data.machine.state == "ON" && !data.machine.berror && data.esp_conn_infos.connection_valid){
|
||||
makeCoffee.classList.remove("deniePress");
|
||||
}else {
|
||||
makeCoffee.classList.add("deniePress");
|
||||
}
|
||||
if(data.machine.ready){
|
||||
machienReady.classList.add("initBackRed");
|
||||
machienReady.classList.remove("initBackGreen");
|
||||
gebId("machiene-ready-text").innerText = "Bereit";
|
||||
}else {
|
||||
machienReady.classList.remove("initBackRed");
|
||||
machienReady.classList.add("initBackGreen");
|
||||
gebId("machiene-ready-text").innerText = "Nicht bereit";
|
||||
}
|
||||
});
|
||||
|
||||
@@ -226,6 +226,12 @@ background-color: red;
|
||||
.initBackRed:Hover{
|
||||
background-color: rgb(252, 47, 47);
|
||||
}
|
||||
.initBackGreen {
|
||||
background-color: green;
|
||||
}
|
||||
.initBackGreen:hover {
|
||||
background-color: rgb(0, 151, 0);
|
||||
}
|
||||
.deniePress:hover{
|
||||
cursor: not-allowed;
|
||||
}
|
||||
@@ -252,6 +258,10 @@ background-color: red;
|
||||
.validButt:hover.deniePress{
|
||||
background-color: green !important;
|
||||
}
|
||||
.initBackGreen:hover.deniePress {
|
||||
background-color: green !important;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
.deniePress:hover{
|
||||
cursor: not-allowed;
|
||||
}
|
||||
Reference in New Issue
Block a user