implemented action get_zone_info
This commit is contained in:
parent
2747b79f37
commit
442a7a8b11
|
@ -0,0 +1,23 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="de">
|
||||
<head>
|
||||
|
||||
<title>{{ translater.getTranslation("Irrigation") }}{{ translater.getTranslation("system") }}</title>
|
||||
</head>
|
||||
<body>
|
||||
{% include "header.html" %}
|
||||
|
||||
<main>
|
||||
|
||||
<h2>Action</h2>
|
||||
|
||||
<div>
|
||||
<p>
|
||||
Sucess: {{ sucess }}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
</main>
|
||||
|
||||
</body>
|
||||
</html>
|
|
@ -89,6 +89,10 @@ class Webserver:
|
|||
self.zoneManager.deleteIrrigationJobByID(index)
|
||||
case "get_zone_list":
|
||||
return self.zoneManager.zonesToJSON()
|
||||
case "get_zone_info":
|
||||
if (index):
|
||||
zone = self.zoneManager.getZone(index)
|
||||
return zone.toJSON()
|
||||
case "get_pipeline":
|
||||
return self.zoneManager.pipelineToJSON()
|
||||
return render_template('action.html', translater=self.translater, zones=self.zoneManager.zones, sucess=sucess)
|
||||
|
|
|
@ -0,0 +1,67 @@
|
|||
function sleep (time) {
|
||||
|
||||
return new Promise((resolve) => setTimeout(resolve, time));
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
function send_web_request($url, $messagestring, $varstring) {
|
||||
// Browserkompatibles Request-Objekt erzeugen:
|
||||
r = null;
|
||||
|
||||
if(window.XMLHttpRequest)
|
||||
{
|
||||
|
||||
r = new XMLHttpRequest();
|
||||
}
|
||||
else if(window.ActiveXObject)
|
||||
{
|
||||
|
||||
try
|
||||
{
|
||||
r = new ActiveXObject('Msxml2.XMLHTTP');
|
||||
}
|
||||
catch(e1)
|
||||
{
|
||||
try
|
||||
{
|
||||
r = new ActiveXObject('Microsoft.XMLHTTP');
|
||||
}
|
||||
catch(e2)
|
||||
{
|
||||
alert("Ein Fehler ist aufgetreten. Bitte versuchen Sie es erneut.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Wenn Request-Objekt vorhanden, dann Anfrage senden:
|
||||
if(r != null)
|
||||
{
|
||||
|
||||
|
||||
// HTTP-POST
|
||||
r.open('POST', $url, true);
|
||||
|
||||
r.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
|
||||
|
||||
r.send($varstring);
|
||||
if($messagestring != 'no')
|
||||
{
|
||||
alert($messagestring);
|
||||
}
|
||||
sleep(500).then(() => {
|
||||
|
||||
//window.location.href = window.location.href;
|
||||
//document.location.reload();
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
alert("Ein Fehler ist aufgetreten. Bitte versuchen Sie es erneut.");
|
||||
}
|
||||
|
||||
|
||||
}
|
Loading…
Reference in New Issue