add single pump test mode to config page
This commit is contained in:
@@ -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;
|
||||
|
Reference in New Issue
Block a user