Added service install type stats.
This commit is contained in:
parent
040f855647
commit
a4b4516f61
9 changed files with 231 additions and 4 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2020 Christian Pierre MOMON <christian@momon.org>
|
||||
* Copyright (C) 2020-2021 Christian Pierre MOMON <christian@momon.org>
|
||||
*
|
||||
* This file is part of StatoolInfos, simple service statistics tool.
|
||||
*
|
||||
|
@ -73,6 +73,18 @@ public class Service extends PathPropertyList
|
|||
UNKNOWN
|
||||
}
|
||||
|
||||
public enum ServiceInstallType
|
||||
{
|
||||
DISTRIBUTION,
|
||||
PROVIDER,
|
||||
PACKAGE,
|
||||
CLONEREPO,
|
||||
ARCHIVE,
|
||||
SOURCES,
|
||||
CONTAINER,
|
||||
UNKNOWN
|
||||
}
|
||||
|
||||
public enum Status
|
||||
{
|
||||
OK,
|
||||
|
@ -405,6 +417,30 @@ public class Service extends PathPropertyList
|
|||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the service install type.
|
||||
*
|
||||
* @return the service install type
|
||||
*/
|
||||
public ServiceInstallType getServiceInstallType()
|
||||
{
|
||||
ServiceInstallType result;
|
||||
|
||||
try
|
||||
{
|
||||
String value = StringUtils.toRootUpperCase(get("service.install.type"));
|
||||
|
||||
result = ServiceInstallType.valueOf(value);
|
||||
}
|
||||
catch (IllegalArgumentException | NullPointerException exception)
|
||||
{
|
||||
result = ServiceInstallType.UNKNOWN;
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the software description.
|
||||
*
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2020 Christian Pierre MOMON <christian@momon.org>
|
||||
* Copyright (C) 2020-2021 Christian Pierre MOMON <christian@momon.org>
|
||||
*
|
||||
* This file is part of StatoolInfos, simple service statistics tool.
|
||||
*
|
||||
|
@ -70,6 +70,7 @@ public class FederationStatsPage
|
|||
data.setContent("turnoutChart", Htmlizer.htmlizeOrganizationTurnoutChart(federation.getOrganizations()));
|
||||
data.setContent("hostServerTypeChart", Htmlizer.htmlizeHostServerTypeChart(federation.getAllServices()));
|
||||
data.setContent("hostProviderTypeChart", Htmlizer.htmlizeHostProviderTypeChart(federation.getAllServices()));
|
||||
data.setContent("serviceInstallTypeChart", Htmlizer.htmlizeServiceInstallTypeChart(federation.getAllServices()));
|
||||
|
||||
//
|
||||
{
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2020 Christian Pierre MOMON <christian@momon.org>
|
||||
* Copyright (C) 2020-2021 Christian Pierre MOMON <christian@momon.org>
|
||||
*
|
||||
* This file is part of StatoolInfos, simple service statistics tool.
|
||||
*
|
||||
|
@ -45,6 +45,7 @@ import fr.devinsy.statoolinfos.stats.organizations.OrganizationTurnoutStats;
|
|||
import fr.devinsy.statoolinfos.stats.services.HostProviderTypeStats;
|
||||
import fr.devinsy.statoolinfos.stats.services.HostServerTypeStats;
|
||||
import fr.devinsy.statoolinfos.stats.services.RegistrationStats;
|
||||
import fr.devinsy.statoolinfos.stats.services.ServiceInstallTypeStats;
|
||||
import fr.devinsy.statoolinfos.util.URLUtils;
|
||||
|
||||
/**
|
||||
|
@ -295,6 +296,38 @@ public class Htmlizer
|
|||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Htmlize service install type chart.
|
||||
*
|
||||
* @param services
|
||||
* the services
|
||||
* @return the string
|
||||
* @throws StatoolInfosException
|
||||
* the statool infos exception
|
||||
*/
|
||||
public static String htmlizeServiceInstallTypeChart(final Services services) throws StatoolInfosException
|
||||
{
|
||||
String result;
|
||||
|
||||
ServiceInstallTypeStats stats = StatAgent.statServiceInstallType(services);
|
||||
|
||||
PieChart pie = new PieChart("Types d'installation du service");
|
||||
pie.add("Distribution", stats.getDistributionCount(), ChartColor.PURPLE);
|
||||
pie.add("Fournisseur", stats.getProviderCount(), ChartColor.GREEN);
|
||||
pie.add("Paquet", stats.getPackageCount(), ChartColor.YELLOW);
|
||||
pie.add("Dépôt cloné", stats.getClonerepoCount(), ChartColor.ORANGE);
|
||||
pie.add("Archive", stats.getArchiveCount(), ChartColor.RED);
|
||||
pie.add("Sources", stats.getSourcesCount(), ChartColor.GREY);
|
||||
pie.add("Containeur", stats.getContainerCount(), ChartColor.CYAN);
|
||||
pie.add("Inconnu", stats.getUnknownCount(), ChartColor.BLUE);
|
||||
pie.setLegendPosition(Position.RIGHT);
|
||||
|
||||
result = DoughnutChartView.build(pie);
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* To bar chart.
|
||||
*
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2020 Christian Pierre MOMON <christian@momon.org>
|
||||
* Copyright (C) 2020-2021 Christian Pierre MOMON <christian@momon.org>
|
||||
*
|
||||
* This file is part of StatoolInfos, simple service statistics tool.
|
||||
*
|
||||
|
@ -85,8 +85,10 @@ public class OrganizationStatsPage
|
|||
TagDataManager data = new TagDataManager();
|
||||
|
||||
data.setContent("turnoutChart", Htmlizer.htmlizeOrganizationTurnoutChart(organization));
|
||||
|
||||
data.setContent("hostServerTypeChart", Htmlizer.htmlizeHostServerTypeChart(organization.getServices()));
|
||||
data.setContent("hostProviderTypeChart", Htmlizer.htmlizeHostProviderTypeChart(organization.getServices()));
|
||||
data.setContent("serviceInstallTypeChart", Htmlizer.htmlizeServiceInstallTypeChart(organization.getServices()));
|
||||
|
||||
//
|
||||
{
|
||||
|
|
|
@ -23,10 +23,12 @@ package fr.devinsy.statoolinfos.htmlize.charts;
|
|||
*/
|
||||
public enum ChartColor
|
||||
{
|
||||
// https://html-color-codes.info/
|
||||
RED("rgb(255, 99, 132)"),
|
||||
ORANGE("rgb(255, 159, 64)"),
|
||||
YELLOW("rgb(255, 205, 86)"),
|
||||
GREEN("rgb(75, 192, 192)"),
|
||||
CYAN("rgb(00, 255, 255)"),
|
||||
BLUE("rgb(54, 162, 235)"),
|
||||
PURPLE("rgb(153, 102, 255)"),
|
||||
GREY("rgb(201, 203, 207)");
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
<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: 200px; display: inline-block;"/>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div id="registrationTypeChart" class="column chartborder" style="width: 250px; height: 200px; display: inline-block;"/>
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
<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: 200px; display: inline-block;"/>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div id="registrationTypeChart" class="column chartborder" style="width: 250px; height: 200px; display: inline-block;"/>
|
||||
|
|
|
@ -46,6 +46,7 @@ import fr.devinsy.statoolinfos.stats.propertyfiles.PropertiesFileStats;
|
|||
import fr.devinsy.statoolinfos.stats.services.HostProviderTypeStats;
|
||||
import fr.devinsy.statoolinfos.stats.services.HostServerTypeStats;
|
||||
import fr.devinsy.statoolinfos.stats.services.RegistrationStats;
|
||||
import fr.devinsy.statoolinfos.stats.services.ServiceInstallTypeStats;
|
||||
import fr.devinsy.statoolinfos.stats.softwares.SoftwareStat;
|
||||
import fr.devinsy.statoolinfos.stats.softwares.SoftwareStats;
|
||||
import fr.devinsy.strings.StringSet;
|
||||
|
@ -329,6 +330,29 @@ public class StatAgent
|
|||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Stat service install type.
|
||||
*
|
||||
* @param services
|
||||
* the services
|
||||
* @return the service install type stats
|
||||
*/
|
||||
public static ServiceInstallTypeStats statServiceInstallType(final Services services)
|
||||
{
|
||||
ServiceInstallTypeStats result;
|
||||
|
||||
result = new ServiceInstallTypeStats();
|
||||
|
||||
//
|
||||
for (Service service : services)
|
||||
{
|
||||
result.inc(service.getServiceInstallType());
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param services
|
||||
* @return
|
||||
|
|
|
@ -0,0 +1,127 @@
|
|||
/*
|
||||
* 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.stats.services;
|
||||
|
||||
import fr.devinsy.statoolinfos.core.Service.ServiceInstallType;
|
||||
|
||||
/**
|
||||
* The Class ServiceInstallTypeStats.
|
||||
*/
|
||||
public class ServiceInstallTypeStats
|
||||
{
|
||||
private long distributionCount;
|
||||
private long providerCount;
|
||||
private long packageCount;
|
||||
private long clonerepoCount;
|
||||
private long archiveCount;
|
||||
private long sourcesCount;
|
||||
private long containerCount;
|
||||
private long unknownCount;
|
||||
|
||||
/**
|
||||
* Instantiates a new host provider type stats.
|
||||
*/
|
||||
public ServiceInstallTypeStats()
|
||||
{
|
||||
this.distributionCount = 0;
|
||||
this.providerCount = 0;
|
||||
this.packageCount = 0;
|
||||
this.clonerepoCount = 0;
|
||||
this.archiveCount = 0;
|
||||
this.sourcesCount = 0;
|
||||
this.containerCount = 0;
|
||||
this.unknownCount = 0;
|
||||
}
|
||||
|
||||
public long getArchiveCount()
|
||||
{
|
||||
return this.archiveCount;
|
||||
}
|
||||
|
||||
public long getClonerepoCount()
|
||||
{
|
||||
return this.clonerepoCount;
|
||||
}
|
||||
|
||||
public long getContainerCount()
|
||||
{
|
||||
return this.containerCount;
|
||||
}
|
||||
|
||||
public long getDistributionCount()
|
||||
{
|
||||
return this.distributionCount;
|
||||
}
|
||||
|
||||
public long getPackageCount()
|
||||
{
|
||||
return this.packageCount;
|
||||
}
|
||||
|
||||
public long getProviderCount()
|
||||
{
|
||||
return this.providerCount;
|
||||
}
|
||||
|
||||
public long getSourcesCount()
|
||||
{
|
||||
return this.sourcesCount;
|
||||
}
|
||||
|
||||
public long getUnknownCount()
|
||||
{
|
||||
return this.unknownCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* Inc.
|
||||
*
|
||||
* @param type
|
||||
* the type
|
||||
*/
|
||||
public void inc(final ServiceInstallType type)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case DISTRIBUTION:
|
||||
this.distributionCount += 1;
|
||||
break;
|
||||
case PROVIDER:
|
||||
this.providerCount += 1;
|
||||
break;
|
||||
case PACKAGE:
|
||||
this.packageCount += 1;
|
||||
break;
|
||||
case CLONEREPO:
|
||||
this.clonerepoCount += 1;
|
||||
break;
|
||||
case ARCHIVE:
|
||||
this.archiveCount += 1;
|
||||
break;
|
||||
case SOURCES:
|
||||
this.sourcesCount += 1;
|
||||
break;
|
||||
case CONTAINER:
|
||||
this.containerCount += 1;
|
||||
break;
|
||||
default:
|
||||
this.unknownCount += 1;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue