diff --git a/caimira/apps/calculator/static/js/form.js b/caimira/apps/calculator/static/js/form.js index 41536425..1ab36325 100644 --- a/caimira/apps/calculator/static/js/form.js +++ b/caimira/apps/calculator/static/js/form.js @@ -315,8 +315,15 @@ function show_sensors_data(url) { if (result.length == 0) return; // If the ARVE credentials were not defined, we don't have a valid result. DATA_FROM_SENSORS = result; result.map(room => { + if (room['Details']['Online'] == false) return; // If the sensor is offline, it should not be added to the list. $("#sensors").append(``); }); + if ($('#sensors > option').length == 0) { + $('#offline_sensors').show(); + $('#DIVsensors_data').hide(); + $('#arve_sensor_yes').prop('disabled', true) + return; // All sensors are offline + } populate_temp_hum_values(result, 0); if (url.searchParams.has('sensor_in_use')) { $("#sensors").val(url.searchParams.get('sensor_in_use')); diff --git a/caimira/apps/templates/cern/calculator.form.html.j2 b/caimira/apps/templates/cern/calculator.form.html.j2 index ffc67bd2..7a2f418a 100644 --- a/caimira/apps/templates/cern/calculator.form.html.j2 +++ b/caimira/apps/templates/cern/calculator.form.html.j2 @@ -14,7 +14,8 @@ -