Refactored stats menu in organization and service.
This commit is contained in:
parent
ddf4132386
commit
b4b01f5610
17 changed files with 276 additions and 187 deletions
|
@ -37,8 +37,8 @@ public class OrganizationMetricMenuView
|
|||
|
||||
public enum MenuItem
|
||||
{
|
||||
SUMMARY,
|
||||
GENERAL,
|
||||
SUMMARY,
|
||||
GENERIC,
|
||||
WEB,
|
||||
SPECIFIC
|
||||
|
@ -61,20 +61,20 @@ public class OrganizationMetricMenuView
|
|||
{
|
||||
TagDataManager data = new TagDataManager();
|
||||
|
||||
data.setAttribute("summaryTypeButton", "href", organization.getTechnicalName() + "-stats.xhtml");
|
||||
data.setAttribute("generalTypeButton", "href", organization.getTechnicalName() + "-stats-general.xhtml");
|
||||
data.setAttribute("generalTypeButton", "href", organization.getTechnicalName() + "-stats.xhtml");
|
||||
data.setAttribute("summaryTypeButton", "href", organization.getTechnicalName() + "-stats-summarymetrics.xhtml");
|
||||
data.setAttribute("genericTypeButton", "href", organization.getTechnicalName() + "-stats-genericmetrics.xhtml");
|
||||
data.setAttribute("webTypeButton", "href", organization.getTechnicalName() + "-stats-webmetrics.xhtml");
|
||||
data.setAttribute("specificTypeButton", "href", organization.getTechnicalName() + "-stats-specificmetrics.xhtml");
|
||||
|
||||
if ((item == null) || (item == MenuItem.SUMMARY))
|
||||
{
|
||||
data.appendAttribute("summaryTypeButton", "class", "button selected");
|
||||
}
|
||||
else if (item == MenuItem.GENERAL)
|
||||
if ((item == null) || (item == MenuItem.GENERAL))
|
||||
{
|
||||
data.appendAttribute("generalTypeButton", "class", "button selected");
|
||||
}
|
||||
else if (item == MenuItem.SUMMARY)
|
||||
{
|
||||
data.appendAttribute("summaryTypeButton", "class", "button selected");
|
||||
}
|
||||
else if (item == MenuItem.GENERIC)
|
||||
{
|
||||
data.appendAttribute("genericTypeButton", "class", "button selected");
|
||||
|
|
|
@ -77,9 +77,9 @@ public class OrganizationPage
|
|||
page = OrganizationStatsPage.htmlize(organization);
|
||||
FileUtils.write(new File(htmlizeDirectory, organization.getLocalFileBaseName() + "-stats.xhtml"), page, StandardCharsets.UTF_8);
|
||||
|
||||
logger.info("Htmlize organization general metric page: {}.", organization.getName());
|
||||
page = OrganizationGeneralStatsPage.htmlize(organization);
|
||||
FileUtils.write(new File(htmlizeDirectory, organization.getLocalFileBaseName() + "-stats-general.xhtml"), page, StandardCharsets.UTF_8);
|
||||
logger.info("Htmlize organization summarty metric page: {}.", organization.getName());
|
||||
page = OrganizationSummaryStatsPage.htmlize(organization);
|
||||
FileUtils.write(new File(htmlizeDirectory, organization.getLocalFileBaseName() + "-stats-summarymetrics.xhtml"), page, StandardCharsets.UTF_8);
|
||||
|
||||
logger.info("Htmlize organization generic metric page: {}.", organization.getName());
|
||||
page = OrganizationGenericMetricPage.htmlize(organization);
|
||||
|
|
|
@ -20,7 +20,6 @@ package fr.devinsy.statoolinfos.htmlize;
|
|||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.time.YearMonth;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
@ -29,8 +28,8 @@ import fr.devinsy.statoolinfos.HtmlizerContext;
|
|||
import fr.devinsy.statoolinfos.core.Organization;
|
||||
import fr.devinsy.statoolinfos.core.StatoolInfosException;
|
||||
import fr.devinsy.statoolinfos.htmlize.OrganizationMetricMenuView.MenuItem;
|
||||
import fr.devinsy.statoolinfos.htmlize.charts.ChartColor;
|
||||
import fr.devinsy.statoolinfos.htmlize.charts.MonthValues;
|
||||
import fr.devinsy.statoolinfos.stats.StatAgent;
|
||||
import fr.devinsy.statoolinfos.stats.services.RegistrationStats;
|
||||
import fr.devinsy.xidyn.XidynException;
|
||||
import fr.devinsy.xidyn.data.TagDataManager;
|
||||
import fr.devinsy.xidyn.presenters.PresenterUtils;
|
||||
|
@ -67,32 +66,32 @@ public class OrganizationStatsPage
|
|||
|
||||
//
|
||||
data.setContent("headerView", OrganizationHeaderView.htmlize(organization));
|
||||
data.setContent("metricMenuView", OrganizationMetricMenuView.htmlize(organization, MenuItem.SUMMARY));
|
||||
data.setContent("metricMenuView", OrganizationMetricMenuView.htmlize(organization, MenuItem.GENERAL));
|
||||
|
||||
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) };
|
||||
//
|
||||
data.setContent("serviceCountYearChart", ChartHtmlizer.htmlizeServiceCountYearChart(organization));
|
||||
data.setContent("serviceDateStatusChart", ChartHtmlizer.htmlizeServiceDateStatusChart(organization.getServices()));
|
||||
|
||||
for (int index = 0; index < tagIds.length; index++)
|
||||
data.setContent("turnoutChart", ChartHtmlizer.htmlizeOrganizationTurnoutChart(organization));
|
||||
|
||||
data.setContent("hostServerTypeChart", ChartHtmlizer.htmlizeHostServerTypeChart(organization.getServices()));
|
||||
data.setContent("hostProviderTypeChart", ChartHtmlizer.htmlizeHostProviderTypeChart(organization.getServices()));
|
||||
data.setContent("serviceInstallTypeChart", ChartHtmlizer.htmlizeServiceInstallTypeChart(organization.getServices()));
|
||||
data.setContent("serviceCountryChart", ChartHtmlizer.htmlizeServiceCountryChart(organization.getServices()));
|
||||
|
||||
//
|
||||
{
|
||||
String tagId = tagIds[index];
|
||||
YearMonth start = starts[index];
|
||||
YearMonth end = ends[index];
|
||||
RegistrationStats stats = StatAgent.statRegistrationTypes(organization.getServices());
|
||||
|
||||
int graphicIndex = 0;
|
||||
|
||||
MonthValues metric = organization.getMetricMonthValuesAll("metrics.http.hits.visitors");
|
||||
data.setContent(tagId, graphicIndex++, ChartHtmlizer.htmlizeMetricsChart(start, end, metric, ChartColor.GREEN));
|
||||
|
||||
metric = organization.getMetricMonthValuesAll("metrics.http.ip.visitors");
|
||||
data.setContent(tagId, graphicIndex++, ChartHtmlizer.htmlizeMetricsChart(start, end, metric, ChartColor.GREEN));
|
||||
|
||||
metric = organization.getMetricMonthValuesAll("metrics.http.visits.visitors");
|
||||
data.setContent(tagId, graphicIndex++, ChartHtmlizer.htmlizeMetricsChart(start, end, metric, ChartColor.GREEN));
|
||||
data.setContent("registrationTypeChart", ChartHtmlizer.htmlizeRegistrationBarChart(stats));
|
||||
data.setContent("registrationNoneTypeChart", ChartHtmlizer.htmlizeRegistrationNonePieChart(stats));
|
||||
data.setContent("registrationFreeTypeChart", ChartHtmlizer.htmlizeRegistrationFreePieChart(stats));
|
||||
data.setContent("registrationMemberTypeChart", ChartHtmlizer.htmlizeRegistrationMemberPieChart(stats));
|
||||
data.setContent("registrationClientTypeChart", ChartHtmlizer.htmlizeRegistrationClientPieChart(stats));
|
||||
}
|
||||
|
||||
//
|
||||
String content = PresenterUtils.dynamize("/fr/devinsy/statoolinfos/htmlize/organizationMetricView.xhtml", data).toString();
|
||||
String content = PresenterUtils.dynamize("/fr/devinsy/statoolinfos/htmlize/organizationStatsView.xhtml", data).toString();
|
||||
|
||||
//
|
||||
BreadcrumbTrail trail = new BreadcrumbTrail();
|
||||
|
|
|
@ -20,6 +20,7 @@ package fr.devinsy.statoolinfos.htmlize;
|
|||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.time.YearMonth;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
@ -28,8 +29,8 @@ import fr.devinsy.statoolinfos.HtmlizerContext;
|
|||
import fr.devinsy.statoolinfos.core.Organization;
|
||||
import fr.devinsy.statoolinfos.core.StatoolInfosException;
|
||||
import fr.devinsy.statoolinfos.htmlize.OrganizationMetricMenuView.MenuItem;
|
||||
import fr.devinsy.statoolinfos.stats.StatAgent;
|
||||
import fr.devinsy.statoolinfos.stats.services.RegistrationStats;
|
||||
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;
|
||||
|
@ -37,9 +38,9 @@ import fr.devinsy.xidyn.presenters.PresenterUtils;
|
|||
/**
|
||||
* The Class OrganizationGeneralStatsPage.
|
||||
*/
|
||||
public class OrganizationGeneralStatsPage
|
||||
public class OrganizationSummaryStatsPage
|
||||
{
|
||||
private static Logger logger = LoggerFactory.getLogger(OrganizationGeneralStatsPage.class);
|
||||
private static Logger logger = LoggerFactory.getLogger(OrganizationSummaryStatsPage.class);
|
||||
|
||||
/**
|
||||
* Htmlize.
|
||||
|
@ -58,7 +59,7 @@ public class OrganizationGeneralStatsPage
|
|||
|
||||
try
|
||||
{
|
||||
logger.debug("Building organization general page {}…");
|
||||
logger.debug("Building organization summary page {}…");
|
||||
|
||||
File htmlizeDirectory = HtmlizerContext.instance().getHtmlizeDirectory();
|
||||
|
||||
|
@ -68,30 +69,30 @@ public class OrganizationGeneralStatsPage
|
|||
data.setContent("headerView", OrganizationHeaderView.htmlize(organization));
|
||||
data.setContent("metricMenuView", OrganizationMetricMenuView.htmlize(organization, MenuItem.SUMMARY));
|
||||
|
||||
//
|
||||
data.setContent("serviceCountYearChart", ChartHtmlizer.htmlizeServiceCountYearChart(organization));
|
||||
data.setContent("serviceDateStatusChart", ChartHtmlizer.htmlizeServiceDateStatusChart(organization.getServices()));
|
||||
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) };
|
||||
|
||||
data.setContent("turnoutChart", ChartHtmlizer.htmlizeOrganizationTurnoutChart(organization));
|
||||
|
||||
data.setContent("hostServerTypeChart", ChartHtmlizer.htmlizeHostServerTypeChart(organization.getServices()));
|
||||
data.setContent("hostProviderTypeChart", ChartHtmlizer.htmlizeHostProviderTypeChart(organization.getServices()));
|
||||
data.setContent("serviceInstallTypeChart", ChartHtmlizer.htmlizeServiceInstallTypeChart(organization.getServices()));
|
||||
data.setContent("serviceCountryChart", ChartHtmlizer.htmlizeServiceCountryChart(organization.getServices()));
|
||||
|
||||
//
|
||||
for (int index = 0; index < tagIds.length; index++)
|
||||
{
|
||||
RegistrationStats stats = StatAgent.statRegistrationTypes(organization.getServices());
|
||||
String tagId = tagIds[index];
|
||||
YearMonth start = starts[index];
|
||||
YearMonth end = ends[index];
|
||||
|
||||
data.setContent("registrationTypeChart", ChartHtmlizer.htmlizeRegistrationBarChart(stats));
|
||||
data.setContent("registrationNoneTypeChart", ChartHtmlizer.htmlizeRegistrationNonePieChart(stats));
|
||||
data.setContent("registrationFreeTypeChart", ChartHtmlizer.htmlizeRegistrationFreePieChart(stats));
|
||||
data.setContent("registrationMemberTypeChart", ChartHtmlizer.htmlizeRegistrationMemberPieChart(stats));
|
||||
data.setContent("registrationClientTypeChart", ChartHtmlizer.htmlizeRegistrationClientPieChart(stats));
|
||||
int graphicIndex = 0;
|
||||
|
||||
MonthValues metric = organization.getMetricMonthValuesAll("metrics.http.hits.visitors");
|
||||
data.setContent(tagId, graphicIndex++, ChartHtmlizer.htmlizeMetricsChart(start, end, metric, ChartColor.GREEN));
|
||||
|
||||
metric = organization.getMetricMonthValuesAll("metrics.http.ip.visitors");
|
||||
data.setContent(tagId, graphicIndex++, ChartHtmlizer.htmlizeMetricsChart(start, end, metric, ChartColor.GREEN));
|
||||
|
||||
metric = organization.getMetricMonthValuesAll("metrics.http.visits.visitors");
|
||||
data.setContent(tagId, graphicIndex++, ChartHtmlizer.htmlizeMetricsChart(start, end, metric, ChartColor.GREEN));
|
||||
}
|
||||
|
||||
//
|
||||
String content = PresenterUtils.dynamize("/fr/devinsy/statoolinfos/htmlize/organizationGeneralStatsView.xhtml", data).toString();
|
||||
String content = PresenterUtils.dynamize("/fr/devinsy/statoolinfos/htmlize/organizationMetricView.xhtml", data).toString();
|
||||
|
||||
//
|
||||
BreadcrumbTrail trail = new BreadcrumbTrail();
|
||||
|
@ -100,7 +101,7 @@ public class OrganizationGeneralStatsPage
|
|||
}
|
||||
catch (XidynException exception)
|
||||
{
|
||||
throw new StatoolInfosException("Error building organization general page: " + exception.getMessage(), exception);
|
||||
throw new StatoolInfosException("Error building organization summary page: " + exception.getMessage(), exception);
|
||||
}
|
||||
|
||||
//
|
|
@ -50,19 +50,19 @@ public class ServiceGenericMetricPage
|
|||
|
||||
try
|
||||
{
|
||||
logger.debug("Building service page {}…", service.get("service.name"));
|
||||
logger.debug("Building service generic metrics view {}…", service.get("service.name"));
|
||||
|
||||
TagDataManager data = new TagDataManager();
|
||||
|
||||
//
|
||||
data.setContent("headerView", ServiceHeaderView.htmlize(service));
|
||||
data.setContent("serviceMetricMenuView", ServiceMetricMenuView.htmlize(service, MenuItem.GENERIC));
|
||||
data.setContent("metricMenuView", ServiceMetricMenuView.htmlize(service, MenuItem.GENERIC));
|
||||
|
||||
//
|
||||
int graphicIndex = 0;
|
||||
|
||||
//
|
||||
String content = PresenterUtils.dynamize("/fr/devinsy/statoolinfos/htmlize/service.xhtml", data).toString();
|
||||
String content = PresenterUtils.dynamize("/fr/devinsy/statoolinfos/htmlize/serviceMetricView.xhtml", data).toString();
|
||||
|
||||
BreadcrumbTrail trail = new BreadcrumbTrail();
|
||||
trail.add(service.getOrganization().getName(), service.getOrganization().getTechnicalName() + ".xhtml");
|
||||
|
@ -71,7 +71,7 @@ public class ServiceGenericMetricPage
|
|||
}
|
||||
catch (XidynException exception)
|
||||
{
|
||||
throw new StatoolInfosException("Error building service page: " + exception.getMessage(), exception);
|
||||
throw new StatoolInfosException("Error building service generic metric view: " + exception.getMessage(), exception);
|
||||
}
|
||||
|
||||
//
|
||||
|
|
|
@ -37,10 +37,10 @@ public class ServiceMetricMenuView
|
|||
|
||||
public enum MenuItem
|
||||
{
|
||||
SUMMARY,
|
||||
GENERAL,
|
||||
GENERIC,
|
||||
SUMMARY,
|
||||
WEB,
|
||||
GENERIC,
|
||||
SPECIFIC
|
||||
}
|
||||
|
||||
|
@ -61,20 +61,20 @@ public class ServiceMetricMenuView
|
|||
{
|
||||
TagDataManager data = new TagDataManager();
|
||||
|
||||
data.setAttribute("summaryTypeButton", "href", service.getOrganization().getTechnicalName() + "-" + service.getTechnicalName() + ".xhtml");
|
||||
data.setAttribute("generalTypeButton", "href", service.getOrganization().getTechnicalName() + "-" + service.getTechnicalName() + "-metrics-general.xhtml");
|
||||
data.setAttribute("genericTypeButton", "href", service.getOrganization().getTechnicalName() + "-" + service.getTechnicalName() + "-metrics-generic.xhtml");
|
||||
data.setAttribute("webTypeButton", "href", service.getOrganization().getTechnicalName() + "-" + service.getTechnicalName() + "-metrics-web.xhtml");
|
||||
data.setAttribute("specificTypeButton", "href", service.getOrganization().getTechnicalName() + "-" + service.getTechnicalName() + "-metrics-specific.xhtml");
|
||||
data.setAttribute("generalTypeButton", "href", service.getOrganization().getTechnicalName() + "-" + service.getTechnicalName() + ".xhtml");
|
||||
data.setAttribute("summaryTypeButton", "href", service.getOrganization().getTechnicalName() + "-" + service.getTechnicalName() + "-stats-summarymetrics.xhtml");
|
||||
data.setAttribute("genericTypeButton", "href", service.getOrganization().getTechnicalName() + "-" + service.getTechnicalName() + "-stats-genericmetrics.xhtml");
|
||||
data.setAttribute("webTypeButton", "href", service.getOrganization().getTechnicalName() + "-" + service.getTechnicalName() + "-stats-webmetrics.xhtml");
|
||||
data.setAttribute("specificTypeButton", "href", service.getOrganization().getTechnicalName() + "-" + service.getTechnicalName() + "-stats-specificmetrics.xhtml");
|
||||
|
||||
if ((item == null) || (item == MenuItem.SUMMARY))
|
||||
{
|
||||
data.appendAttribute("summaryTypeButton", "class", "button selected");
|
||||
}
|
||||
else if (item == MenuItem.GENERAL)
|
||||
if ((item == null) || (item == MenuItem.GENERAL))
|
||||
{
|
||||
data.appendAttribute("generalTypeButton", "class", "button selected");
|
||||
}
|
||||
else if (item == MenuItem.SUMMARY)
|
||||
{
|
||||
data.appendAttribute("summaryTypeButton", "class", "button selected");
|
||||
}
|
||||
else if (item == MenuItem.GENERIC)
|
||||
{
|
||||
data.appendAttribute("genericTypeButton", "class", "button selected");
|
||||
|
|
|
@ -21,7 +21,6 @@ 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.slf4j.Logger;
|
||||
|
@ -33,9 +32,6 @@ import fr.devinsy.statoolinfos.core.Metrics;
|
|||
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.TagDataManager;
|
||||
import fr.devinsy.xidyn.presenters.PresenterUtils;
|
||||
|
@ -80,22 +76,22 @@ public class ServicePage
|
|||
FileUtils.write(new File(htmlizeDirectory, service.getLocalFileBaseName() + ".xhtml"), page, StandardCharsets.UTF_8);
|
||||
|
||||
//
|
||||
logger.info("Htmlize service general metric page: {}.", service.getName());
|
||||
page = ServiceStatsPage.htmlize(service);
|
||||
FileUtils.write(new File(htmlizeDirectory, service.getLocalFileBaseName() + "-metrics-general.xhtml"), page, StandardCharsets.UTF_8);
|
||||
logger.info("Htmlize service summary metric page: {}.", service.getName());
|
||||
page = ServiceSummaryMetricPage.htmlize(service);
|
||||
FileUtils.write(new File(htmlizeDirectory, service.getLocalFileBaseName() + "-stats-summarymetrics.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);
|
||||
FileUtils.write(new File(htmlizeDirectory, service.getLocalFileBaseName() + "-stats-genericmetrics.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);
|
||||
FileUtils.write(new File(htmlizeDirectory, service.getLocalFileBaseName() + "-stats-webmetrics.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);
|
||||
FileUtils.write(new File(htmlizeDirectory, service.getLocalFileBaseName() + "-stats-specificmetrics.xhtml"), page, StandardCharsets.UTF_8);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -135,7 +131,7 @@ public class ServicePage
|
|||
|
||||
//
|
||||
data.setContent("headerView", ServiceHeaderView.htmlize(service));
|
||||
data.setContent("serviceMetricMenuView", ServiceMetricMenuView.htmlize(service, MenuItem.SUMMARY));
|
||||
data.setContent("statsView", ServiceStatsView.htmlize(service));
|
||||
|
||||
//
|
||||
// data.setContent("fooChart", graphicIndex++,
|
||||
|
@ -143,28 +139,6 @@ public class ServicePage
|
|||
|
||||
// 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.visitors");
|
||||
data.setContent(tagId, graphicIndex++, ChartHtmlizer.htmlizeMetricsChart(start, end, metric, ChartColor.GREEN));
|
||||
|
||||
metric = service.getMetricMonthValues("metrics.http.ip.visitors");
|
||||
data.setContent(tagId, graphicIndex++, ChartHtmlizer.htmlizeMetricsChart(start, end, metric, ChartColor.GREEN));
|
||||
|
||||
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();
|
||||
|
||||
|
|
|
@ -50,19 +50,19 @@ public class ServiceSpecificMetricPage
|
|||
|
||||
try
|
||||
{
|
||||
logger.debug("Building service specific page {}…", service.get("service.name"));
|
||||
logger.debug("Building service specific metric view {}…", service.get("service.name"));
|
||||
|
||||
TagDataManager data = new TagDataManager();
|
||||
|
||||
//
|
||||
data.setContent("headerView", ServiceHeaderView.htmlize(service));
|
||||
data.setContent("serviceMetricMenuView", ServiceMetricMenuView.htmlize(service, MenuItem.SPECIFIC));
|
||||
data.setContent("metricMenuView", ServiceMetricMenuView.htmlize(service, MenuItem.SPECIFIC));
|
||||
|
||||
//
|
||||
int graphicIndex = 0;
|
||||
|
||||
//
|
||||
String content = PresenterUtils.dynamize("/fr/devinsy/statoolinfos/htmlize/service.xhtml", data).toString();
|
||||
String content = PresenterUtils.dynamize("/fr/devinsy/statoolinfos/htmlize/serviceMetricView.xhtml", data).toString();
|
||||
|
||||
BreadcrumbTrail trail = new BreadcrumbTrail();
|
||||
trail.add(service.getOrganization().getName(), service.getOrganization().getTechnicalName() + ".xhtml");
|
||||
|
@ -71,7 +71,7 @@ public class ServiceSpecificMetricPage
|
|||
}
|
||||
catch (XidynException exception)
|
||||
{
|
||||
throw new StatoolInfosException("Error building service page: " + exception.getMessage(), exception);
|
||||
throw new StatoolInfosException("Error building service specific metrics view: " + exception.getMessage(), exception);
|
||||
}
|
||||
|
||||
//
|
||||
|
|
|
@ -30,13 +30,14 @@ import fr.devinsy.statoolinfos.stats.services.RegistrationStats;
|
|||
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 ServiceStatsPage.
|
||||
*/
|
||||
public class ServiceStatsPage
|
||||
public class ServiceStatsView
|
||||
{
|
||||
private static Logger logger = LoggerFactory.getLogger(ServiceStatsPage.class);
|
||||
private static Logger logger = LoggerFactory.getLogger(ServiceStatsView.class);
|
||||
|
||||
/**
|
||||
* Builds the.
|
||||
|
@ -53,13 +54,12 @@ public class ServiceStatsPage
|
|||
|
||||
try
|
||||
{
|
||||
logger.debug("Building service stats page {}…", service.get("service.name"));
|
||||
logger.debug("Building service stats view {}…", service.get("service.name"));
|
||||
|
||||
TagDataManager data = new TagDataManager();
|
||||
|
||||
//
|
||||
data.setContent("headerView", ServiceHeaderView.htmlize(service));
|
||||
data.setContent("serviceMetricMenuView", ServiceMetricMenuView.htmlize(service, MenuItem.GENERAL));
|
||||
data.setContent("metricMenuView", ServiceMetricMenuView.htmlize(service, MenuItem.GENERAL));
|
||||
|
||||
//
|
||||
data.setContent("turnoutChart", ChartHtmlizer.htmlizeOrganizationTurnoutChart(service));
|
||||
|
@ -86,16 +86,13 @@ public class ServiceStatsPage
|
|||
data.setContent("serviceDateStatusChart", ChartHtmlizer.htmlizeServiceDateStatusChart(mock));
|
||||
|
||||
//
|
||||
String content = PresenterUtils.dynamize("/fr/devinsy/statoolinfos/htmlize/serviceStats.xhtml", data).toString();
|
||||
String content = PresenterUtils.dynamize("/fr/devinsy/statoolinfos/htmlize/serviceStatsView.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);
|
||||
result = XidynUtils.extractBodyContent(content);
|
||||
}
|
||||
catch (XidynException exception)
|
||||
{
|
||||
throw new StatoolInfosException("Error building service page: " + exception.getMessage(), exception);
|
||||
throw new StatoolInfosException("Error building service view: " + exception.getMessage(), exception);
|
||||
}
|
||||
|
||||
//
|
|
@ -0,0 +1,104 @@
|
|||
/*
|
||||
* 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 ServiceSummaryMetricPage.
|
||||
*/
|
||||
public class ServiceSummaryMetricPage
|
||||
{
|
||||
private static Logger logger = LoggerFactory.getLogger(ServiceSummaryMetricPage.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 summary view {}…", service.get("service.name"));
|
||||
|
||||
TagDataManager data = new TagDataManager();
|
||||
|
||||
//
|
||||
data.setContent("headerView", ServiceHeaderView.htmlize(service));
|
||||
data.setContent("metricMenuView", ServiceMetricMenuView.htmlize(service, MenuItem.SUMMARY));
|
||||
|
||||
//
|
||||
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.visitors");
|
||||
data.setContent(tagId, graphicIndex++, ChartHtmlizer.htmlizeMetricsChart(start, end, metric, ChartColor.GREEN));
|
||||
|
||||
metric = service.getMetricMonthValues("metrics.http.ip.visitors");
|
||||
data.setContent(tagId, graphicIndex++, ChartHtmlizer.htmlizeMetricsChart(start, end, metric, ChartColor.GREEN));
|
||||
|
||||
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/serviceMetricView.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 summary metrics view: " + exception.getMessage(), exception);
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
}
|
|
@ -60,7 +60,7 @@ public class ServiceWebMetricPage
|
|||
|
||||
//
|
||||
data.setContent("headerView", ServiceHeaderView.htmlize(service));
|
||||
data.setContent("serviceMetricMenuView", ServiceMetricMenuView.htmlize(service, MenuItem.WEB));
|
||||
data.setContent("metricMenuView", ServiceMetricMenuView.htmlize(service, MenuItem.WEB));
|
||||
|
||||
// service.getPrefixes();
|
||||
|
||||
|
@ -138,7 +138,7 @@ public class ServiceWebMetricPage
|
|||
}
|
||||
|
||||
//
|
||||
String content = PresenterUtils.dynamize("/fr/devinsy/statoolinfos/htmlize/service.xhtml", data).toString();
|
||||
String content = PresenterUtils.dynamize("/fr/devinsy/statoolinfos/htmlize/serviceMetricView.xhtml", data).toString();
|
||||
|
||||
BreadcrumbTrail trail = new BreadcrumbTrail();
|
||||
trail.add(service.getOrganization().getName(), service.getOrganization().getTechnicalName() + ".xhtml");
|
||||
|
|
|
@ -14,8 +14,8 @@
|
|||
<div>
|
||||
<div style="margin: 5px;">
|
||||
<span style="display: inline-block; width: 100px">Type</span>
|
||||
<a onclick="javascript:selectTypeMenu('summary');" href="#" id="summaryTypeButton" class="button">Résumé</a>
|
||||
<a onclick="javascript:selectTypeMenu('general');" href="#" id="generalTypeButton" class="button">Général</a>
|
||||
<a onclick="javascript:selectTypeMenu('summary');" href="#" id="summaryTypeButton" class="button">Résumé</a>
|
||||
<a onclick="javascript:selectTypeMenu('generic');" href="#" id="genericTypeButton" class="button">Génériques</a>
|
||||
<a onclick="javascript:selectTypeMenu('web');" href="#" id="webTypeButton" class="button">Web</a>
|
||||
<a onclick="javascript:selectTypeMenu('specific');" href="#" id="specificTypeButton" class="button">Spécifiques</a>
|
||||
|
|
|
@ -12,20 +12,6 @@
|
|||
</head>
|
||||
<body>
|
||||
<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 id="lastCharts" style="display: block;">
|
||||
<div id="lastChart" style="width: 450px; height: 300px; display: inline-block; border: 1px solid #e7e7e7;"/>
|
||||
</div>
|
||||
<div id="2020Charts" style="display: none;">
|
||||
<div id="2020Chart" style="width: 450px; height: 300px; display: inline-block; border: 1px solid #e7e7e7;"/>
|
||||
</div>
|
||||
<div id="2021Charts" style="display: none;">
|
||||
<div id="2021Chart" style="width: 450px; height: 300px; display: inline-block; border: 1px solid #e7e7e7;"/>
|
||||
</div>
|
||||
</div>
|
||||
<div id="statsView" />
|
||||
</body>
|
||||
</html>
|
||||
|
|
31
src/fr/devinsy/statoolinfos/htmlize/serviceMetricView.xhtml
Normal file
31
src/fr/devinsy/statoolinfos/htmlize/serviceMetricView.xhtml
Normal file
|
@ -0,0 +1,31 @@
|
|||
<?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 id="headerView" />
|
||||
<div id="metricZone">
|
||||
<div id="metricMenuView" />
|
||||
<div id="fullCharts" style="display: none;">
|
||||
<div id="fullChart" style="width: 450px; height: 300px; display: inline-block; border: 1px solid #e7e7e7;"/>
|
||||
</div>
|
||||
<div id="lastCharts" style="display: block;">
|
||||
<div id="lastChart" style="width: 450px; height: 300px; display: inline-block; border: 1px solid #e7e7e7;"/>
|
||||
</div>
|
||||
<div id="2020Charts" style="display: none;">
|
||||
<div id="2020Chart" style="width: 450px; height: 300px; display: inline-block; border: 1px solid #e7e7e7;"/>
|
||||
</div>
|
||||
<div id="2021Charts" style="display: none;">
|
||||
<div id="2021Chart" style="width: 450px; height: 300px; display: inline-block; border: 1px solid #e7e7e7;"/>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -1,48 +0,0 @@
|
|||
<?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 id="headerView" />
|
||||
<div id="metricZone">
|
||||
<!-- h2 id="title" class="center">Statistiques</h2-->
|
||||
<div id="serviceMetricMenuView" />
|
||||
<div>
|
||||
<div>
|
||||
<div id="turnoutChart" class="chartborder" style="width: 250px; height: 200px; display: inline-block;"/>
|
||||
</div>
|
||||
<div>
|
||||
<div id="hostServerTypeChart" class="chartborder" style="width: 250px; height: 200px; display: inline-block;"/>
|
||||
<div id="hostProviderTypeChart" class="chartborder" style="width: 250px; height: 200px; display: inline-block;"/>
|
||||
<div id="serviceInstallTypeChart" class="chartborder" style="width: 250px; height: 230px; display: inline-block; vertical-align: top;"/>
|
||||
<div id="serviceCountryChart" class="chartborder" style="width: 250px; height: 200px; display: inline-block;"/>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div id="registrationTypeChart" class="column chartborder" style="width: 250px; height: 200px; display: inline-block;"/>
|
||||
<div class="column">
|
||||
<div class="row">
|
||||
<div id="registrationNoneTypeChart" class="chartborder" style="width: 122px; height: 97px; display: inline-block;"/>
|
||||
<div id="registrationFreeTypeChart" class="chartborder" style="width: 122px; height: 97px; display: inline-block;"/>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div id="registrationMemberTypeChart" class="chartborder" style="width: 122px; height: 97px; display: inline-block;"/>
|
||||
<div id="registrationClientTypeChart" class="chartborder" style="width: 122px; height: 97px; display: inline-block;"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<div id="serviceDateStatusChart" class="chartborder" style="width: 250px; height: 200px; display: inline-block;"/>
|
||||
<div id="serviceCountYearChart" class="chartborder" style="width: 250px; height: 200px; display: inline-block;"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
45
src/fr/devinsy/statoolinfos/htmlize/serviceStatsView.xhtml
Normal file
45
src/fr/devinsy/statoolinfos/htmlize/serviceStatsView.xhtml
Normal file
|
@ -0,0 +1,45 @@
|
|||
<?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 id="metricMenuView" />
|
||||
<div id="metricZone" class="row center_table" style="width: 1100px;">
|
||||
<!-- h2 id="title" class="center">Statistiques</h2-->
|
||||
<div>
|
||||
<div id="turnoutChart" class="chartborder" style="width: 250px; height: 200px; display: inline-block;"/>
|
||||
</div>
|
||||
<div>
|
||||
<div id="hostServerTypeChart" class="chartborder" style="width: 250px; height: 200px; display: inline-block;"/>
|
||||
<div id="hostProviderTypeChart" class="chartborder" style="width: 250px; height: 200px; display: inline-block;"/>
|
||||
<div id="serviceInstallTypeChart" class="chartborder" style="width: 250px; height: 230px; display: inline-block; vertical-align: top;"/>
|
||||
<div id="serviceCountryChart" class="chartborder" style="width: 250px; height: 200px; display: inline-block;"/>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div id="registrationTypeChart" class="column chartborder" style="width: 250px; height: 200px; display: inline-block;"/>
|
||||
<div class="column">
|
||||
<div class="row">
|
||||
<div id="registrationNoneTypeChart" class="chartborder" style="width: 122px; height: 97px; display: inline-block;"/>
|
||||
<div id="registrationFreeTypeChart" class="chartborder" style="width: 122px; height: 97px; display: inline-block;"/>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div id="registrationMemberTypeChart" class="chartborder" style="width: 122px; height: 97px; display: inline-block;"/>
|
||||
<div id="registrationClientTypeChart" class="chartborder" style="width: 122px; height: 97px; display: inline-block;"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<div id="serviceDateStatusChart" class="chartborder" style="width: 250px; height: 200px; display: inline-block;"/>
|
||||
<div id="serviceCountYearChart" class="chartborder" style="width: 250px; height: 200px; display: inline-block;"/>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in a new issue