\
\
\
- ' + tr("Hosts") + '\
+ ' + tr("User information") + '\
\
- \
+ \
\
- \
- ' + tr("Total Hosts") + ' | \
- ' + tr("State") + ' | \
- \
- \
- \
- | \
- \
-\
- \
- ' + tr("Global CPU Usage") + ' | \
- | \
- \
- \
- | \
- \
-\
- \
- ' + tr("Used vs. Max CPU") + ' | \
- | \
- \
- \
- \
- \
- | \
- \
-\
- \
- ' + tr("Used vs. Max Memory") + ' | \
- | \
- \
- \
- \
- \
- | \
- \
\
\
\
@@ -128,8 +92,98 @@ Sunstone.addMainTab('dashboard_tab',dashboard_tab);
var $dashboard;
-// Monitoring calls and config in Sunstone plugins
+
+function dashboardQuotaRow(quota_json){
+ var row = '';
+
+ switch (quota_json.TYPE){
+ case "VM":
+ row += ''+tr("VMS")+' | ';
+ row += ''+quota_json.VMS_USED+' / '+quota_json.VMS+' | ';
+ row += ''+tr("Memory")+' | ';
+ row += ''+quota_json.MEMORY_USED+' / '+quota_json.MEMORY+' | ';
+ row += ''+tr("CPU")+' | ';
+ row += ''+quota_json.CPU_USED+' / '+quota_json.CPU+' | ';
+ break;
+ case "DATASTORE":
+ row += ''+tr("Datastore")+' id '+quota_json.ID+': | | ';
+
+ row += ''+tr("Size")+' | ';
+ row += ''+quota_json.SIZE_USED+' / '+quota_json.SIZE+' | ';
+
+ row += ' '+tr("Images")+' | ';
+ row += ''+quota_json.IMAGES_USED+' / '+quota_json.IMAGES+' | ';
+ break;
+ case "IMAGE":
+ row += ' '+tr("Image")+' id '+quota_json.ID+': | | ';
+
+ row += ''+tr("RVMs")+' | ';
+ row += ''+quota_json.RVMS_USED+' / '+quota_json.RVMS+' | ';
+ break;
+ case "NETWORK":
+ row += ' '+tr("Network")+' id '+quota_json.ID+': | | ';
+
+ row += ''+tr("Leases")+' | ';
+ row += ''+quota_json.RVMS_USED+' / '+quota_json.RVMS+' | ';
+ break;
+ }
+ return row
+}
+
+function dashboardQuotasHTML(user){
+ var html = ' \
+ ' + tr("Resource quotas") + ' | \
+ ' + tr("Used / Allowed") + ' | \
+ \
+ \
+ | | \
+ ';
+
+ var results = parseQuotas(user, dashboardQuotaRow);
+
+ html += ''+tr("VM quota")+': | \
+ '+
+ (results.VM.length ? "" : tr("None"))+' | '
+
+ html += results.VM;
+
+ html += '\
+ | | \
+ ';
+
+ html += ''+tr("Datastore quotas")+': | \
+ '+
+ (results.DATASTORE.length ? "" : tr("None"))+' | '
+
+ html += results.DATASTORE;
+
+ html += '\
+ | | \
+ ';
+
+ html += ''+tr("Image quotas")+': | \
+ '+
+ (results.IMAGE.length ? "" : tr("None"))+' | '
+
+ html += results.IMAGE;
+
+ html += '\
+ | | \
+ ';
+
+ html += ''+tr("Network quotas")+': | \
+ '+
+ (results.NETWORK.length ? "" : tr("None"))+' | '
+
+ html += results.NETWORK;
+
+ html += '\
+ | | \
+ ';
+
+ $('#dashboard_user_info', $dashboard).html(html);
+}
$(document).ready(function(){
- $dashboard = $('#dashboard_tab', main_tabs_context);
+ $dashboard = $('#dashboard_tab', main_tabs_context);
});
\ No newline at end of file
diff --git a/src/sunstone/public/js/plugins/groups-tab.js b/src/sunstone/public/js/plugins/groups-tab.js
index 2daae71f36..d156644c36 100644
--- a/src/sunstone/public/js/plugins/groups-tab.js
+++ b/src/sunstone/public/js/plugins/groups-tab.js
@@ -32,8 +32,8 @@ var groups_tab_content = '\
'+tr("Name")+' | \
'+tr("Users")+' | \
'+tr("VMs")+' | \
- '+tr("Memory used")+' | \
- '+tr("CPU used")+' | \
+ '+tr("Used memory")+' | \
+ '+tr("Used CPU")+' | \
\
\
\
@@ -142,10 +142,19 @@ var group_actions = {
error: onError,
},
- // "Group.showinfo" : {
- // type: "custom",
- // call: updateGroupInfo
- // },
+ "Group.show" : {
+ type: "single",
+ call: OpenNebula.Group.show,
+ callback: updateGroupElement,
+ error: onError
+ },
+
+ "Group.showinfo" : {
+ type: "single",
+ call: OpenNebula.Group.show,
+ callback: updateGroupInfo,
+ error: onError
+ },
"Group.autorefresh" : {
type: "custom",
@@ -185,7 +194,7 @@ var group_actions = {
type: "single",
call: OpenNebula.Group.show,
callback: function (request,response) {
- var parsed = parseQuotas(response.GROUP);
+ var parsed = parseQuotas(response.GROUP,quotaListItem);
$('.current_quotas table tbody',$group_quotas_dialog).append(parsed.VM);
$('.current_quotas table tbody',$group_quotas_dialog).append(parsed.DATASTORE);
$('.current_quotas table tbody',$group_quotas_dialog).append(parsed.IMAGE);
@@ -225,7 +234,8 @@ var group_buttons = {
},
"Group.create_dialog" : {
type: "create_dialog",
- text: tr("+ New Group")
+ text: tr("+ New Group"),
+ condition: mustBeAdmin
},
// "Group.chown" : {
// type: "confirm_with_select",
@@ -236,11 +246,13 @@ var group_buttons = {
// },
"Group.quotas_dialog" : {
type : "action",
- text : tr("Update quotas")
+ text : tr("Update quotas"),
+ condition: mustBeAdmin,
},
"Group.delete" : {
type: "confirm",
- text: tr("Delete")
+ text: tr("Delete"),
+ condition: mustBeAdmin
},
"Group.help" : {
type: "action",
@@ -249,17 +261,35 @@ var group_buttons = {
}
};
+var group_info_panel = {
+ "group_info_tab" : {
+ title: tr("Group information"),
+ content:""
+ },
+};
+
var groups_tab = {
title: tr("Groups"),
content: groups_tab_content,
buttons: group_buttons,
tabClass: 'subTab',
- parentTab: 'system_tab'
+ parentTab: 'system_tab',
+ condition: mustBeAdmin
};
+var groups_tab_non_admin = {
+ title: tr("Group info"),
+ content: groups_tab_content,
+ buttons: group_buttons,
+ tabClass: 'subTab',
+ parentTab: 'dashboard_tab',
+ condition: mustNotBeAdmin
+}
+
SunstoneMonitoringConfig['GROUP'] = {
plot: function(monitoring){
+ if (!mustBeAdmin()) return;
$('#totalGroups', $dashboard).text(monitoring['totalGroups'])
},
monitor: {
@@ -271,6 +301,8 @@ SunstoneMonitoringConfig['GROUP'] = {
Sunstone.addActions(group_actions);
Sunstone.addMainTab('groups_tab',groups_tab);
+Sunstone.addMainTab('groups_tab_non_admin',groups_tab_non_admin);
+Sunstone.addInfoPanel("group_info_panel",group_info_panel);
function groupElements(){
return getSelectedNodes(dataTable_groups);
@@ -350,9 +382,63 @@ function updateGroupsView(request, group_list){
updateView(group_list_array,dataTable_groups);
updateGroupSelect(group_list);
SunstoneMonitoring.monitor('GROUP', group_list)
- updateSystemDashboard("groups",group_list);
+ if (mustBeAdmin())
+ updateSystemDashboard("groups",group_list);
}
+function updateGroupInfo(request,group){
+ var info = group.GROUP;
+
+ var info_tab_html = '\
+ \
+ \
+ ' + tr("Group information") + ' - '+info.NAME+' | \
+ \
+ \
+ \
+ ' + tr("ID") + ' | \
+ '+info.ID+' | \
+ \
+ \
+ \
+ \
+ \
+ ' + tr("Quota information") +' | \
+ \
+ | | \
+ ';
+
+ if (!$.isEmptyObject(info.VM_QUOTA))
+ info_tab_html += '\
+ '+prettyPrintJSON(info.VM_QUOTA)+'\
+ '
+
+ if (!$.isEmptyObject(info.DATASTORE_QUOTA))
+ info_tab_html += '\
+ '+prettyPrintJSON(info.DATASTORE_QUOTA)+'\
+ '
+
+ if (!$.isEmptyObject(info.IMAGE_QUOTA))
+ info_tab_html += '\
+ '+prettyPrintJSON(info.IMAGE_QUOTA)+'\
+ ';
+
+ if (!$.isEmptyObject(info.NETWORK_QUOTA))
+ info_tab_html += '\
+ '+prettyPrintJSON(info.NETWORK_QUOTA)+'\
+ ';
+
+ var info_tab = {
+ title : tr("Group information"),
+ content : info_tab_html
+ };
+
+ Sunstone.updateInfoPanelTab("group_info_panel","group_info_tab",info_tab);
+ Sunstone.popUpInfoPanel("group_info_panel");
+}
+
+
+
//Prepares the dialog to create
function setupCreateGroupDialog(){
dialogs_context.append('');
@@ -437,7 +523,8 @@ $(document).ready(function(){
initCheckAllBoxes(dataTable_groups);
tableCheckboxesListener(dataTable_groups);
- infoListener(dataTable_groups);
+ infoListener(dataTable_groups, 'Group.showinfo');
$('div#groups_tab div.legend_div').hide();
+ $('div#groups_tab_non_admin div.legend_div').hide();
})
diff --git a/src/sunstone/public/js/plugins/marketplace-tab.js b/src/sunstone/public/js/plugins/marketplace-tab.js
index 5223e9837b..3ffb249040 100644
--- a/src/sunstone/public/js/plugins/marketplace-tab.js
+++ b/src/sunstone/public/js/plugins/marketplace-tab.js
@@ -152,6 +152,10 @@ function updateMarketInfo(request,app){
' + tr("ID") + ' | \
'+app['_id']["$oid"]+' | \
\
+ \
+ ' + tr("URL") + ' | \
+ '+config_response.system_config.marketplace_url+'/'+app['_id']["$oid"]+' | \
+ \
\
' + tr("Publisher") + ' | \
'+app['publisher']+' | \
@@ -170,7 +174,7 @@ function updateMarketInfo(request,app){
\
\
' + tr("Size") + ' | \
- '+app['files'][0]['size']+' | \
+ '+humanize_size(app['files'][0]['size'],true)+' | \
\
\
' + tr("Hypervisor") + ' | \
diff --git a/src/sunstone/public/js/plugins/templates-tab.js b/src/sunstone/public/js/plugins/templates-tab.js
index 0b879c0cf3..295ffe0762 100644
--- a/src/sunstone/public/js/plugins/templates-tab.js
+++ b/src/sunstone/public/js/plugins/templates-tab.js
@@ -1391,9 +1391,10 @@ function setupCreateTemplateDialog(){
//Auto-set IMAGE_UNAME hidden field value
$('#IMAGE', section_disks).change(function(){
- var uname = getValue($(this).val(),4,2,dataTable_images);
+ var option = $('option:selected',this);
+ var uname = getValue(option.attr('elem_id'),1,2,dataTable_images);
$('input#IMAGE_UNAME',section_disks).val(uname);
- var target = getValue($(this).val(),4,12,dataTable_images);
+ var target = getValue(option.attr('elem_id'),1,12,dataTable_images);
if (target && target != "--")
$('input#TARGET',section_disks).val(target);
else
@@ -1555,7 +1556,8 @@ function setupCreateTemplateDialog(){
//Auto-set IMAGE_UNAME hidden field value
$('#NETWORK', section_networks).change(function(){
- var uname = getValue($(this).val(),4,2,dataTable_vNetworks);
+ var option = $('option:selected',this);
+ var uname = getValue(option.attr('elem_id'),1,2,dataTable_vNetworks);
$('input#NETWORK_UNAME',section_networks).val(uname);
});
diff --git a/src/sunstone/public/js/plugins/users-tab.js b/src/sunstone/public/js/plugins/users-tab.js
index d894c98f48..7288a1628f 100644
--- a/src/sunstone/public/js/plugins/users-tab.js
+++ b/src/sunstone/public/js/plugins/users-tab.js
@@ -35,8 +35,8 @@ var users_tab_content = '\
'+tr("Group")+' | \
'+tr("Authentication driver")+' | \
'+tr("VMs")+' | \
- '+tr("Memory used")+' | \
- '+tr("CPU used")+' | \
+ '+tr("Used memory")+' | \
+ '+tr("Used CPU")+' | \
'+tr("Group ID")+' | \
\
\
@@ -323,7 +323,7 @@ var user_actions = {
// when we receive quotas we parse them and create an
// quota objects with html code () that can be inserted
// in the dialog
- var parsed = parseQuotas(response.USER);
+ var parsed = parseQuotas(response.USER,quotaListItem);
$('.current_quotas table tbody',$user_quotas_dialog).append(parsed.VM);
$('.current_quotas table tbody',$user_quotas_dialog).append(parsed.DATASTORE);
$('.current_quotas table tbody',$user_quotas_dialog).append(parsed.IMAGE);
@@ -365,7 +365,8 @@ var user_buttons = {
},
"User.create_dialog" : {
type: "create_dialog",
- text: tr("+ New")
+ text: tr("+ New"),
+ condition: mustBeAdmin
},
"User.update_dialog" : {
type: "action",
@@ -378,13 +379,15 @@ var user_buttons = {
},
"User.quotas_dialog" : {
type : "action",
- text : tr("Update quotas")
+ text : tr("Update quotas"),
+ condition: mustBeAdmin
},
"User.chgrp" : {
type: "confirm_with_select",
text: tr("Change group"),
select: groups_sel,
- tip: tr("This will change the main group of the selected users. Select the new group")+":"
+ tip: tr("This will change the main group of the selected users. Select the new group")+":",
+ condition: mustBeAdmin
},
"User.chauth" : {
type: "confirm_with_select",
@@ -396,7 +399,8 @@ var user_buttons = {
\
'
},
- tip: tr("Please choose the new type of authentication for the selected users")+":"
+ tip: tr("Please choose the new type of authentication for the selected users")+":",
+ condition: mustBeAdmin
},
// "User.addgroup" : {
// type: "confirm_with_select",
@@ -414,7 +418,8 @@ var user_buttons = {
// },
"User.delete" : {
type: "confirm",
- text: tr("Delete")
+ text: tr("Delete"),
+ condition: mustBeAdmin
},
"User.help" : {
type: "action",
@@ -440,12 +445,25 @@ var users_tab = {
content: users_tab_content,
buttons: user_buttons,
tabClass: 'subTab',
- parentTab: 'system_tab'
+ parentTab: 'system_tab',
+ condition: mustBeAdmin,
};
+var users_tab_non_admin = {
+ title: tr("User info"),
+ content: users_tab_content,
+ buttons: user_buttons,
+ tabClass: 'subTab',
+ parentTab: 'dashboard_tab',
+ condition: mustNotBeAdmin,
+}
+
SunstoneMonitoringConfig['USER'] = {
plot: function(monitoring){
+ //plot only when i am admin
+ if (!mustBeAdmin()) return;
+
//plot the number of total users
$('#totalUsers', $dashboard).text(monitoring['totalUsers'])
@@ -484,6 +502,7 @@ SunstoneMonitoringConfig['USER'] = {
Sunstone.addActions(user_actions);
Sunstone.addMainTab('users_tab',users_tab);
+Sunstone.addMainTab('users_tab_non_admin',users_tab_non_admin);
Sunstone.addInfoPanel("user_info_panel",user_info_panel);
function userElements(){
@@ -553,11 +572,14 @@ function updateUsersView(request,users_list){
var user_list_array = [];
$.each(users_list,function(){
+ if (this.USER.ID == uid)
+ dashboardQuotasHTML(this.USER);
user_list_array.push(userElementArray(this));
});
updateView(user_list_array,dataTable_users);
SunstoneMonitoring.monitor('USER', users_list)
- updateSystemDashboard("users",users_list);
+ if (mustBeAdmin())
+ updateSystemDashboard("users",users_list);
updateUserSelect();
};
@@ -573,7 +595,7 @@ function updateUserInfo(request,user){
\
\
\
- ' + tr("id") + ' | \
+ ' + tr("ID") + ' | \
'+user_info.ID+' | \
\
\
@@ -786,4 +808,5 @@ $(document).ready(function(){
infoListener(dataTable_users,'User.showinfo');
$('div#users_tab div.legend_div').hide();
+ $('div#users_tab_non_admin div.legend_div').hide();
});
diff --git a/src/sunstone/public/js/plugins/vms-tab.js b/src/sunstone/public/js/plugins/vms-tab.js
index 1e52062d3f..b187dd7da1 100644
--- a/src/sunstone/public/js/plugins/vms-tab.js
+++ b/src/sunstone/public/js/plugins/vms-tab.js
@@ -38,11 +38,13 @@ var vm_graphs = [
{ title : tr("Network transmission"),
monitor_resources : "NET_TX",
humanize_figures : true,
+ convert_from_bytes : true,
history_length : VM_HISTORY_LENGTH
},
{ title : tr("Network reception"),
monitor_resources : "NET_RX",
humanize_figures : true,
+ convert_from_bytes : true,
history_length : VM_HISTORY_LENGTH
}
];
@@ -668,10 +670,10 @@ SunstoneMonitoringConfig['VM'] = {
var t = ((new Date().getTime()) - netUsage.time) / 1000 //in secs
var bandwidth_up = monitoring['netUsageBar'][1].data[0][0] - netUsage.up
bandwidth_up /= t
- var bandwidth_up_str = humanize_size(bandwidth_up) + "b/s" //bytes /sec
+ var bandwidth_up_str = humanize_size(bandwidth_up,true) + "B/s" //bytes /sec
var bandwidth_down = monitoring['netUsageBar'][0].data[0][0] - netUsage.down
bandwidth_down /= t
- var bandwidth_down_str = humanize_size(bandwidth_down) + "b/s" //bytes /sec
+ var bandwidth_down_str = humanize_size(bandwidth_down,true) + "B/s" //bytes /sec
if (bandwidth_up >= 0)
$('#bandwidth_up', $dashboard).text(bandwidth_up_str)
@@ -742,14 +744,14 @@ SunstoneMonitoringConfig['VM'] = {
xaxis: {
min: 0,
tickFormatter : function(val,axis) {
- return humanize_size(val);
+ return humanize_size(val,true);
},
},
legend: {
noColumns: 3,
container: '#netUsageBar_legend',
labelFormatter: function(label, series){
- return label + " - " + humanize_size(series.data[0][0])
+ return label + " - " + humanize_size(series.data[0][0],true)
}
}
}
@@ -1114,27 +1116,28 @@ function printDisks(vm_info){
html += ' \
'+tr("No disks to show")+'\
| | ';
- html += ' ';
- return html;
}
+ else {
- for (var i = 0; i < disks.length; i++){
- var disk = disks[i];
- html += ' ';
- html += disk.DISK_ID + ' - ' +
- (disk.IMAGE ? disk.IMAGE : "Volatile") + ' | ';
- html += '\
+ for (var i = 0; i < disks.length; i++){
+ var disk = disks[i];
+ html += ' | ';
+ html += disk.DISK_ID + ' - ' +
+ (disk.IMAGE ? disk.IMAGE : "Volatile") + ' | ';
+ html += '\
'+(vm_info.STATE == "3" ? '\
- \
+ \
' : '')+'\
- \
- '
-+'\
- | ';
+ \
+ \
+ '
+ +'\
+';
+ }
}
html += '\
- |