Added red uptime button for federation, organizations and services.
This commit is contained in:
parent
fe72332ff3
commit
54a4cea231
9 changed files with 260 additions and 2 deletions
|
@ -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");
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -0,0 +1,65 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
version="1.1"
|
||||
id="svg2"
|
||||
xml:space="preserve"
|
||||
width="85.333336"
|
||||
height="85.333336"
|
||||
viewBox="0 0 85.333336 85.333336"
|
||||
sodipodi:docname="countdown-ko-mono.svg"
|
||||
inkscape:version="0.92.4 (5da689c313, 2019-01-14)"><metadata
|
||||
id="metadata8"><rdf:RDF><cc:Work
|
||||
rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title></dc:title></cc:Work></rdf:RDF></metadata><defs
|
||||
id="defs6"><clipPath
|
||||
clipPathUnits="userSpaceOnUse"
|
||||
id="clipPath18"><path
|
||||
d="M 0,64 H 64 V 0 H 0 Z"
|
||||
id="path16"
|
||||
inkscape:connector-curvature="0" /></clipPath></defs><sodipodi:namedview
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1"
|
||||
objecttolerance="10"
|
||||
gridtolerance="10"
|
||||
guidetolerance="10"
|
||||
inkscape:pageopacity="0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:window-width="1552"
|
||||
inkscape:window-height="958"
|
||||
id="namedview4"
|
||||
showgrid="false"
|
||||
inkscape:zoom="6.8298015"
|
||||
inkscape:cx="65.842204"
|
||||
inkscape:cy="42.666668"
|
||||
inkscape:window-x="111"
|
||||
inkscape:window-y="93"
|
||||
inkscape:window-maximized="0"
|
||||
inkscape:current-layer="g10" /><g
|
||||
id="g10"
|
||||
inkscape:groupmode="layer"
|
||||
inkscape:label="Elegant_circle-icons_3"
|
||||
transform="matrix(1.3333333,0,0,-1.3333333,0,85.333333)"><g
|
||||
id="g184"><g
|
||||
id="g177"><g
|
||||
id="g20-3"
|
||||
transform="translate(64,32)"><path
|
||||
inkscape:connector-curvature="0"
|
||||
d="m 0,0 c 0,-17.673 -14.327,-32 -32,-32 -17.673,0 -32,14.327 -32,32 0,17.673 14.327,32 32,32 C -14.327,32 0,17.673 0,0"
|
||||
style="fill:#c75c5c;fill-opacity:1;fill-rule:nonzero;stroke:none"
|
||||
id="path22-6" /></g><g
|
||||
id="g24"
|
||||
transform="translate(50.424,33.5)"><path
|
||||
d="m 0,0 c -0.728,9.004 -7.92,16.196 -16.924,16.924 v 2 C -6.818,18.187 1.263,10.106 2,0 Z m -16.924,-21.924 v 2 C -7.92,-19.196 -0.728,-12.004 0,-3 H 2 C 1.263,-13.106 -6.818,-21.187 -16.924,-21.924 m 0,18.817 9.06,-9.707 c -2.427,-2.266 -5.571,-3.773 -9.06,-4.11 z m -3,20.031 C -28.928,16.196 -36.12,9.004 -36.848,0 h -2 c 0.737,10.106 8.818,18.187 18.924,18.924 z m 0,-16.924 h -13.924 c 0.71,7.351 6.573,13.214 13.924,13.924 z m 0,-16.924 c -7.351,0.71 -13.214,6.573 -13.924,13.924 h 13.924 z m 0,-5 C -30.03,-21.187 -38.111,-13.106 -38.848,-3 h 2 c 0.728,-9.004 7.92,-16.196 16.924,-16.924 z m 1.5,43.924 c -12.958,0 -23.5,-10.542 -23.5,-23.5 0,-12.958 10.542,-23.5 23.5,-23.5 12.958,0 23.5,10.542 23.5,23.5 0,12.958 -10.542,23.5 -23.5,23.5"
|
||||
style="fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none"
|
||||
id="path26"
|
||||
inkscape:connector-curvature="0" /></g></g></g></g></svg>
|
After Width: | Height: | Size: 3.2 KiB |
|
@ -0,0 +1,66 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
version="1.1"
|
||||
id="svg2"
|
||||
xml:space="preserve"
|
||||
width="85.333336"
|
||||
height="85.333336"
|
||||
viewBox="0 0 85.333336 85.333336"
|
||||
sodipodi:docname="countdown.svg"
|
||||
inkscape:version="0.92.4 (5da689c313, 2019-01-14)"><metadata
|
||||
id="metadata8"><rdf:RDF><cc:Work
|
||||
rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title></dc:title></cc:Work></rdf:RDF></metadata><defs
|
||||
id="defs6"><clipPath
|
||||
clipPathUnits="userSpaceOnUse"
|
||||
id="clipPath18"><path
|
||||
d="M 0,64 H 64 V 0 H 0 Z"
|
||||
id="path16"
|
||||
inkscape:connector-curvature="0" /></clipPath></defs><sodipodi:namedview
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1"
|
||||
objecttolerance="10"
|
||||
gridtolerance="10"
|
||||
guidetolerance="10"
|
||||
inkscape:pageopacity="0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:window-width="640"
|
||||
inkscape:window-height="480"
|
||||
id="namedview4"
|
||||
showgrid="false"
|
||||
inkscape:zoom="2.7656249"
|
||||
inkscape:cx="42.666668"
|
||||
inkscape:cy="42.666668"
|
||||
inkscape:window-x="0"
|
||||
inkscape:window-y="25"
|
||||
inkscape:window-maximized="0"
|
||||
inkscape:current-layer="g10" /><g
|
||||
id="g10"
|
||||
inkscape:groupmode="layer"
|
||||
inkscape:label="Elegant_circle-icons_3"
|
||||
transform="matrix(1.3333333,0,0,-1.3333333,0,85.333333)"><g
|
||||
id="g12"><g
|
||||
id="g14"
|
||||
clip-path="url(#clipPath18)"><g
|
||||
id="g20"
|
||||
transform="translate(64,32)"><path
|
||||
d="m 0,0 c 0,-17.673 -14.327,-32 -32,-32 -17.673,0 -32,14.327 -32,32 0,17.673 14.327,32 32,32 C -14.327,32 0,17.673 0,0"
|
||||
style="fill:#4f5d73;fill-opacity:1;fill-rule:nonzero;stroke:none"
|
||||
id="path22"
|
||||
inkscape:connector-curvature="0" /></g><g
|
||||
id="g24"
|
||||
transform="translate(50.424,33.5)"><path
|
||||
d="m 0,0 c -0.728,9.004 -7.92,16.196 -16.924,16.924 v 2 C -6.818,18.187 1.263,10.106 2,0 Z m -16.924,-21.924 v 2 C -7.92,-19.196 -0.728,-12.004 0,-3 H 2 C 1.263,-13.106 -6.818,-21.187 -16.924,-21.924 m 0,18.817 9.06,-9.707 c -2.427,-2.266 -5.571,-3.773 -9.06,-4.11 z m -3,20.031 C -28.928,16.196 -36.12,9.004 -36.848,0 h -2 c 0.737,10.106 8.818,18.187 18.924,18.924 z m 0,-16.924 h -13.924 c 0.71,7.351 6.573,13.214 13.924,13.924 z m 0,-16.924 c -7.351,0.71 -13.214,6.573 -13.924,13.924 h 13.924 z m 0,-5 C -30.03,-21.187 -38.111,-13.106 -38.848,-3 h 2 c 0.728,-9.004 7.92,-16.196 16.924,-16.924 z m 1.5,43.924 c -12.958,0 -23.5,-10.542 -23.5,-23.5 0,-12.958 10.542,-23.5 23.5,-23.5 12.958,0 23.5,10.542 23.5,23.5 0,12.958 -10.542,23.5 -23.5,23.5"
|
||||
style="fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none"
|
||||
id="path26"
|
||||
inkscape:connector-curvature="0" /></g></g></g></g></svg>
|
After Width: | Height: | Size: 3.2 KiB |
|
@ -13,6 +13,19 @@
|
|||
<body>
|
||||
<div style="width:1150px; margin: 0 auto 0 auto;">
|
||||
<h2>Disponibilités</h2>
|
||||
|
||||
<div class="legend right" style="float: right; margin-top: -150px;">
|
||||
<div class="row">
|
||||
<div class="column left">
|
||||
<img src="status-ok.png" title="" style="height: 16px; width: 10px;" />Journée sans erreur<br/>
|
||||
<img src="status-warning.png" title="" style="height: 16px; width: 10px;" />Erreur rétablie<br/>
|
||||
<img src="status-alert.png" title="" style="height: 16px; width: 10px;" />Erreur en cours<br/>
|
||||
<img src="status-error.png" title="" style="height: 16px; width: 10px;" />Erreurs continues<br/>
|
||||
<img src="status-void.png" title="" style="height: 16px; width: 10px;" />Absence de données<br/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<table class="center_table table_classic left uptimeTable">
|
||||
<tr id="lineHeader">
|
||||
<th id="lineName" style="padding-top: 0; padding-bottom: 0;">Service</th>
|
||||
|
|
|
@ -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<Service> iterator = services.iterator();
|
||||
result = false;
|
||||
while (!ended)
|
||||
{
|
||||
if (iterator.hasNext())
|
||||
{
|
||||
Service current = iterator.next();
|
||||
if (getUptimes(current.getWebsiteURL()).last().getStatus() == UptimeStatus.ERROR)
|
||||
{
|
||||
ended = true;
|
||||
result = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ended = true;
|
||||
result = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Purge.
|
||||
*
|
||||
|
@ -318,4 +365,15 @@ public class UptimeJournal
|
|||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sort all.
|
||||
*/
|
||||
public void sortAll()
|
||||
{
|
||||
for (Uptimes uptimes : this.map.values())
|
||||
{
|
||||
uptimes.sortByDateTime();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -137,6 +137,8 @@ public class UptimeJournalFile
|
|||
}
|
||||
}
|
||||
|
||||
result.sortAll();
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -89,6 +89,28 @@ public class Uptimes extends ArrayList<Uptime>
|
|||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Last.
|
||||
*
|
||||
* @return the uptime
|
||||
*/
|
||||
public Uptime last()
|
||||
{
|
||||
Uptime result;
|
||||
|
||||
if (isEmpty())
|
||||
{
|
||||
result = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
result = get(size() - 1);
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Purge.
|
||||
*
|
||||
|
|
Loading…
Reference in a new issue