Refactored service page and views. Added metric menu.
This commit is contained in:
parent
ded6ccf056
commit
330e81c02b
11 changed files with 850 additions and 238 deletions
|
@ -29,6 +29,7 @@ import org.apache.commons.lang3.StringUtils;
|
|||
|
||||
import fr.devinsy.statoolinfos.checker.PropertyChecks;
|
||||
import fr.devinsy.statoolinfos.crawl.CrawlJournal;
|
||||
import fr.devinsy.statoolinfos.htmlize.charts.MonthValues;
|
||||
import fr.devinsy.statoolinfos.properties.PathProperties;
|
||||
import fr.devinsy.statoolinfos.properties.PathPropertyList;
|
||||
|
||||
|
@ -443,6 +444,28 @@ public class Organization extends PathPropertyList
|
|||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the metric month values all.
|
||||
*
|
||||
* @param path
|
||||
* the path
|
||||
* @return the metric month values all
|
||||
*/
|
||||
public MonthValues getMetricMonthValuesAll(final String path)
|
||||
{
|
||||
MonthValues result;
|
||||
|
||||
result = getMetricMonthValues(path);
|
||||
|
||||
for (Service service : getServices())
|
||||
{
|
||||
result.addAll(service.getMetricMonthValues(path));
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the mobilizon webpage.
|
||||
*
|
||||
|
|
|
@ -0,0 +1,80 @@
|
|||
/*
|
||||
* Copyright (C) 2020-2021 Christian Pierre MOMON <christian@momon.org>
|
||||
*
|
||||
* This file is part of StatoolInfos, simple service statistics tool.
|
||||
*
|
||||
* StatoolInfos is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* StatoolInfos is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with StatoolInfos. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package fr.devinsy.statoolinfos.htmlize;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import fr.devinsy.statoolinfos.core.Service;
|
||||
import fr.devinsy.statoolinfos.core.StatoolInfosException;
|
||||
import fr.devinsy.statoolinfos.htmlize.ServiceMetricMenuView.MenuItem;
|
||||
import fr.devinsy.xidyn.XidynException;
|
||||
import fr.devinsy.xidyn.data.TagDataManager;
|
||||
import fr.devinsy.xidyn.presenters.PresenterUtils;
|
||||
|
||||
/**
|
||||
* The Class ServicePage.
|
||||
*/
|
||||
public class ServiceGenericMetricPage
|
||||
{
|
||||
private static Logger logger = LoggerFactory.getLogger(ServiceGenericMetricPage.class);
|
||||
|
||||
/**
|
||||
* Builds the.
|
||||
*
|
||||
* @param service
|
||||
* the service
|
||||
* @return the string
|
||||
* @throws StatoolInfosException
|
||||
* the statool infos exception
|
||||
*/
|
||||
public static String htmlize(final Service service) throws StatoolInfosException
|
||||
{
|
||||
String result;
|
||||
|
||||
try
|
||||
{
|
||||
logger.debug("Building service page {}…", service.get("service.name"));
|
||||
|
||||
TagDataManager data = new TagDataManager();
|
||||
|
||||
//
|
||||
data.setContent("headerView", ServiceHeaderView.htmlize(service));
|
||||
data.setContent("serviceMetricMenuView", ServiceMetricMenuView.htmlize(service, MenuItem.GENERIC));
|
||||
|
||||
//
|
||||
int graphicIndex = 0;
|
||||
|
||||
//
|
||||
String content = PresenterUtils.dynamize("/fr/devinsy/statoolinfos/htmlize/service.xhtml", data).toString();
|
||||
|
||||
BreadcrumbTrail trail = new BreadcrumbTrail();
|
||||
trail.add(service.getOrganization().getName(), service.getOrganization().getTechnicalName() + ".xhtml");
|
||||
trail.add(service.getName(), service.getOrganization().getTechnicalName() + "-" + service.getTechnicalName() + ".xhtml");
|
||||
result = WebCharterView.build(content, trail);
|
||||
}
|
||||
catch (XidynException exception)
|
||||
{
|
||||
throw new StatoolInfosException("Error building service page: " + exception.getMessage(), exception);
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
}
|
203
src/fr/devinsy/statoolinfos/htmlize/ServiceHeaderView.java
Normal file
203
src/fr/devinsy/statoolinfos/htmlize/ServiceHeaderView.java
Normal file
|
@ -0,0 +1,203 @@
|
|||
/*
|
||||
* Copyright (C) 2020-2021 Christian Pierre MOMON <christian@momon.org>
|
||||
*
|
||||
* This file is part of StatoolInfos, simple service statistics tool.
|
||||
*
|
||||
* StatoolInfos is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* StatoolInfos is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with StatoolInfos. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package fr.devinsy.statoolinfos.htmlize;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import fr.devinsy.statoolinfos.checker.PropertyChecks;
|
||||
import fr.devinsy.statoolinfos.core.Service;
|
||||
import fr.devinsy.statoolinfos.core.StatoolInfosException;
|
||||
import fr.devinsy.xidyn.XidynException;
|
||||
import fr.devinsy.xidyn.data.DisplayMode;
|
||||
import fr.devinsy.xidyn.data.TagDataManager;
|
||||
import fr.devinsy.xidyn.presenters.PresenterUtils;
|
||||
import fr.devinsy.xidyn.utils.XidynUtils;
|
||||
|
||||
/**
|
||||
* The Class ServiceHeaderView.
|
||||
*/
|
||||
public class ServiceHeaderView
|
||||
{
|
||||
private static Logger logger = LoggerFactory.getLogger(ServiceHeaderView.class);
|
||||
|
||||
/**
|
||||
* Htmlize.
|
||||
*
|
||||
* @param service
|
||||
* the service
|
||||
* @return the string
|
||||
* @throws StatoolInfosException
|
||||
* the statool infos exception
|
||||
*/
|
||||
public static String htmlize(final Service service) throws StatoolInfosException
|
||||
{
|
||||
String result;
|
||||
|
||||
try
|
||||
{
|
||||
logger.debug("htmlizing service header page {}…", service.get("service.name"));
|
||||
|
||||
TagDataManager data = new TagDataManager();
|
||||
|
||||
data.setAttribute("serviceLogo", "src", service.getLogoFileName());
|
||||
|
||||
data.setEscapedContent("serviceName", service.getName());
|
||||
data.setEscapedAttribute("serviceName", "href", service.getWebsite());
|
||||
|
||||
data.setEscapedContent("serviceURL", service.getWebsite());
|
||||
data.setEscapedAttribute("serviceURL", "href", service.getWebsite());
|
||||
|
||||
data.setEscapedContent("serviceDescription", StringUtils.defaultIfBlank(service.getDescription(), "n/a"));
|
||||
|
||||
data.setContent("serviceStartDate", StringUtils.defaultIfBlank(service.getStartDate(), "n/a"));
|
||||
data.setContent("serviceEndDate", StringUtils.defaultIfBlank(service.getEndDate(), "n/a"));
|
||||
data.setContent("serviceAge", StringUtils.defaultIfBlank(service.getAge(), "n/a"));
|
||||
if (StringUtils.isBlank(service.getEndDate()))
|
||||
{
|
||||
data.setAttribute("serviceEndDateData", "style", "display: none;");
|
||||
}
|
||||
else
|
||||
{
|
||||
data.setAttribute("serviceStartDateWord", "style", "display: none;");
|
||||
}
|
||||
|
||||
data.setAttribute("serviceStatusImg", "src", "status-" + service.getStatus().toString().toLowerCase() + ".png");
|
||||
data.setAttribute("serviceStatusImg", "title", StringUtils.defaultIfBlank(service.getStatusDescription(), service.getStatus().toString()));
|
||||
|
||||
data.setAttribute("rawLink", "href", service.getOrganization().getTechnicalName() + "-" + service.getTechnicalName() + ".properties");
|
||||
data.setAttribute("rawCheckLink", "href", service.getOrganization().getTechnicalName() + "-" + service.getTechnicalName() + "-check.xhtml");
|
||||
|
||||
data.setAttribute("statsLink", "href", service.getOrganization().getTechnicalName() + "-" + service.getTechnicalName() + ".xhtml");
|
||||
|
||||
if (StringUtils.isNotBlank(service.getLegalWebsite()))
|
||||
{
|
||||
data.setEscapedAttribute("legalLink", "href", service.getLegalWebsite());
|
||||
data.setAttribute("legalLinkImg", "class", "");
|
||||
data.getIdData("legalLinkImg").getAttribute("class").setMode(DisplayMode.REPLACE);
|
||||
}
|
||||
if (StringUtils.isNotBlank(service.getContactWebsite()))
|
||||
{
|
||||
data.setEscapedAttribute("contactLink", "href", service.getContactWebsite());
|
||||
data.setAttribute("contactLinkImg", "class", "");
|
||||
data.getIdData("contactLinkImg").getAttribute("class").setMode(DisplayMode.REPLACE);
|
||||
}
|
||||
if (StringUtils.isNotBlank(service.getContactEmail()))
|
||||
{
|
||||
data.setEscapedAttribute("emailLink", "href", "mailto:" + service.getContactEmail());
|
||||
data.setAttribute("emailLinkImg", "class", "");
|
||||
data.getIdData("emailLinkImg").getAttribute("class").setMode(DisplayMode.REPLACE);
|
||||
}
|
||||
if (StringUtils.isNotBlank(service.getUserDocWebsite()))
|
||||
{
|
||||
data.setEscapedAttribute("userDocLink", "href", service.getUserDocWebsite());
|
||||
data.setAttribute("userDocLinkImg", "class", "");
|
||||
data.getIdData("userDocLinkImg").getAttribute("class").setMode(DisplayMode.REPLACE);
|
||||
}
|
||||
if (StringUtils.isNotBlank(service.getTechnicalDocWebsite()))
|
||||
{
|
||||
data.setEscapedAttribute("technicalDocLink", "href", service.getTechnicalDocWebsite());
|
||||
data.setAttribute("technicalDocLinkImg", "class", "");
|
||||
data.getIdData("technicalDocLinkImg").getAttribute("class").setMode(DisplayMode.REPLACE);
|
||||
}
|
||||
|
||||
//
|
||||
if (service.isRegistrationNone())
|
||||
{
|
||||
data.setAttribute("registrationNoneImg", "class", "");
|
||||
data.getIdData("registrationNoneImg").getAttribute("class").setMode(DisplayMode.REPLACE);
|
||||
}
|
||||
if (service.isRegistrationFree())
|
||||
{
|
||||
data.setAttribute("registrationFreeImg", "class", "");
|
||||
data.getIdData("registrationFreeImg").getAttribute("class").setMode(DisplayMode.REPLACE);
|
||||
}
|
||||
if (service.isRegistrationMember())
|
||||
{
|
||||
data.setAttribute("registrationMemberImg", "class", "");
|
||||
data.getIdData("registrationMemberImg").getAttribute("class").setMode(DisplayMode.REPLACE);
|
||||
}
|
||||
if (service.isRegistrationClient())
|
||||
{
|
||||
data.setAttribute("registrationClientImg", "class", "");
|
||||
data.getIdData("registrationClientImg").getAttribute("class").setMode(DisplayMode.REPLACE);
|
||||
}
|
||||
if (service.isRegistrationLoadFull())
|
||||
{
|
||||
data.setAttribute("registrationLoadImg", "class", "");
|
||||
data.getIdData("registrationLoadImg").getAttribute("class").setMode(DisplayMode.REPLACE);
|
||||
}
|
||||
|
||||
//
|
||||
data.setEscapedContent("softwareName", StringUtils.defaultIfBlank(service.getSoftwareName(), "n/a"));
|
||||
data.setContent("softwareVersion", StringUtils.defaultIfBlank(service.getSoftwareVersion(), "n/a"));
|
||||
data.setEscapedContent("softwareLicenseName", StringUtils.defaultIfBlank(service.getSoftwareLicenseName(), "n/a"));
|
||||
if (StringUtils.isNotBlank(service.getSoftwareWebsite()))
|
||||
{
|
||||
data.setEscapedAttribute("softwareWebsiteLink", "href", service.getSoftwareWebsite());
|
||||
data.setAttribute("softwareWebsiteLinkImg", "class", "");
|
||||
data.getIdData("softwareWebsiteLinkImg").getAttribute("class").setMode(DisplayMode.REPLACE);
|
||||
}
|
||||
if (StringUtils.isNotBlank(service.getSoftwareLicenseWebpage()))
|
||||
{
|
||||
data.setEscapedAttribute("softwareLicenseLink", "href", service.getSoftwareLicenseWebpage());
|
||||
data.setAttribute("softwareLicenseLinkImg", "class", "");
|
||||
data.getIdData("softwareLicenseLinkImg").getAttribute("class").setMode(DisplayMode.REPLACE);
|
||||
}
|
||||
if (StringUtils.isNotBlank(service.getSoftwareSourceWebsite()))
|
||||
{
|
||||
data.setEscapedAttribute("softwareSourceLink", "href", service.getSoftwareSourceWebsite());
|
||||
data.setAttribute("softwareSourceLinkImg", "class", "");
|
||||
data.getIdData("softwareSourceLinkImg").getAttribute("class").setMode(DisplayMode.REPLACE);
|
||||
}
|
||||
|
||||
data.setAttribute("crawlLink", "href", service.getOrganization().getTechnicalName() + "-" + service.getTechnicalName() + "-crawl.xhtml");
|
||||
if (service.getCrawlJournal().getErrors().isEmpty())
|
||||
{
|
||||
data.setAttribute("crawlLinkImg", "src", "circle-icons/download-mono.svg");
|
||||
}
|
||||
else
|
||||
{
|
||||
data.setAttribute("crawlLinkImg", "src", "circle-icons/download.svg");
|
||||
}
|
||||
|
||||
{
|
||||
PropertyChecks checks = service.getInputChecksAll();
|
||||
data.setContent("errorCount", checks.getErrorCount());
|
||||
data.setContent("warningCount", checks.getWarningCount());
|
||||
data.setContent("voidCount", checks.getVoidCount());
|
||||
|
||||
data.setAttribute("alertLink", "href", service.getOrganization().getTechnicalName() + "-" + service.getTechnicalName() + "-check.xhtml#alerts");
|
||||
}
|
||||
|
||||
//
|
||||
String content = PresenterUtils.dynamize("/fr/devinsy/statoolinfos/htmlize/serviceHeaderView.xhtml", data).toString();
|
||||
|
||||
result = XidynUtils.extractBodyContent(content);
|
||||
}
|
||||
catch (XidynException exception)
|
||||
{
|
||||
throw new StatoolInfosException("Error building service header view: " + exception.getMessage(), exception);
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,97 @@
|
|||
/*
|
||||
* Copyright (C) 2021 Christian Pierre MOMON <christian@momon.org>
|
||||
*
|
||||
* This file is part of StatoolInfos, simple service statistics tool.
|
||||
*
|
||||
* StatoolInfos is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* StatoolInfos is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with StatoolInfos. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package fr.devinsy.statoolinfos.htmlize;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import fr.devinsy.statoolinfos.core.Service;
|
||||
import fr.devinsy.statoolinfos.core.StatoolInfosException;
|
||||
import fr.devinsy.xidyn.XidynException;
|
||||
import fr.devinsy.xidyn.data.TagDataManager;
|
||||
import fr.devinsy.xidyn.presenters.PresenterUtils;
|
||||
import fr.devinsy.xidyn.utils.XidynUtils;
|
||||
|
||||
/**
|
||||
* The Class ServiceMetricMenuView.
|
||||
*/
|
||||
public class ServiceMetricMenuView
|
||||
{
|
||||
private static Logger logger = LoggerFactory.getLogger(ServiceMetricMenuView.class);
|
||||
|
||||
public enum MenuItem
|
||||
{
|
||||
SUMMARY,
|
||||
GENERIC,
|
||||
WEB,
|
||||
SPECIFIC
|
||||
}
|
||||
|
||||
/**
|
||||
* Htmlize.
|
||||
*
|
||||
* @param service
|
||||
* the service
|
||||
* @return the string
|
||||
* @throws StatoolInfosException
|
||||
* the statool infos exception
|
||||
*/
|
||||
public static String htmlize(final Service service, final MenuItem item) throws StatoolInfosException
|
||||
{
|
||||
String result;
|
||||
|
||||
try
|
||||
{
|
||||
TagDataManager data = new TagDataManager();
|
||||
|
||||
data.setAttribute("summaryCategoryButton", "href", service.getOrganization().getTechnicalName() + "-" + service.getTechnicalName() + ".xhtml");
|
||||
data.setAttribute("genericCategoryButton", "href", service.getOrganization().getTechnicalName() + "-" + service.getTechnicalName() + "-metrics-generic.xhtml");
|
||||
data.setAttribute("webCategoryButton", "href", service.getOrganization().getTechnicalName() + "-" + service.getTechnicalName() + "-metrics-web.xhtml");
|
||||
data.setAttribute("specificCategoryButton", "href", service.getOrganization().getTechnicalName() + "-" + service.getTechnicalName() + "-metrics-specific.xhtml");
|
||||
|
||||
if ((item == null) || (item == MenuItem.SUMMARY))
|
||||
{
|
||||
data.appendAttribute("summaryCategoryButton", "class", "button selected");
|
||||
}
|
||||
else if (item == MenuItem.GENERIC)
|
||||
{
|
||||
data.appendAttribute("genericCategoryButton", "class", "button selected");
|
||||
}
|
||||
else if (item == MenuItem.WEB)
|
||||
{
|
||||
data.appendAttribute("webCategoryButton", "class", "button selected");
|
||||
}
|
||||
else if (item == MenuItem.SPECIFIC)
|
||||
{
|
||||
data.appendAttribute("specificCategoryButton", "class", "button selected");
|
||||
}
|
||||
|
||||
//
|
||||
String content = PresenterUtils.dynamize("/fr/devinsy/statoolinfos/htmlize/serviceMetricMenuView.xhtml", data).toString();
|
||||
result = XidynUtils.extractBodyContent(content);
|
||||
}
|
||||
catch (XidynException exception)
|
||||
{
|
||||
throw new StatoolInfosException("Error building service metric menu view: " + exception.getMessage(), exception);
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
}
|
|
@ -21,24 +21,22 @@ package fr.devinsy.statoolinfos.htmlize;
|
|||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.time.YearMonth;
|
||||
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import fr.devinsy.catgenerator.core.BirdGenerator;
|
||||
import fr.devinsy.statoolinfos.HtmlizerContext;
|
||||
import fr.devinsy.statoolinfos.checker.PropertyChecks;
|
||||
import fr.devinsy.statoolinfos.core.Metrics;
|
||||
import fr.devinsy.statoolinfos.core.Organization;
|
||||
import fr.devinsy.statoolinfos.core.Service;
|
||||
import fr.devinsy.statoolinfos.core.StatoolInfosException;
|
||||
import fr.devinsy.statoolinfos.crawl.CrawlCache;
|
||||
import fr.devinsy.statoolinfos.htmlize.ServiceMetricMenuView.MenuItem;
|
||||
import fr.devinsy.statoolinfos.htmlize.charts.ChartColor;
|
||||
import fr.devinsy.statoolinfos.htmlize.charts.MonthValues;
|
||||
import fr.devinsy.xidyn.XidynException;
|
||||
import fr.devinsy.xidyn.data.DisplayMode;
|
||||
import fr.devinsy.xidyn.data.TagDataManager;
|
||||
import fr.devinsy.xidyn.presenters.PresenterUtils;
|
||||
|
||||
|
@ -78,8 +76,21 @@ public class ServicePage
|
|||
|
||||
//
|
||||
logger.info("Htmlize service page: {}.", service.getName());
|
||||
String page = ServicePage.htmlize(service.getOrganization(), service);
|
||||
String page = ServicePage.htmlize(service);
|
||||
FileUtils.write(new File(htmlizeDirectory, service.getLocalFileBaseName() + ".xhtml"), page, StandardCharsets.UTF_8);
|
||||
|
||||
//
|
||||
logger.info("Htmlize service generic metric page: {}.", service.getName());
|
||||
page = ServiceGenericMetricPage.htmlize(service);
|
||||
FileUtils.write(new File(htmlizeDirectory, service.getLocalFileBaseName() + "-metrics-generic.xhtml"), page, StandardCharsets.UTF_8);
|
||||
|
||||
logger.info("Htmlize service web metric page: {}.", service.getName());
|
||||
page = ServiceWebMetricPage.htmlize(service);
|
||||
FileUtils.write(new File(htmlizeDirectory, service.getLocalFileBaseName() + "-metrics-web.xhtml"), page, StandardCharsets.UTF_8);
|
||||
|
||||
logger.info("Htmlize service specific metric page: {}.", service.getName());
|
||||
page = ServiceSpecificMetricPage.htmlize(service);
|
||||
FileUtils.write(new File(htmlizeDirectory, service.getLocalFileBaseName() + "-metrics-specific.xhtml"), page, StandardCharsets.UTF_8);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -107,7 +118,7 @@ public class ServicePage
|
|||
* @throws StatoolInfosException
|
||||
* the statool infos exception
|
||||
*/
|
||||
public static String htmlize(final Organization organization, final Service service) throws StatoolInfosException
|
||||
public static String htmlize(final Service service) throws StatoolInfosException
|
||||
{
|
||||
String result;
|
||||
|
||||
|
@ -117,202 +128,37 @@ public class ServicePage
|
|||
|
||||
TagDataManager data = new TagDataManager();
|
||||
|
||||
data.setAttribute("serviceLogo", "src", service.getLogoFileName());
|
||||
|
||||
data.setEscapedContent("serviceName", service.getName());
|
||||
data.setEscapedAttribute("serviceName", "href", service.getWebsite());
|
||||
|
||||
data.setEscapedContent("serviceURL", service.getWebsite());
|
||||
data.setEscapedAttribute("serviceURL", "href", service.getWebsite());
|
||||
|
||||
data.setEscapedContent("serviceDescription", StringUtils.defaultIfBlank(service.getDescription(), "n/a"));
|
||||
|
||||
data.setContent("serviceStartDate", StringUtils.defaultIfBlank(service.getStartDate(), "n/a"));
|
||||
data.setContent("serviceEndDate", StringUtils.defaultIfBlank(service.getEndDate(), "n/a"));
|
||||
data.setContent("serviceAge", StringUtils.defaultIfBlank(service.getAge(), "n/a"));
|
||||
if (StringUtils.isBlank(service.getEndDate()))
|
||||
{
|
||||
data.setAttribute("serviceEndDateData", "style", "display: none;");
|
||||
}
|
||||
else
|
||||
{
|
||||
data.setAttribute("serviceStartDateWord", "style", "display: none;");
|
||||
}
|
||||
|
||||
data.setAttribute("serviceStatusImg", "src", "status-" + service.getStatus().toString().toLowerCase() + ".png");
|
||||
data.setAttribute("serviceStatusImg", "title", StringUtils.defaultIfBlank(service.getStatusDescription(), service.getStatus().toString()));
|
||||
|
||||
data.setAttribute("rawLink", "href", organization.getTechnicalName() + "-" + service.getTechnicalName() + ".properties");
|
||||
data.setAttribute("rawCheckLink", "href", organization.getTechnicalName() + "-" + service.getTechnicalName() + "-check.xhtml");
|
||||
|
||||
data.setAttribute("statsLink", "href", organization.getTechnicalName() + "-" + service.getTechnicalName() + ".xhtml");
|
||||
|
||||
if (StringUtils.isNotBlank(service.getLegalWebsite()))
|
||||
{
|
||||
data.setEscapedAttribute("legalLink", "href", service.getLegalWebsite());
|
||||
data.setAttribute("legalLinkImg", "class", "");
|
||||
data.getIdData("legalLinkImg").getAttribute("class").setMode(DisplayMode.REPLACE);
|
||||
}
|
||||
if (StringUtils.isNotBlank(service.getContactWebsite()))
|
||||
{
|
||||
data.setEscapedAttribute("contactLink", "href", service.getContactWebsite());
|
||||
data.setAttribute("contactLinkImg", "class", "");
|
||||
data.getIdData("contactLinkImg").getAttribute("class").setMode(DisplayMode.REPLACE);
|
||||
}
|
||||
if (StringUtils.isNotBlank(service.getContactEmail()))
|
||||
{
|
||||
data.setEscapedAttribute("emailLink", "href", "mailto:" + service.getContactEmail());
|
||||
data.setAttribute("emailLinkImg", "class", "");
|
||||
data.getIdData("emailLinkImg").getAttribute("class").setMode(DisplayMode.REPLACE);
|
||||
}
|
||||
if (StringUtils.isNotBlank(service.getUserDocWebsite()))
|
||||
{
|
||||
data.setEscapedAttribute("userDocLink", "href", service.getUserDocWebsite());
|
||||
data.setAttribute("userDocLinkImg", "class", "");
|
||||
data.getIdData("userDocLinkImg").getAttribute("class").setMode(DisplayMode.REPLACE);
|
||||
}
|
||||
if (StringUtils.isNotBlank(service.getTechnicalDocWebsite()))
|
||||
{
|
||||
data.setEscapedAttribute("technicalDocLink", "href", service.getTechnicalDocWebsite());
|
||||
data.setAttribute("technicalDocLinkImg", "class", "");
|
||||
data.getIdData("technicalDocLinkImg").getAttribute("class").setMode(DisplayMode.REPLACE);
|
||||
}
|
||||
//
|
||||
data.setContent("headerView", ServiceHeaderView.htmlize(service));
|
||||
data.setContent("serviceMetricMenuView", ServiceMetricMenuView.htmlize(service, MenuItem.SUMMARY));
|
||||
|
||||
//
|
||||
if (service.isRegistrationNone())
|
||||
{
|
||||
data.setAttribute("registrationNoneImg", "class", "");
|
||||
data.getIdData("registrationNoneImg").getAttribute("class").setMode(DisplayMode.REPLACE);
|
||||
}
|
||||
if (service.isRegistrationFree())
|
||||
{
|
||||
data.setAttribute("registrationFreeImg", "class", "");
|
||||
data.getIdData("registrationFreeImg").getAttribute("class").setMode(DisplayMode.REPLACE);
|
||||
}
|
||||
if (service.isRegistrationMember())
|
||||
{
|
||||
data.setAttribute("registrationMemberImg", "class", "");
|
||||
data.getIdData("registrationMemberImg").getAttribute("class").setMode(DisplayMode.REPLACE);
|
||||
}
|
||||
if (service.isRegistrationClient())
|
||||
{
|
||||
data.setAttribute("registrationClientImg", "class", "");
|
||||
data.getIdData("registrationClientImg").getAttribute("class").setMode(DisplayMode.REPLACE);
|
||||
}
|
||||
if (service.isRegistrationLoadFull())
|
||||
{
|
||||
data.setAttribute("registrationLoadImg", "class", "");
|
||||
data.getIdData("registrationLoadImg").getAttribute("class").setMode(DisplayMode.REPLACE);
|
||||
}
|
||||
|
||||
//
|
||||
data.setEscapedContent("softwareName", StringUtils.defaultIfBlank(service.getSoftwareName(), "n/a"));
|
||||
data.setContent("softwareVersion", StringUtils.defaultIfBlank(service.getSoftwareVersion(), "n/a"));
|
||||
data.setEscapedContent("softwareLicenseName", StringUtils.defaultIfBlank(service.getSoftwareLicenseName(), "n/a"));
|
||||
if (StringUtils.isNotBlank(service.getSoftwareWebsite()))
|
||||
{
|
||||
data.setEscapedAttribute("softwareWebsiteLink", "href", service.getSoftwareWebsite());
|
||||
data.setAttribute("softwareWebsiteLinkImg", "class", "");
|
||||
data.getIdData("softwareWebsiteLinkImg").getAttribute("class").setMode(DisplayMode.REPLACE);
|
||||
}
|
||||
if (StringUtils.isNotBlank(service.getSoftwareLicenseWebpage()))
|
||||
{
|
||||
data.setEscapedAttribute("softwareLicenseLink", "href", service.getSoftwareLicenseWebpage());
|
||||
data.setAttribute("softwareLicenseLinkImg", "class", "");
|
||||
data.getIdData("softwareLicenseLinkImg").getAttribute("class").setMode(DisplayMode.REPLACE);
|
||||
}
|
||||
if (StringUtils.isNotBlank(service.getSoftwareSourceWebsite()))
|
||||
{
|
||||
data.setEscapedAttribute("softwareSourceLink", "href", service.getSoftwareSourceWebsite());
|
||||
data.setAttribute("softwareSourceLinkImg", "class", "");
|
||||
data.getIdData("softwareSourceLinkImg").getAttribute("class").setMode(DisplayMode.REPLACE);
|
||||
}
|
||||
|
||||
data.setAttribute("crawlLink", "href", service.getOrganization().getTechnicalName() + "-" + service.getTechnicalName() + "-crawl.xhtml");
|
||||
if (service.getCrawlJournal().getErrors().isEmpty())
|
||||
{
|
||||
data.setAttribute("crawlLinkImg", "src", "circle-icons/download-mono.svg");
|
||||
}
|
||||
else
|
||||
{
|
||||
data.setAttribute("crawlLinkImg", "src", "circle-icons/download.svg");
|
||||
}
|
||||
|
||||
{
|
||||
PropertyChecks checks = service.getInputChecksAll();
|
||||
data.setContent("errorCount", checks.getErrorCount());
|
||||
data.setContent("warningCount", checks.getWarningCount());
|
||||
data.setContent("voidCount", checks.getVoidCount());
|
||||
|
||||
data.setAttribute("alertLink", "href", organization.getTechnicalName() + "-" + service.getTechnicalName() + "-check.xhtml#alerts");
|
||||
}
|
||||
|
||||
//
|
||||
int graphicIndex = 0;
|
||||
// data.setContent("fooChart", graphicIndex++,
|
||||
// LineMonthsChartView.build());
|
||||
|
||||
// service.getPrefixes();
|
||||
|
||||
MonthValues metric = service.getMetricMonthValues("metrics.http.hits");
|
||||
data.setContent("fooChart", graphicIndex++, ChartHtmlizer.htmlizeMetricsChart(null, null, metric, ChartColor.BLUE));
|
||||
String tagIds[] = { "fullChart", "lastChart", "2020Chart", "2021Chart" };
|
||||
YearMonth starts[] = { null, YearMonth.now().minusMonths(11), YearMonth.of(2020, 01), YearMonth.of(2021, 01) };
|
||||
YearMonth ends[] = { null, YearMonth.now(), YearMonth.of(2020, 12), YearMonth.of(2021, 12) };
|
||||
|
||||
MonthValues metric4 = service.getMetricMonthValues("metrics.http.hits.ipv4");
|
||||
MonthValues metric6 = service.getMetricMonthValues("metrics.http.hits.ipv6");
|
||||
data.setContent("fooChart", graphicIndex++,
|
||||
ChartHtmlizer.htmlizeMetricsChart("http.hits (ipv4 + ipv6)", null, null, new ChartColor[] { ChartColor.YELLOW, ChartColor.GREEN }, metric4, metric6));
|
||||
data.setContent("fooChart", graphicIndex++, ChartHtmlizer.htmlizeMetricsChart(null, null, metric4, ChartColor.YELLOW));
|
||||
data.setContent("fooChart", graphicIndex++, ChartHtmlizer.htmlizeMetricsChart(null, null, metric6, ChartColor.GREEN));
|
||||
for (int index = 0; index < tagIds.length; index++)
|
||||
{
|
||||
String tagId = tagIds[index];
|
||||
YearMonth start = starts[index];
|
||||
YearMonth end = ends[index];
|
||||
|
||||
metric4 = service.getMetricMonthValues("metrics.http.hits.bots");
|
||||
metric6 = service.getMetricMonthValues("metrics.http.hits.visitors");
|
||||
data.setContent("fooChart", graphicIndex++,
|
||||
ChartHtmlizer.htmlizeMetricsChart("http.hits (visitors + bots)", null, null, new ChartColor[] { ChartColor.GREEN, ChartColor.YELLOW }, metric6, metric4));
|
||||
data.setContent("fooChart", graphicIndex++, ChartHtmlizer.htmlizeMetricsChart(null, null, metric4, ChartColor.YELLOW));
|
||||
data.setContent("fooChart", graphicIndex++, ChartHtmlizer.htmlizeMetricsChart(null, null, metric6, ChartColor.GREEN));
|
||||
int graphicIndex = 0;
|
||||
|
||||
metric = service.getMetricMonthValues("metrics.http.errors");
|
||||
data.setContent("fooChart", graphicIndex++, ChartHtmlizer.htmlizeMetricsChart(null, null, metric, ChartColor.RED));
|
||||
MonthValues metric = service.getMetricMonthValues("metrics.http.hits.visitors");
|
||||
data.setContent(tagId, graphicIndex++, ChartHtmlizer.htmlizeMetricsChart(start, end, metric, ChartColor.GREEN));
|
||||
|
||||
metric = service.getMetricMonthValues("metrics.http.errors.php");
|
||||
data.setContent("fooChart", graphicIndex++, ChartHtmlizer.htmlizeMetricsChart(null, null, metric, ChartColor.RED));
|
||||
metric = service.getMetricMonthValues("metrics.http.ip.visitors");
|
||||
data.setContent(tagId, graphicIndex++, ChartHtmlizer.htmlizeMetricsChart(start, end, metric, ChartColor.GREEN));
|
||||
|
||||
metric = service.getMetricMonthValues("metrics.http.files");
|
||||
data.setContent("fooChart", graphicIndex++, ChartHtmlizer.htmlizeMetricsChart(null, null, metric, ChartColor.BLUE));
|
||||
|
||||
metric = service.getMetricMonthValues("metrics.http.pages");
|
||||
data.setContent("fooChart", graphicIndex++, ChartHtmlizer.htmlizeMetricsChart(null, null, metric, ChartColor.BLUE));
|
||||
|
||||
metric = service.getMetricMonthValues("metrics.http.bytes");
|
||||
data.setContent("fooChart", graphicIndex++, ChartHtmlizer.htmlizeMetricsChart(null, null, metric, ChartColor.BLUE));
|
||||
|
||||
metric = service.getMetricMonthValues("metrics.http.ip");
|
||||
data.setContent("fooChart", graphicIndex++, ChartHtmlizer.htmlizeMetricsChart(null, null, metric, ChartColor.BLUE));
|
||||
|
||||
metric4 = service.getMetricMonthValues("metrics.http.ip.bots");
|
||||
metric6 = service.getMetricMonthValues("metrics.http.ip.visitors");
|
||||
data.setContent("fooChart", graphicIndex++,
|
||||
ChartHtmlizer.htmlizeMetricsChart("http.ip (visitors + bots)", null, null, new ChartColor[] { ChartColor.GREEN, ChartColor.YELLOW }, metric6, metric4));
|
||||
data.setContent("fooChart", graphicIndex++, ChartHtmlizer.htmlizeMetricsChart(null, null, metric6, ChartColor.GREEN));
|
||||
data.setContent("fooChart", graphicIndex++, ChartHtmlizer.htmlizeMetricsChart(null, null, metric4, ChartColor.YELLOW));
|
||||
|
||||
metric4 = service.getMetricMonthValues("metrics.http.ip.ipv4");
|
||||
metric6 = service.getMetricMonthValues("metrics.http.ip.ipv6");
|
||||
data.setContent("fooChart", graphicIndex++,
|
||||
ChartHtmlizer.htmlizeMetricsChart("http.ip (ipv4 + ipv6)", null, null, new ChartColor[] { ChartColor.YELLOW, ChartColor.GREEN }, metric4, metric6));
|
||||
data.setContent("fooChart", graphicIndex++, ChartHtmlizer.htmlizeMetricsChart(null, null, metric4, ChartColor.YELLOW));
|
||||
data.setContent("fooChart", graphicIndex++, ChartHtmlizer.htmlizeMetricsChart(null, null, metric6, ChartColor.GREEN));
|
||||
|
||||
metric = service.getMetricMonthValues("metrics.http.visits");
|
||||
data.setContent("fooChart", graphicIndex++, ChartHtmlizer.htmlizeMetricsChart(null, null, metric, ChartColor.BLUE));
|
||||
|
||||
metric4 = service.getMetricMonthValues("metrics.http.visits.bots");
|
||||
metric6 = service.getMetricMonthValues("metrics.http.visits.visitors");
|
||||
data.setContent("fooChart", graphicIndex++,
|
||||
ChartHtmlizer.htmlizeMetricsChart("http.visits (visitors + bots)", null, null, new ChartColor[] { ChartColor.GREEN, ChartColor.YELLOW }, metric6, metric4));
|
||||
|
||||
data.setContent("fooChart", graphicIndex++, ChartHtmlizer.htmlizeMetricsChart(null, null, metric6, ChartColor.GREEN));
|
||||
data.setContent("fooChart", graphicIndex++, ChartHtmlizer.htmlizeMetricsChart(null, null, metric4, ChartColor.YELLOW));
|
||||
metric = service.getMetricMonthValues("metrics.http.visits.visitors");
|
||||
data.setContent(tagId, graphicIndex++, ChartHtmlizer.htmlizeMetricsChart(start, end, metric, ChartColor.GREEN));
|
||||
}
|
||||
|
||||
//
|
||||
String content = PresenterUtils.dynamize("/fr/devinsy/statoolinfos/htmlize/service.xhtml", data).toString();
|
||||
|
|
|
@ -0,0 +1,80 @@
|
|||
/*
|
||||
* Copyright (C) 2020-2021 Christian Pierre MOMON <christian@momon.org>
|
||||
*
|
||||
* This file is part of StatoolInfos, simple service statistics tool.
|
||||
*
|
||||
* StatoolInfos is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* StatoolInfos is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with StatoolInfos. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package fr.devinsy.statoolinfos.htmlize;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import fr.devinsy.statoolinfos.core.Service;
|
||||
import fr.devinsy.statoolinfos.core.StatoolInfosException;
|
||||
import fr.devinsy.statoolinfos.htmlize.ServiceMetricMenuView.MenuItem;
|
||||
import fr.devinsy.xidyn.XidynException;
|
||||
import fr.devinsy.xidyn.data.TagDataManager;
|
||||
import fr.devinsy.xidyn.presenters.PresenterUtils;
|
||||
|
||||
/**
|
||||
* The Class ServicePage.
|
||||
*/
|
||||
public class ServiceSpecificMetricPage
|
||||
{
|
||||
private static Logger logger = LoggerFactory.getLogger(ServiceSpecificMetricPage.class);
|
||||
|
||||
/**
|
||||
* Builds the.
|
||||
*
|
||||
* @param service
|
||||
* the service
|
||||
* @return the string
|
||||
* @throws StatoolInfosException
|
||||
* the statool infos exception
|
||||
*/
|
||||
public static String htmlize(final Service service) throws StatoolInfosException
|
||||
{
|
||||
String result;
|
||||
|
||||
try
|
||||
{
|
||||
logger.debug("Building service specific page {}…", service.get("service.name"));
|
||||
|
||||
TagDataManager data = new TagDataManager();
|
||||
|
||||
//
|
||||
data.setContent("headerView", ServiceHeaderView.htmlize(service));
|
||||
data.setContent("serviceMetricMenuView", ServiceMetricMenuView.htmlize(service, MenuItem.SPECIFIC));
|
||||
|
||||
//
|
||||
int graphicIndex = 0;
|
||||
|
||||
//
|
||||
String content = PresenterUtils.dynamize("/fr/devinsy/statoolinfos/htmlize/service.xhtml", data).toString();
|
||||
|
||||
BreadcrumbTrail trail = new BreadcrumbTrail();
|
||||
trail.add(service.getOrganization().getName(), service.getOrganization().getTechnicalName() + ".xhtml");
|
||||
trail.add(service.getName(), service.getOrganization().getTechnicalName() + "-" + service.getTechnicalName() + ".xhtml");
|
||||
result = WebCharterView.build(content, trail);
|
||||
}
|
||||
catch (XidynException exception)
|
||||
{
|
||||
throw new StatoolInfosException("Error building service page: " + exception.getMessage(), exception);
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
}
|
156
src/fr/devinsy/statoolinfos/htmlize/ServiceWebMetricPage.java
Normal file
156
src/fr/devinsy/statoolinfos/htmlize/ServiceWebMetricPage.java
Normal file
|
@ -0,0 +1,156 @@
|
|||
/*
|
||||
* Copyright (C) 2020-2021 Christian Pierre MOMON <christian@momon.org>
|
||||
*
|
||||
* This file is part of StatoolInfos, simple service statistics tool.
|
||||
*
|
||||
* StatoolInfos is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* StatoolInfos is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with StatoolInfos. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package fr.devinsy.statoolinfos.htmlize;
|
||||
|
||||
import java.time.YearMonth;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import fr.devinsy.statoolinfos.core.Service;
|
||||
import fr.devinsy.statoolinfos.core.StatoolInfosException;
|
||||
import fr.devinsy.statoolinfos.htmlize.ServiceMetricMenuView.MenuItem;
|
||||
import fr.devinsy.statoolinfos.htmlize.charts.ChartColor;
|
||||
import fr.devinsy.statoolinfos.htmlize.charts.MonthValues;
|
||||
import fr.devinsy.xidyn.XidynException;
|
||||
import fr.devinsy.xidyn.data.TagDataManager;
|
||||
import fr.devinsy.xidyn.presenters.PresenterUtils;
|
||||
|
||||
/**
|
||||
* The Class ServicePage.
|
||||
*/
|
||||
public class ServiceWebMetricPage
|
||||
{
|
||||
private static Logger logger = LoggerFactory.getLogger(ServiceWebMetricPage.class);
|
||||
|
||||
/**
|
||||
* Builds the.
|
||||
*
|
||||
* @param service
|
||||
* the service
|
||||
* @return the string
|
||||
* @throws StatoolInfosException
|
||||
* the statool infos exception
|
||||
*/
|
||||
public static String htmlize(final Service service) throws StatoolInfosException
|
||||
{
|
||||
String result;
|
||||
|
||||
try
|
||||
{
|
||||
logger.debug("Building service generic metric page {}…", service.get("service.name"));
|
||||
|
||||
TagDataManager data = new TagDataManager();
|
||||
|
||||
//
|
||||
data.setContent("headerView", ServiceHeaderView.htmlize(service));
|
||||
data.setContent("serviceMetricMenuView", ServiceMetricMenuView.htmlize(service, MenuItem.WEB));
|
||||
|
||||
// service.getPrefixes();
|
||||
|
||||
String tagIds[] = { "fullChart", "lastChart", "2020Chart", "2021Chart" };
|
||||
YearMonth starts[] = { null, YearMonth.now().minusMonths(11), YearMonth.of(2020, 01), YearMonth.of(2021, 01) };
|
||||
YearMonth ends[] = { null, YearMonth.now(), YearMonth.of(2020, 12), YearMonth.of(2021, 12) };
|
||||
|
||||
for (int index = 0; index < tagIds.length; index++)
|
||||
{
|
||||
String tagId = tagIds[index];
|
||||
YearMonth start = starts[index];
|
||||
YearMonth end = ends[index];
|
||||
|
||||
int graphicIndex = 0;
|
||||
|
||||
MonthValues metric = service.getMetricMonthValues("metrics.http.hits");
|
||||
data.setContent(tagId, graphicIndex++, ChartHtmlizer.htmlizeMetricsChart(start, end, metric, ChartColor.BLUE));
|
||||
|
||||
MonthValues metric4 = service.getMetricMonthValues("metrics.http.hits.ipv4");
|
||||
MonthValues metric6 = service.getMetricMonthValues("metrics.http.hits.ipv6");
|
||||
data.setContent(tagId, graphicIndex++,
|
||||
ChartHtmlizer.htmlizeMetricsChart("http.hits (ipv4 + ipv6)", start, end, new ChartColor[] { ChartColor.YELLOW, ChartColor.GREEN }, metric4, metric6));
|
||||
data.setContent(tagId, graphicIndex++, ChartHtmlizer.htmlizeMetricsChart(start, end, metric4, ChartColor.YELLOW));
|
||||
data.setContent(tagId, graphicIndex++, ChartHtmlizer.htmlizeMetricsChart(start, end, metric6, ChartColor.GREEN));
|
||||
|
||||
metric4 = service.getMetricMonthValues("metrics.http.hits.bots");
|
||||
metric6 = service.getMetricMonthValues("metrics.http.hits.visitors");
|
||||
data.setContent(tagId, graphicIndex++,
|
||||
ChartHtmlizer.htmlizeMetricsChart("http.hits (visitors + bots)", start, end, new ChartColor[] { ChartColor.GREEN, ChartColor.YELLOW }, metric6, metric4));
|
||||
data.setContent(tagId, graphicIndex++, ChartHtmlizer.htmlizeMetricsChart(start, end, metric4, ChartColor.YELLOW));
|
||||
data.setContent(tagId, graphicIndex++, ChartHtmlizer.htmlizeMetricsChart(start, end, metric6, ChartColor.GREEN));
|
||||
|
||||
metric = service.getMetricMonthValues("metrics.http.errors");
|
||||
data.setContent(tagId, graphicIndex++, ChartHtmlizer.htmlizeMetricsChart(start, end, metric, ChartColor.RED));
|
||||
|
||||
metric = service.getMetricMonthValues("metrics.http.errors.php");
|
||||
data.setContent(tagId, graphicIndex++, ChartHtmlizer.htmlizeMetricsChart(start, end, metric, ChartColor.RED));
|
||||
|
||||
metric = service.getMetricMonthValues("metrics.http.files");
|
||||
data.setContent(tagId, graphicIndex++, ChartHtmlizer.htmlizeMetricsChart(start, end, metric, ChartColor.BLUE));
|
||||
|
||||
metric = service.getMetricMonthValues("metrics.http.pages");
|
||||
data.setContent(tagId, graphicIndex++, ChartHtmlizer.htmlizeMetricsChart(start, end, metric, ChartColor.BLUE));
|
||||
|
||||
metric = service.getMetricMonthValues("metrics.http.bytes");
|
||||
data.setContent(tagId, graphicIndex++, ChartHtmlizer.htmlizeMetricsChart(start, end, metric, ChartColor.BLUE));
|
||||
|
||||
metric = service.getMetricMonthValues("metrics.http.ip");
|
||||
data.setContent(tagId, graphicIndex++, ChartHtmlizer.htmlizeMetricsChart(start, end, metric, ChartColor.BLUE));
|
||||
|
||||
metric4 = service.getMetricMonthValues("metrics.http.ip.bots");
|
||||
metric6 = service.getMetricMonthValues("metrics.http.ip.visitors");
|
||||
data.setContent(tagId, graphicIndex++,
|
||||
ChartHtmlizer.htmlizeMetricsChart("http.ip (visitors + bots)", start, end, new ChartColor[] { ChartColor.GREEN, ChartColor.YELLOW }, metric6, metric4));
|
||||
data.setContent(tagId, graphicIndex++, ChartHtmlizer.htmlizeMetricsChart(start, end, metric6, ChartColor.GREEN));
|
||||
data.setContent(tagId, graphicIndex++, ChartHtmlizer.htmlizeMetricsChart(start, end, metric4, ChartColor.YELLOW));
|
||||
|
||||
metric4 = service.getMetricMonthValues("metrics.http.ip.ipv4");
|
||||
metric6 = service.getMetricMonthValues("metrics.http.ip.ipv6");
|
||||
data.setContent(tagId, graphicIndex++,
|
||||
ChartHtmlizer.htmlizeMetricsChart("http.ip (ipv4 + ipv6)", start, end, new ChartColor[] { ChartColor.YELLOW, ChartColor.GREEN }, metric4, metric6));
|
||||
data.setContent(tagId, graphicIndex++, ChartHtmlizer.htmlizeMetricsChart(start, end, metric4, ChartColor.YELLOW));
|
||||
data.setContent(tagId, graphicIndex++, ChartHtmlizer.htmlizeMetricsChart(start, end, metric6, ChartColor.GREEN));
|
||||
|
||||
metric = service.getMetricMonthValues("metrics.http.visits");
|
||||
data.setContent(tagId, graphicIndex++, ChartHtmlizer.htmlizeMetricsChart(start, end, metric, ChartColor.BLUE));
|
||||
|
||||
metric4 = service.getMetricMonthValues("metrics.http.visits.bots");
|
||||
metric6 = service.getMetricMonthValues("metrics.http.visits.visitors");
|
||||
data.setContent(tagId, graphicIndex++,
|
||||
ChartHtmlizer.htmlizeMetricsChart("http.visits (visitors + bots)", start, end, new ChartColor[] { ChartColor.GREEN, ChartColor.YELLOW }, metric6, metric4));
|
||||
|
||||
data.setContent(tagId, graphicIndex++, ChartHtmlizer.htmlizeMetricsChart(start, end, metric6, ChartColor.GREEN));
|
||||
data.setContent(tagId, graphicIndex++, ChartHtmlizer.htmlizeMetricsChart(start, end, metric4, ChartColor.YELLOW));
|
||||
}
|
||||
|
||||
//
|
||||
String content = PresenterUtils.dynamize("/fr/devinsy/statoolinfos/htmlize/service.xhtml", data).toString();
|
||||
|
||||
BreadcrumbTrail trail = new BreadcrumbTrail();
|
||||
trail.add(service.getOrganization().getName(), service.getOrganization().getTechnicalName() + ".xhtml");
|
||||
trail.add(service.getName(), service.getOrganization().getTechnicalName() + "-" + service.getTechnicalName() + ".xhtml");
|
||||
result = WebCharterView.build(content, trail);
|
||||
}
|
||||
catch (XidynException exception)
|
||||
{
|
||||
throw new StatoolInfosException("Error building service page: " + exception.getMessage(), exception);
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
}
|
|
@ -21,6 +21,7 @@ package fr.devinsy.statoolinfos.htmlize.charts;
|
|||
import java.io.IOException;
|
||||
|
||||
import org.apache.commons.codec.digest.DigestUtils;
|
||||
import org.apache.commons.lang3.RandomStringUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
@ -54,7 +55,7 @@ public class BarChartView
|
|||
String source = XidynUtils.load(BarChartView.class.getResource("/fr/devinsy/statoolinfos/htmlize/charts/barChartView.xhtml"));
|
||||
result = XidynUtils.extractBodyContent(source);
|
||||
|
||||
result = result.replace("myChart", "myChart_" + DigestUtils.sha1Hex(chart.getTitle() + "barChart"));
|
||||
result = result.replace("myChart", "myChart_" + DigestUtils.sha1Hex(chart.getTitle() + "barChart" + RandomStringUtils.random(10)));
|
||||
|
||||
StringList lines = new StringList();
|
||||
lines.append("{\n");
|
||||
|
|
|
@ -11,57 +11,21 @@
|
|||
<script src="Chart.bundle.min.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div class="center">
|
||||
<div class="row center" style="border: 0px solid yellow;">
|
||||
<div class="column" style="border: 0px solid red;">
|
||||
<img id="serviceLogo" src="#" style="width: 100px; height: 100px;"/>
|
||||
<div id="headerView" />
|
||||
<div id="metricZone">
|
||||
<div id="serviceMetricMenuView" />
|
||||
<div id="fullCharts" style="display: none;">
|
||||
<div id="fullChart" style="width: 450px; height: 300px; display: inline-block; border: 1px solid #e7e7e7;"/>
|
||||
</div>
|
||||
<div class="column" style="border: 0px solid red; max-width: 400px;">
|
||||
<div class="content_title"><a id="serviceName" href="#">Service name</a></div>
|
||||
<div class="content_subtitle"><a id="serviceURL" href="#" style="text-decoration: none;">URL n/a</a></div>
|
||||
<div id="lastCharts" style="display: block;">
|
||||
<div id="lastChart" style="width: 450px; height: 300px; display: inline-block; border: 1px solid #e7e7e7;"/>
|
||||
</div>
|
||||
<p id="serviceDescription" class="center_table" style="width: 500px;">Description absente…</p>
|
||||
<div id="2020Charts" style="display: none;">
|
||||
<div id="2020Chart" style="width: 450px; height: 300px; display: inline-block; border: 1px solid #e7e7e7;"/>
|
||||
</div>
|
||||
|
||||
<div><span id="serviceStartDateWord">Depuis</span> <span id="serviceStartDate">n/a</span><span id="serviceEndDateData"> – <span id="serviceEndDate">n/a</span></span> (<span id="serviceAge">n/a</span>)   Statut : <img id="serviceStatusImg" src="status-void.png" style="width: 25px; vertical-align: bottom;" /></div>
|
||||
<div class="content_infos" style="border: 0px solid blue; border-radius: 8px; margin: 5px;">
|
||||
Inscription :
|
||||
<img id="registrationNoneImg" src="circle-icons/global-mono.svg" class="disabled" title="Sans compte"/>
|
||||
<img id="registrationFreeImg" src="circle-icons/profile-mono.svg" class="disabled" title="Compte libre"/>
|
||||
<img id="registrationMemberImg" src="circle-icons/rgb-mono.svg" class="disabled" title="Réservé aux membres"/>
|
||||
<img id="registrationClientImg" src="circle-icons/creditcard-mono.svg" class="disabled" title="Réservé aux clients"/>
|
||||
<img id="registrationLoadImg" src="circle-icons/lock-mono.svg" class="disabled" title="Actuellement fermé"/>
|
||||
<div id="2021Charts" style="display: none;">
|
||||
<div id="2021Chart" style="width: 450px; height: 300px; display: inline-block; border: 1px solid #e7e7e7;"/>
|
||||
</div>
|
||||
<div class="content_infos" style="margin: 5px;">
|
||||
Liens :
|
||||
<a id="legalLink" href="#"><img id="legalLinkImg" src="circle-icons/ribbon.svg" class="disabled" title="Mentions légales"/></a>
|
||||
<a id="contactLink" href="#"><img id="contactLinkImg" src="circle-icons/contacts.svg" class="disabled" title="Page web de contact"/></a>
|
||||
<a id="emailLink" href="#"><img id="emailLinkImg" src="circle-icons/mail.svg" class="disabled" title="Courriel de contact/support"/></a>
|
||||
<a id="userDocLink" href="#"><img id="userDocLinkImg" src="circle-icons/bookshelf.svg" class="disabled" title="Documentation"/></a>
|
||||
<a id="technicalDocLink" href="#"><img id="technicalDocLinkImg" src="circle-icons/tools.svg" class="disabled" title="Documentation technique"/></a>
|
||||
<a id="rawCheckLink" href="#"><img id="rawCheckLinkImg" src="circle-icons/clipboard-mono.svg" title="Fichier propriétés analysé"/></a>
|
||||
<a id="rawLink" href="#"><img id="rawLinkImg" src="circle-icons/document-mono.svg" title="Fichier propriétés"/></a>
|
||||
<a id="crawlLink" href="#"><img id="crawlLinkImg" src="circle-icons/download-mono.svg" title="Statut des téléchargements"/></a>
|
||||
<a id="statsLink" href="#"><img id="statsLinkImg" src="circle-icons/barchart-mono.svg" title="Statistiques"/></a>
|
||||
<div style="display: inline-block; vertical-align: middle; font-size: smaller; margin-left: 2px; width: 35px;">
|
||||
<a id="alertLink" href="#" style="text-decoration: none;">
|
||||
<div id="errorCount" class="bg_error center" title="Propriétés en erreurs">n/a</div>
|
||||
<div id="warningCount" class="bg_warning center" title="Propriétés attendues">n/a</div>
|
||||
<div id="voidCount" class="bg_void center" title="Propriétés Inconnues">n/a</div>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="content_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>  
|
||||
<a id="softwareWebsiteLink" href="#"><img id="softwareWebsiteLinkImg" src="circle-icons/cruise.svg" class="disabled" title="Site web"/></a>
|
||||
<a id="softwareLicenseLink" href="#"><img id="softwareLicenseLinkImg" src="circle-icons/booklet.svg" class="disabled" title="Licence"/></a>
|
||||
<a id="softwareSourceLink" href="#"><img id="softwareSourceLinkImg" src="circle-icons/dev.svg" class="disabled" title="Sources"/></a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="chartZone">
|
||||
<div id="fooChart" style="width: 450px; height: 300px; display: inline-block; border: 1px solid #e7e7e7;"/>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
|
63
src/fr/devinsy/statoolinfos/htmlize/serviceHeaderView.xhtml
Normal file
63
src/fr/devinsy/statoolinfos/htmlize/serviceHeaderView.xhtml
Normal file
|
@ -0,0 +1,63 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE html>
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>StatoolInfos</title>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="keywords" content="statoolinfos,devinsy,federation" />
|
||||
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon" />
|
||||
<link rel="stylesheet" type="text/css" href="statoolinfos.css" />
|
||||
<script src="sorttable.js" />
|
||||
<script src="Chart.bundle.min.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div class="center">
|
||||
<div class="row center" style="border: 0px solid yellow;">
|
||||
<div class="column" style="border: 0px solid red;">
|
||||
<img id="serviceLogo" src="#" style="width: 100px; height: 100px;"/>
|
||||
</div>
|
||||
<div class="column" style="border: 0px solid red; max-width: 400px;">
|
||||
<div class="content_title"><a id="serviceName" href="#">Service name</a></div>
|
||||
<div class="content_subtitle"><a id="serviceURL" href="#" style="text-decoration: none;">URL n/a</a></div>
|
||||
</div>
|
||||
<p id="serviceDescription" class="center_table" style="width: 500px;">Description absente…</p>
|
||||
</div>
|
||||
|
||||
<div><span id="serviceStartDateWord">Depuis</span> <span id="serviceStartDate">n/a</span><span id="serviceEndDateData"> – <span id="serviceEndDate">n/a</span></span> (<span id="serviceAge">n/a</span>)   Statut : <img id="serviceStatusImg" src="status-void.png" style="width: 25px; vertical-align: bottom;" /></div>
|
||||
<div class="content_infos" style="border: 0px solid blue; border-radius: 8px; margin: 5px;">
|
||||
Inscription :
|
||||
<img id="registrationNoneImg" src="circle-icons/global-mono.svg" class="disabled" title="Sans compte"/>
|
||||
<img id="registrationFreeImg" src="circle-icons/profile-mono.svg" class="disabled" title="Compte libre"/>
|
||||
<img id="registrationMemberImg" src="circle-icons/rgb-mono.svg" class="disabled" title="Réservé aux membres"/>
|
||||
<img id="registrationClientImg" src="circle-icons/creditcard-mono.svg" class="disabled" title="Réservé aux clients"/>
|
||||
<img id="registrationLoadImg" src="circle-icons/lock-mono.svg" class="disabled" title="Actuellement fermé"/>
|
||||
</div>
|
||||
<div class="content_infos" style="margin: 5px;">
|
||||
Liens :
|
||||
<a id="legalLink" href="#"><img id="legalLinkImg" src="circle-icons/ribbon.svg" class="disabled" title="Mentions légales"/></a>
|
||||
<a id="contactLink" href="#"><img id="contactLinkImg" src="circle-icons/contacts.svg" class="disabled" title="Page web de contact"/></a>
|
||||
<a id="emailLink" href="#"><img id="emailLinkImg" src="circle-icons/mail.svg" class="disabled" title="Courriel de contact/support"/></a>
|
||||
<a id="userDocLink" href="#"><img id="userDocLinkImg" src="circle-icons/bookshelf.svg" class="disabled" title="Documentation"/></a>
|
||||
<a id="technicalDocLink" href="#"><img id="technicalDocLinkImg" src="circle-icons/tools.svg" class="disabled" title="Documentation technique"/></a>
|
||||
<a id="rawCheckLink" href="#"><img id="rawCheckLinkImg" src="circle-icons/clipboard-mono.svg" title="Fichier propriétés analysé"/></a>
|
||||
<a id="rawLink" href="#"><img id="rawLinkImg" src="circle-icons/document-mono.svg" title="Fichier propriétés"/></a>
|
||||
<a id="crawlLink" href="#"><img id="crawlLinkImg" src="circle-icons/download-mono.svg" title="Statut des téléchargements"/></a>
|
||||
<a id="statsLink" href="#"><img id="statsLinkImg" src="circle-icons/barchart-mono.svg" title="Statistiques"/></a>
|
||||
<div style="display: inline-block; vertical-align: middle; font-size: smaller; margin-left: 2px; width: 35px;">
|
||||
<a id="alertLink" href="#" style="text-decoration: none;">
|
||||
<div id="errorCount" class="bg_error center" title="Propriétés en erreurs">n/a</div>
|
||||
<div id="warningCount" class="bg_warning center" title="Propriétés attendues">n/a</div>
|
||||
<div id="voidCount" class="bg_void center" title="Propriétés Inconnues">n/a</div>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="content_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>  
|
||||
<a id="softwareWebsiteLink" href="#"><img id="softwareWebsiteLinkImg" src="circle-icons/cruise.svg" class="disabled" title="Site web"/></a>
|
||||
<a id="softwareLicenseLink" href="#"><img id="softwareLicenseLinkImg" src="circle-icons/booklet.svg" class="disabled" title="Licence"/></a>
|
||||
<a id="softwareSourceLink" href="#"><img id="softwareSourceLinkImg" src="circle-icons/dev.svg" class="disabled" title="Sources"/></a>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,99 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE html>
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>StatoolInfos</title>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="keywords" content="statoolinfos,devinsy,federation" />
|
||||
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon" />
|
||||
<link rel="stylesheet" type="text/css" href="statoolinfos.css" />
|
||||
<script src="sorttable.js" />
|
||||
<script src="Chart.bundle.min.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div>
|
||||
<div style="margin: 5px;">
|
||||
<span style="display: inline-block; width: 100px">Catégorie</span>
|
||||
<a onclick="javascript:selectCategoryMenu('summary');" href="#" id="summaryCategoryButton" class="button">Résumé</a>
|
||||
<a onclick="javascript:selectCategoryMenu('generic');" href="#" id="genericCategoryButton" class="button">Générique</a>
|
||||
<a onclick="javascript:selectCategoryMenu('web');" href="#" id="webCategoryButton" class="button">Web</a>
|
||||
<a onclick="javascript:selectCategoryMenu('specific');" href="#" id="specificCategoryButton" class="button">Spécifiques</a>
|
||||
</div>
|
||||
<div style="margin: 5px;">
|
||||
<span style="display: inline-block; width: 100px">Période</span>
|
||||
<a onclick="javascript:selectPeriodMenu('full');" href="#" id="fullPeriodButton" class="button">Full</a>
|
||||
<a onclick="javascript:selectPeriodMenu('last');" href="#" id="lastPeriodButton" class="button selected">12 mois</a>
|
||||
<a onclick="javascript:selectPeriodMenu('2020');" href="#" id="2020PeriodButton" class="button">2020</a>
|
||||
<a onclick="javascript:selectPeriodMenu('2021');" href="#" id="2021PeriodButton" class="button">2021</a>
|
||||
</div>
|
||||
<div style="margin: 5px;">
|
||||
<span style="display: inline-block; width: 100px">Vue</span>
|
||||
<a onclick="javascript:createClosedSelect('years');" href="#" id="yearViewButton" class="button">Années</a>
|
||||
<a onclick="javascript:createClosedSelect('months');" href="#" id="monthViewButton" class="button selected">Mois</a>
|
||||
<a onclick="javascript:createClosedSelect('weekds');" href="#" id="weekViewButton" class="button">Semaines</a>
|
||||
<a onclick="javascript:createClosedSelect('days');" href="#" id="dayViewButton" class="button">Jours</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
function selectCategoryMenu(selection)
|
||||
{
|
||||
document.getElementById ('summaryCategoryButton').classList.remove('selected');
|
||||
document.getElementById ('genericCategoryButton').classList.remove('selected');
|
||||
document.getElementById ('webCategoryButton').classList.remove('selected');
|
||||
document.getElementById ('specificCategoryButton').classList.remove('selected');
|
||||
|
||||
if (selection == 'summary')
|
||||
{
|
||||
document.getElementById ('summaryCategoryButton').classList.add('selected');
|
||||
}
|
||||
else if (selection == 'generic')
|
||||
{
|
||||
document.getElementById ('genericCategoryButton').classList.add('selected');
|
||||
}
|
||||
else if (selection == 'web')
|
||||
{
|
||||
document.getElementById ('webCategoryButton').classList.add('selected');
|
||||
}
|
||||
else if (selection == 'specific')
|
||||
{
|
||||
document.getElementById ('specificCategoryButton').classList.add('selected');
|
||||
}
|
||||
}
|
||||
|
||||
function selectPeriodMenu(selection)
|
||||
{
|
||||
document.getElementById('fullCharts').style.display = 'none';
|
||||
document.getElementById('lastCharts').style.display = 'none';
|
||||
document.getElementById('2020Charts').style.display = 'none';
|
||||
document.getElementById('2021Charts').style.display = 'none';
|
||||
|
||||
document.getElementById('fullPeriodButton').classList.remove('selected');
|
||||
document.getElementById('lastPeriodButton').classList.remove('selected');
|
||||
document.getElementById('2020PeriodButton').classList.remove('selected');
|
||||
document.getElementById('2021PeriodButton').classList.remove('selected');
|
||||
|
||||
if (selection == 'full')
|
||||
{
|
||||
document.getElementById('fullPeriodButton').classList.add('selected');
|
||||
document.getElementById('fullCharts').style.display = 'block';
|
||||
}
|
||||
else if (selection == 'last')
|
||||
{
|
||||
document.getElementById('lastPeriodButton').classList.add('selected');
|
||||
document.getElementById('lastCharts').style.display = 'block';
|
||||
}
|
||||
else if (selection == '2020')
|
||||
{
|
||||
document.getElementById('2020PeriodButton').classList.add('selected');
|
||||
document.getElementById('2020Charts').style.display = 'block';
|
||||
}
|
||||
else if (selection == '2021')
|
||||
{
|
||||
document.getElementById('2021PeriodButton').classList.add('selected');
|
||||
document.getElementById('2021Charts').style.display = 'block';
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in a new issue