mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-19 06:50:07 +03:00
Merge branch 'bug-847' of git@git.opennebula.org:one into bug-847
This commit is contained in:
commit
a5c16ddf75
@ -128,6 +128,20 @@ var create_image_tmpl =
|
||||
<div class="tip">Type of file system to be built. This can be any value understood by mkfs unix command.</div>\
|
||||
</div>\
|
||||
</fieldset>\
|
||||
<fieldset>\
|
||||
<div class="">\
|
||||
<label for="custom_var_image_name">Name:</label>\
|
||||
<input type="text" id="custom_var_image_name" name="custom_var_image_name" />\
|
||||
<label for="custom_var_image_value">Value:</label>\
|
||||
<input type="text" id="custom_var_image_value" name="custom_var_image_value" />\
|
||||
<button class="add_remove_button add_button" id="add_custom_var_image_button" value="add_custom_image_var">Add</button>\
|
||||
<button class="add_remove_button" id="remove_custom_var_image_button" value="remove_custom_image_var">Remove selected</button>\
|
||||
<div class="clear"></div>\
|
||||
<label for="custom_var_image_box">Custom attributes:</label>\
|
||||
<select id="custom_var_image_box" name="custom_var_image_box" style="height:100px;" multiple>\
|
||||
</select>\
|
||||
</div>\
|
||||
</fieldset>\
|
||||
<fieldset>\
|
||||
<div class="form_buttons">\
|
||||
<button class="button" id="create_image_submit" value="user/create">Create</button>\
|
||||
@ -658,6 +672,30 @@ function setupCreateImageDialog(){
|
||||
});
|
||||
|
||||
|
||||
$('#add_custom_var_image_button', dialog).click(
|
||||
function(){
|
||||
var name = $('#custom_var_image_name',$create_image_dialog).val();
|
||||
var value = $('#custom_var_image_value',$create_image_dialog).val();
|
||||
if (!name.length || !value.length) {
|
||||
notifyError("Custom attribute name and value must be filled in");
|
||||
return false;
|
||||
}
|
||||
option= '<option value=\''+value+'\' name=\''+name+'\'>'+
|
||||
name+'='+value+
|
||||
'</option>';
|
||||
$('select#custom_var_image_box',$create_image_dialog).append(option);
|
||||
return false;
|
||||
}
|
||||
);
|
||||
|
||||
$('#remove_custom_var_image_button', dialog).click(
|
||||
function(){
|
||||
$('select#custom_var_image_box :selected',$create_image_dialog).remove();
|
||||
return false;
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
$('#create_image_form_easy',dialog).submit(function(){
|
||||
var exit = false;
|
||||
$('.img_man',this).each(function(){
|
||||
@ -709,6 +747,15 @@ function setupCreateImageDialog(){
|
||||
img_json["FSTYPE"] = fstype;
|
||||
break;
|
||||
}
|
||||
|
||||
//Time to add custom attributes
|
||||
$('#custom_var_image_box option',$create_image_dialog).each(function(){
|
||||
var attr_name = $(this).attr("name");
|
||||
var attr_value = $(this).val();
|
||||
img_json[attr_name] = attr_value;
|
||||
});
|
||||
|
||||
|
||||
var obj = { "image" : img_json };
|
||||
Sunstone.runAction("Image.create", obj);
|
||||
|
||||
|
@ -535,7 +535,7 @@ var create_template_tmpl = '<div id="template_create_tabs">\
|
||||
<input type="text" id="custom_var_name" name="custom_var_name" />\
|
||||
<div class="tip">Name for the custom variable</div>\
|
||||
</div>\
|
||||
<div class="vm_param kvm_opt xen_opt">\
|
||||
<div class="vm_param kvm_opt xen_opt vmware_opt">\
|
||||
<label for="custom_var_value">Value:</label>\
|
||||
<input type="text" id="custom_var_value" name="custom_var_value" />\
|
||||
<div class="tip">Value of the custom variable</div>\
|
||||
@ -1733,8 +1733,7 @@ function setupCreateTemplateDialog(){
|
||||
var name = $('#custom_var_name',section_custom_var).val();
|
||||
var value = $('#custom_var_value',section_custom_var).val();
|
||||
if (!name.length || !value.length) {
|
||||
notifyError("Custom variable name and value must be\
|
||||
filled in");
|
||||
notifyError("Custom variable name and value must be filled in");
|
||||
return false;
|
||||
}
|
||||
option= '<option value=\''+value+'\' name=\''+name+'\'>'+
|
||||
|
@ -92,6 +92,20 @@ var create_vn_tmpl =
|
||||
</div>\
|
||||
<div class="clear"></div>\
|
||||
</fieldset>\
|
||||
<fieldset>\
|
||||
<div class="">\
|
||||
<label for="custom_var_vnet_name">Name:</label>\
|
||||
<input type="text" id="custom_var_vnet_name" name="custom_var_vnet_name" />\
|
||||
<label for="custom_var_vnet_value">Value:</label>\
|
||||
<input type="text" id="custom_var_vnet_value" name="custom_var_vnet_value" />\
|
||||
<button class="add_remove_button add_button" id="add_custom_var_vnet_button" value="add_custom_vnet_var">Add</button>\
|
||||
<button class="add_remove_button" id="remove_custom_var_vnet_button" value="remove_custom_vnet_var">Remove selected</button>\
|
||||
<div class="clear"></div>\
|
||||
<label for="custom_var_vnet_box">Custom attributes:</label>\
|
||||
<select id="custom_var_vnet_box" name="custom_var_vnet_box" style="height:100px;" multiple>\
|
||||
</select>\
|
||||
</div>\
|
||||
</fieldset>\
|
||||
<fieldset>\
|
||||
<div class="form_buttons">\
|
||||
<button class="button" id="create_vn_submit_easy" value="vn/create">\
|
||||
@ -508,12 +522,14 @@ function setupCreateVNetDialog() {
|
||||
var dialog = $create_vn_dialog;
|
||||
dialog.html(create_vn_tmpl);
|
||||
|
||||
var height = Math.floor($(window).height()*0.8); //set height to a percentage of the window
|
||||
|
||||
//Prepare the jquery-ui dialog. Set style options here.
|
||||
dialog.dialog({
|
||||
autoOpen: false,
|
||||
modal: true,
|
||||
width: 475,
|
||||
height: 500
|
||||
height: height
|
||||
});
|
||||
|
||||
//Make the tabs look nice for the creation mode
|
||||
@ -565,6 +581,31 @@ function setupCreateVNetDialog() {
|
||||
return false;
|
||||
});
|
||||
|
||||
|
||||
$('#add_custom_var_vnet_button', dialog).click(
|
||||
function(){
|
||||
var name = $('#custom_var_vnet_name',$create_vn_dialog).val();
|
||||
var value = $('#custom_var_vnet_value',$create_vn_dialog).val();
|
||||
if (!name.length || !value.length) {
|
||||
notifyError("Custom attribute name and value must be filled in");
|
||||
return false;
|
||||
}
|
||||
option= '<option value=\''+value+'\' name=\''+name+'\'>'+
|
||||
name+'='+value+
|
||||
'</option>';
|
||||
$('select#custom_var_vnet_box',$create_vn_dialog).append(option);
|
||||
return false;
|
||||
}
|
||||
);
|
||||
|
||||
$('#remove_custom_var_vnet_button', dialog).click(
|
||||
function(){
|
||||
$('select#custom_var_vnet_box :selected',$create_vn_dialog).remove();
|
||||
return false;
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
//Handle submission of the easy mode
|
||||
$('#create_vn_form_easy',dialog).submit(function(){
|
||||
//Fetch values
|
||||
@ -616,6 +657,13 @@ function setupCreateVNetDialog() {
|
||||
};
|
||||
};
|
||||
|
||||
//Time to add custom attributes
|
||||
$('#custom_var_vnet_box option',$create_vn_dialog).each(function(){
|
||||
var attr_name = $(this).attr("name");
|
||||
var attr_value = $(this).val();
|
||||
network_json["vnet"][attr_name] = attr_value;
|
||||
});
|
||||
|
||||
//Create the VNetwork.
|
||||
|
||||
Sunstone.runAction("Network.create",network_json);
|
||||
|
Loading…
x
Reference in New Issue
Block a user