diff --git a/src/fr/devinsy/statoolinfos/htmlize/FederationHeaderView.java b/src/fr/devinsy/statoolinfos/htmlize/FederationHeaderView.java index d111a3a..96bd695 100644 --- a/src/fr/devinsy/statoolinfos/htmlize/FederationHeaderView.java +++ b/src/fr/devinsy/statoolinfos/htmlize/FederationHeaderView.java @@ -24,6 +24,7 @@ import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import fr.devinsy.statoolinfos.HtmlizerContext; import fr.devinsy.statoolinfos.checker.PropertyChecks; import fr.devinsy.statoolinfos.core.Federation; import fr.devinsy.statoolinfos.core.StatoolInfosException; @@ -79,6 +80,15 @@ public class FederationHeaderView data.setAttribute("crawlLink", "href", federation.getTechnicalName() + "-crawl.xhtml"); data.setAttribute("uptimeLink", "href", federation.getLocalFileBaseName() + "-uptimes.xhtml"); + if (HtmlizerContext.instance().getUptimeJournal().hasRecentError(federation.getServicesAll())) + { + data.setAttribute("uptimeLinkImg", "src", "circle-icons/countdown-ko-mono.svg"); + } + else + { + data.setAttribute("uptimeLinkImg", "src", "circle-icons/countdown-ok-mono.svg"); + } + if (federation.getCrawlJournal().getErrors().isEmpty()) { data.setAttribute("crawlLinkImg", "src", "circle-icons/download-mono.svg"); diff --git a/src/fr/devinsy/statoolinfos/htmlize/OrganizationHeaderView.java b/src/fr/devinsy/statoolinfos/htmlize/OrganizationHeaderView.java index 846f7f8..90bca5e 100644 --- a/src/fr/devinsy/statoolinfos/htmlize/OrganizationHeaderView.java +++ b/src/fr/devinsy/statoolinfos/htmlize/OrganizationHeaderView.java @@ -22,6 +22,7 @@ import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import fr.devinsy.statoolinfos.HtmlizerContext; import fr.devinsy.statoolinfos.checker.PropertyChecks; import fr.devinsy.statoolinfos.core.Organization; import fr.devinsy.statoolinfos.core.StatoolInfosException; @@ -103,8 +104,6 @@ public class OrganizationHeaderView data.setAttribute("metricsLink", "href", organization.getTechnicalName() + "-metrics-summary-months-last.xhtml"); data.setAttribute("crawlLink", "href", organization.getTechnicalName() + "-crawl.xhtml"); - data.setAttribute("uptimeLink", "href", organization.getLocalFileBaseName() + "-uptimes.xhtml"); - if (organization.getCrawlJournal().getErrors().isEmpty()) { data.setAttribute("crawlLinkImg", "src", "circle-icons/download-mono.svg"); @@ -114,6 +113,16 @@ public class OrganizationHeaderView data.setAttribute("crawlLinkImg", "src", "circle-icons/download.svg"); } + data.setAttribute("uptimeLink", "href", organization.getLocalFileBaseName() + "-uptimes.xhtml"); + if (HtmlizerContext.instance().getUptimeJournal().hasRecentError(organization.getServices())) + { + data.setAttribute("uptimeLinkImg", "src", "circle-icons/countdown-ko-mono.svg"); + } + else + { + data.setAttribute("uptimeLinkImg", "src", "circle-icons/countdown-ok-mono.svg"); + } + { PropertyChecks checks = organization.getInputChecksAll(); diff --git a/src/fr/devinsy/statoolinfos/htmlize/ServiceHeaderView.java b/src/fr/devinsy/statoolinfos/htmlize/ServiceHeaderView.java index e0b4b29..d39c742 100644 --- a/src/fr/devinsy/statoolinfos/htmlize/ServiceHeaderView.java +++ b/src/fr/devinsy/statoolinfos/htmlize/ServiceHeaderView.java @@ -22,8 +22,10 @@ import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import fr.devinsy.statoolinfos.HtmlizerContext; import fr.devinsy.statoolinfos.checker.PropertyChecks; import fr.devinsy.statoolinfos.core.Service; +import fr.devinsy.statoolinfos.core.Services; import fr.devinsy.statoolinfos.core.StatoolInfosException; import fr.devinsy.xidyn.XidynException; import fr.devinsy.xidyn.data.DisplayMode; @@ -180,7 +182,18 @@ public class ServiceHeaderView { data.setAttribute("crawlLinkImg", "src", "circle-icons/download.svg"); } + data.setAttribute("uptimeLink", "href", service.getLocalFileBaseName() + "-uptimes.xhtml"); + Services services = new Services(); + services.add(service); + if (HtmlizerContext.instance().getUptimeJournal().hasRecentError(services)) + { + data.setAttribute("uptimeLinkImg", "src", "circle-icons/countdown-ko-mono.svg"); + } + else + { + data.setAttribute("uptimeLinkImg", "src", "circle-icons/countdown-ok-mono.svg"); + } { PropertyChecks checks = service.getInputChecksAll(); diff --git a/src/fr/devinsy/statoolinfos/htmlize/stuff/circle-icons/countdown-ko-mono.svg b/src/fr/devinsy/statoolinfos/htmlize/stuff/circle-icons/countdown-ko-mono.svg new file mode 100644 index 0000000..b0b8649 --- /dev/null +++ b/src/fr/devinsy/statoolinfos/htmlize/stuff/circle-icons/countdown-ko-mono.svg @@ -0,0 +1,65 @@ + + + + \ No newline at end of file diff --git a/src/fr/devinsy/statoolinfos/htmlize/stuff/circle-icons/countdown-ok-mono.svg b/src/fr/devinsy/statoolinfos/htmlize/stuff/circle-icons/countdown-ok-mono.svg new file mode 100644 index 0000000..f144a5b --- /dev/null +++ b/src/fr/devinsy/statoolinfos/htmlize/stuff/circle-icons/countdown-ok-mono.svg @@ -0,0 +1,66 @@ + + + + \ No newline at end of file diff --git a/src/fr/devinsy/statoolinfos/htmlize/uptimeView.xhtml b/src/fr/devinsy/statoolinfos/htmlize/uptimeView.xhtml index cc0013b..4ea8d40 100644 --- a/src/fr/devinsy/statoolinfos/htmlize/uptimeView.xhtml +++ b/src/fr/devinsy/statoolinfos/htmlize/uptimeView.xhtml @@ -13,6 +13,19 @@
Service | diff --git a/src/fr/devinsy/statoolinfos/uptime/UptimeJournal.java b/src/fr/devinsy/statoolinfos/uptime/UptimeJournal.java index 87d4654..3bc1efc 100644 --- a/src/fr/devinsy/statoolinfos/uptime/UptimeJournal.java +++ b/src/fr/devinsy/statoolinfos/uptime/UptimeJournal.java @@ -22,10 +22,14 @@ import java.net.MalformedURLException; import java.net.URL; import java.time.LocalDate; import java.util.HashMap; +import java.util.Iterator; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import fr.devinsy.statoolinfos.core.Service; +import fr.devinsy.statoolinfos.core.Services; + /** * The Class UptimeJournal. */ @@ -290,6 +294,49 @@ public class UptimeJournal return result; } + /** + * Checks for last in error. + * + * @param services + * the services + * @return true, if successful + */ + public boolean hasRecentError(final Services services) + { + boolean result; + + if (services == null) + { + result = false; + } + else + { + boolean ended = false; + Iterator
---|