diff --git a/src/sunstone/public/js/plugins/acls-tab.js b/src/sunstone/public/js/plugins/acls-tab.js
index 1ac86d68f4..a87447e2fc 100644
--- a/src/sunstone/public/js/plugins/acls-tab.js
+++ b/src/sunstone/public/js/plugins/acls-tab.js
@@ -27,15 +27,40 @@ var create_acl_tmpl =
\
\
@@ -109,7 +109,8 @@ var create_file_tmpl ='
\
\
\
\
- \
+
\
+
\
\
\
\
@@ -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();
diff --git a/src/sunstone/public/js/plugins/groups-tab.js b/src/sunstone/public/js/plugins/groups-tab.js
index 2a3676ec78..9bc1785a76 100644
--- a/src/sunstone/public/js/plugins/groups-tab.js
+++ b/src/sunstone/public/js/plugins/groups-tab.js
@@ -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);
diff --git a/src/sunstone/public/js/plugins/hosts-tab.js b/src/sunstone/public/js/plugins/hosts-tab.js
index 203c9680ce..b2ea5da17f 100644
--- a/src/sunstone/public/js/plugins/hosts-tab.js
+++ b/src/sunstone/public/js/plugins/hosts-tab.js
@@ -109,7 +109,6 @@ var create_host_tmpl =
\
×';
-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();
diff --git a/src/sunstone/public/js/plugins/images-tab.js b/src/sunstone/public/js/plugins/images-tab.js
index d50fe2a233..c2fff57c2b 100644
--- a/src/sunstone/public/js/plugins/images-tab.js
+++ b/src/sunstone/public/js/plugins/images-tab.js
@@ -74,8 +74,8 @@ var create_image_tmpl ='
\
\
- \
+
\
+
\
\
\
\
@@ -215,7 +215,8 @@ var create_image_tmpl ='
\
\
\
\
- \
+
\
+
\
\
\
\
@@ -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');
diff --git a/src/sunstone/public/js/plugins/oneflow-services.js b/src/sunstone/public/js/plugins/oneflow-services.js
index 569e19da75..ed458c7bb0 100644
--- a/src/sunstone/public/js/plugins/oneflow-services.js
+++ b/src/sunstone/public/js/plugins/oneflow-services.js
@@ -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"
},
diff --git a/src/sunstone/public/js/plugins/oneflow-templates.js b/src/sunstone/public/js/plugins/oneflow-templates.js
index 1dc75e4dba..8057109662 100644
--- a/src/sunstone/public/js/plugins/oneflow-templates.js
+++ b/src/sunstone/public/js/plugins/oneflow-templates.js
@@ -93,7 +93,7 @@ var create_service_template_tmpl = '\
\
\
\
-
\
\
\
@@ -149,7 +149,7 @@ var role_tab_content = '\
\
\
\
- ' + tr("Shutdown action") +
+ ' + tr("Shutdown action") +
''+ tr("VM shutdown action: 'shutdown' or 'shutdown-hard'. If it is not set, the one set for the Service will be used") +''+
'\