1
0
mirror of https://github.com/dkmstr/openuds.git synced 2025-01-10 01:17:59 +03:00

Added graphs for in use & assigned services

This commit is contained in:
Adolfo Gómez 2014-01-28 10:02:32 +00:00
parent dcab2e120b
commit 81439890e1
6 changed files with 47 additions and 17 deletions

View File

@ -48,8 +48,8 @@ logger = logging.getLogger(__name__)
cache = Cache('StatsDispatcher')
# Enclosed methods under /syatem path
POINTS = 300
SINCE = 1000 # Days
POINTS = 365
SINCE = 365 # Days
USE_MAX = True

View File

@ -501,4 +501,15 @@ api.networks = new BasicModelRest('networks');
api.servicesPool = new BasicModelRest('servicespool');
api.configuration = new BasicModelRest('config');
api.system = new BasicModelRest('system');
api.system.stats = function(type, success_fnc, fail_fnc) {
"use strict";
return this.get({
id: 'stats/' + type,
success: success_fnc,
fail: fail_fnc
});
};

File diff suppressed because one or more lines are too long

View File

@ -14,18 +14,23 @@ gui.dashboard.link = function(event) {
}));
gui.setLinksEvents();
var d1 = [];
for (var i = 0; i < 14; i += 0.5) {
d1.push([i, Math.sin(i)]);
}
$.each(['assigned', 'inuse'], function(index, stat){
api.system.stats(stat, function(data) {
var d = [];
$.each(data, function(index, value){
d.push([value.stamp * 1000, value.value]);
});
gui.doLog('Data', d);
$.plot('#placeholder-' + stat + '-chart', [d], {
xaxis: {
mode: "time",
timeformat: api.tools.djangoFormat(django.formats.SHORT_DATE_FORMAT)
}
});
});
});
var d2 = [[0, 3], [4, 8], [8, 5], [9, 13]];
// A null signifies separate line segments
var d3 = [[0, 12], [7, 12], null, [7, 2.5], [12, 2.5]];
$.plot("#placeholder", [ d1, d2, d3 ]);
});
gui.tools.fix3dButtons('#test');

View File

@ -74,6 +74,7 @@
<!-- Flost charts -->
<script src="{% get_static_prefix %}adm/js/flot/jquery.flot.min.js"></script>
<script src="{% get_static_prefix %}adm/js/flot/jquery.flot.resize.min.js"></script>
<script src="{% get_static_prefix %}adm/js/flot/jquery.flot.time.min.js"></script>
<!-- Table tools -->
<script src="{% get_static_prefix %}adm/js/TableTools.min.js"></script>
@ -117,7 +118,7 @@
<script src="{% get_static_prefix %}adm/js/gui-d-config.js"></script>
{% else %}
<!-- minified js from: 'jquery.cookie', 'bootstrap.min', 'bootstrap-switch.min', 'bootstrap-select.min', 'jquery.validate.min', 'jquery.blockUI',
<!-- minified js from: 'jquery.cookie', 'bootstrap.min', 'bootstrap-switch.min', 'bootstrap-select.min', 'jquery.validate.min', 'jquery.blockUI', 'flot',
'jquery.dataTables.min', 'TableTools.min', 'Blob', 'FileSaver', 'ZeroClipboard', 'dataTables.bootstrap', 'handlebars-v1.1.2', UDS admin JS's -->
<script src="{% get_static_prefix %}adm/js/admin.min.js"></script>
{% endif %}

View File

@ -96,7 +96,7 @@
<div class="panel-heading">
<div class="row">
<div class="col-xs-6">
<i class="fa fa-heart fa-5x"></i>
<i class="fa fa-heart fa-5x" style="color: red"></i>
</div>
<div class="col-xs-6 text-right">
<p class="announcement-heading">{{ restrained_services_pools }}</p>
@ -121,14 +121,26 @@
</div><!-- /.row -->
<div class="row">
<div class="col-lg-12">
<div class="col-lg-6">
<div class="panel panel-primary">
<div class="panel-heading">
<h3 class="panel-title"><i class="fa fa-bar-chart-o"></i> {% endverbatim %}{% trans 'Assigned services graph' %}{% verbatim %}</h3>
</div>
<div class="panel-body">
<div class="chart-medium">
<div id="placeholder" class="chart-content"></div>
<div id="placeholder-assigned-chart" class="chart-content"></div>
</div>
</div>
</div>
</div>
<div class="col-lg-6">
<div class="panel panel-primary">
<div class="panel-heading">
<h3 class="panel-title"><i class="fa fa-bar-chart-o"></i> {% endverbatim %}{% trans 'Used services graph' %}{% verbatim %}</h3>
</div>
<div class="panel-body">
<div class="chart-medium">
<div id="placeholder-inuse-chart" class="chart-content"></div>
</div>
</div>
</div>