diff --git a/src/sunstone/public/js/plugins/images-tab.js b/src/sunstone/public/js/plugins/images-tab.js index 4fe86d4051..d7a5ebe693 100644 --- a/src/sunstone/public/js/plugins/images-tab.js +++ b/src/sunstone/public/js/plugins/images-tab.js @@ -36,6 +36,7 @@ var images_tab_content = '\ '+tr("Persistent")+'\ '+tr("Status")+'\ '+tr("#VMS")+'\ + '+tr("Target")+'\ \ \ \ @@ -108,6 +109,11 @@ var create_image_tmpl = \
'+tr("Specific image mapping driver. KVM: raw, qcow2. XEN: tap:aio, file:")+'
\ \ +
\ + \ + \ +
'+tr("Target on which the image will be mounted at. For example: hda, sdb...")+'
\ +
\ \
\
\ @@ -544,7 +550,8 @@ function imageElementArray(image_json){ parseInt(image.PERSISTENT) ? '' : '', 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(); diff --git a/src/sunstone/public/js/plugins/templates-tab.js b/src/sunstone/public/js/plugins/templates-tab.js index 993f3980fb..8411a95bd8 100644 --- a/src/sunstone/public/js/plugins/templates-tab.js +++ b/src/sunstone/public/js/plugins/templates-tab.js @@ -208,7 +208,7 @@ var create_template_tmpl = '
\ \
'+tr("Type of disk device to emulate: ide, scsi")+'
\
\ -
\ +
\ \ \
'+tr("Device to map image disk. If set, it will overwrite the default device mapping")+'
\ @@ -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();