Bewaesserungsanlage/Webserver/static/js/dashboard.js

28 lines
1.8 KiB
JavaScript

function refreshZone(zone_json) {
const zone = JSON.parse(zone_json);
document.getElementById("name_zone_" + zone.number).innerHTML = zone.name;
document.getElementById("inner_icon_state_zone_" + zone.number).className = 'inner_icon ' + (zone.state ? 'dot_green' : 'dot_red');
document.getElementById("state_text_zone_" + zone.number).innerHTML = zone.state_text;
document.getElementById("end_time_row_zone_" + zone.number).style.display = ((zone.setState == 1 || zone.setState == 2) ? 'table-row' : 'none');
document.getElementById("end_time_zone_" + zone.number).innerHTML = zone.endTimeSetState;
document.getElementById("planed_duration_row_zone_" + zone.number).style.display = ((zone.planedDuration > 0) ? 'table-row' : 'none');
document.getElementById("planed_duration_zone" + zone.number).innerHTML = zone.planedDuration/60;
document.getElementById("inner_icon_mode_zone_" + zone.number).innerHTML = zone.autoMode ? 'A' : 'M';
document.getElementById("slider_state_zone_" + zone.number).checked = zone.autoMode ? true : false;
document.getElementById("mode_text_zone_" + zone.number).innerHTML = zone.operationMode_text;
document.getElementById("inner_icon_humidity_zone_" + zone.number).className = 'inner_icon ' + ((zone.actualHumidity >= zone.desiredHumidity) ? 'dot_green' : 'dot_red');
document.getElementById("acutal_humidity_zone_" + zone.number).innerHTML = zone.actualHumidity;
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) {
document.getElementById("jobListBody").innerHTML = pipeline_html;
}