Skip to content

Commit

Permalink
Fix display of data from Functions on the Live Page
Browse files Browse the repository at this point in the history
  • Loading branch information
kizniche committed Dec 24, 2023
1 parent 999ec09 commit 455c55b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
- Fix inability to properly import settings backup
- Fix Actions not executing for MQTT, TTN, and Python Code Inputs ([#1336](https://github.com/kizniche/Mycodo/issues/1336))
- Fix running pylint
- Fix display of data from Functions on the Live Page

### Features

Expand Down
8 changes: 5 additions & 3 deletions mycodo/mycodo_flask/templates/pages/live.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
$.ajax(url, {
success: function(data, responseText, jqXHR) {
if (jqXHR.status === 204) {
document.getElementById(measure_string + "-time").innerHTML = "No Data Last " + period.toString() + " sec";
if (period === 0) document.getElementById(measure_string + "-time").innerHTML = "No Data Found";
else document.getElementById(measure_string + "-time").innerHTML = "No Data Last " + period.toString() + " sec";
document.getElementById(measure_string + "-value").innerHTML = "0";
}
else {
Expand All @@ -31,7 +32,8 @@
}
},
error: function(XMLHttpRequest, textStatus, errorThrown) {
document.getElementById(measure_string + "-time").innerHTML = "Error: No Data Last " + period.toString() + " sec";
if (period === 0) document.getElementById(measure_string + "-time").innerHTML = "Error: No Data Found";
else document.getElementById(measure_string + "-time").innerHTML = "Error: No Data Last " + period.toString() + " sec";
document.getElementById(measure_string + "-value").innerHTML = "0";
},
cache: false
Expand Down Expand Up @@ -68,7 +70,7 @@
{% if function_period %}
liveTextData('{{each_function.unique_id}}', 'function', '{{each_meas.unique_id}}', {{function_period * 2}}, {{function_period}});
{% else %}
liveTextData('{{each_function.unique_id}}', 'function', '{{each_meas.unique_id}}', 1440, 30);
liveTextData('{{each_function.unique_id}}', 'function', '{{each_meas.unique_id}}', 0, 30);
{% endif %}
{% endfor %}
{%- endfor -%}
Expand Down

0 comments on commit 455c55b

Please sign in to comment.