Refactored federation stats. Added provider hypervisor chart.

This commit is contained in:
Christian P. MOMON 2022-07-22 18:32:54 +02:00
parent 4d6e592204
commit fbf6e50b49
4 changed files with 88 additions and 7 deletions

View file

@ -275,6 +275,21 @@ public class Service extends PathPropertyList
return result; return result;
} }
/**
* Gets the host provider hypervisor.
*
* @return the host provider hypervisor
*/
public String getHostProviderHypervisor()
{
String result;
result = get("host.provider.hypervisor");
//
return result;
}
/** /**
* Gets the host provider type. * Gets the host provider type.
* *

View file

@ -245,6 +245,69 @@ public class ChartHtmlizer
return result; return result;
} }
/**
* Htmlize host provider hypervisor chart.
*
* @param services
* the services
* @return the string
* @throws StatoolInfosException
* the statool infos exception
*/
public static String htmlizeHostProviderHypervisorChart(final Services services) throws StatoolInfosException
{
String result;
ChartColors colors = ChartColor.valueList();
colors.remove(ChartColor.BLUE);
StringCounters counters = new StringCounters();
long unknowns = 0;
for (Service service : services)
{
String hypervisor = service.getHostProviderHypervisor();
if (StringUtils.isBlank(hypervisor))
{
unknowns += 1;
}
else
{
counters.inc(StringUtils.capitalize(hypervisor.toLowerCase()));
}
}
StringCounterList list = counters.toList().sortByCounter().reverse();
PieChart pie = new PieChart("Distributions des hyperviseurs");
pie.setLegendPosition(Position.RIGHT);
int index = 0;
while ((index < list.size() && (index < 7)))
{
ChartColor color = colors.get(index);
StringCounter counter = list.get(index);
pie.add(counter.getString(), counter.getCounter(), color);
index += 1;
}
int others = 0;
while (index < list.size())
{
StringCounter counter = list.get(index);
others += counter.getCounter();
index += 1;
}
pie.add("Autres", others, ChartColor.GREY);
pie.add("Inconnus", unknowns, ChartColor.BLUE);
result = DoughnutChartView.build(pie);
//
return result;
}
/** /**
* Htmlize host provider type chart. * Htmlize host provider type chart.
* *

View file

@ -74,12 +74,15 @@ public class FederationStatsPage
data.setContent("organizationCountChart", ChartHtmlizer.htmlizeOrganizationCountChart(federation)); data.setContent("organizationCountChart", ChartHtmlizer.htmlizeOrganizationCountChart(federation));
data.setContent("organizationInOutChart", ChartHtmlizer.htmlizeOrganizationInOutChart(federation)); data.setContent("organizationInOutChart", ChartHtmlizer.htmlizeOrganizationInOutChart(federation));
data.setContent("hostServerDistributionChart", ChartHtmlizer.htmlizeHostServerDistributionChart(services)); data.setContent("serviceCountYearChart", ChartHtmlizer.htmlizeServiceCountYearChart(federation));
data.setContent("hostServerTypeChart", ChartHtmlizer.htmlizeHostServerTypeChart(services)); data.setContent("hostServerTypeChart", ChartHtmlizer.htmlizeHostServerTypeChart(services));
data.setContent("hostProviderTypeChart", ChartHtmlizer.htmlizeHostProviderTypeChart(services)); data.setContent("hostProviderTypeChart", ChartHtmlizer.htmlizeHostProviderTypeChart(services));
data.setContent("serviceCountryChart", ChartHtmlizer.htmlizeServiceCountryChart(services)); data.setContent("serviceCountryChart", ChartHtmlizer.htmlizeServiceCountryChart(services));
data.setContent("hostNameChart", ChartHtmlizer.htmlizeHostNamePieChart(services)); data.setContent("hostNameChart", ChartHtmlizer.htmlizeHostNamePieChart(services));
data.setContent("hostProviderHypervisorChart", ChartHtmlizer.htmlizeHostProviderHypervisorChart(services));
data.setContent("hostServerDistributionChart", ChartHtmlizer.htmlizeHostServerDistributionChart(services));
data.setContent("serviceInstallTypeChart", ChartHtmlizer.htmlizeServiceInstallTypeChart(services)); data.setContent("serviceInstallTypeChart", ChartHtmlizer.htmlizeServiceInstallTypeChart(services));
{ {
@ -92,7 +95,6 @@ public class FederationStatsPage
data.setContent("registrationClientTypeChart", ChartHtmlizer.htmlizeRegistrationClientPieChart(stats)); data.setContent("registrationClientTypeChart", ChartHtmlizer.htmlizeRegistrationClientPieChart(stats));
} }
data.setContent("serviceCountYearChart", ChartHtmlizer.htmlizeServiceCountYearChart(federation));
data.setContent("serviceDateStatusChart", ChartHtmlizer.htmlizeServiceDateStatusChart(services)); data.setContent("serviceDateStatusChart", ChartHtmlizer.htmlizeServiceDateStatusChart(services));
data.setContent("softwareDistributionChart", ChartHtmlizer.htmlizeSoftwareDistributionChart()); data.setContent("softwareDistributionChart", ChartHtmlizer.htmlizeSoftwareDistributionChart());

View file

@ -23,14 +23,18 @@
<div id="organizationInOutChart" class="chartborder" style="width: 250px; height: 200px; display: inline-block;"/> <div id="organizationInOutChart" class="chartborder" style="width: 250px; height: 200px; display: inline-block;"/>
</div> </div>
<div> <div>
<div id="hostServerDistributionChart" class="chartborder" style="width: 250px; height: 200px; display: inline-block;"/> <div id="serviceCountYearChart" class="chartborder" style="width: 250px; height: 200px; display: inline-block;"/>
<div id="hostServerTypeChart" class="chartborder" style="width: 250px; height: 200px; display: inline-block;"/> <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="hostProviderTypeChart" class="chartborder" style="width: 250px; height: 200px; display: inline-block;"/>
<div id="serviceCountryChart" class="chartborder" style="width: 250px; height: 200px; display: inline-block;"/> <div id="serviceCountryChart" class="chartborder" style="width: 250px; height: 200px; display: inline-block;"/>
</div> </div>
<div> <div>
<div id="hostNameChart" class="chartborder" style="width: 500px; height: 250px; display: inline-block;"/> <div id="hostNameChart" class="chartborder" style="width: 500px; height: 250px; display: inline-block;"/>
<div id="serviceInstallTypeChart" class="chartborder" style="width: 500px; height: 250px; display: inline-block; vertical-align: top;"/> <div id="hostProviderHypervisorChart" class="chartborder" style="width: 500px; height: 250px; display: inline-block;"/>
</div>
<div>
<div id="hostServerDistributionChart" class="chartborder" style="width: 500px; height: 250px; display: inline-block;"/>
<div id="serviceInstallTypeChart" class="chartborder" style="width: 500px; height: 250px; display: inline-block;"/>
</div> </div>
<div class="row"> <div class="row">
<div id="registrationTypeChart" class="column chartborder" style="width: 250px; height: 200px; display: inline-block;"/> <div id="registrationTypeChart" class="column chartborder" style="width: 250px; height: 200px; display: inline-block;"/>
@ -44,10 +48,7 @@
<div id="registrationClientTypeChart" 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>
<div>
<div id="serviceDateStatusChart" class="chartborder" style="width: 250px; height: 200px; display: inline-block;"/> <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> <div>
<div id="categoryDistributionPieChart" class="chartborder" style="width: 500px; height: 300px; display: inline-block;"/> <div id="categoryDistributionPieChart" class="chartborder" style="width: 500px; height: 300px; display: inline-block;"/>