mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-23 22:50:09 +03:00
Feature #2778: Migrate all selects to the new async method
This commit is contained in:
parent
3d174e2ecc
commit
f7f0c545a1
@ -27,15 +27,40 @@ var create_acl_tmpl =
|
||||
<div class="reveal-body">\
|
||||
<form id="create_acl_form" action="">\
|
||||
<div class="row">\
|
||||
<div class="large-6 columns">\
|
||||
<label for="applies">'+tr("This rule applies to")+':</label>\
|
||||
<select name="applies" id="applies"></select>\
|
||||
</div>\
|
||||
<div class="large-6 columns">\
|
||||
<label for="zones_applies">'+tr("Zones where the rule applies")+'</label>\
|
||||
<select name="zones_applies" id="zones_applies"></select>\
|
||||
<div name="zones_applies" id="zones_applies">\
|
||||
</div>\
|
||||
</div>\
|
||||
</div>\
|
||||
<fieldset>\
|
||||
<legend>'+tr("This rule applies to")+'</legend>\
|
||||
<div class="row">\
|
||||
<div class="large-3 columns">\
|
||||
<input type="radio" class="applies" name="applies_select" value="*" id="applies_all"><label class="applies" for="applies_all">'+tr("All")+'</label>\
|
||||
</div>\
|
||||
<div class="large-3 columns">\
|
||||
<input type="radio" class="applies" name="applies_select" value="applies_to_user" id="applies_id"><label class="applies" for="applies_id">'+tr("User")+'</label>\
|
||||
</div>\
|
||||
<div class="large-3 columns">\
|
||||
<input type="radio" class="applies" name="applies_select" value="applies_to_group" id="applies_group"><label class="applies" for="applies_group">'+tr("Group")+'</label>\
|
||||
</div>\
|
||||
</div>\
|
||||
<div class="row">\
|
||||
<div class="large-6 columns">\
|
||||
<div class="applies_to_user">\
|
||||
<label for="applies_to_user">'+tr("User")+':</label>\
|
||||
<div name="applies_to_user" id="applies_to_user">\
|
||||
</div>\
|
||||
</div>\
|
||||
<div class="applies_to_group">\
|
||||
<label for="applies_to_group">'+tr("Group")+':</label>\
|
||||
<div name="applies_to_group" id="applies_to_group">\
|
||||
</div>\
|
||||
</div>\
|
||||
</div>\
|
||||
</div>\
|
||||
</fieldset>\
|
||||
<fieldset>\
|
||||
<legend>'+tr("Affected resources")+'</legend>\
|
||||
<div class="row">\
|
||||
@ -104,7 +129,8 @@ var create_acl_tmpl =
|
||||
</div>\
|
||||
<div class="belonging_to">\
|
||||
<label for="belonging_to">'+tr("Group")+':</label>\
|
||||
<select name="belonging_to" id="belonging_to"></select>\
|
||||
<div name="belonging_to" id="belonging_to">\
|
||||
</div>\
|
||||
</div>\
|
||||
<div class="in_cluster">\
|
||||
<label for="in_cluster">'+tr("Cluster")+':</label>\
|
||||
@ -449,6 +475,10 @@ function setupCreateAclDialog(){
|
||||
dialog.addClass("reveal-modal large max-height").attr("data-reveal", "");
|
||||
|
||||
//Default selected options
|
||||
$('#applies_all',dialog).attr('checked','checked');
|
||||
$('.applies_to_user',dialog).hide();
|
||||
$('.applies_to_group',dialog).hide();
|
||||
|
||||
$('#res_subgroup_all',dialog).attr('checked','checked');
|
||||
$('.res_id',dialog).hide();
|
||||
$('.belonging_to',dialog).hide();
|
||||
@ -456,6 +486,25 @@ function setupCreateAclDialog(){
|
||||
|
||||
//$('button',dialog).button();
|
||||
|
||||
//Applies to subset radio buttons
|
||||
$('.applies',dialog).click(function(){
|
||||
var value = $(this).val();
|
||||
switch (value) {
|
||||
case "*":
|
||||
$('.applies_to_user',dialog).hide();
|
||||
$('.applies_to_group',dialog).hide();
|
||||
break;
|
||||
case "applies_to_user":
|
||||
$('.applies_to_user',dialog).show();
|
||||
$('.applies_to_group',dialog).hide();
|
||||
break;
|
||||
case "applies_to_group":
|
||||
$('.applies_to_user',dialog).hide();
|
||||
$('.applies_to_group',dialog).show();
|
||||
break;
|
||||
};
|
||||
});
|
||||
|
||||
//Resource subset radio buttons
|
||||
$('.res_subgroup',dialog).click(function(){
|
||||
var value = $(this).val();
|
||||
@ -492,13 +541,20 @@ function setupCreateAclDialog(){
|
||||
$(dialog).off('change', 'input,select');
|
||||
$(dialog).on('change', 'input,select', function(){
|
||||
var context = $('#create_acl_form',$create_acl_dialog);
|
||||
var user = $('#applies',context).val();
|
||||
|
||||
if ($('#applies :selected',context).hasClass("user")){
|
||||
user='#'+user;
|
||||
} else if ($('#applies :selected',context).hasClass("group")){
|
||||
user = '@'+user;
|
||||
};
|
||||
var user="";
|
||||
var mode = $('.applies:checked',context).val();
|
||||
switch (mode) {
|
||||
case "*":
|
||||
user="*";
|
||||
break;
|
||||
case "applies_to_user":
|
||||
user="#"+$('div#applies_to_user .resource_list_select',context).val();
|
||||
break;
|
||||
case "applies_to_group":
|
||||
user="@"+$('div#applies_to_group .resource_list_select',context).val();
|
||||
break;
|
||||
}
|
||||
|
||||
var resources = "";
|
||||
$('.resource_cb:checked',context).each(function(){
|
||||
@ -516,7 +572,7 @@ function setupCreateAclDialog(){
|
||||
belonging="#"+$('#res_id',context).val();
|
||||
break;
|
||||
case "belonging_to":
|
||||
belonging="@"+$('#belonging_to',context).val();
|
||||
belonging="@"+$('div#belonging_to .resource_list_select',context).val();
|
||||
break;
|
||||
case "in_cluster":
|
||||
belonging="%"+$('#in_cluster .resource_list_select',context).val();
|
||||
@ -530,9 +586,9 @@ function setupCreateAclDialog(){
|
||||
});
|
||||
if (rights.length) { rights = rights.substring(0,rights.length-1) };
|
||||
|
||||
var zone = $('#zones_applies',context).val();
|
||||
var zone = $('#zones_applies .resource_list_select',context).val();
|
||||
|
||||
if ($('#zones_applies :selected',context).hasClass("zone")){
|
||||
if (zone != "*"){
|
||||
zone = '#'+zone;
|
||||
}
|
||||
|
||||
@ -543,11 +599,23 @@ function setupCreateAclDialog(){
|
||||
});
|
||||
|
||||
$('#create_acl_form',dialog).submit(function(){
|
||||
var user = $('#applies',this).val();
|
||||
if (!user.length) {
|
||||
notifyError(tr("Please specify to who this ACL applies"));
|
||||
return false;
|
||||
};
|
||||
var mode = $('.applies:checked',this).val();
|
||||
switch (mode) {
|
||||
case "applies_to_user":
|
||||
var l=$('#applies_to_user .resource_list_select',this).val().length;
|
||||
if (!l){
|
||||
notifyError("Please select a user to whom the acl applies");
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case "applies_to_group":
|
||||
var l=$('#applies_to_group .resource_list_select',this).val().length;
|
||||
if (!l){
|
||||
notifyError("Please select a group to whom the acl applies");
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
var resources = $('.resource_cb:checked',this).length;
|
||||
if (!resources) {
|
||||
@ -565,7 +633,7 @@ function setupCreateAclDialog(){
|
||||
}
|
||||
break;
|
||||
case "belonging_to":
|
||||
var l=$('#belonging_to',this).val().length;
|
||||
var l=$('#belonging_to .resource_list_select',this).val().length;
|
||||
if (!l){
|
||||
notifyError("Please select a group to which the selected resources belong to");
|
||||
return false;
|
||||
@ -598,34 +666,16 @@ function setupCreateAclDialog(){
|
||||
// required: we have to put the right options in the
|
||||
// selects.
|
||||
function popUpCreateAclDialog(){
|
||||
var users = $('<select>'+users_sel()+'</select>');
|
||||
$('.empty_value',users).remove();
|
||||
$('option',users).addClass("user");
|
||||
users.prepend('<option value="">---'+tr("Users")+'---</option>');
|
||||
|
||||
var groups = $('<select>'+groups_sel()+'</select>');
|
||||
$('.empty_value',groups).remove();
|
||||
$('option',groups).addClass("group");
|
||||
groups.prepend('<option value="">---'+tr("Groups")+'---</option>');
|
||||
|
||||
var dialog = $create_acl_dialog;
|
||||
|
||||
$('#applies',dialog).html('<option value="*">'+tr("All")+'</option>'+
|
||||
users.html()+groups.html());
|
||||
$('#belonging_to',dialog).html(groups_select);
|
||||
insertSelectClusters('#in_cluster',dialog, null, true);
|
||||
insertSelectOptions('div#applies_to_user', dialog, "User", null, true);
|
||||
insertSelectOptions('div#applies_to_group', dialog, "Group", null, true);
|
||||
|
||||
$('#applies',dialog).trigger("change");
|
||||
|
||||
var zones = $('<select>'+zones_sel()+'</select>');
|
||||
$('.empty_value',zones).remove();
|
||||
$('option',zones).addClass("zone");
|
||||
|
||||
$('#zones_applies',dialog).html('<option value="*">'+tr("All")+'</option>'+
|
||||
zones.html());
|
||||
|
||||
$('#zones_applies',dialog).trigger("change");
|
||||
insertSelectOptions('div#belonging_to', dialog, "Group", null, true);
|
||||
insertSelectOptions('#in_cluster',dialog, "Cluster", null, true);
|
||||
|
||||
insertSelectOptions('div#zones_applies', dialog, "Zone", "*", false,
|
||||
'<option value="*">'+tr("All")+'</option>');
|
||||
|
||||
dialog.foundation().foundation('reveal', 'open');
|
||||
}
|
||||
|
@ -251,7 +251,6 @@ var datastore_image_table_tmpl='<thead>\
|
||||
<tbody id="tbodyimages">\
|
||||
</tbody>'
|
||||
|
||||
var datastores_select="";
|
||||
var dataTable_datastores;
|
||||
var $create_datastore_dialog;
|
||||
|
||||
@ -470,7 +469,7 @@ var datastore_buttons = {
|
||||
"Datastore.addtocluster" : {
|
||||
type: "confirm_with_select",
|
||||
text: tr("Select cluster"),
|
||||
select: insertSelectClusters,
|
||||
select: "Cluster",
|
||||
layout: "more_select",
|
||||
tip: tr("Select the destination cluster:"),
|
||||
condition: mustBeAdmin
|
||||
@ -478,7 +477,7 @@ var datastore_buttons = {
|
||||
"Datastore.chown" : {
|
||||
type: "confirm_with_select",
|
||||
text: tr("Change owner"),
|
||||
select: users_sel,
|
||||
select: "User",
|
||||
layout: "user_select",
|
||||
tip: tr("Select the new owner")+":",
|
||||
condition: mustBeAdmin
|
||||
@ -486,7 +485,7 @@ var datastore_buttons = {
|
||||
"Datastore.chgrp" : {
|
||||
type: "confirm_with_select",
|
||||
text: tr("Change group"),
|
||||
select: groups_sel,
|
||||
select: "Group",
|
||||
layout: "user_select",
|
||||
tip: tr("Select the new group")+":",
|
||||
condition: mustBeAdmin
|
||||
@ -594,33 +593,20 @@ function datastoreElementArray(element_json){
|
||||
];
|
||||
}
|
||||
|
||||
function updateDatastoreSelect(){
|
||||
datastores_select = makeSelectOptions(dataTable_datastores,
|
||||
1,
|
||||
4,
|
||||
[9],//system ds
|
||||
['system'], //filter out sys datastores
|
||||
true
|
||||
);
|
||||
};
|
||||
|
||||
function updateDatastoreElement(request, element_json){
|
||||
var id = element_json.DATASTORE.ID;
|
||||
var element = datastoreElementArray(element_json);
|
||||
updateSingleElement(element,dataTable_datastores,'#datastore_'+id)
|
||||
updateDatastoreSelect();
|
||||
}
|
||||
|
||||
function deleteDatastoreElement(request){
|
||||
deleteElement(dataTable_datastores,'#datastore_'+request.request.data);
|
||||
updateDatastoreSelect();
|
||||
}
|
||||
|
||||
function addDatastoreElement(request,element_json){
|
||||
var id = element_json.DATASTORE.ID;
|
||||
var element = datastoreElementArray(element_json);
|
||||
addElement(element,dataTable_datastores);
|
||||
updateDatastoreSelect();
|
||||
}
|
||||
|
||||
|
||||
@ -632,7 +618,6 @@ function updateDatastoresView(request, list){
|
||||
});
|
||||
|
||||
updateView(list_array,dataTable_datastores);
|
||||
updateDatastoreSelect();
|
||||
}
|
||||
|
||||
|
||||
@ -1108,8 +1093,8 @@ function popUpCreateDatastoreDialog(){
|
||||
if (!cluster_id_raw) cluster_id_raw = "-1";
|
||||
|
||||
|
||||
insertSelectClusters('div#cluster_id', $create_datastore_dialog, cluster_id, false);
|
||||
insertSelectClusters('div#datastore_cluster_raw', $create_datastore_dialog, cluster_id_raw, false);
|
||||
insertSelectOptions('div#cluster_id', $create_datastore_dialog, "Cluster", cluster_id, false);
|
||||
insertSelectOptions('div#datastore_cluster_raw', $create_datastore_dialog, "Cluster", cluster_id_raw, false);
|
||||
$create_datastore_dialog.foundation().foundation('reveal', 'open');
|
||||
$("input#name",$create_datastore_dialog).focus();
|
||||
}
|
||||
|
@ -69,8 +69,8 @@ var create_file_tmpl ='<div class="row">\
|
||||
<label for="file_datastore">'+tr("Datastore")+
|
||||
'<span class="tip">'+tr("Select the datastore for this file")+'</span>'+
|
||||
'</label>\
|
||||
<select id="file_datastore" name="file_datastore">\
|
||||
</select>\
|
||||
<div id="file_datastore" name="file_datastore">\
|
||||
</div>\
|
||||
</div>\
|
||||
</div>\
|
||||
</div>\
|
||||
@ -109,7 +109,8 @@ var create_file_tmpl ='<div class="row">\
|
||||
<div class="row">\
|
||||
<div class="columns large-12">\
|
||||
<label for="file_datastores_raw">'+tr("Datastore")+':</label>\
|
||||
<select id="file_datastore_raw" name="file_datastore_raw"></select>\
|
||||
<div id="file_datastore_raw" name="file_datastore_raw">\
|
||||
</div>\
|
||||
</div>\
|
||||
</div>\
|
||||
<div class="row">\
|
||||
@ -311,7 +312,7 @@ var file_buttons = {
|
||||
type: "confirm_with_select",
|
||||
text: tr("Change owner"),
|
||||
layout: "user_select",
|
||||
select: users_sel,
|
||||
select: "User",
|
||||
tip: tr("Select the new owner")+":",
|
||||
condition: mustBeAdmin
|
||||
},
|
||||
@ -319,7 +320,7 @@ var file_buttons = {
|
||||
type: "confirm_with_select",
|
||||
text: tr("Change group"),
|
||||
layout: "user_select",
|
||||
select: groups_sel,
|
||||
select: "Group",
|
||||
tip: tr("Select the new group")+":",
|
||||
condition: mustBeAdmin
|
||||
},
|
||||
@ -698,7 +699,7 @@ function setupCreateFileDialog(){
|
||||
$('#create_file_submit',dialog).click(function(){
|
||||
var upload = false;
|
||||
|
||||
var ds_id = $('#file_datastore',dialog).val();
|
||||
var ds_id = $('#file_datastore .resource_list_select',dialog).val();
|
||||
if (!ds_id){
|
||||
notifyError(tr("Please select a datastore for this file"));
|
||||
return false;
|
||||
@ -748,7 +749,7 @@ function setupCreateFileDialog(){
|
||||
|
||||
$('#create_file_submit_manual',dialog).click(function(){
|
||||
var template=$('#template',dialog).val();
|
||||
var ds_id = $('#file_datastore_raw',dialog).val();
|
||||
var ds_id = $('#file_datastore_raw .resource_list_select',dialog).val();
|
||||
|
||||
if (!ds_id){
|
||||
notifyError(tr("Please select a datastore for this file"));
|
||||
@ -787,16 +788,21 @@ function popUpCreateFileDialog(){
|
||||
$('#files_file-uploader input',$create_file_dialog).removeAttr("style");
|
||||
$('#files_file-uploader input',$create_file_dialog).attr('style','margin:0;width:256px!important');
|
||||
|
||||
datastores_str = makeSelectOptions(dataTable_datastores,
|
||||
1,
|
||||
4,
|
||||
[10,10],//system ds
|
||||
['image','system'], //filter image & sys datastores
|
||||
true
|
||||
);
|
||||
var ds_id = $("div#file_datastore .resource_list_select",
|
||||
$create_file_dialog).val();
|
||||
|
||||
$('#file_datastore',$create_file_dialog).html(datastores_str);
|
||||
$('#file_datastore_raw',$create_file_dialog).html(datastores_str);
|
||||
var ds_id_raw = $("div#file_datastore_raw .resource_list_select",
|
||||
$create_file_dialog).val();
|
||||
|
||||
// Filter out DS with type image (0) or system (1)
|
||||
var filter_att = ["TYPE", "TYPE"];
|
||||
var filter_val = ["0", "1"];
|
||||
|
||||
insertSelectOptions('div#file_datastore', $create_file_dialog, "Datastore",
|
||||
ds_id, false, null, filter_att, filter_val);
|
||||
|
||||
insertSelectOptions('div#file_datastore_raw', $create_file_dialog, "Datastore",
|
||||
ds_id_raw, false, null, filter_att, filter_val);
|
||||
|
||||
$create_file_dialog.foundation().foundation('reveal', 'open');
|
||||
$("input#file_name",$create_file_dialog).focus();
|
||||
|
@ -14,7 +14,6 @@
|
||||
/* limitations under the License. */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
var groups_select="";
|
||||
var dataTable_groups;
|
||||
var $create_group_dialog;
|
||||
var $group_quotas_dialog;
|
||||
@ -496,15 +495,6 @@ function groupElementArray(group_json){
|
||||
];
|
||||
}
|
||||
|
||||
function updateGroupSelect(){
|
||||
groups_select = makeSelectOptions(dataTable_groups,
|
||||
1,//id_col
|
||||
2,//name_col
|
||||
[],//status_cols
|
||||
[]//bad_status_cols
|
||||
);
|
||||
}
|
||||
|
||||
function updateGroupElement(request, group_json){
|
||||
var id = group_json.GROUP.ID;
|
||||
var element = groupElementArray(group_json);
|
||||
@ -514,14 +504,12 @@ function updateGroupElement(request, group_json){
|
||||
|
||||
function deleteGroupElement(request){
|
||||
deleteElement(dataTable_groups,'#group_'+request.request.data);
|
||||
updateGroupSelect();
|
||||
}
|
||||
|
||||
function addGroupElement(request,group_json){
|
||||
var id = group_json.GROUP.ID;
|
||||
var element = groupElementArray(group_json);
|
||||
addElement(element,dataTable_groups);
|
||||
updateGroupSelect();
|
||||
}
|
||||
|
||||
//updates the list
|
||||
@ -542,7 +530,6 @@ function updateGroupsView(request, group_list, quotas_hash){
|
||||
group_list_array.push(groupElementArray(this));
|
||||
});
|
||||
updateView(group_list_array,dataTable_groups);
|
||||
updateGroupSelect(group_list);
|
||||
|
||||
// Dashboard info
|
||||
$(".total_groups").text(group_list.length);
|
||||
|
@ -109,7 +109,6 @@ var create_host_tmpl =
|
||||
</div>\
|
||||
<a class="close-reveal-modal">×</a>';
|
||||
|
||||
var hosts_select="";
|
||||
var dataTable_hosts;
|
||||
var $create_host_dialog;
|
||||
|
||||
@ -298,7 +297,7 @@ var host_buttons = {
|
||||
"Host.addtocluster" : {
|
||||
type: "confirm_with_select",
|
||||
text: tr("Select cluster"),
|
||||
select: insertSelectClusters,
|
||||
select: "Cluster",
|
||||
tip: tr("Select the destination cluster:"),
|
||||
layout: "more_select",
|
||||
condition: mustBeAdmin
|
||||
@ -487,28 +486,16 @@ function hostElementArray(host_json){
|
||||
];
|
||||
}
|
||||
|
||||
//updates the host select by refreshing the options in it
|
||||
function updateHostSelect(){
|
||||
hosts_select = makeSelectOptions(dataTable_hosts,
|
||||
1,//id_col
|
||||
2,//name_col
|
||||
[7,7],//status_cols
|
||||
[tr("ERROR"),tr("OFF"),tr("RETRY")]//bad_st
|
||||
);
|
||||
}
|
||||
|
||||
//callback for an action affecting a host element
|
||||
function updateHostElement(request, host_json){
|
||||
var id = host_json.HOST.ID;
|
||||
var element = hostElementArray(host_json);
|
||||
updateSingleElement(element,dataTable_hosts,'#host_'+id);
|
||||
updateHostSelect();
|
||||
}
|
||||
|
||||
//callback for actions deleting a host element
|
||||
function deleteHostElement(req){
|
||||
deleteElement(dataTable_hosts,'#host_'+req.request.data);
|
||||
updateHostSelect();
|
||||
}
|
||||
|
||||
//call back for actions creating a host element
|
||||
@ -516,7 +503,6 @@ function addHostElement(request,host_json){
|
||||
var id = host_json.HOST.ID;
|
||||
var element = hostElementArray(host_json);
|
||||
addElement(element,dataTable_hosts);
|
||||
updateHostSelect();
|
||||
}
|
||||
|
||||
//callback to update the list of hosts.
|
||||
@ -593,7 +579,6 @@ function updateHostsView (request,host_list){
|
||||
}
|
||||
|
||||
updateView(host_list_array,dataTable_hosts);
|
||||
updateHostSelect();
|
||||
|
||||
$(".total_hosts").text(host_list.length);
|
||||
$(".on_hosts").text(on_hosts);
|
||||
@ -956,7 +941,7 @@ function popUpCreateHostDialog(){
|
||||
var cluster_id = $('#host_cluster_id .resource_list_select',$('div#create_host_dialog')).val();
|
||||
if (!cluster_id) cluster_id = "-1";
|
||||
|
||||
insertSelectClusters('#host_cluster_id',$('div#create_host_dialog'), cluster_id, false);
|
||||
insertSelectOptions('#host_cluster_id',$('div#create_host_dialog'), "Cluster", cluster_id, false);
|
||||
|
||||
$('div#create_host_dialog').foundation('reveal', 'open');
|
||||
$("input#name",$('div#create_host_dialog')).focus();
|
||||
|
@ -74,8 +74,8 @@ var create_image_tmpl ='<div class="row create_image_header">\
|
||||
<label for="img_datastore">'+tr("Datastore")+
|
||||
'<span class="tip">'+tr("Select the datastore for this image")+'</span>'+
|
||||
'</label>\
|
||||
<select id="img_datastore" name="img_datastore">\
|
||||
</select>\
|
||||
<div id="img_datastore" name="img_datastore">\
|
||||
</div>\
|
||||
</div>\
|
||||
</div>\
|
||||
<div class="row">\
|
||||
@ -215,7 +215,8 @@ var create_image_tmpl ='<div class="row create_image_header">\
|
||||
<div class="row">\
|
||||
<div class="columns large-12">\
|
||||
<label for="img_datastores_raw">'+tr("Datastore")+':</label>\
|
||||
<select id="img_datastore_raw" name="img_datastore_raw"></select>\
|
||||
<div id="img_datastore_raw" name="img_datastore_raw">\
|
||||
</div>\
|
||||
</div>\
|
||||
</div>\
|
||||
<div class="row">\
|
||||
@ -452,7 +453,7 @@ var image_buttons = {
|
||||
type: "confirm_with_select",
|
||||
text: tr("Change owner"),
|
||||
layout: "user_select",
|
||||
select: users_sel,
|
||||
select: "User",
|
||||
tip: tr("Select the new owner")+":",
|
||||
condition: mustBeAdmin
|
||||
},
|
||||
@ -460,7 +461,7 @@ var image_buttons = {
|
||||
type: "confirm_with_select",
|
||||
text: tr("Change group"),
|
||||
layout: "user_select",
|
||||
select: groups_sel,
|
||||
select: "Group",
|
||||
tip: tr("Select the new group")+":",
|
||||
condition: mustBeAdmin
|
||||
},
|
||||
@ -985,38 +986,6 @@ function initialize_create_image_dialog(dialog) {
|
||||
file_input = input; return false;
|
||||
};
|
||||
|
||||
$('#img_type').change(function(){
|
||||
enable_all_datastores();
|
||||
var choice_str = $(this).val();
|
||||
switch(choice_str)
|
||||
{
|
||||
case 'OS':
|
||||
case 'CDROM':
|
||||
case 'DATABLOCK':
|
||||
$('select#img_datastore').children('option').each(function() {
|
||||
$(this).removeAttr('disabled');
|
||||
if ($(this).val() == "2")
|
||||
{
|
||||
$(this).attr('disabled', 'disabled');
|
||||
}
|
||||
});
|
||||
$('select#img_datastore').val("1");
|
||||
break;
|
||||
case 'KERNEL':
|
||||
case 'RAMDISK':
|
||||
case 'CONTEXT':
|
||||
$('select#img_datastore').children('option').each(function() {
|
||||
$(this).attr('disabled', 'disabled');
|
||||
if ($(this).val() == "2")
|
||||
{
|
||||
$(this).removeAttr('disabled');
|
||||
}
|
||||
});
|
||||
$('select#img_datastore').val("2");
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
||||
$('#create_image_submit',dialog).click(function(){
|
||||
var exit = false;
|
||||
var upload = false;
|
||||
@ -1029,7 +998,7 @@ function initialize_create_image_dialog(dialog) {
|
||||
});
|
||||
if (exit) { return false; }
|
||||
|
||||
var ds_id = $('#img_datastore',dialog).val();
|
||||
var ds_id = $('#img_datastore .resource_list_select',dialog).val();
|
||||
if (!ds_id){
|
||||
notifyError(tr("Please select a datastore for this image"));
|
||||
return false;
|
||||
@ -1108,7 +1077,7 @@ function initialize_create_image_dialog(dialog) {
|
||||
|
||||
$('#create_image_submit_manual',dialog).click(function(){
|
||||
var template=$('#template',dialog).val();
|
||||
var ds_id = $('#img_datastore_raw',dialog).val();
|
||||
var ds_id = $('#img_datastore_raw .resource_list_select',dialog).val();
|
||||
|
||||
if (!ds_id){
|
||||
notifyError(tr("Please select a datastore for this image"));
|
||||
@ -1143,31 +1112,18 @@ function initialize_create_image_dialog(dialog) {
|
||||
}
|
||||
|
||||
function initialize_datastore_info_create_image_dialog(dialog) {
|
||||
datastores_str = makeSelectOptions(dataTable_datastores,
|
||||
1,
|
||||
4,
|
||||
[10,10],//system ds
|
||||
['file','system'], //filter image & sys datastores
|
||||
true
|
||||
);
|
||||
var ds_id = $('#img_datastore .resource_list_select',dialog).val();
|
||||
var ds_id_raw = $('#img_datastore_raw .resource_list_select',dialog).val();
|
||||
|
||||
var selected_datastore = $('#img_datastore',dialog).val();
|
||||
var selected_datastore_raw = $('#img_datastore_raw',dialog).val();
|
||||
// Filter out DS with type system (1) or file (2)
|
||||
var filter_att = ["TYPE", "TYPE"];
|
||||
var filter_val = ["1", "2"];
|
||||
|
||||
$('#img_datastore',dialog).html(datastores_str);
|
||||
$('#img_datastore_raw',dialog).html(datastores_str);
|
||||
insertSelectOptions('div#img_datastore', dialog, "Datastore",
|
||||
ds_id, false, null, filter_att, filter_val);
|
||||
|
||||
if (selected_datastore)
|
||||
$('#img_datastore',dialog).val(selected_datastore)
|
||||
|
||||
if (selected_datastore_raw)
|
||||
$('#img_datastore_raw',dialog).val(selected_datastore_raw)
|
||||
|
||||
$('select#img_datastore', dialog).children('option').each(function() {
|
||||
if ($(this).val() == "2") {
|
||||
$(this).attr('disabled', 'disabled');
|
||||
}
|
||||
});
|
||||
insertSelectOptions('div#img_datastore_raw', dialog, "Datastore",
|
||||
ds_id_raw, false, null, filter_att, filter_val);
|
||||
|
||||
$('#file-uploader input',dialog).removeAttr("style");
|
||||
$('#file-uploader input',dialog).attr('style','margin:0;width:256px!important');
|
||||
|
@ -1007,14 +1007,14 @@ var service_buttons = {
|
||||
"Service.chown" : {
|
||||
type: "confirm_with_select",
|
||||
text: tr("Change owner"),
|
||||
select: users_sel,
|
||||
select: "User",
|
||||
tip: tr("Select the new owner")+":",
|
||||
layout: "user_select"
|
||||
},
|
||||
"Service.chgrp" : {
|
||||
type: "confirm_with_select",
|
||||
text: tr("Change group"),
|
||||
select: groups_sel,
|
||||
select: "Group",
|
||||
tip: tr("Select the new group")+":",
|
||||
layout: "user_select"
|
||||
},
|
||||
|
@ -93,7 +93,7 @@ var create_service_template_tmpl = '\
|
||||
</select>\
|
||||
</div>\
|
||||
<div class="service_template_param st_man large-6 columns">\
|
||||
<label for="vm_template">' + tr("Shutdown action") +
|
||||
<label for="shutdown_action_service">' + tr("Shutdown action") +
|
||||
'<span class="tip">'+ tr("VM shutdown action: 'shutdown' or 'shutdown-hard'.") +'</span>'+
|
||||
'</label>\
|
||||
<select name="shutdown_action_service">\
|
||||
@ -137,8 +137,8 @@ var role_tab_content = '\
|
||||
<label for="vm_template">' + tr("VM template") +
|
||||
'<span class="tip">'+ tr("Template associated to this role") +'</span>'+
|
||||
'</label>\
|
||||
<select name="vm_template">\
|
||||
</select>\
|
||||
<div id="vm_template">\
|
||||
</div>\
|
||||
</div>\
|
||||
</div>\
|
||||
<div class="row">\
|
||||
@ -149,7 +149,7 @@ var role_tab_content = '\
|
||||
<input type="text" id="cardinality" name="cardinality" value="1" />\
|
||||
</div>\
|
||||
<div class="service_template_param service_role large-3 columns">\
|
||||
<label for="vm_template">' + tr("Shutdown action") +
|
||||
<label for="shutdown_action_role">' + tr("Shutdown action") +
|
||||
'<span class="tip">'+ tr("VM shutdown action: 'shutdown' or 'shutdown-hard'. If it is not set, the one set for the Service will be used") +'</span>'+
|
||||
'</label>\
|
||||
<select name="shutdown_action_role">\
|
||||
@ -484,7 +484,7 @@ var service_template_buttons = {
|
||||
"ServiceTemplate.chown" : {
|
||||
type: "confirm_with_select",
|
||||
text: tr("Change owner"),
|
||||
select: users_sel,
|
||||
select: "User",
|
||||
layout: "user_select",
|
||||
tip: tr("Select the new owner")+":",
|
||||
condition: mustBeAdmin
|
||||
@ -492,7 +492,7 @@ var service_template_buttons = {
|
||||
"ServiceTemplate.chgrp" : {
|
||||
type: "confirm_with_select",
|
||||
text: tr("Change group"),
|
||||
select: groups_sel,
|
||||
select: "Group",
|
||||
layout: "user_select",
|
||||
tip: tr("Select the new group")+":",
|
||||
condition: mustBeAdmin
|
||||
@ -901,8 +901,7 @@ function setup_policy_tab_content(policy_section, html_policy_id) {
|
||||
function setup_role_tab_content(role_section, html_role_id) {
|
||||
setupTips(role_section);
|
||||
|
||||
var tpl_select = makeSelectOptions(dataTable_templates, 1, 4, [], [], true);
|
||||
$('select[name="vm_template"]', role_section).html(tpl_select);
|
||||
insertSelectOptions('div#vm_template', role_section, "Template", null, false);
|
||||
|
||||
$("#role_name", role_section).change(function(){
|
||||
$("#" + html_role_id +" #role_name_text").html($(this).val());
|
||||
@ -1180,7 +1179,7 @@ function generate_json_service_template_from_form() {
|
||||
var role = {};
|
||||
role['name'] = $('input[name="name"]', this).val();
|
||||
role['cardinality'] = $('input[name="cardinality"]', this).val();
|
||||
role['vm_template'] = $('select[name="vm_template"]', this).val();
|
||||
role['vm_template'] = $('#vm_template .resource_list_select', this).val();
|
||||
role['shutdown_action'] = $('select[name="shutdown_action_role"]', this).val();
|
||||
role['parents'] = [];
|
||||
|
||||
@ -1326,7 +1325,13 @@ function fillUpUpdateServiceTemplateDialog(request, response){
|
||||
roles_names.push(value.name);
|
||||
|
||||
$("#cardinality", context).val(value.cardinality);
|
||||
$('select[name="vm_template"]', context).val(value.vm_template);
|
||||
|
||||
// The vm_template select is already initialized, but we need to select
|
||||
// the template retrived from the service_template. Since the initialization
|
||||
// is async, we can't assume the .resource_list_select exists yet.
|
||||
// Calling the initialization again with the correct init_val should
|
||||
// use the cache anyway
|
||||
insertSelectOptions('div#vm_template', context, "Template", value.vm_template, false);
|
||||
|
||||
$("select[name='shutdown_action_role']", context).val(value.shutdown_action);
|
||||
$("#min_vms", context).val(value.min_vms);
|
||||
|
@ -475,7 +475,7 @@ var template_buttons = {
|
||||
type: "confirm_with_select",
|
||||
text: tr("Change owner"),
|
||||
layout: "user_select",
|
||||
select: users_sel,
|
||||
select: "User",
|
||||
tip: tr("Select the new owner")+":",
|
||||
condition: mustBeAdmin
|
||||
},
|
||||
@ -483,7 +483,7 @@ var template_buttons = {
|
||||
type: "confirm_with_select",
|
||||
text: tr("Change group"),
|
||||
layout: "user_select",
|
||||
select: groups_sel,
|
||||
select: "Group",
|
||||
tip: tr("Select the new group")+":",
|
||||
condition: mustBeAdmin
|
||||
},
|
||||
@ -565,39 +565,22 @@ function templateElementArray(template_json){
|
||||
];
|
||||
}
|
||||
|
||||
//Updates the select input field with an option for each template
|
||||
function updateTemplateSelect(){
|
||||
var templates_select =
|
||||
makeSelectOptions(dataTable_templates,
|
||||
1,//id_col
|
||||
4,//name_col
|
||||
[],//status_cols
|
||||
[]//bad status values
|
||||
);
|
||||
|
||||
//update static selectors:
|
||||
$('#template_id', $create_vm_dialog).html(templates_select);
|
||||
}
|
||||
|
||||
// Callback to update an element in the dataTable
|
||||
function updateTemplateElement(request, template_json){
|
||||
var id = template_json.VMTEMPLATE.ID;
|
||||
var element = templateElementArray(template_json);
|
||||
updateSingleElement(element,dataTable_templates,'#template_'+id);
|
||||
updateTemplateSelect();
|
||||
}
|
||||
|
||||
// Callback to remove an element from the dataTable
|
||||
function deleteTemplateElement(req){
|
||||
deleteElement(dataTable_templates,'#template_'+req.request.data);
|
||||
updateTemplateSelect();
|
||||
}
|
||||
|
||||
// Callback to add a template element
|
||||
function addTemplateElement(request, template_json){
|
||||
var element = templateElementArray(template_json);
|
||||
addElement(element,dataTable_templates);
|
||||
updateTemplateSelect();
|
||||
}
|
||||
|
||||
// Callback to refresh the list of templates
|
||||
@ -609,7 +592,6 @@ function updateTemplatesView(request, templates_list){
|
||||
});
|
||||
|
||||
updateView(template_list_array,dataTable_templates);
|
||||
updateTemplateSelect();
|
||||
}
|
||||
|
||||
function generate_capacity_tab_content() {
|
||||
|
@ -16,7 +16,6 @@
|
||||
|
||||
/*Users tab plugin*/
|
||||
var dataTable_users;
|
||||
var users_select="";
|
||||
var $create_user_dialog;
|
||||
var $user_quotas_dialog;
|
||||
var $update_pw_dialog;
|
||||
@ -465,7 +464,7 @@ var user_buttons = {
|
||||
type: "confirm_with_select",
|
||||
text: tr("Change group"),
|
||||
layout: "user_select",
|
||||
select: groups_sel,
|
||||
select: "Group",
|
||||
tip: tr("This will change the main group of the selected users. Select the new group")+":",
|
||||
condition: mustBeAdmin
|
||||
},
|
||||
@ -473,7 +472,7 @@ var user_buttons = {
|
||||
type: "confirm_with_select",
|
||||
text: tr("Add to group"),
|
||||
layout: "user_select",
|
||||
select: groups_sel,
|
||||
select: "Group",
|
||||
tip: tr("This will add the user to a secondary group. Select the new group")+":",
|
||||
condition: mustBeAdmin
|
||||
},
|
||||
@ -481,7 +480,7 @@ var user_buttons = {
|
||||
type: "confirm_with_select",
|
||||
text: tr("Remove from group"),
|
||||
layout: "user_select",
|
||||
select: groups_sel,
|
||||
select: "Group",
|
||||
tip: tr("This will remove the user from a secondary group. Select the group")+":",
|
||||
condition: mustBeAdmin
|
||||
},
|
||||
@ -588,15 +587,6 @@ function userElementArray(user_json){
|
||||
]
|
||||
};
|
||||
|
||||
function updateUserSelect(){
|
||||
users_select = makeSelectOptions(dataTable_users,
|
||||
1,//id_col
|
||||
2,//name_col
|
||||
[],//status_cols
|
||||
[]//bad status values
|
||||
);
|
||||
}
|
||||
|
||||
// Callback to refresh a single element from the dataTable
|
||||
function updateUserElement(request, user_json){
|
||||
var id = user_json.USER.ID;
|
||||
@ -607,14 +597,12 @@ function updateUserElement(request, user_json){
|
||||
// Callback to delete a single element from the dataTable
|
||||
function deleteUserElement(req){
|
||||
deleteElement(dataTable_users,'#user_'+req.request.data);
|
||||
updateUserSelect();
|
||||
}
|
||||
|
||||
// Callback to add a single user element
|
||||
function addUserElement(request,user_json){
|
||||
var element = userElementArray(user_json);
|
||||
addElement(element,dataTable_users);
|
||||
updateUserSelect();
|
||||
}
|
||||
|
||||
// Callback to update the list of users
|
||||
@ -638,7 +626,6 @@ function updateUsersView(request,users_list,quotas_list){
|
||||
});
|
||||
updateView(user_list_array,dataTable_users);
|
||||
|
||||
updateUserSelect();
|
||||
|
||||
$(".total_users").text(users_list.length);
|
||||
};
|
||||
|
@ -949,7 +949,7 @@ var vm_buttons = {
|
||||
"VM.chown" : {
|
||||
type: "confirm_with_select",
|
||||
text: tr("Change owner"),
|
||||
select: users_sel,
|
||||
select: "User",
|
||||
layout: "user_select",
|
||||
tip: tr("Select the new owner")+":",
|
||||
condition: mustBeAdmin
|
||||
@ -958,7 +958,7 @@ var vm_buttons = {
|
||||
"VM.chgrp" : {
|
||||
type: "confirm_with_select",
|
||||
text: tr("Change group"),
|
||||
select: groups_sel,
|
||||
select: "Group",
|
||||
layout: "user_select",
|
||||
tip: tr("Select the new group")+":",
|
||||
condition: mustBeAdmin
|
||||
@ -1098,8 +1098,8 @@ var vm_buttons = {
|
||||
type: "confirm_with_select",
|
||||
text: tr("Recover"),
|
||||
layout: "vmsplanification_buttons",
|
||||
select: function(){ return '<option value="success">' + tr("success") + '</option>\
|
||||
<option value="failure">' + tr("failure") + '</option>'},
|
||||
custom_select: '<select class="resource_list_select"><option value="success">' + tr("success") + '</option>\
|
||||
<option value="failure">' + tr("failure") + '</option></select>',
|
||||
tip: tr("Recovers a stuck VM that is waiting for a driver operation. \
|
||||
The recovery may be done by failing or succeeding the pending operation. \
|
||||
YOU NEED TO MANUALLY CHECK THE VM STATUS ON THE HOST, to decide if the operation \
|
||||
|
@ -532,7 +532,7 @@ var vnet_buttons = {
|
||||
type: "confirm_with_select",
|
||||
text: tr("Select cluster"),
|
||||
layout: "more_select",
|
||||
select: insertSelectClusters,
|
||||
select: "Cluster",
|
||||
tip: tr("Select the destination cluster:"),
|
||||
condition: mustBeAdmin
|
||||
},
|
||||
@ -540,7 +540,7 @@ var vnet_buttons = {
|
||||
type: "confirm_with_select",
|
||||
text: tr("Change owner"),
|
||||
layout: "user_select",
|
||||
select: users_sel,
|
||||
select: "User",
|
||||
tip: tr("Select the new owner")+":",
|
||||
condition: mustBeAdmin
|
||||
},
|
||||
@ -549,7 +549,7 @@ var vnet_buttons = {
|
||||
type: "confirm_with_select",
|
||||
text: tr("Change group"),
|
||||
layout: "user_select",
|
||||
select: groups_sel,
|
||||
select: "Group",
|
||||
tip: tr("Select the new group")+":",
|
||||
condition: mustBeAdmin
|
||||
},
|
||||
|
@ -76,7 +76,6 @@ var create_zone_tmpl =
|
||||
<a class="close-reveal-modal">×</a>\
|
||||
</form>';
|
||||
|
||||
var zones_select="";
|
||||
var dataTable_zones;
|
||||
var $create_zone_dialog;
|
||||
|
||||
@ -266,32 +265,17 @@ function zoneElementArray(element_json){
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
//updates the zone select by refreshing the options in it
|
||||
function updateZoneSelect(){
|
||||
zones_select = makeSelectOptions(dataTable_zones,
|
||||
1,//id_col
|
||||
2,//name_col
|
||||
3,//endpoint_col
|
||||
[],//status_cols
|
||||
[],//bad_st
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
//callback for an action affecting a zone element
|
||||
function updateZoneElement(request, element_json){
|
||||
var id = element_json.ZONE.ID;
|
||||
var element = zoneElementArray(element_json);
|
||||
updateSingleElement(element,dataTable_zones,'#zone_'+id);
|
||||
updateZoneSelect();
|
||||
}
|
||||
|
||||
//callback for actions deleting a zone element
|
||||
function deleteZoneElement(req){
|
||||
deleteElement(dataTable_zones,'#zone_'+req.request.data);
|
||||
$('div#zone_tab_'+req.request.data,main_tabs_context).remove();
|
||||
updateZoneSelect();
|
||||
}
|
||||
|
||||
//call back for actions creating a zone element
|
||||
@ -299,7 +283,6 @@ function addZoneElement(request,element_json){
|
||||
var id = element_json.ZONE.ID;
|
||||
var element = zoneElementArray(element_json);
|
||||
addElement(element,dataTable_zones);
|
||||
updateZoneSelect();
|
||||
}
|
||||
|
||||
//callback to update the list of zones.
|
||||
@ -312,7 +295,6 @@ function updateZonesView (request,list){
|
||||
});
|
||||
|
||||
updateView(list_array,dataTable_zones);
|
||||
updateZoneSelect();
|
||||
};
|
||||
|
||||
|
||||
@ -364,10 +346,6 @@ function updateZoneInfo(request,zone){
|
||||
Sunstone.popUpInfoPanel("zone_info_panel", "zones-tab");
|
||||
}
|
||||
|
||||
function zones_sel() {
|
||||
return zones_select;
|
||||
}
|
||||
|
||||
//This is executed after the sunstone.js ready() is run.
|
||||
//Here we can basicly init the zone datatable, preload it
|
||||
//and add specific listeners
|
||||
|
@ -959,7 +959,11 @@ function popUpConfirmWithSelectDialog(target_elem){
|
||||
else
|
||||
var tip = button.tip
|
||||
|
||||
button.select('div#confirm_select', dialog, null, true);
|
||||
if (button.custom_select){
|
||||
$('div#confirm_select', dialog).html(button.custom_select);
|
||||
} else{
|
||||
insertSelectOptions('div#confirm_select', dialog, button.select, null, true);
|
||||
}
|
||||
|
||||
$('div#confirm_with_select_tip',dialog).text(tip);
|
||||
|
||||
@ -1638,17 +1642,9 @@ function getSelectedNodes(dataTable, force_datatable){
|
||||
return selected_nodes;
|
||||
}
|
||||
|
||||
function insertSelectClusters(id, context, init_val, empty_value, extra_options){
|
||||
if(!extra_options){
|
||||
extra_options = "";
|
||||
}
|
||||
|
||||
extra_options += '<option value="-1">Default (none)</option>';
|
||||
|
||||
insertSelectOptions(id, context, "Cluster", init_val, empty_value, extra_options)
|
||||
}
|
||||
|
||||
function insertSelectOptions(id, context, resource, init_val, empty_value, extra_options){
|
||||
// TODO: Too many arguments. Change to use a params object
|
||||
function insertSelectOptions(id, context, resource, init_val, empty_value,
|
||||
extra_options, filter_att, filter_val){
|
||||
|
||||
$(id, context).html('<i class="fa fa-spinner fa-spin"></i>');
|
||||
|
||||
@ -1658,75 +1654,58 @@ function insertSelectOptions(id, context, resource, init_val, empty_value, extra
|
||||
var select_str='<select class="resource_list_select">';
|
||||
|
||||
if (empty_value){
|
||||
select_str += '<option class="empty_value" value="">'+tr("Please select")+'</option>';
|
||||
select_str += '<option class="empty_value" value="">'+
|
||||
tr("Please select")+'</option>';
|
||||
}
|
||||
|
||||
if (resource == "Cluster"){
|
||||
if(!extra_options){
|
||||
extra_options = "";
|
||||
}
|
||||
|
||||
extra_options += '<option value="-1">Default (none)</option>';
|
||||
}
|
||||
|
||||
if (extra_options){
|
||||
select_str += extra_options;
|
||||
}
|
||||
|
||||
if (!filter_att){
|
||||
filter_att = [];
|
||||
}
|
||||
|
||||
var res_name = OpenNebula[resource].resource;
|
||||
$.each(obj_list,function(){
|
||||
var id = this[res_name].ID;
|
||||
var name = this[res_name].NAME;
|
||||
select_str +='<option elem_id="'+id+'" value="'+id+'">'+id+': '+name+'</option>';
|
||||
var add = true;
|
||||
|
||||
for (var i=0;i<filter_att.length;i++){
|
||||
if (this[res_name][filter_att[i]] == filter_val[i]){
|
||||
add = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (add){
|
||||
select_str +='<option elem_id="'+id+'" value="'+id+'">'+
|
||||
id+': '+name+'</option>';
|
||||
}
|
||||
});
|
||||
|
||||
select_str+="</select>";
|
||||
|
||||
$(id, context).html(select_str);
|
||||
|
||||
$(id+" .resource_list_select", context).val(init_val);
|
||||
if (init_val){
|
||||
$(id+" .resource_list_select", context).val(init_val);
|
||||
}
|
||||
},
|
||||
error: onError
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
//returns a HTML string with options for
|
||||
//a select input code generated from a dataTable.
|
||||
//Allows filtering elements specifing status columns
|
||||
//and bad status (if the values of the columns match the bad status)
|
||||
//then this elem is skipped.
|
||||
//no_empty_obj allows to skip adding a Please Select option
|
||||
function makeSelectOptions(dataTable,
|
||||
option_value_col,
|
||||
option_name_col,
|
||||
status_cols,
|
||||
bad_status_values,
|
||||
no_empty_opt){
|
||||
var nodes = dataTable.fnGetData();
|
||||
var select = "";
|
||||
if (!no_empty_opt)
|
||||
select = '<option class="empty_value" value="">'+tr("Please select")+'</option>';
|
||||
var array;
|
||||
for (var j=0; j<nodes.length;j++){
|
||||
var elem = nodes[j];
|
||||
var value = elem[option_value_col];
|
||||
|
||||
//ASSUMPTION: elem id in column 1
|
||||
var id = elem[1];
|
||||
|
||||
var name = elem[option_name_col];
|
||||
var status, bad_status;
|
||||
var ok=true;
|
||||
for (var i=0;i<status_cols.length;i++){
|
||||
status = elem[status_cols[i]];
|
||||
bad_status = bad_status_values[i];
|
||||
//if the column has a bad value, we
|
||||
//will skip this item
|
||||
if (status == bad_status){
|
||||
ok=false;
|
||||
break;
|
||||
};
|
||||
};
|
||||
if (ok){
|
||||
select +='<option elem_id="'+id+'" value="'+value+'">'+name+' (id:'+id+')</option>';
|
||||
};
|
||||
};
|
||||
return select;
|
||||
}
|
||||
|
||||
//Escape doublequote in a string and return it
|
||||
function escapeDoubleQuotes(string){
|
||||
if (string != undefined) {
|
||||
@ -1981,26 +1960,6 @@ function mustNotBeAdmin(){
|
||||
return !mustBeAdmin();
|
||||
}
|
||||
|
||||
function users_sel(){
|
||||
return users_select;
|
||||
}
|
||||
|
||||
function groups_sel(){
|
||||
return groups_select;
|
||||
}
|
||||
|
||||
function hosts_sel(){
|
||||
return hosts_select;
|
||||
}
|
||||
|
||||
function datastores_sel() {
|
||||
return datastores_select;
|
||||
}
|
||||
|
||||
function zones_sel(){
|
||||
return zones_select;
|
||||
}
|
||||
|
||||
/* Below functions to easier permission management */
|
||||
|
||||
function ownerUse(resource){
|
||||
|
Loading…
x
Reference in New Issue
Block a user