Added alert filter in check page.

This commit is contained in:
Christian P. MOMON 2021-01-07 17:49:57 +01:00
parent 5c195b433c
commit 88d54c0279
3 changed files with 75 additions and 20 deletions

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2020 Christian Pierre MOMON <christian@momon.org> * Copyright (C) 2020-2021 Christian Pierre MOMON <christian@momon.org>
* *
* This file is part of StatoolInfos, simple service statistics tool. * This file is part of StatoolInfos, simple service statistics tool.
* *
@ -63,6 +63,29 @@ public class PropertyChecks extends ArrayList<PropertyCheck>
return result; return result;
} }
/**
* Extract alert lines.
*
* @return the property checks
*/
public PropertyChecks extractAlertLines()
{
PropertyChecks result;
result = new PropertyChecks();
for (PropertyCheck check : this)
{
if (check.getStatus() != Status.OK)
{
result.add(check);
}
}
//
return result;
}
/** /**
* Gets the alert count. * Gets the alert count.
* *

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2020 Christian Pierre MOMON <christian@momon.org> * Copyright (C) 2020-2021 Christian Pierre MOMON <christian@momon.org>
* *
* This file is part of StatoolInfos, simple service statistics tool. * This file is part of StatoolInfos, simple service statistics tool.
* *
@ -99,6 +99,7 @@ public class PropertyFileCheckPage
TagDataManager data = new TagDataManager(); TagDataManager data = new TagDataManager();
data.setContent("lineCount", checks.size());
data.setContent("warningCount", checks.getWarningCount()); data.setContent("warningCount", checks.getWarningCount());
data.setContent("errorCount", checks.getErrorCount()); data.setContent("errorCount", checks.getErrorCount());
data.setContent("voidCount", checks.getVoidCount()); data.setContent("voidCount", checks.getVoidCount());
@ -130,6 +131,18 @@ public class PropertyFileCheckPage
index += 1; index += 1;
} }
index = 0;
for (PropertyCheck check : checks.extractAlertLines())
{
//
data.setContent("alertLine", index, "alertLineIndex", check.getIndex());
data.setEscapedContent("alertLine", index, "alertLineContent", check.getLine());
data.setEscapedContent("alertLine", index, "alertLineComment", check.getComment());
data.setAttribute("alertLine", index, "alertLineContent", "class", statusToCSS(check.getStatus()));
index += 1;
}
// //
String content = PresenterUtils.dynamize("/fr/devinsy/statoolinfos/htmlize/propertyFileCheck.xhtml", data).toString(); String content = PresenterUtils.dynamize("/fr/devinsy/statoolinfos/htmlize/propertyFileCheck.xhtml", data).toString();

View file

@ -15,13 +15,13 @@
<div class="center"> <div class="center">
<h2 id="statsTitle">n/a</h2> <h2 id="statsTitle">n/a</h2>
</div> </div>
<div id="rawgroupedswitch" style="margin: 4px;"> <div style="margin: 4px;">
<span style="display: inline-block; padding-top: 6px; vertical-align: text-top;"><a href="#part2">Réduit</a></span> <a id="" href="#all" class="button" onclick="javascript:setView('ALL');">Tout</a>
<label class="switch"> <a id="" href="#shrinked" class="button" onclick="javascript:setView('SHRINKED');">Réduit</a>
<input type="checkbox" onclick="javascript:viewFlip();" /> <a id="" href="#alerts" class="button" onclick="javascript:setView('ALERTS');">Alertes</a>
<span class="slider round"></span>
</label> <span style="margin-left: 150px;">Statistiques : </span>
<span style="margin-left: 50px;">Statistiques : </span> <span id="lineCount" style="padding: 0 10px; background-color: #d5d5d5" title="Nombre de lignes">n/a</span>
<span id="warningCount" class="bg_warning" style="padding: 0 10px;" title="Attendus">n/a</span> <span id="warningCount" class="bg_warning" style="padding: 0 10px;" title="Attendus">n/a</span>
<span id="errorCount" class="bg_error" style="padding: 0 10px;" title="Erreurs">n/a</span> <span id="errorCount" class="bg_error" style="padding: 0 10px;" title="Erreurs">n/a</span>
<span id="voidCount" class="bg_void" style="padding: 0 10px;" title="Inconnus">n/a</span> <span id="voidCount" class="bg_void" style="padding: 0 10px;" title="Inconnus">n/a</span>
@ -48,24 +48,43 @@
</tbody> </tbody>
</table> </table>
</div> </div>
<div id="alertBlock" style="width: 100%; display: none;">
<table class="table_simple">
<tbody>
<tr id="alertLine">
<td id="alertLineIndex" style="width: 30px; text-align: right;">000</td>
<td id="alertLineContent" style="padding-left: 10px;">n/a</td>
<td id="alertLineComment" style="width: 200px; padding-left: 10px;">n/a</td>
</tr>
</tbody>
</table>
</div>
</div> </div>
<script type="text/javascript"> <script type="text/javascript">
var showView = 'FULL'; function setView (selection)
function viewFlip ()
{
if (showView == 'FULL')
{ {
document.getElementById ('fullBlock').style.display = 'none'; document.getElementById ('fullBlock').style.display = 'none';
document.getElementById ('shrunkBlock').style.display = 'block'; document.getElementById ('shrunkBlock').style.display = 'none';
showView = 'SHRUNK'; document.getElementById ('alertBlock').style.display = 'none';
}
else if (selection == 'ALL')
{ {
document.getElementById ('fullBlock').style.display = 'block'; document.getElementById ('fullBlock').style.display = 'block';
document.getElementById ('shrunkBlock').style.display = 'none'; document.getElementById ('shrunkBlock').style.display = 'none';
showView = 'FULL'; document.getElementById ('alertBlock').style.display = 'none';
}
else if (selection == 'SHRINKED')
{
document.getElementById ('fullBlock').style.display = 'none';
document.getElementById ('shrunkBlock').style.display = 'block';
document.getElementById ('alertBlock').style.display = 'none';
}
else if (selection == 'ALERTS')
{
document.getElementById ('fullBlock').style.display = 'none';
document.getElementById ('shrunkBlock').style.display = 'none';
document.getElementById ('alertBlock').style.display = 'block';
} }
} }
</script> </script>