From 035304bce999bd616de3abddab13a5600e24e666 Mon Sep 17 00:00:00 2001 From: "Christian P. MOMON" Date: Thu, 7 Jan 2021 17:49:57 +0100 Subject: [PATCH] Added alert filter in check page. --- .../statoolinfos/checker/PropertyChecks.java | 25 +++++++- .../htmlize/PropertyFileCheckPage.java | 15 ++++- .../htmlize/propertyFileCheck.xhtml | 63 ++++++++++++------- 3 files changed, 79 insertions(+), 24 deletions(-) diff --git a/src/fr/devinsy/statoolinfos/checker/PropertyChecks.java b/src/fr/devinsy/statoolinfos/checker/PropertyChecks.java index 28a8d7d..dc97158 100644 --- a/src/fr/devinsy/statoolinfos/checker/PropertyChecks.java +++ b/src/fr/devinsy/statoolinfos/checker/PropertyChecks.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2020 Christian Pierre MOMON + * Copyright (C) 2020-2021 Christian Pierre MOMON * * This file is part of StatoolInfos, simple service statistics tool. * @@ -63,6 +63,29 @@ public class PropertyChecks extends ArrayList 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. * diff --git a/src/fr/devinsy/statoolinfos/htmlize/PropertyFileCheckPage.java b/src/fr/devinsy/statoolinfos/htmlize/PropertyFileCheckPage.java index c3a87b1..f4803ed 100644 --- a/src/fr/devinsy/statoolinfos/htmlize/PropertyFileCheckPage.java +++ b/src/fr/devinsy/statoolinfos/htmlize/PropertyFileCheckPage.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2020 Christian Pierre MOMON + * Copyright (C) 2020-2021 Christian Pierre MOMON * * This file is part of StatoolInfos, simple service statistics tool. * @@ -99,6 +99,7 @@ public class PropertyFileCheckPage TagDataManager data = new TagDataManager(); + data.setContent("lineCount", checks.size()); data.setContent("warningCount", checks.getWarningCount()); data.setContent("errorCount", checks.getErrorCount()); data.setContent("voidCount", checks.getVoidCount()); @@ -130,6 +131,18 @@ public class PropertyFileCheckPage 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(); diff --git a/src/fr/devinsy/statoolinfos/htmlize/propertyFileCheck.xhtml b/src/fr/devinsy/statoolinfos/htmlize/propertyFileCheck.xhtml index 76d1a01..ba5536a 100644 --- a/src/fr/devinsy/statoolinfos/htmlize/propertyFileCheck.xhtml +++ b/src/fr/devinsy/statoolinfos/htmlize/propertyFileCheck.xhtml @@ -15,13 +15,13 @@

n/a

-
- Réduit - - Statistiques : +
+ Tout + Réduit + Alertes + + Statistiques : + n/a n/a n/a n/a @@ -30,9 +30,9 @@ - + - +
000000 n/an/an/a
@@ -41,9 +41,20 @@ - + - + + + +
000000 n/an/an/a
+
+