From 01356099193aa24d9036ddcfa835485961278fa7 Mon Sep 17 00:00:00 2001 From: schrom01 Date: Sat, 27 Aug 2022 22:06:58 +0200 Subject: [PATCH] implemented alert to delete all jobs #8 --- Webserver/Templates/dashboard/dashboard.html | 18 ++++++++++++++++-- Webserver/Translater.py | 3 ++- Webserver/static/Styles/scrollingTable.css | 7 +++++-- Webserver/static/js/dashboard.js | 19 ++++++++----------- 4 files changed, 31 insertions(+), 16 deletions(-) diff --git a/Webserver/Templates/dashboard/dashboard.html b/Webserver/Templates/dashboard/dashboard.html index cd9eb59..24b0dc1 100644 --- a/Webserver/Templates/dashboard/dashboard.html +++ b/Webserver/Templates/dashboard/dashboard.html @@ -34,6 +34,20 @@ executeAction('get_zone_info', {{ zone.number }}, '0', refreshZone); {% endfor %} } + + function buttonDeleteJobById(jobId) { + if(jobId == "all") { + if(confirm('{{ translater.getTranslation("delete all planed and cancel running jobs?")}}')){ + document.getElementById("jobListBody").innerHTML = ""; + } else { + return + } + } else { + var jobToDelete = document.getElementById("job_" + jobId); + document.getElementById("jobListBody").removeChild(jobToDelete); + } + deleteJobById('delete_job_by_id',jobId); + } @@ -46,11 +60,11 @@
-
+
- + diff --git a/Webserver/Translater.py b/Webserver/Translater.py index e5c8ea7..abfb071 100644 --- a/Webserver/Translater.py +++ b/Webserver/Translater.py @@ -36,7 +36,8 @@ class Translater: "delete": "löschen", "delete and cancel all jobs": "alle Aufträge löschen und abbrechen", "switch all to": "stelle alle um auf", - "currently there are no planned jobs.": "momentan sind keine Aufträge geplant." + "currently there are no planned jobs.": "momentan sind keine Aufträge geplant.", + "delete all planed and cancel running jobs?": "Sollen alle geplanten Aufträge gelöscht und laufende abgerochen werden?", } diff --git a/Webserver/static/Styles/scrollingTable.css b/Webserver/static/Styles/scrollingTable.css index 9a3203b..904c6cc 100644 --- a/Webserver/static/Styles/scrollingTable.css +++ b/Webserver/static/Styles/scrollingTable.css @@ -6,7 +6,7 @@ width: auto; /*set table width here if using fixed value*/ min-width: 100%; /*set table width here if using %*/ height: 300px; /*set table height here; can be fixed value or %*/ - min-height: 104px; if using % height, make this at least large enough to fit scrollbar arrows + captions + thead + min-height: 104px; /*if using % height, make this at least large enough to fit scrollbar arrows + captions + thead */ font-family: Verdana, Tahoma, sans-serif; font-size: 15px; line-height: 25px; @@ -14,6 +14,9 @@ padding-bottom: 25px; /*this determines bottom caption height*/ text-align: left; } +#button_delete_all_jobs{ + margin-top: 25px; +} .scrollingtable * {box-sizing: border-box;} .scrollingtable > div { position: relative; @@ -36,7 +39,7 @@ } .scrollingtable > div > div { /*min-height: 43px;*/ /*if using % height, make this at least large enough to fit scrollbar arrows*/ - max-height: 100%; + max-height: 200px; overflow: scroll; /*set to auto if using fixed or % width; else scroll*/ overflow-x: hidden; border: 1px solid black; /*border around table body*/ diff --git a/Webserver/static/js/dashboard.js b/Webserver/static/js/dashboard.js index 91e8df8..1a38a6f 100644 --- a/Webserver/static/js/dashboard.js +++ b/Webserver/static/js/dashboard.js @@ -20,16 +20,13 @@ function refreshPipeline(pipeline_html) { //alert("refreshing Pipeline"); var jobListBody = document.getElementById("jobListBody"); jobListBody.innerHTML = pipeline_html; - document.getElementById("text_no_jobs").style.display = jobListBody.childElementCount ? 'none' : 'block'; - document.getElementById("button_delete_all_jobs").style.display = jobListBody.childElementCount ? 'block' : 'none'; + if(!jobListBody.childElementCount){ + document.getElementById("button_delete_all_jobs").style.display = 'none'; + document.getElementById("text_no_jobs").style.display = 'block'; + } else { + document.getElementById("button_delete_all_jobs").style.display = 'block'; + document.getElementById("text_no_jobs").style.display = 'none'; + } + } -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); - } -} \ No newline at end of file
{{ translater.getTranslation("planed irrigationjobs") }}