From 0aeaada9221dcd7b889610c2abe76fe92590d335 Mon Sep 17 00:00:00 2001 From: JKA Network Date: Tue, 9 Jan 2018 23:34:50 +0100 Subject: [PATCH] Fix for new tests at index --- assets/html/indexpage.twig | 40 +++++++++++++++++++------------------- index.php | 7 ++++--- 2 files changed, 24 insertions(+), 23 deletions(-) diff --git a/assets/html/indexpage.twig b/assets/html/indexpage.twig index 9c34fb0..370c3b4 100755 --- a/assets/html/indexpage.twig +++ b/assets/html/indexpage.twig @@ -31,30 +31,30 @@ {# "Switch" type #} {% if check.ID_TC == 1 or check.ID_TC == 2 or check.ID_TC == 4 %} {# Ping, HttpCode, SQL DB #} + + {% if check.uptime != -1 %}{#Only if records exists#} {{check.statusText}} ({{ check.uptime}}%) - {% if check.uptime != -1 %}{#Only if records exists#} - - {{check.dateLastChk}} - - {% if check.failedLastChk == 0 %} - {{T_.status_right}} - {% else %} - {{T_.failed}} - {% endif %} - - {%else%} - Dame tiempo para recopilar estadísticas - {%endif%} - - {%if check.dateLastErr is not null%} - {{check.dateLastErr}} - {%else%} - {{T_.no_errs}} - {%endif%} - - + + {{check.dateLastChk}} - + {% if check.failedLastChk == 0 %} + {{T_.status_right}} + {% else %} + {{T_.failed}} + {% endif %} + + {%else%} {#If not records yet#} + Dame tiempo para recopilar estadísticas + {%endif%} + + {%if check.dateLastErr is not null%} + {{check.dateLastErr}} + {%else%} + {{T_.no_errs}} + {%endif%} + {% endif %} {% if check.ID_TC == 3 %} diff --git a/index.php b/index.php index 5191489..3fec12d 100755 --- a/index.php +++ b/index.php @@ -14,8 +14,9 @@ while ($onechk = dbw_fetch_array($db_conn,$results)){ $idchk = $onechk['ID_C']; $chks[$idchk] = $onechk; //First array data $chks[$idchk]['nameGroup'] = $groups[$onechk['ID_G']]; //Know group of this check + $ID_TC = $chks[$idchk]['ID_TC']; //Type of Check - switch ($chks[$idchk]['ID_TC']){ + switch ($ID_TC){ // Case 1 and 2 are normal status, case 3 (Visits) is numeric, not status case 1: //Ping case 2: //HttpCode @@ -34,7 +35,6 @@ while ($onechk = dbw_fetch_array($db_conn,$results)){ $chks[$idchk]['dateLastErr'] = date('d/m H:i',$lastErr); } - $ID_TC = $chks[$idchk]['ID_TC']; $chks[$idchk]['nameCheck'] = textTypeChk($ID_TC); if ($onechk['manStatus'] != ''){ @@ -43,7 +43,8 @@ while ($onechk = dbw_fetch_array($db_conn,$results)){ $chks[$idchk]['uptime'] = getUptime($idchk); } list($chks[$idchk]['statusText'],$chks[$idchk]['statusColor']) = getStatus($idchk); - + }else{ + $chks[$idchk]['uptime'] = -1; //Anything collected yet } break;