diff --git a/src/sunstone/public/js/plugins/acls-tab.js b/src/sunstone/public/js/plugins/acls-tab.js
index 421dde9b89..1ac86d68f4 100644
--- a/src/sunstone/public/js/plugins/acls-tab.js
+++ b/src/sunstone/public/js/plugins/acls-tab.js
@@ -108,7 +108,8 @@ var create_acl_tmpl =
\
\
\
- \
+
\
+
\
\
\
\
@@ -488,7 +489,8 @@ function setupCreateAclDialog(){
});
//update the rule preview every time some field changes
- $('input,select',dialog).change(function(){
+ $(dialog).off('change', 'input,select');
+ $(dialog).on('change', 'input,select', function(){
var context = $('#create_acl_form',$create_acl_dialog);
var user = $('#applies',context).val();
@@ -517,7 +519,7 @@ function setupCreateAclDialog(){
belonging="@"+$('#belonging_to',context).val();
break;
case "in_cluster":
- belonging="%"+$('#in_cluster',context).val();
+ belonging="%"+$('#in_cluster .resource_list_select',context).val();
break;
}
@@ -570,7 +572,7 @@ function setupCreateAclDialog(){
}
break;
case "in_cluster":
- var l=$('#in_cluster',this).val().length;
+ var l=$('#in_cluster .resource_list_select',this).val().length;
if (!l){
notifyError("Please select a cluster to which the selected resources belong to");
return false;
@@ -611,7 +613,7 @@ function popUpCreateAclDialog(){
$('#applies',dialog).html(''+
users.html()+groups.html());
$('#belonging_to',dialog).html(groups_select);
- $('#in_cluster',dialog).html(clusters_select);
+ insertSelectClusters('#in_cluster',dialog, null, true);
$('#applies',dialog).trigger("change");
diff --git a/src/sunstone/public/js/plugins/clusters-tab.js b/src/sunstone/public/js/plugins/clusters-tab.js
index e27d776dca..955841c110 100644
--- a/src/sunstone/public/js/plugins/clusters-tab.js
+++ b/src/sunstone/public/js/plugins/clusters-tab.js
@@ -871,8 +871,6 @@ function updateClusterDatastoresInfoView (request,datastore_list){
/* -------- End of datatables section -------- */
-
-var clusters_select="";
var dataTable_clusters;
var $create_cluster_dialog;
@@ -1174,32 +1172,17 @@ function clusterElementArray(element_json){
];
}
-
-//updates the cluster select by refreshing the options in it
-function updateClusterSelect(){
- clusters_select = '';
- clusters_select += makeSelectOptions(dataTable_clusters,
- 1,//id_col
- 2,//name_col
- [],//status_cols
- [],//bad_st
- true
- );
-}
-
//callback for an action affecting a cluster element
function updateClusterElement(request, element_json){
var id = element_json.CLUSTER.ID;
var element = clusterElementArray(element_json);
updateSingleElement(element,dataTable_clusters,'#cluster_'+id);
- updateClusterSelect();
}
//callback for actions deleting a cluster element
function deleteClusterElement(req){
deleteElement(dataTable_clusters,'#cluster_'+req.request.data);
$('div#cluster_tab_'+req.request.data,main_tabs_context).remove();
- updateClusterSelect();
}
//call back for actions creating a cluster element
@@ -1207,7 +1190,6 @@ function addClusterElement(request,element_json){
var id = element_json.CLUSTER.ID;
var element = clusterElementArray(element_json);
addElement(element,dataTable_clusters);
- updateClusterSelect();
}
//callback to update the list of clusters.
@@ -1220,7 +1202,6 @@ function updateClustersView (request,list){
});
updateView(list_array,dataTable_clusters);
- updateClusterSelect();
};
@@ -1393,10 +1374,6 @@ function clusterResourceViewListeners(){
});
};
-function clusters_sel() {
- return clusters_select;
-}
-
//This is executed after the sunstone.js ready() is run.
//Here we can basicly init the host datatable, preload it
//and add specific listeners
diff --git a/src/sunstone/public/js/plugins/datastores-tab.js b/src/sunstone/public/js/plugins/datastores-tab.js
index 7b419bc2a4..97742d91da 100644
--- a/src/sunstone/public/js/plugins/datastores-tab.js
+++ b/src/sunstone/public/js/plugins/datastores-tab.js
@@ -51,8 +51,8 @@ var create_datastore_tmpl =
\
\
\
- \
+
\
+
\
\
\
\
@@ -210,7 +210,8 @@ var create_datastore_tmpl =
\
\
\
- \
+
\
+
\
\
\
\
@@ -469,7 +470,7 @@ var datastore_buttons = {
"Datastore.addtocluster" : {
type: "confirm_with_select",
text: tr("Select cluster"),
- select: clusters_sel,
+ select: insertSelectClusters,
layout: "more_select",
tip: tr("Select the destination cluster:"),
condition: mustBeAdmin
@@ -869,7 +870,7 @@ function setupCreateDatastoreDialog(){
$('#create_datastore_submit',dialog).click(function(){
var context = $( "#create_datastore_form", dialog);
var name = $('#name',context).val();
- var cluster_id = $('#cluster_id',context).val();
+ var cluster_id = $(".resource_list_select", $('#cluster_id',dialog)).val();
var ds_type = $('input[name=ds_type]:checked',context).val();
var ds_mad = $('#ds_mad',context).val();
ds_mad = ds_mad == "custom" ? $('input[name="ds_tab_custom_ds_mad"]').val() : ds_mad;
@@ -964,7 +965,7 @@ function setupCreateDatastoreDialog(){
$('#create_datastore_submit_manual',dialog).click(function(){
var template = $('#template',dialog).val();
- var cluster_id = $('#datastore_cluster_raw',dialog).val();
+ var cluster_id = $(".resource_list_select", $('#datastore_cluster_raw',dialog)).val();
if (!cluster_id){
notifyError(tr("Please select a cluster for this datastore"));
@@ -1100,8 +1101,15 @@ function select_custom(){
}
function popUpCreateDatastoreDialog(){
- $('select#cluster_id',$create_datastore_dialog).html(clusters_sel());
- $('select#datastore_cluster_raw',$create_datastore_dialog).html(clusters_sel());
+ var cluster_id = $("div#cluster_id .resource_list_select", $create_datastore_dialog).val();
+ if (!cluster_id) cluster_id = "-1";
+
+ var cluster_id_raw = $("div#datastore_cluster_raw .resource_list_select", $create_datastore_dialog).val();
+ 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);
$create_datastore_dialog.foundation().foundation('reveal', 'open');
$("input#name",$create_datastore_dialog).focus();
}
diff --git a/src/sunstone/public/js/plugins/hosts-tab.js b/src/sunstone/public/js/plugins/hosts-tab.js
index 92d61d9ed9..203c9680ce 100644
--- a/src/sunstone/public/js/plugins/hosts-tab.js
+++ b/src/sunstone/public/js/plugins/hosts-tab.js
@@ -33,8 +33,8 @@ var create_host_tmpl =