feature #1664: Add permissions honogenously accross tabs

Remove "All" from datatable headers
This commit is contained in:
Tino Vazquez committed 2013-01-31 16:59:26 +01:00
1 parent 26630d9fd1
commit 080ec23368
7 files changed
+115 -90

No files matched your search

@@ -20,7 +20,7 @@
var host_datatable_table_tmpl='<thead>\
<tr>\
<th class="check"><input type="checkbox" class="check_all" value="">' + tr("All") + '</input></th>\
<th class="check"><input type="checkbox" class="check_all" value=""></input></th>\
<th>' + tr("ID") + '</th>\
<th>' + tr("Name") + '</th>\
<th>' + tr("Cluster") + '</th>\
@@ -40,7 +40,7 @@ var host_datatable_table_tmpl='<thead>\
var vnet_datatable_table_tmpl='<thead>\
<tr>\
<th class="check"><input type="checkbox" class="check_all" value="">'+tr("All")+'</input></th>\
<th class="check"><input type="checkbox" class="check_all" value=""></input></th>\
<th>'+tr("ID")+'</th>\
<th>'+tr("Owner")+'</th>\
<th>'+tr("Group")+'</th>\
@@ -56,7 +56,7 @@ var vnet_datatable_table_tmpl='<thead>\
var datastore_datatable_table_tmpl='<thead>\
<tr>\
<th class="check"><input type="checkbox" class="check_all" value="">' + tr("All") + '</input></th>\
<th class="check"><input type="checkbox" class="check_all" value=""></input></th>\
<th>'+tr("ID")+'</th>\
<th>'+tr("Owner")+'</th>\
<th>'+tr("Group")+'</th>\
@@ -848,7 +848,7 @@ var clusters_tab_content = '\
<table id="datatable_clusters" class="display">\
<thead>\
<tr>\
<th class="check"><input type="checkbox" class="check_all" value="">' + tr("All") + '</input></th>\
<th class="check"><input type="checkbox" class="check_all" value=""></input></th>\
<th>' + tr("ID") + '</th>\
<th>' + tr("Name") + '</th>\
<th>' + tr("Hosts") + '</th>\
@@ -25,7 +25,7 @@ var datastores_tab_content = '\
<table id="datatable_datastores" class="display">\
<thead>\
<tr>\
<th class="check"><input type="checkbox" class="check_all" value="">' + tr("All") + '</input></th>\
<th class="check"><input type="checkbox" class="check_all" value=""></input></th>\
<th>'+tr("ID")+'</th>\
<th>'+tr("Owner")+'</th>\
<th>'+tr("Group")+'</th>\
@@ -497,8 +497,12 @@ function updateDatastoreInfo(request,ds){
info.ID)
// Inserts the change permissions table
info_tab_content += insert_permissions_table("Datastore",info.ID);
info_tab_content += insert_permissions_table("Datastore",
info.ID,
info.UNAME,
info.GNAME,
info.UID,
info.GID);
var info_tab = {
title : tr("Information"),
+1 -1
View File
@@ -44,7 +44,7 @@ var hosts_tab_content = '\
<table id="datatable_hosts" class="display">\
<thead>\
<tr>\
<th class="check"><input type="checkbox" class="check_all" value="">' + tr("All") + '</input></th>\
<th class="check"><input type="checkbox" class="check_all" value=""></input></th>\
<th>' + tr("ID") + '</th>\
<th>' + tr("Name") + '</th>\
<th>' + tr("Cluster") + '</th>\
+16 -25
View File
@@ -24,7 +24,7 @@ var images_tab_content = '\
<table id="datatable_images" class="display">\
<thead>\
<tr>\
<th class="check"><input type="checkbox" class="check_all" value="">'+tr("All")+'</input></th>\
<th class="check"><input type="checkbox" class="check_all" value=""></input></th>\
<th>'+tr("ID")+'</th>\
<th>'+tr("Owner")+'</th>\
<th>'+tr("Group")+'</th>\
@@ -245,26 +245,6 @@ var image_actions = {
}
},
"Image.fetch_template" : {
type: "single",
call: OpenNebula.Image.fetch_template,
callback: function (request,response) {
$('#image_template_update_dialog #image_template_update_textarea').val(response.template);
},
error: onError
},
"Image.fetch_permissions" : {
type: "single",
call: OpenNebula.Image.show,
callback: function(request,image_json){
var dialog = $('#image_template_update_dialog form');
var image = image_json.IMAGE;
setPermissionsTable(image,dialog);
},
error: onError
},
"Image.update_template" : {
type: "single",
call: OpenNebula.Image.update,
@@ -335,6 +315,7 @@ var image_actions = {
call: OpenNebula.Image.chown,
callback: function (req) {
Sunstone.runAction("Image.show",req.request.data[0][0]);
Sunstone.runAction('Image.showinfo',request.request.data[0]);
},
elements: imageElements,
error: onError,
@@ -346,6 +327,7 @@ var image_actions = {
call: OpenNebula.Image.chgrp,
callback: function (req) {
Sunstone.runAction("Image.show",req.request.data[0][0]);
Sunstone.runAction('Image.showinfo',request.request.data[0]);
},
elements: imageElements,
error: onError,
@@ -619,10 +601,17 @@ function updateImageInfo(request,img){
<td class="key_td">'+tr("Running #VMS")+'</td>\
<td class="value_td">'+img_info.RUNNING_VMS+'</td>\
</tr>\
</table>' + insert_extended_template_table(img_info.TEMPLATE,
"Image",
img_info.ID) +
insert_permissions_table("Image",img_info.ID)
</table>' +
insert_extended_template_table(img_info.TEMPLATE,
"Image",
img_info.ID) +
insert_permissions_table("Image",
img_info.ID,
img_info.UNAME,
img_info.GNAME,
img_info.UID,
img_info.GID)
}
$("#div_edit_rename_link").die();
@@ -693,6 +682,8 @@ function updateImageInfo(request,img){
Sunstone.updateInfoPanelTab("image_info_panel","image_info_tab",info_tab);
Sunstone.popUpInfoPanel("image_info_panel");
setPermissionsTable(img_info,'');
}
// Prepare the image creation dialog
+27 -5
View File
@@ -68,7 +68,7 @@ var vms_tab_content = '\
<table id="datatable_vmachines" class="display">\
<thead>\
<tr>\
<th class="check"><input type="checkbox" class="check_all" value="">'+tr("All")+'</input></th>\
<th class="check"><input type="checkbox" class="check_all" value=""></input></th>\
<th>'+tr("ID")+'</th>\
<th>'+tr("Owner")+'</th>\
<th>'+tr("Group")+'</th>\
@@ -477,7 +477,21 @@ var vm_buttons = {
text: tr("Shutdown"),
tip: tr("This will initiate the shutdown process in the selected VMs")
},
"VM.chown" : {
type: "confirm_with_select",
text: tr("Change owner"),
select: users_sel,
tip: tr("Select the new owner")+":",
condition: mustBeAdmin
},
"VM.chgrp" : {
type: "confirm_with_select",
text: tr("Change group"),
select: groups_sel,
tip: tr("Select the new group")+":",
condition: mustBeAdmin
},
"action_list" : {
type: "select",
actions: {
@@ -956,10 +970,18 @@ function updateVMInfo(request,vm){
<td class="value_td">'+(typeof(vm_info.DEPLOY_ID) == "object" ? "-" : vm_info.DEPLOY_ID)+'</td>\
</tr>\
</tbody>\
</table>' + insert_extended_template_table(vm_info.USER_TEMPLATE,
"VM",
vm_info.ID) +
insert_permissions_table("VM",vm_info.ID, vm_info.UNAME, vm_info.GNAME, vm_info.UID, vm_info.GID) +
</table>' +
insert_extended_template_table(vm_info.USER_TEMPLATE,
"VM",
vm_info.ID) +
insert_permissions_table("VM",
vm_info.ID,
vm_info.UNAME,
vm_info.GNAME,
vm_info.UID,
vm_info.GID) +
'<table id="vm_monitoring_table" class="info_table">\
<thead>\
<tr><th colspan="2">'+tr("Monitoring information")+'</th></tr>\
+7 -3
View File
@@ -24,7 +24,7 @@ var vnets_tab_content = '\
<table id="datatable_vnetworks" class="display">\
<thead>\
<tr>\
<th class="check"><input type="checkbox" class="check_all" value="">'+tr("All")+'</input></th>\
<th class="check"><input type="checkbox" class="check_all" value=""></input></th>\
<th>'+tr("ID")+'</th>\
<th>'+tr("Owner")+'</th>\
<th>'+tr("Group")+'</th>\
@@ -598,8 +598,12 @@ function updateVNetworkInfo(request,vn){
"Network",
vn_info.ID);
info_tab_content += insert_permissions_table("Network",vn_info.ID);
info_tab_content += insert_permissions_table("Network",
vn_info.ID,
vn_info.UNAME,
vn_info.GNAME,
vn_info.UID,
vn_info.GID);
var info_tab = {
title: tr("Information"),
+53 -49
View File
@@ -1406,7 +1406,7 @@ function buildOctet(permTable){
// Returns HTML with listeners to control permissions
function insert_permissions_table(resource_type,resource_id, owner, group, uid, gid){
function insert_permissions_table(resource_type,resource_id, owner, group, vm_uid, vm_gid){
var str ='<table class="'+resource_type.toLowerCase()+'_permissions_table" style="padding:0 10px;">\
<thead><tr>\
<td style="width:130px">'+tr("Permissions")+':</td>\
@@ -1430,8 +1430,11 @@ function insert_permissions_table(resource_type,resource_id, owner, group, uid,
<td style="text-align:center"><input type="checkbox" class="permission_check other_u" /></td>\
<td style="text-align:center"><input type="checkbox" class="permission_check other_m" /></td>\
<td style="text-align:center"><input type="checkbox" class="permission_check other_a" /></td>\
</tr>\
<tr><td style="width:130px">'+tr("Ownership")+'</td>\</tr>\
</tr>'
if (mustBeAdmin())
{
str += '<tr><td style="width:130px">'+tr("Ownership")+'</td>\</tr>\
<tr>\
<td>'+tr("Owner")+'</td>\
<td></td>\
@@ -1452,6 +1455,53 @@ function insert_permissions_table(resource_type,resource_id, owner, group, uid,
</tr>\
</table>'
// Handlers for chown
$("#div_edit_chg_owner_link").die();
$("#user_confirm_select").die();
// Listener for key,value pair edit action
$("#div_edit_chg_owner_link").live("click", function() {
var value_str = $("#value_td_owner").text();
var select_str='<select style="margin: 10px 0;" id="user_confirm_select">';
select_str += makeSelectOptions(dataTable_users,1,2,[],[],true);
select_str+="</select>";
$("#value_td_owner").html(select_str);
$("select#user_confirm_select").val(vm_uid);
});
$("#user_confirm_select").live("change", function() {
var value_str = $('select#user_confirm_select').val();
if(value_str!="")
{
// Let OpenNebula know
Sunstone.runAction(resource_type+".chown",resource_id,value_str);
}
});
// Handlers for chgrp
$("#div_edit_chg_group_link").die();
$("#group_confirm_select").die();
// Listener for key,value pair edit action
$("#div_edit_chg_group_link").live("click", function() {
var value_str = $("#value_td_group").text();
var select_str='<select style="margin: 10px 0;" id="group_confirm_select">';
select_str += makeSelectOptions(dataTable_groups,1,2,[],[],true);
select_str+="</select>";
$("#value_td_group").html(select_str);
$("select#group_confirm_select").val(vm_gid);
});
$("#group_confirm_select").live("change", function() {
var value_str = $('select#group_confirm_select').val();
if(value_str!="")
{
// Let OpenNebula know
Sunstone.runAction(resource_type+".chgrp",resource_id,value_str);
}
});
}
$(".permission_check").die();
$(".permission_check").live('change',function(){
var permissions_table = $("."+resource_type.toLowerCase()+"_permissions_table");
@@ -1460,52 +1510,6 @@ function insert_permissions_table(resource_type,resource_id, owner, group, uid,
Sunstone.runAction(resource_type+".chmod",resource_id,permissions_octect);
});
// Handlers for chown
$("#div_edit_chg_owner_link").die();
$("#user_confirm_select").die();
// Listener for key,value pair edit action
$("#div_edit_chg_owner_link").live("click", function() {
var value_str = $("#value_td_owner").text();
var select_str='<select style="margin: 10px 0;" id="user_confirm_select">';
select_str += makeSelectOptions(dataTable_users,1,2,[],[],true);
select_str+="</select>";
$("#value_td_owner").html(select_str);
$("select#user_confirm_select").val(uid);
});
$("#user_confirm_select").live("change", function() {
var value_str = $('select#user_confirm_select').val();
if(value_str!="")
{
// Let OpenNebula know
Sunstone.runAction(resource_type+".chown",resource_id,value_str);
}
});
// Handlers for chgrp
$("#div_edit_chg_group_link").die();
$("#group_confirm_select").die();
// Listener for key,value pair edit action
$("#div_edit_chg_group_link").live("click", function() {
var value_str = $("#value_td_group").text();
var select_str='<select style="margin: 10px 0;" id="group_confirm_select">';
select_str += makeSelectOptions(dataTable_groups,1,2,[],[],true);
select_str+="</select>";
$("#value_td_group").html(select_str);
$("select#group_confirm_select").val(gid);
});
$("#group_confirm_select").live("change", function() {
var value_str = $('select#group_confirm_select').val();
if(value_str!="")
{
// Let OpenNebula know
Sunstone.runAction(resource_type+".chgrp",resource_id,value_str);
}
});
return str;
}