diff --git a/inventory/templates/index.html b/inventory/templates/index.html index 4833119..ae37f15 100644 --- a/inventory/templates/index.html +++ b/inventory/templates/index.html @@ -15,21 +15,21 @@
Active Worklogs
You have {{ active_count }} active worklogs. - {% set ids %} - {ids: [{% for row in active_worklog_rows %}{{ row['id'] }}, {% endfor %}]} + {% set ids %} + {ids: [{% for row in active_worklog_rows %}{{ row['id'] }}, {% endfor %}]} {% endset %} {{ links.export_link( - 'active_worklog', - 'worklog', - ids + 'active_worklog', + 'worklog', + ids ) }}
{{ tables.render_table( - headers = active_worklog_headers, - rows = active_worklog_rows, - id = 'Active Worklog', - entry_route = 'worklog_entry', - per_page = 10 + headers = active_worklog_headers, + rows = active_worklog_rows, + id = 'Active Worklog', + entry_route = 'worklog_entry', + per_page = 10 )}} @@ -62,11 +62,14 @@ {% endblock %} {% block script %} - const data = {{ datasets['summary']|tojson }}; - const layout = { title: 'Summary' }; - const work_data = {{ datasets['work_summary']|tojson }}; - const work_layout = { title: 'Work Summary', xaxis: { tickangle: -45 } }; - - Plotly.newPlot('summary', data, layout) - Plotly.newPlot('work_summary', work_data, work_layout); -{% endblock %} +{% if datasets['summary'] %} +const data = {{ datasets['summary']|tojson }}; +const layout = { title: 'Summary' }; +Plotly.newPlot('summary', data, layout) +{% endif %} +{% if datasets['work_summary'] %} +const work_data = {{ datasets['work_summary']|tojson }}; +const work_layout = { title: 'Work Summary', xaxis: { tickangle: -45 } }; +Plotly.newPlot('work_summary', work_data, work_layout); +{% endif %} +{% endblock %} \ No newline at end of file