add single pump test mode to config page

This commit is contained in:
2024-04-06 21:14:56 +02:00
parent 1f71b94238
commit e7e38e9fca
8 changed files with 182995 additions and 150452 deletions

View File

@@ -24,6 +24,10 @@ interface PlantConfig {
}[]
}
interface TestPump{
pump: number
}
let plants = document.getElementById("plants") as HTMLInputElement;
let fromWrapper = (() => {
@@ -77,9 +81,33 @@ let fromWrapper = (() => {
header.textContent = "Plant " + (i + 1);
plant.appendChild(header);
{
let holder = document.createElement("div");
plant.appendChild(holder);
let testButton = document.createElement("button");
testButton.innerText = "Test";
testButton.id = "plant_" + i + "_test";
testButton.onclick = function (){
var body:TestPump = {
pump: i
}
var pretty = JSON.stringify(body, undefined, 1);
fetch("/pumptest", {
method :"POST",
body: pretty
})
.then(response => response.text())
.then(text => submit_status.innerText = text)
};
holder.appendChild(testButton);
let br = document.createElement("br");
holder.appendChild(br);
let inputf = document.createElement("select");
inputf.id = "plant_" + i + "_mode";
inputf.onchange = updateJson;