1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-21 14:50:08 +03:00

feature #3748: Add nets dashboard

This commit is contained in:
Daniel Molina 2015-06-12 18:27:13 +02:00
parent ee809de0fa
commit 14908fcff4
2 changed files with 34 additions and 2 deletions

View File

@ -0,0 +1,17 @@
<div class="row totals-info dashboard-widget-footer">
<div class="small-12 large-12 columns text-center">
<h2 class="subheader">
<small>{{tr "VNETs"}}</small>
<br>
<span class="total_vnets subheader"></span>
<small><i class="fa fa-fw fa-sitemap"></i> </small>
</h2>
</div>
<div class="small-12 large-12 columns text-center">
<h5 class="subheader">
<span class="addresses_vnets subheader"></span>
<br>
<small>{{tr "USED IPs"}}</small>
</h5>
</div>
</div>

View File

@ -62,12 +62,17 @@ define(function(require) {
"you_selected_multiple": Locale.tr("You selected the following networks:")
};
this.usedLeases = 0;
this.totalVNets = 0;
TabDataTable.call(this);
};
Table.prototype = Object.create(TabDataTable.prototype);
Table.prototype.constructor = Table;
Table.prototype.elementArray = _elementArray;
Table.prototype.preUpdateView = _preUpdateView;
Table.prototype.postUpdateView = _postUpdateView;
return Table;
@ -78,8 +83,8 @@ define(function(require) {
function _elementArray(element_json) {
var element = element_json[XML_ROOT];
// TODO: used by the dashboard
//addresses_vnets = addresses_vnets + parseInt(network.USED_LEASES);
this.usedLeases = this.usedLeases + parseInt(element.USED_LEASES);
this.totalVNets++;
var total_size = 0;
@ -104,4 +109,14 @@ define(function(require) {
element.VLAN_ID.length ? element.VLAN_ID : "-"
];
}
function _preUpdateView() {
this.totalVNets = 0;
this.usedLeases = 0;
}
function _postUpdateView() {
$(".total_vnets").text(this.totalVNets);
$(".addresses_vnets").text(this.usedLeases);
}
});