lemur/lemur/static/app/angular/dashboard/dashboard.js

93 lines
3.2 KiB
JavaScript
Raw Normal View History

2015-06-22 22:47:27 +02:00
'use strict';
angular.module('lemur')
.config(function config($routeProvider) {
$routeProvider.when('/dashboard', {
templateUrl: '/angular/dashboard/dashboard.tpl.html',
controller: 'DashboardController'
});
})
2015-07-21 22:36:03 +02:00
.controller('DashboardController', function ($scope, $rootScope, $filter, $location, LemurRestangular) {
2015-06-22 22:47:27 +02:00
var baseAccounts = LemurRestangular.all('accounts');
baseAccounts.getList()
.then(function (data) {
$scope.accounts = data;
});
$scope.colours = [
{
fillColor: 'rgba(41, 171, 224, 0.2)',
strokeColor: 'rgba(41, 171, 224, 1)',
pointColor: 'rgba(41, 171, 224, 0.2)',
pointStrongColor: '#fff',
pointHighlightFill: '#fff',
pointHighlightStrokeColor: 'rgba(41, 171, 224, 0.8)'
}, {
fillColor: 'rgba(147, 197, 75, 0.2)',
strokeColor: 'rgba(147, 197, 75, 1)',
pointColor: 'rgba(147, 197, 75, 0.2)',
pointStrongColor: '#fff',
pointHighlightFill: '#fff',
pointHighlightStrokeColor: 'rgba(147, 197, 75, 0.8)'
}, {
fillColor: 'rgba(217, 83, 79, 0.2)',
strokeColor: 'rgba(217, 83, 79, 1)',
pointColor: 'rgba(217, 83, 79, 0.2)',
pointStrongColor: '#fff',
pointHighlightFill: '#fff',
pointHighlightStrokeColor: 'rgba(217, 83, 79, 0.8)'
}, {
fillColor: 'rgba(244, 124, 60, 0.2)',
strokeColor: 'rgba(244, 124, 60, 1)',
pointColor: 'rgba(244, 124, 60, 0.2)',
pointStrongColor: '#fff',
pointHighlightFill: '#fff',
pointHighlightStrokeColor: 'rgba(244, 124, 60, 0.8)'
}, {
fillColor: 'rgba(243, 156, 18, 0.2)',
strokeColor: 'rgba(243, 156, 18, 1)',
pointColor: 'rgba(243, 156, 18, 0.2)',
pointStrongColor: '#fff',
pointHighlightFill: '#fff',
pointHighlightStrokeColor: 'rgba(243, 156, 18, 0.8)'
}, {
fillColor: 'rgba(231, 76, 60, 0.2)',
strokeColor: 'rgba(231, 76, 60, 1)',
pointColor: 'rgba(231, 76, 60, 0.2)',
pointStrongColor: '#fff',
pointHighlightFill: '#fff',
pointHighlightStrokeColor: 'rgba(231, 76, 60, 0.8)'
}, {
fillColor: 'rgba(255, 102, 102, 0.2)',
strokeColor: 'rgba(255, 102, 102, 1)',
pointColor: 'rgba(255, 102, 102, 0.2)',
pointStrongColor: '#fff',
pointHighlightFill: '#fff',
pointHighlightStrokeColor: 'rgba(255, 102, 102, 0.8)'
}, {
fillColor: 'rgba(255, 230, 230, 0.2)',
strokeColor: 'rgba(255, 230, 230, 1)',
pointColor: 'rgba(255, 230, 230, 0.2)',
pointStrongColor: '#fff',
pointHighlightFill: '#fff',
pointHighlightStrokeColor: 'rgba(255, 230, 230, 0.8)'
}];
LemurRestangular.all('certificates').customGET('stats', {metric: 'issuer'})
.then(function (data) {
2015-07-21 22:36:03 +02:00
$scope.issuers = data.items;
2015-06-22 22:47:27 +02:00
});
LemurRestangular.all('certificates').customGET('stats', {metric: 'bits'})
.then(function (data) {
2015-07-21 22:36:03 +02:00
$scope.bits = data.items;
2015-06-22 22:47:27 +02:00
});
LemurRestangular.all('certificates').customGET('stats', {metric: 'not_after'})
.then(function (data) {
2015-07-21 22:36:03 +02:00
$scope.expiring = {labels: data.items.labels, values: [data.items.values]};
2015-06-22 22:47:27 +02:00
});
});