From 02c24b67f74f54f668ad1e104c9f289773e97722 Mon Sep 17 00:00:00 2001 From: Chris Date: Sun, 20 Nov 2022 00:31:58 +0100 Subject: [PATCH] make server template more robust if there are no checks available --- app/templates/main.html.j2 | 48 ++++++++++++++++++++------------------ 1 file changed, 25 insertions(+), 23 deletions(-) diff --git a/app/templates/main.html.j2 b/app/templates/main.html.j2 index debd102..5fdb7e6 100644 --- a/app/templates/main.html.j2 +++ b/app/templates/main.html.j2 @@ -20,30 +20,32 @@ output last try last successful - {% for check in server.get('check_results') %} - - - {{ check.get('name') }} - - - {{ check.get('state') }} - - - {{ check.get('command') | join(' ') }} - - - {{ check.get('output').get('output_text') }} - - - {{ check.get('last_exec_start') }} - - - {{ check.get('last_exec_finish') }} - - - {% endfor %} + {% if server.get('check_results') != None %} + {% for check in server.get('check_results', []) %} + + + {{ check.get('name') }} + + + {{ check.get('state') }} + + + {{ check.get('command') | join(' ') }} + + + {{ check.get('output').get('output_text') }} + + + {{ check.get('last_exec_start') }} + + + {{ check.get('last_exec_finish') }} + + + {% endfor %} + {% endif %} {% endfor %} - \ No newline at end of file +