1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-23 22:50:09 +03:00

Feature #1613: Add DS capacity to sunstone

This commit is contained in:
Carlos Martín 2013-07-12 18:26:36 +02:00
parent bde6770678
commit 0069bb38b8
4 changed files with 50 additions and 12 deletions

View File

@ -16,6 +16,6 @@
# limitations under the License. #
#--------------------------------------------------------------------------- #
echo "USED_MB=30720"
echo "USED_MB=9720"
echo "TOTAL_MB=20480"
echo "FREE_MB=20480"

View File

@ -290,11 +290,12 @@ tabs:
- 2 # Owner
- 3 # Group
- 4 # Name
- 5 # Cluster
#- 6 # Basepath
#- 7 # TM
#- 8 # DS
- 9 # Type
- 5 # Capacity
- 6 # Cluster
#- 7 # Basepath
#- 8 # TM
#- 9 # DS
- 10 # Type
actions:
Datastore.refresh: true
Datastore.create_dialog: true

View File

@ -291,11 +291,13 @@ tabs:
- 2 # Owner
- 3 # Group
- 4 # Name
- 5 # Cluster
#- 6 # Basepath
#- 7 # TM
#- 8 # DS
#- 9 # Type
- 5 # Capacity
- 6 # Cluster
#- 7 # Basepath
#- 8 # TM
#- 9 # DS
#- 10 # Type
actions:
Datastore.refresh: true
Datastore.create_dialog: false

View File

@ -56,6 +56,7 @@ var datastores_tab_content = '\
<th>'+tr("Owner")+'</th>\
<th>'+tr("Group")+'</th>\
<th>'+tr("Name")+'</th>\
<th>'+tr("Capacity")+'</th>\
<th>'+tr("Cluster")+'</th>\
<th>'+tr("Basepath")+'</th>\
<th>'+tr("TM MAD")+'</th>\
@ -605,6 +606,23 @@ function datastoreElementArray(element_json){
type = element.TEMPLATE.TYPE;
}
var total = parseInt(element.TOTAL_MB);
var used = parseInt(element.USED_MB);
if (total > 0) {
var ratio = Math.round((used / total) * 100);
info_str = humanize_size_from_mb(used) + ' / ' + humanize_size_from_mb(total) + ' (' + ratio + '%)';
} else {
if(element.TYPE == 1) {
info_str = '- / -';
} else {
info_str = humanize_size(used) + ' / -';
}
}
var pb_capacity = quotaBarHtml(used, total, info_str);
return [
'<input class="check_item" type="checkbox" id="datastore_'+
element.ID+'" name="selected_items" value="'+
@ -613,6 +631,7 @@ function datastoreElementArray(element_json){
element.UNAME,
element.GNAME,
element.NAME,
pb_capacity,
element.CLUSTER.length ? element.CLUSTER : "-",
element.BASE_PATH,
element.TM_MAD,
@ -693,12 +712,14 @@ function updateDatastoreInfo(request,ds){
images_str=getImageName(info.IMAGES.ID);
};
var cluster_str = '<td class="key_td">Cluster</td><td>-</td>';
var cluster_str = '<td class="key_td">Cluster</td><td colspan="2">-</td>';
if (info.ID != "0")
{
cluster_str = insert_cluster_dropdown("Datastore",info.ID,info.CLUSTER,info.CLUSTER_ID);
}
var is_system = (info.TYPE == 1)
var info_tab_content = '<div class="">\
<div class="six columns">\
<table id="info_datastore_table" class="twelve datatable extended_table">\
@ -724,6 +745,19 @@ function updateDatastoreInfo(request,ds){
<td class="value_td">'+info.BASE_PATH+'</td>\
<td></td>\
</tr>\
<thead><tr><th colspan="3" style="width:130px">'+tr("Capacity")+'</th>\</tr></thead>\
<tr>\
<td class="key_td">' + tr("Total") + '</td>\
<td class="value_td" colspan="2">'+(is_system ? '-' : humanize_size_from_mb(info.TOTAL_MB))+'</td>\
</tr>\
<tr>\
<td class="key_td">' + tr("Used") + '</td>\
<td class="value_td" colspan="2">'+(is_system ? '-' : humanize_size_from_mb(info.USED_MB))+'</td>\
</tr>\
<tr>\
<td class="key_td">' + tr("Free") + '</td>\
<td class="value_td" colspan="2">'+(is_system ? '-' : humanize_size_from_mb(info.FREE_MB))+'</td>\
</tr>\
</tbody>\
</table>'
+ insert_extended_template_table(info.TEMPLATE,
@ -1087,6 +1121,7 @@ $(document).ready(function(){
"aoColumnDefs": [
{ "bSortable": false, "aTargets": ["check"] },
{ "sWidth": "35px", "aTargets": [0] },
{ "sWidth": "200px", "aTargets": [5] },
{ "bVisible": true, "aTargets": config['view']['tabs']['datastores-tab']['table_columns']},
{ "bVisible": false, "aTargets": ['_all']}
]