This commit is contained in:
schrom01 2022-08-27 19:08:50 +02:00
parent 279c9e74be
commit d5a9e4781c
6 changed files with 30 additions and 9 deletions

View File

@ -64,7 +64,7 @@
</tbody> </tbody>
</table> </table>
</div> </div>
Text unter Table <button onclick="buttonDeleteJobById('all')">{{ translater.getTranslation("delete all jobs")}}</button>
</div> </div>
</div> </div>

View File

@ -32,6 +32,7 @@ class Translater:
"planed duration": "geplante Dauer", "planed duration": "geplante Dauer",
"cancel": "abbrechen", "cancel": "abbrechen",
"delete": "löschen", "delete": "löschen",
"delete all jobs" : "alle Aufträge löschen",
} }

View File

@ -108,8 +108,12 @@ class Webserver:
self.zoneManager.deleteIrrigationJobsForZone(zone) self.zoneManager.deleteIrrigationJobsForZone(zone)
return "True" return "True"
case "delete_job_by_id": case "delete_job_by_id":
if(index_str == "all"):
self.zoneManager.clearIrrigationJobs()
return "True"
if (index): if (index):
self.zoneManager.deleteIrrigationJobByID(index) self.zoneManager.deleteIrrigationJobByID(index)
return "True"
case "get_dashboard_zone_html": case "get_dashboard_zone_html":
if (index): if (index):
zone = self.zoneManager.getZone(index) zone = self.zoneManager.getZone(index)

View File

@ -15,13 +15,17 @@ function refreshZone(zone_json) {
document.getElementById("desired_humidity_zone_" + zone.number).innerHTML = zone.desiredHumidity; document.getElementById("desired_humidity_zone_" + zone.number).innerHTML = zone.desiredHumidity;
} }
function buttonDeleteJobById(jobId) {
deleteJobById('delete_job_by_id',jobId);
var jobToDelete = document.getElementById("job_" + jobId);
document.getElementById("jobListBody").removeChild(jobToDelete);
}
function refreshPipeline(pipeline_html) { function refreshPipeline(pipeline_html) {
document.getElementById("jobListBody").innerHTML = pipeline_html; document.getElementById("jobListBody").innerHTML = pipeline_html;
} }
function buttonDeleteJobById(jobId) {
deleteJobById('delete_job_by_id',jobId);
if(jobId == "all") {
document.getElementById("jobListBody").innerHTML = "";
} else {
var jobToDelete = document.getElementById("job_" + jobId);
document.getElementById("jobListBody").removeChild(jobToDelete);
}
}

14
Zone.py
View File

@ -45,7 +45,10 @@ class Zone:
self.zoneManager.switchZoneState(zone=self, state=True, duration=self.zoneManager.systemSettings.defaultAutoIrrigationDuration, instant=False) self.zoneManager.switchZoneState(zone=self, state=True, duration=self.zoneManager.systemSettings.defaultAutoIrrigationDuration, instant=False)
case 1: case 1:
if(self.timeOver()): if(self.timeOver()):
self.setState = 0 if (self.planedDuration > 0):
self.setState = 3
else:
self.setState = 0
self.refreshStateAutomode() self.refreshStateAutomode()
else: else:
self.state = False self.state = False
@ -70,7 +73,10 @@ class Zone:
self.setState = 3 self.setState = 3
case 1: case 1:
if(self.timeOver()): if(self.timeOver()):
self.setState = 0 if (self.planedDuration > 0):
self.setState = 3
else:
self.setState = 0
self.state = False self.state = False
case 2: case 2:
if (self.timeOver()): if (self.timeOver()):
@ -105,7 +111,9 @@ class Zone:
self.setState = 2 self.setState = 2
self.endTimeSetState = time.time() + duration self.endTimeSetState = time.time() + duration
else: else:
if(state): if(self.setState == 1):
pass
elif(state):
self.setState = 3 self.setState = 3
self.refreshState() self.refreshState()

View File

@ -60,6 +60,10 @@ class ZoneManager:
else: else:
i = i + 1 i = i + 1
def clearIrrigationJobs(self):
with self.piplineMutexLock:
self.pipeLine = []
def isAnyZoneBusy(self): def isAnyZoneBusy(self):
for zone in self.zones: for zone in self.zones:
if(zone.state): if(zone.state):