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

feature #3748: Add images dashboard

This commit is contained in:
Daniel Molina 2015-06-12 18:26:43 +02:00
parent e7b6e783c2
commit c0c9a418a9
2 changed files with 37 additions and 0 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 "IMAGES"}}</small>
<br>
<span class="total_images subheader"></span>
<small><i class="fa fa-fw fa-upload"></i> </small>
</h2>
</div>
<div class="small-12 large-12 columns text-center">
<h5 class="subheader">
<span class="size_images subheader"></span>
<br>
<small>{{tr "USED"}}</small>
</h5>
</div>
</div>

View File

@ -68,12 +68,17 @@ define(function(require) {
"you_selected_multiple": Locale.tr("You selected the following images:")
};
this.totalImages = 0;
this.sizeImages = 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;
Table.COLUMN_IDS = COLUMN_IDS;
return Table;
@ -90,6 +95,9 @@ define(function(require) {
return false;
}
this.sizeImages = this.sizeImages + parseInt(element.SIZE);
this.totalImages++;
return [
'<input class="check_item" type="checkbox" id="image_' + element.ID + '" name="selected_items" value="' + element.ID + '"/>',
element.ID,
@ -106,4 +114,16 @@ define(function(require) {
element.TEMPLATE.TARGET ? element.TEMPLATE.TARGET : '--'
];
}
function _preUpdateView() {
this.totalImages = 0;
this.sizeImages = 0;
}
function _postUpdateView() {
var size = Humanize.sizeFromMB(this.sizeImages);
$(".total_images").text(this.totalImages);
$(".size_images").text(size);
}
});