implemented alert to delete all jobs

#8
This commit is contained in:
schrom01 2022-08-27 22:06:58 +02:00
parent 0ed508f70d
commit 0135609919
4 changed files with 31 additions and 16 deletions

View File

@ -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);
}
</script>
</head>
@ -46,11 +60,11 @@
<div id="pipeline" class="scrollingtable">
<div>
<div id="jobListTable">
<div>
<table>
<caption>{{ translater.getTranslation("planed irrigationjobs") }}</caption>
<thead>
<thead id="jobListHead">
<tr>
<th><div label="Nr."></div></th>
<th><div label="{{ translater.getTranslation("Zone") }}"></div></th>

View File

@ -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?",
}

View File

@ -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*/

View File

@ -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);
}
}