mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-21 14:50:08 +03:00
feature #3748: Add vms dashboard
This commit is contained in:
parent
c0c9a418a9
commit
ee809de0fa
58
src/sunstone/public/app/tabs/dashboard-tab/vms.hbs
Normal file
58
src/sunstone/public/app/tabs/dashboard-tab/vms.hbs
Normal file
@ -0,0 +1,58 @@
|
||||
<div class="row totals-info">
|
||||
<div class="small-12 medium-6 large-3 columns">
|
||||
<div class="small-12 large-12 columns text-center">
|
||||
<h2 class="subheader">
|
||||
<small>{{tr "VMs"}}</small>
|
||||
<br>
|
||||
<span class="subheader total_vms"></span>
|
||||
<small><i class="fa fa-fw fa-th"></i></small>
|
||||
</h2>
|
||||
</div>
|
||||
<div class="small-4 large-4 columns text-center">
|
||||
<h5 class="subheader">
|
||||
<span class="subheader active_vms success-color"></span>
|
||||
<br>
|
||||
<small class="success-color">{{tr "ACTIVE"}}</small>
|
||||
</h5>
|
||||
</div>
|
||||
<div class="small-4 large-4 columns text-center">
|
||||
<h5 class="subheader">
|
||||
<span class="subheader pending_vms"></span>
|
||||
<br>
|
||||
<small>{{tr "PENDING"}}</small>
|
||||
</h5>
|
||||
</div>
|
||||
<div class="small-4 large-4 columns text-center">
|
||||
<h5 class="subheader">
|
||||
<span class="subheader failed_vms alert-color"></span>
|
||||
<br>
|
||||
<small class="alert-color">{{tr "FAILED"}}</small>
|
||||
</h5>
|
||||
</div>
|
||||
<div class="small-12 large-12 columns text-center" style="margin-top: 20px">
|
||||
<a class="button secondary radius small show_vms_tab"> <i class="fa fa-lg fa-list fa-fw"></i>
|
||||
</a>
|
||||
<a class="button secondary radius small show_create_vm">
|
||||
<i class="fa fa-lg fa-plus fa-fw"></i></a>
|
||||
<br>
|
||||
</div>
|
||||
</div>
|
||||
<div class="large-9 medium-6 small-12 columns text-center" id="dashboard_vm_accounting">
|
||||
<input style="display:none;" value="vm" id="acct_group_by"/>
|
||||
<div class="small-12 large-6 columns">
|
||||
<h4 class="subheader">
|
||||
<small>{{tr "CPU hours"}}</small>
|
||||
</h4>
|
||||
<div class="large-12 columns centered graph text-center" id="acct_cpu_graph" style="height: 180px;">{{> ./empty-graph}}</div>
|
||||
</div>
|
||||
<div class="small-12 large-6 columns">
|
||||
<h4 class="subheader">
|
||||
<small>{{tr "Memory GB hours"}}</small>
|
||||
</h4>
|
||||
<div class="large-12 columns centered graph text-center" id="acct_mem_graph" style="height: 180px;">{{> ./empty-graph}}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row dashboard-widget-footer">
|
||||
<div class="small-3 large-3 columns text-center"></div>
|
||||
</div>
|
@ -71,14 +71,21 @@ define(function(require) {
|
||||
"you_selected_multiple": Locale.tr("You selected the following VMs:")
|
||||
};
|
||||
|
||||
this.totalVms = 0;
|
||||
this.activeVms = 0;
|
||||
this.pendingVms = 0;
|
||||
this.failedVms = 0;
|
||||
this.offVms = 0;
|
||||
|
||||
TabDataTable.call(this);
|
||||
};
|
||||
|
||||
Table.prototype = Object.create(TabDataTable.prototype);
|
||||
Table.prototype.constructor = Table;
|
||||
Table.prototype.elementArray = _elementArray;
|
||||
Table.prototype.onUpdateView = _onUpdateView;
|
||||
Table.prototype.initialize = _initialize;
|
||||
Table.prototype.preUpdateView = _preUpdateView;
|
||||
Table.prototype.postUpdateView = _postUpdateView;
|
||||
|
||||
return Table;
|
||||
|
||||
@ -91,27 +98,27 @@ define(function(require) {
|
||||
|
||||
var state = OpenNebulaVM.stateStr(element.STATE);
|
||||
|
||||
/* TODO
|
||||
this.totalVms++;
|
||||
switch (state) {
|
||||
case tr("INIT"):
|
||||
case tr("PENDING"):
|
||||
case tr("HOLD"):
|
||||
pending_vms++;
|
||||
case "INIT":
|
||||
case "PENDING":
|
||||
case "HOLD":
|
||||
this.pendingVms++;
|
||||
break;
|
||||
case tr("FAILED"):
|
||||
failed_vms++;
|
||||
case "FAILED":
|
||||
this.failedVms++;
|
||||
break;
|
||||
case tr("ACTIVE"):
|
||||
active_vms++;
|
||||
case "ACTIVE":
|
||||
this.activeVms++;
|
||||
break;
|
||||
case tr("STOPPED"):
|
||||
case tr("SUSPENDED"):
|
||||
case tr("POWEROFF"):
|
||||
off_vms++;
|
||||
case "STOPPED":
|
||||
case "SUSPENDED":
|
||||
case "POWEROFF":
|
||||
this.offVms++;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}*/
|
||||
}
|
||||
|
||||
if (state == "ACTIVE") {
|
||||
state = OpenNebulaVM.shortLcmStateStr(element.LCM_STATE);
|
||||
@ -146,8 +153,22 @@ define(function(require) {
|
||||
];
|
||||
}
|
||||
|
||||
function _onUpdateView() {
|
||||
function _preUpdateView() {
|
||||
StateActions.resetStateButtons();
|
||||
|
||||
this.totalVms = 0;
|
||||
this.activeVms = 0;
|
||||
this.pendingVms = 0;
|
||||
this.failedVms = 0;
|
||||
this.offVms = 0;
|
||||
}
|
||||
|
||||
function _postUpdateView() {
|
||||
$(".total_vms").text(this.totalVms);
|
||||
$(".active_vms").text(this.activeVms);
|
||||
$(".pending_vms").text(this.pendingVms);
|
||||
$(".failed_vms").text(this.failedVms);
|
||||
$(".off_vms").text(this.offVms);
|
||||
}
|
||||
|
||||
function _initialize(opts) {
|
||||
|
@ -625,6 +625,7 @@ define(function(require) {
|
||||
|
||||
return {
|
||||
'html': _html,
|
||||
'setup': _setup
|
||||
'setup': _setup,
|
||||
'fillAccounting': _fillAccounting
|
||||
};
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user