Fixes destination stat
This commit is contained in:
parent
73cb8da8c1
commit
798a6295ee
|
@ -8,6 +8,7 @@
|
|||
from sqlalchemy import func
|
||||
|
||||
from lemur import database
|
||||
from lemur.models import certificate_destination_associations
|
||||
from lemur.destinations.models import Destination
|
||||
from lemur.certificates.models import Certificate
|
||||
|
||||
|
@ -117,10 +118,9 @@ def stats(**kwargs):
|
|||
:param kwargs:
|
||||
:return:
|
||||
"""
|
||||
attr = getattr(Destination, kwargs.get('metric'))
|
||||
query = database.db.session.query(attr, func.count(attr))
|
||||
|
||||
items = query.group_by(attr).all()
|
||||
items = database.db.session.query(Destination.label, func.count(certificate_destination_associations.c.certificate_id))\
|
||||
.join(certificate_destination_associations)\
|
||||
.group_by(Destination.label).all()
|
||||
|
||||
keys = []
|
||||
values = []
|
||||
|
|
|
@ -84,8 +84,8 @@ angular.module('lemur')
|
|||
$scope.expiring = {labels: data.items.labels, values: [data.items.values]};
|
||||
});
|
||||
|
||||
LemurRestangular.all('destinations').customGET('stats', {metric: 'certificates'})
|
||||
LemurRestangular.all('destinations').customGET('stats', {metric: 'certificate'})
|
||||
.then(function (data) {
|
||||
$scope.destinations = {labels: data.items.labels, values: [data.items.values]};
|
||||
$scope.destinations = data.items;
|
||||
});
|
||||
});
|
||||
|
|
|
@ -10,43 +10,45 @@
|
|||
<h3 class="panel-title">Expiring Certificates</h3>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<canvas id="expiringBar" class="chart chart-bar" data="expiring.values" labels="expiring.labels" colours="colours"></canvas>
|
||||
<canvas id="expiringBar" class="chart chart-bar" data="expiring.values" labels="expiring.labels"
|
||||
colours="colours"></canvas>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row"></div>
|
||||
<div class="col-md-6">
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<h3 class="panel-title">Issuers</h3>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<canvas id="issuersPie" class="chart chart-pie" data="issuers.values" labels="issuers.labels" colours="colours" legend="true"></canvas>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<h3 class="panel-title">Issuers</h3>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<h3 class="panel-title">Bit Strength</h3>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<canvas id="bitsPie" class="chart chart-pie" data="bits.values" labels="bits.labels" colours="colours" legend="true"></canvas>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<canvas id="issuersPie" class="chart chart-pie" data="issuers.values" labels="issuers.labels" colours="colours"
|
||||
legend="true"></canvas>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<h3 class="panel-title">Bit Strength</h3>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<canvas id="bitsPie" class="chart chart-pie" data="bits.values" labels="bits.labels" colours="colours"
|
||||
legend="true"></canvas>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row"></div>
|
||||
<div class="col-md-6">
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<h3 class="panel-title">Destinations</h3>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<canvas id="destinationPie" class="chart chart-pie" data="destinations.values" labels="destinations.labels"
|
||||
colours="colours" legend="true"></canvas>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row"></div>
|
||||
<div class="col-md-6">
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<h3 class="panel-title">Destinations</h3>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<canvas id="destinationPie" class="chart chart-pie" data="destinations.values" labels="destinations.labels" colours="colours" legend="true"></canvas>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.row -->
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue