mirror of
https://gitlab.com/JKANetwork/CheckServer.git
synced 2026-02-16 18:21:35 +01:00
More info for checks activated
This commit is contained in:
@@ -39,7 +39,7 @@
|
|||||||
|
|
||||||
<div class="wrapper recent-updated">
|
<div class="wrapper recent-updated">
|
||||||
<div id="new-updates" class="card-header d-flex justify-content-between align-items-center">
|
<div id="new-updates" class="card-header d-flex justify-content-between align-items-center">
|
||||||
<h2 class="h5 display"><a data-toggle="collapse" data-parent="#accordion" href="#upadtes-box" aria-expanded="true" aria-controls="upadtes-box">Ultimos fallos</a></h2>
|
<h2 class="h5 display"><a data-toggle="collapse" data-parent="#accordion" href="#upadtes-box" aria-expanded="true" aria-controls="upadtes-box">{{T_.lastest_fails}}</a></h2>
|
||||||
</div>
|
</div>
|
||||||
<div id="upadtes-box" role="tabpanel" class="collapse show">
|
<div id="upadtes-box" role="tabpanel" class="collapse show">
|
||||||
<ul class="news list-unstyled">
|
<ul class="news list-unstyled">
|
||||||
@@ -48,9 +48,9 @@
|
|||||||
<li class="d-flex justify-content-between">
|
<li class="d-flex justify-content-between">
|
||||||
<div class="left-col d-flex">
|
<div class="left-col d-flex">
|
||||||
<div class="icon"><i class="icon-times"></i></div>
|
<div class="icon"><i class="icon-times"></i></div>
|
||||||
<div class="title">{{fail.name}} - <strong>{{fail.groupName}}</strong>
|
<div class="title"><a href="?page=viewhist&ID_C={{fail.ID_C}}">{{fail.name}} - <strong>{{fail.groupName}}</strong>
|
||||||
<p>{{fail.typeCheck}}</p>
|
<p>{{fail.typeCheck}}</p>
|
||||||
</div>
|
</a></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="right-col text-right">
|
<div class="right-col text-right">
|
||||||
<div class="update-date">{{fail.date}}<span class="month">{{fail.hour}}</span></div>
|
<div class="update-date">{{fail.date}}<span class="month">{{fail.hour}}</span></div>
|
||||||
|
|||||||
84
assets/html/panel/p_viewhist.twig
Executable file
84
assets/html/panel/p_viewhist.twig
Executable file
@@ -0,0 +1,84 @@
|
|||||||
|
{% include 'panel/p_header.twig' %}
|
||||||
|
<script src="assets/js/Chart.min.js"></script>
|
||||||
|
<!-- Checks -->
|
||||||
|
<section>
|
||||||
|
<div class="col-lg-12">
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-header d-flex align-items-center">
|
||||||
|
<h2 class="h5 display">Historial de los últimos {{pagedata.cant}} checks de {{pagedata.name}} - {{pagedata.group}}</h2>
|
||||||
|
</div>
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-block">
|
||||||
|
<div style="width:75%;">
|
||||||
|
<canvas id="canvas"></canvas>
|
||||||
|
</div>
|
||||||
|
<!-- Lastest fails -->
|
||||||
|
<h2>{{T_.lastest_fails}}</h2>
|
||||||
|
<table class="table table-striped table-hover">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Fecha</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{% for err in pagedata.fails %}
|
||||||
|
<tr>
|
||||||
|
<td>{{err}}</td>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<!-- Script Chartjs -->
|
||||||
|
<script>
|
||||||
|
var barChartData = {
|
||||||
|
//labels: ["Correctos", "Errores"],
|
||||||
|
datasets: [{
|
||||||
|
label: "Correctos",
|
||||||
|
backgroundColor: "#2B86FF",
|
||||||
|
borderColor: "#2B86FF",
|
||||||
|
data: [ {{ pagedata.cgood }} ]
|
||||||
|
},{
|
||||||
|
label: "Errores",
|
||||||
|
backgroundColor: "#ff2a2a",
|
||||||
|
borderColor: "#ff2a2a",
|
||||||
|
data: [ {{ pagedata.cbad }} ]
|
||||||
|
}]
|
||||||
|
};
|
||||||
|
var config = {
|
||||||
|
type: 'bar',
|
||||||
|
data: barChartData,
|
||||||
|
|
||||||
|
options: {
|
||||||
|
responsive: true,
|
||||||
|
legend: {
|
||||||
|
position: 'top',
|
||||||
|
},
|
||||||
|
title: {
|
||||||
|
display: true,
|
||||||
|
text: 'Checks correctos y erroneos'
|
||||||
|
},
|
||||||
|
scales: {
|
||||||
|
yAxes: [{
|
||||||
|
ticks: {
|
||||||
|
beginAtZero: true
|
||||||
|
}
|
||||||
|
}]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
window.onload = function() {
|
||||||
|
var ctx = document.getElementById("canvas").getContext("2d");
|
||||||
|
window.myBar = new Chart(ctx, config);
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
{% include 'footer.twig' %}
|
||||||
@@ -38,4 +38,5 @@ $T_['VISIT_COUNT'] = 'Visit counter';
|
|||||||
$T_['DATABASE'] = 'Database check';
|
$T_['DATABASE'] = 'Database check';
|
||||||
$T_['add_grp_to_add_chk'] = 'Add a group for start adding checks';
|
$T_['add_grp_to_add_chk'] = 'Add a group for start adding checks';
|
||||||
$T_['view_hist'] = 'View history';
|
$T_['view_hist'] = 'View history';
|
||||||
|
$T_['lastest_fails'] = 'Lastest fails';
|
||||||
?>
|
?>
|
||||||
@@ -38,4 +38,5 @@ $T_['VISIT_COUNT'] = 'Contador de visitas';
|
|||||||
$T_['DATABASE'] = 'Conexión a base de datos';
|
$T_['DATABASE'] = 'Conexión a base de datos';
|
||||||
$T_['add_grp_to_add_chk'] = 'Añade un grupo para empezar a añadir checks';
|
$T_['add_grp_to_add_chk'] = 'Añade un grupo para empezar a añadir checks';
|
||||||
$T_['view_hist'] = 'Ver histórico';
|
$T_['view_hist'] = 'Ver histórico';
|
||||||
|
$T_['lastest_fails'] = 'Ultimos errores';
|
||||||
?>
|
?>
|
||||||
@@ -29,7 +29,7 @@ while ($onechk = dbw_fetch_array($db_conn,$results)){
|
|||||||
|
|
||||||
$chks[$idchk]['failedLastChk'] = $consul['code'];
|
$chks[$idchk]['failedLastChk'] = $consul['code'];
|
||||||
|
|
||||||
$lastErr = dbw_query_fetch_array($db_conn, "SELECT MIN(`timestamp`) FROM CHKHIST WHERE ID_C = '$idchk' AND code != 0")[0]; //Record last error, for showing if there are any.
|
$lastErr = dbw_query_fetch_array($db_conn, "SELECT MAX(`timestamp`) FROM CHKHIST WHERE ID_C = '$idchk' AND code != 0")[0]; //Record last error, for showing if there are any.
|
||||||
if ($lastErr != false){
|
if ($lastErr != false){
|
||||||
$chks[$idchk]['dateLastErr'] = date('d/m H:i',$lastErr);
|
$chks[$idchk]['dateLastErr'] = date('d/m H:i',$lastErr);
|
||||||
}
|
}
|
||||||
|
|||||||
27
panel.php
27
panel.php
@@ -271,6 +271,32 @@ switch($page){
|
|||||||
header('Location: panel.php?page=users');
|
header('Location: panel.php?page=users');
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
|
//History of checks for a ID_C
|
||||||
|
case 'viewhist':
|
||||||
|
//All page data
|
||||||
|
$ID_C = (int)$_GET['ID_C'];
|
||||||
|
$page = dbw_query_fetch_array($db_conn,"SELECT name FROM CHECKS WHERE ID_C='$ID_C'");
|
||||||
|
$cant = 100;
|
||||||
|
$results = dbw_query($db_conn,"SELECT * FROM CHKHIST WHERE ID_C='$ID_C' ORDER BY `timestamp` DESC LIMIT $cant");
|
||||||
|
|
||||||
|
//TODO TIMESTAMPS FAILS
|
||||||
|
$cgood = 0;$cbad = 0; $fails = array();
|
||||||
|
while ($us = dbw_fetch_array($db_conn,$results)){
|
||||||
|
if ($us['code'] == 0){
|
||||||
|
$cgood++;
|
||||||
|
}else{
|
||||||
|
$cbad++;
|
||||||
|
$fails[] = date('d/m/Y H:i',$us['timestamp']); //Record timestamps
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$group = nameGroupFromIDG($db_conn,IDGFromIDC($db_conn,$ID_C));
|
||||||
|
$pagedata = array('cgood' => $cgood,'cbad' => $cbad,'name' => nameFromIDC($db_conn,$ID_C), 'group' => $group,'cant' => $cant,'fails' => $fails);
|
||||||
|
|
||||||
|
echo $twig->render('panel/p_viewhist.twig', array('T_' => $T_, 'mpage' => 'viewhist', 'you' => $you,'pagedata' => $pagedata));
|
||||||
|
break;
|
||||||
|
|
||||||
// Página principal
|
// Página principal
|
||||||
case 'status':
|
case 'status':
|
||||||
default:
|
default:
|
||||||
@@ -283,6 +309,7 @@ switch($page){
|
|||||||
if ($failssql != false){
|
if ($failssql != false){
|
||||||
while ($fail = dbw_fetch_array($db_conn,$failssql)){ //Create array
|
while ($fail = dbw_fetch_array($db_conn,$failssql)){ //Create array
|
||||||
$fails[] = array (
|
$fails[] = array (
|
||||||
|
'ID_C' => $fail['ID_C'],
|
||||||
'name' => nameFromIDC($db_conn,$fail['ID_C']),
|
'name' => nameFromIDC($db_conn,$fail['ID_C']),
|
||||||
'groupName' => nameGroupFromIDG($db_conn,IDGFromIDC($db_conn,$fail['ID_C'])),
|
'groupName' => nameGroupFromIDG($db_conn,IDGFromIDC($db_conn,$fail['ID_C'])),
|
||||||
'typeCheck' => textTypeChk($T_,$fail['ID_TC']),
|
'typeCheck' => textTypeChk($T_,$fail['ID_TC']),
|
||||||
|
|||||||
Reference in New Issue
Block a user