Compare commits

..

9 commits

15 changed files with 152 additions and 12 deletions

View file

@ -4,7 +4,7 @@
javaCheck=`which java`
if [[ "$javaCheck" =~ ^/.* ]]; then
#echo "Java requirement............... OK"
java -jar "$(dirname "$0")"/statoolinfos.jar $@
java -Djava.awt.headless=true -jar "$(dirname "$0")"/statoolinfos.jar $@
else
echo "Java requirement............... MISSING"
fi

View file

@ -36,10 +36,12 @@ import fr.devinsy.strings.StringsUtils;
public class PropertyChecker
{
public static final String ALL = "^.*$";
public static final String BOM = "\ufeff";
public static final String COMMENT = "^#.*$";
public static final String STRING = "^.+$";
public static final String DATETIME = "\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}(:\\d{2}([\\.,]\\d+)?)?([+-]\\d\\d:\\d\\d)?";
public static final String DATE = "^(\\d{4}-\\d{2}-\\d{2}|\\d{2}/\\d{2}/\\d{4}|\\d{2}/\\d{4})";
public static final String URL = "^(http(s)?://)?[\\w-_\\.]+(\\.\\w+)+(/.*)?$";
public static final String URL = "^(http(s)?://)?[\\w-_\\.]+(\\.\\w+)+(:\\d+)?(/.*)?$";
public static final String EMAIL = "^.*@.*$";
public static final String NUMERIC = "^\\d+$";
public static final String NUMERICS = "^\\d*(,\\d*)*$";
@ -227,6 +229,13 @@ public class PropertyChecker
result = new PropertyChecks();
//
if ((lines != null) && (!lines.isEmpty()) && (lines.get(0).startsWith(BOM)))
{
String line = lines.get(0).substring(1);
lines.set(0, line);
}
//
PropertyRules requiredRules = rules.getMandatories();
requiredRules.addAll(rules.getWished());
@ -281,7 +290,7 @@ public class PropertyChecker
check = new PropertyCheck(lineIndex, "", Status.OK);
check.setComment("OK");
}
else if ((StringUtils.isEmpty(line)) || (line.matches("^#.*$")))
else if ((StringUtils.isEmpty(line)) || (line.matches(COMMENT)))
{
check = new PropertyCheck(lineIndex, line, Status.OK);
check.setComment("OK");

View file

@ -501,6 +501,35 @@ public class Federation extends PathPropertyList
return result;
}
/**
* Gets the URL active all.
*
* @return the URL active all
*/
public URLSet getURLActiveAll()
{
URLSet result;
result = new URLSet();
//
result.add(getContactURL());
result.add(getLegalURL());
result.add(getLogoURL());
result.add(getTechnicalGuideURL());
result.add(getUserGuideURL());
result.add(getWebsiteURL());
//
for (Organization organization : getOrganizations())
{
result.addAll(organization.getURLActiveAll());
}
//
return result;
}
/**
* Gets the URL all.
*

View file

@ -616,6 +616,21 @@ public class Organization extends PathPropertyList
return result;
}
/**
* Gets the service active count.
*
* @return the service active count
*/
public int getServiceActiveCount()
{
int result;
result = this.services.getBy(Service.Status.OK).size();
//
return result;
}
/**
* Gets the service count.
*
@ -683,6 +698,34 @@ public class Organization extends PathPropertyList
return result;
}
/**
* Gets the URL all.
*
* @return the URL all
*/
public URLSet getURLActiveAll()
{
URLSet result;
result = new URLSet();
result.add(getContactURL());
result.add(getLegalURL());
result.add(getLogoURL());
result.add(getTechnicalGuideURL());
result.add(getUserGuideURL());
result.add(getWebsiteURL());
//
for (Service service : getServices().getBy(Service.Status.OK))
{
result.addAll(service.getURLAll());
}
//
return result;
}
/**
* Gets the URL all.
*

View file

@ -84,6 +84,25 @@ public class Organizations extends ArrayList<Organization>
return result;
}
/**
* Gets the service active count.
*
* @return the service active count
*/
public int getServiceActiveCount()
{
int result;
result = 0;
for (Organization organization : this)
{
result += organization.getServiceCount();
}
//
return result;
}
/**
* Gets the service count.
*

View file

@ -23,6 +23,8 @@ import java.util.Collections;
import org.apache.commons.lang3.StringUtils;
import fr.devinsy.statoolinfos.core.Service.Status;
/**
* The Class Services.
*/
@ -90,6 +92,31 @@ public class Services extends ArrayList<Service>
return result;
}
/**
* Gets the by.
*
* @param status
* the category
* @return the by
*/
public Services getBy(final Status status)
{
Services result;
result = new Services();
for (Service service : this)
{
if (service.getStatus() == status)
{
result.add(service);
}
}
//
return result;
}
/**
* Reverse.
*

View file

@ -547,7 +547,7 @@ public class StatoolInfos
UptimeJournal journal = HtmlizerContext.instance().getUptimeJournal();
Federation federation = HtmlizerContext.instance().getFederation();
UptimeSurveyor.survey(journal, federation.getURLAll());
UptimeSurveyor.survey(journal, federation.getURLActiveAll());
HtmlizerContext.instance().getCache().storeUptimeJournal(journal);
}
}

View file

@ -91,7 +91,7 @@ public class ExportsPage
}
catch (Exception exception)
{
logger.error("Error during JSON export: " + exception.getMessage(), exception);
logger.error("Error during ODS export: " + exception.getMessage(), exception);
}
//
@ -104,7 +104,7 @@ public class ExportsPage
}
catch (Exception exception)
{
logger.error("Error during JSON export: " + exception.getMessage(), exception);
logger.error("Error during Uptime export: " + exception.getMessage(), exception);
}
//

View file

@ -74,7 +74,7 @@ public class OrganizationListView
data.setEscapedContent("organizationListLine", index, "organizationListLineUrlLink", organization.getWebsiteURL().toString());
data.setEscapedAttribute("organizationListLine", index, "organizationListLineUrlLink", "href", organization.getWebsiteURL().toString());
}
data.setContent("organizationListLine", index, "organizationListLineServiceCount", organization.getServiceCount());
data.setContent("organizationListLine", index, "organizationListLineServiceCount", organization.getServiceActiveCount());
data.setContent("organizationListLine", index, "organizationListLineUserCount", organization.getPreviousMonthUserCount());
data.setContent("organizationListLine", index, "organizationListLineVisitCount", organization.getPreviousMonthVisitCount());

View file

@ -156,7 +156,7 @@ public class UptimeView
}
int index = 0;
for (Service service : services.sortByName())
for (Service service : services.getBy(Service.Status.OK).sortByName())
{
//
data.setAttribute("line", index, "lineLogo", "src", service.getLogoFileName());

View file

@ -29,8 +29,10 @@
<li>Fabrice61</li>
<li>Thomas @TConstans</li>
<li>@labecasse</li>
<li>Antoine Jaba</li>
<li>@setop</li>
<li>Jérémy Collot</li>
<li>Pilou</li>
</ul>
</body>
</html>

View file

@ -55,7 +55,7 @@
Checks
</a>
</div>
<div class="registration _infos" style="margin: 5px;">
<div class="registration_infos" style="margin: 5px;">
Logiciel :
<span id="softwareName">n/a</span>, version <span id="softwareVersion">n/a</span>, licence <span id="softwareLicenseName">n/a</span>&#160;&#160;
<a id="softwareWebsiteLink" href="#"><img id="softwareWebsiteLinkImg" src="circle-icons/cruise.svg" class="disabled" title="Site web"/></a>

View file

@ -34,6 +34,7 @@
<div class="uptimeCounts">
<ul>
<li>Actuellement : </li>
<li><img src="status-ok.png" title="" /><span id="okCount">n/a</span></li>
<li><img src="status-warning.png" title="" /><span id="warningCount">n/a</span></li>
<li><img src="status-alert.png" title="" /><span id="alertCount">n/a</span></li>

View file

@ -59,10 +59,13 @@ public class ODSFile
CSVFile.write(out, source);
}
finally
{
if (out != null)
{
out.close();
}
}
}
/**
* Save.
@ -81,8 +84,11 @@ public class ODSFile
CSVFile.write(out, source);
}
finally
{
if (out != null)
{
out.close();
}
}
}
}

View file

@ -206,11 +206,15 @@ public class UptimeJournal
if (url == null)
{
result = null;
result = new Uptimes();
}
else
{
result = this.map.get(url.toString());
if (result == null)
{
result = new Uptimes();
}
}
//