mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-22 18:50:08 +03:00
Sunstone: require image target when adding image to VM template. Autofill when attribute is present in image template. Include special input for target in image creation form.
(cherry picked from commit c7721e814dac16b1f5d38e3ce603c854a060338f)
This commit is contained in:
parent
81a142374b
commit
fda4161a6c
@ -36,6 +36,7 @@ var images_tab_content = '\
|
||||
<th>'+tr("Persistent")+'</th>\
|
||||
<th>'+tr("Status")+'</th>\
|
||||
<th>'+tr("#VMS")+'</th>\
|
||||
<th>'+tr("Target")+'</th>\
|
||||
</tr>\
|
||||
</thead>\
|
||||
<tbody id="tbodyimages">\
|
||||
@ -108,6 +109,11 @@ var create_image_tmpl =
|
||||
<input type="text" name="img_driver" id="img_driver" />\
|
||||
<div class="tip">'+tr("Specific image mapping driver. KVM: raw, qcow2. XEN: tap:aio, file:")+'</div>\
|
||||
</div>\
|
||||
<div class="img_param">\
|
||||
<label for="img_target">'+tr("Target")+':</label>\
|
||||
<input type="text" name="img_target" id="img_target" />\
|
||||
<div class="tip">'+tr("Target on which the image will be mounted at. For example: hda, sdb...")+'</div>\
|
||||
</div>\
|
||||
</fieldset>\
|
||||
<fieldset>\
|
||||
<div class="" id="src_path_select">\
|
||||
@ -544,7 +550,8 @@ function imageElementArray(image_json){
|
||||
parseInt(image.PERSISTENT) ? '<input class="action_cb" id="cb_persistent_image" type="checkbox" elem_id="'+image.ID+'" checked="checked"/>'
|
||||
: '<input class="action_cb" id="cb_persistent_image" type="checkbox" elem_id="'+image.ID+'"/>',
|
||||
OpenNebula.Helper.resource_state("image",image.STATE),
|
||||
image.RUNNING_VMS
|
||||
image.RUNNING_VMS,
|
||||
image.TEMPLATE.TARGET ? image.TEMPLATE.TARGET : '--'
|
||||
];
|
||||
}
|
||||
|
||||
@ -899,6 +906,10 @@ function setupCreateImageDialog(){
|
||||
if (driver.length)
|
||||
img_json["DRIVER"] = driver;
|
||||
|
||||
var target = $('#img_target',this).val();
|
||||
if (target)
|
||||
img_json["TARGET"] = target;
|
||||
|
||||
switch ($('#src_path_select input:checked',this).val()){
|
||||
case "path":
|
||||
path = $('#img_path',this).val();
|
||||
@ -1144,10 +1155,10 @@ $(document).ready(function(){
|
||||
"aoColumnDefs": [
|
||||
{ "bSortable": false, "aTargets": ["check"] },
|
||||
{ "sWidth": "60px", "aTargets": [0,2,3,9,10] },
|
||||
{ "sWidth": "35px", "aTargets": [1,6,11] },
|
||||
{ "sWidth": "35px", "aTargets": [1,6,11,12] },
|
||||
{ "sWidth": "100px", "aTargets": [5,7] },
|
||||
{ "sWidth": "150px", "aTargets": [8] },
|
||||
{ "bVisible": false, "aTargets": [6,8]}
|
||||
{ "bVisible": false, "aTargets": [6,8,12]}
|
||||
],
|
||||
"oLanguage": (datatable_lang != "") ?
|
||||
{
|
||||
@ -1158,7 +1169,7 @@ $(document).ready(function(){
|
||||
dataTable_images.fnClearTable();
|
||||
addElement([
|
||||
spinner,
|
||||
'','','','','','','','','','',''],dataTable_images);
|
||||
'','','','','','','','','','','',''],dataTable_images);
|
||||
Sunstone.runAction("Image.list");
|
||||
|
||||
setupCreateImageDialog();
|
||||
|
@ -208,7 +208,7 @@ var create_template_tmpl = '<div id="template_create_tabs">\
|
||||
</select>\
|
||||
<div class="tip">'+tr("Type of disk device to emulate: ide, scsi")+'</div>\
|
||||
</div>\
|
||||
<div class="vm_param kvm_opt xen_opt vmware">\
|
||||
<div class="vm_param kvm xen vmware">\
|
||||
<label for="TARGET">'+tr("Target")+':</label>\
|
||||
<input type="text" id="TARGET" name="target" />\
|
||||
<div class="tip">'+tr("Device to map image disk. If set, it will overwrite the default device mapping")+'</div>\
|
||||
@ -1405,6 +1405,11 @@ function setupCreateTemplateDialog(){
|
||||
$('#IMAGE', section_disks).change(function(){
|
||||
var uname = getValue($(this).val(),4,2,dataTable_images);
|
||||
$('input#IMAGE_UNAME',section_disks).val(uname);
|
||||
var target = getValue($(this).val(),4,12,dataTable_images);
|
||||
if (target && target != "--")
|
||||
$('input#TARGET',section_disks).val(target);
|
||||
else
|
||||
$('input#TARGET',section_disks).val('');
|
||||
});
|
||||
|
||||
//Depending on adding a disk or a image we need to show/hide
|
||||
@ -1420,16 +1425,12 @@ function setupCreateTemplateDialog(){
|
||||
$('.add_image',section_disks).attr('disabled','disabled');
|
||||
$('.add_disk',section_disks).show();
|
||||
$('.add_disk',section_disks).removeAttr('disabled');
|
||||
$('#TARGET',section_disks).parent().removeClass(opt_class);
|
||||
$('#TARGET',section_disks).parent().addClass(man_class);
|
||||
break;
|
||||
case "image":
|
||||
$('.add_disk',section_disks).hide();
|
||||
$('.add_disk',section_disks).attr('disabled','disabled');
|
||||
$('.add_image',section_disks).show();
|
||||
$('.add_image',section_disks).removeAttr('disabled');
|
||||
$('#TARGET',section_disks).parent().removeClass(man_class);
|
||||
$('#TARGET',section_disks).parent().addClass(opt_class);
|
||||
break;
|
||||
}
|
||||
$('#SIZE',section_disks).parent().hide();
|
||||
|
Loading…
x
Reference in New Issue
Block a user