Added services figure view.

This commit is contained in:
Christian P. MOMON 2022-03-05 15:57:57 +01:00
parent 94f807dfad
commit b1e841c787
3 changed files with 88 additions and 5 deletions

View file

@ -497,6 +497,40 @@ public class Service extends PathPropertyList
return result; return result;
} }
/**
* Gets the month database bytes.
*
* @param month
* the month
* @return the month database bytes
*/
public long getMonthDatabaseBytes(final YearMonth month)
{
long result;
result = getMonthCount("metrics.service.database.bytes", month);
//
return result;
}
/**
* Gets the month datafiles bytes.
*
* @param month
* the month
* @return the month datafiles bytes
*/
public long getMonthDatafilesBytes(final YearMonth month)
{
long result;
result = getMonthCount("metrics.service.datafiles.bytes", month);
//
return result;
}
/** /**
* Gets the month hit count. * Gets the month hit count.
* *

View file

@ -62,6 +62,8 @@ public class ServiceFigureView
TagDataManager data = new TagDataManager(); TagDataManager data = new TagDataManager();
data.setContent("serviceCount", services.size()); data.setContent("serviceCount", services.size());
YearMonth month = YearMonth.now();
data.setContent("currentMonth", month.format(DateTimeFormatter.ofPattern("MMMM yyyy")));
if (services.isEmpty()) if (services.isEmpty())
{ {
@ -98,13 +100,14 @@ public class ServiceFigureView
data.setEscapedContent("serviceListLine", index, "serviceListLineSoftwareLink", service.getSoftwareName()); data.setEscapedContent("serviceListLine", index, "serviceListLineSoftwareLink", service.getSoftwareName());
data.setAttribute("serviceListLine", index, "serviceListLineSoftwareLink", "href", "software-" + service.getSoftwareTechnicalName() + ".xhtml"); data.setAttribute("serviceListLine", index, "serviceListLineSoftwareLink", "href", "software-" + service.getSoftwareTechnicalName() + ".xhtml");
YearMonth month = YearMonth.now();
data.setContent("serviceListLine", index, "serviceListLineHitCount", StatoolInfosUtils.defaultIfZero(service.getMonthHitCount(month), "😢")); data.setContent("serviceListLine", index, "serviceListLineHitCount", StatoolInfosUtils.defaultIfZero(service.getMonthHitCount(month), "😢"));
data.setContent("serviceListLine", index, "serviceListLineVisitCount", StatoolInfosUtils.defaultIfZero(service.getMonthVisitCount(month), "😞")); data.setContent("serviceListLine", index, "serviceListLineVisitCount", StatoolInfosUtils.defaultIfZero(service.getMonthVisitCount(month), "😞"));
data.setContent("serviceListLine", index, "serviceListLineVisitorCount", StatoolInfosUtils.defaultIfZero(service.getMonthVisitorCount(month), "😞")); data.setContent("serviceListLine", index, "serviceListLineVisitorCount", StatoolInfosUtils.defaultIfZero(service.getMonthVisitorCount(month), "😞"));
data.setContent("serviceListLine", index, "serviceListLineUserCount", StatoolInfosUtils.defaultIfZero(service.getMonthUserCount(month), "😢")); data.setContent("serviceListLine", index, "serviceListLineUserCount", StatoolInfosUtils.defaultIfZero(service.getMonthUserCount(month), "😢"));
data.setContent("serviceListLine", index, "serviceListLineAccountCount", StatoolInfosUtils.defaultIfZero(service.getMonthAccountCount(month), "😇")); data.setContent("serviceListLine", index, "serviceListLineAccountCount", StatoolInfosUtils.defaultIfZero(service.getMonthAccountCount(month), "😇"));
data.setContent("serviceListLine", index, "serviceListLineActiveAccountCount", StatoolInfosUtils.defaultIfZero(service.getMonthActiveAccountCount(month), "😇")); data.setContent("serviceListLine", index, "serviceListLineActiveAccountCount", StatoolInfosUtils.defaultIfZero(service.getMonthActiveAccountCount(month), "😇"));
data.setContent("serviceListLine", index, "serviceListLineDatabaseBytes", StatoolInfosUtils.defaultIfZero(service.getMonthDatabaseBytes(month), "😇"));
data.setContent("serviceListLine", index, "serviceListLineDatafilesBytes", StatoolInfosUtils.defaultIfZero(service.getMonthDatafilesBytes(month), "😇"));
index += 1; index += 1;
} }

View file

@ -13,8 +13,8 @@
<body> <body>
<div class="center_table" style="width: 1500px;"> <div class="center_table" style="width: 1500px;">
<br/> <br/>
<div class="center">Nombre de services : <span id="serviceCount">n/a</span></div> <div id="currentMonth" class="center">n/a</div>
<div class="center"><span id="serviceCount">n/a</span> services</div>
<table id="serviceListTable" class="center_table table_classic left"> <table id="serviceListTable" class="center_table table_classic left">
<thead> <thead>
<tr> <tr>
@ -26,6 +26,8 @@
<th id="userCountHeaderColumn" class="" style="width: 10px;">Utilisateurs</th> <th id="userCountHeaderColumn" class="" style="width: 10px;">Utilisateurs</th>
<th id="accountCountHeaderColumn" class="" style="width: 10px;">Comptes</th> <th id="accountCountHeaderColumn" class="" style="width: 10px;">Comptes</th>
<th id="activeAccountHeaderColumn" class="" style="width: 10px;">Comptes actifs</th> <th id="activeAccountHeaderColumn" class="" style="width: 10px;">Comptes actifs</th>
<th id="databaseBytesHeaderColumn" class="" style="width: 10px;">Base (octets)</th>
<th id="datafilesBytesHeaderColumn" class="" style="width: 10px;">Fichiers (octets)</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@ -49,8 +51,13 @@
<td id="serviceListLineUserCount" class="td_number">n/a</td> <td id="serviceListLineUserCount" class="td_number">n/a</td>
<td id="serviceListLineAccountCount" class="td_number">n/a</td> <td id="serviceListLineAccountCount" class="td_number">n/a</td>
<td id="serviceListLineActiveAccountCount" class="td_number">n/a</td> <td id="serviceListLineActiveAccountCount" class="td_number">n/a</td>
<td id="serviceListLineDatabaseBytes" class="td_number">n/a</td>
<td id="serviceListLineDatafilesBytes" class="td_number">n/a</td>
</tr> </tr>
</tbody> </tbody>
<tfoot align="right">
<tr><th></th><th></th><th></th><th></th><th></th><th></th><th></th><th></th><th></th><th></th></tr>
</tfoot>
</table> </table>
</div> </div>
<script type="text/javascript"> <script type="text/javascript">
@ -97,8 +104,47 @@
{ targets: 4, "type": 'custom-sort' }, { targets: 4, "type": 'custom-sort' },
{ targets: 5, "type": 'custom-sort' }, { targets: 5, "type": 'custom-sort' },
{ targets: 6, "type": 'custom-sort' }, { targets: 6, "type": 'custom-sort' },
{ targets: 7, "type": 'custom-sort' } { targets: 7, "type": 'custom-sort' },
] { targets: 8, "type": 'custom-sort' },
{ targets: 9, "type": 'custom-sort' }
],
"footerCallback": function (row, data, start, end, display)
{
var api = this.api(), data;
// converting to interger to find total
var intVal = function (i)
{
return typeof i === 'string' ?
i.replace(/[\$,]/g, '')*1 :
typeof i === 'number' ?
i : 0;
};
// computing column Total of the complete result
var hits = api.column(2).data().reduce(function(a, b) {return intVal(isNaN(a)?0:a) + intVal(isNaN(b)?0:b);}, 0);
var visits = api.column(3).data().reduce(function(a, b) {return intVal(isNaN(a)?0:a) + intVal(isNaN(b)?0:b);}, 0);
var visitors = api.column(4).data().reduce(function(a, b) {return intVal(isNaN(a)?0:a) + intVal(isNaN(b)?0:b);}, 0);
var users = api.column(5).data().reduce(function(a, b) {return intVal(isNaN(a)?0:a) + intVal(isNaN(b)?0:b);}, 0);
var accounts = api.column(6).data().reduce(function(a, b) {return intVal(isNaN(a)?0:a) + intVal(isNaN(b)?0:b);}, 0);
var activeAccounts = api.column(7).data().reduce(function(a, b) {return intVal(isNaN(a)?0:a) + intVal(isNaN(b)?0:b);}, 0);
var databaseBytes = api.column(8).data().reduce(function(a, b) {return intVal(isNaN(a)?0:a) + intVal(isNaN(b)?0:b);}, 0);
var datafilesBytes = api.column(9).data().reduce(function(a, b) {return intVal(isNaN(a)?0:a) + intVal(isNaN(b)?0:b);}, 0);
// Update footer by showing the total with the reference of the column index
$( api.column(1).footer()).html('Total');
$( api.column(2).footer()).html(hits);
$( api.column(3).footer()).html(visits);
$( api.column(4).footer()).html(visitors);
$( api.column(5).footer()).html(users);
$( api.column(6).footer()).html(accounts);
$( api.column(7).footer()).html(activeAccounts);
$( api.column(8).footer()).html(databaseBytes);
$( api.column(9).footer()).html(datafilesBytes);
},
"processing": true,
"serverSide": false,
}); });
}); });
</script> </script>