1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-19 06:50:07 +03:00

Update files tab

This commit is contained in:
Daniel Molina 2014-03-05 12:10:58 +01:00
parent 336b810d14
commit 31d85c9801
2 changed files with 290 additions and 387 deletions

View File

@ -14,133 +14,117 @@
/* limitations under the License. */
/* -------------------------------------------------------------------------- */
var create_file_tmpl =
'<div class="panel">\
<h3><small>'+tr("Create File")+'</small></h3>\
</div>\
<div class="reveal-body">\
<form id="create_file_form_easy" action="" class="custom creation">\
<dl class="tabs" data-tab>\
<dd class="active"><a href="#file_easyTab">'+tr("Wizard")+'</a></dd>\
<dd><a href="#file_manualTab">'+tr("Advanced mode")+'</a></dd>\
var create_file_tmpl ='<div class="row">\
<div class="large-5 columns">\
<h3 class="subheader">'+tr("Create File")+'</h3>'+
'</div>'+
'<div class="large-7 columns">'+
'<dl class="tabs right" data-tab>\
<dd class="active"><a href="#file_easyTab">'+tr("Wizard")+'</a></dd>\
<dd><a href="#file_manualTab">'+tr("Advanced mode")+'</a></dd>\
</dl>\
</div>\
</div>\
<div class="reveal-body">\
<form id="create_file_form_easy" action="" class="custom creation">\
<div class="tabs-content">\
<div id="file_easyTab" class="content active">\
<div class="row vm_param">\
<div class="large-6 columns">\
<div class="row">\
<div class="large-4 columns">\
<label class="right inline" for="img_name">'+tr("Name")+':</label>\
<div class="row vm_param">\
<div class="large-6 columns">\
<div class="row">\
<div class="large-12 columns">\
<label for="file_name">'+tr("Name")+
'<span class="tip">'+tr("Name that the File will get. Every file must have a unique name.")+'</span>\
</label>\
<input type="text" name="file_name" id="file_name" />\
</div>\
</div>\
<div class="large-7 columns">\
<input type="text" name="img_name" id="img_name" />\
<div class="row">\
<div class="large-12 columns">\
<label for="file_desc">'+tr("Description")+
'<span class="tip">'+tr("Human readable description of the file for other users.")+'</span>\
</label>\
<textarea name="file_desc" id="file_desc" rows="4"></textarea>\
</div>\
</div>\
<div class="large-1 columns tip">'+tr("Name that the File will get. Every file must have a unique name.")+'</div>\
</div>\
<div class="row">\
<div class="large-4 columns">\
<label class="right inline" for="img_desc">'+tr("Description")+':</label>\
<div class="large-6 columns">\
<div class="row">\
<div class="large-12 columns">\
<label for="file_type">'+tr("Type")+
'<span class="tip">'+tr("Type of the file, explained in detail in the following section. If omitted, the default value is the one defined in oned.conf (install default is OS).")+'</span>'+
'</label>\
<select name="file_type" id="file_type">\
<option value="KERNEL">'+tr("Kernel")+'</option>\
<option value="RAMDISK">'+tr("Ramdisk")+'</option>\
<option value="CONTEXT">'+tr("Context")+'</option>\
</select>\
</div>\
</div>\
<div class="large-7 columns">\
<textarea name="img_desc" id="img_desc" rows="4"></textarea>\
</div>\
<div class="large-1 columns">\
<div class="tip">'+tr("Human readable description of the file for other users.")+'</div>\
<div class="row">\
<div class="large-12 columns">\
<label for="file_datastore">'+tr("Datastore")+
'<span class="tip">'+tr("Select the datastore for this file")+'</span>'+
'</label>\
<select id="file_datastore" name="file_datastore">\
</select>\
</div>\
</div>\
</div>\
</div>\
<div class="large-6 columns">\
<div class="row">\
<div class="large-4 columns">\
<label class="right inline" for="img_type">'+tr("Type")+':</label>\
<fieldset>\
<legend>'+tr("Image location")+':</legend>\
<div class="row" id="src_path_select">\
<div class="large-12 columns text-center">\
<input type="radio" name="src_path" id="path_file" value="path"><label for="path_file">'+ tr("Provide a path")+'</label> \
<input type="radio" name="src_path" id="upload_file" value="upload"> <label for="upload_file">'+tr("Upload")+'</label> \
</div>\
<div class="large-7 columns">\
<select name="img_type" id="img_type">\
<option value="KERNEL">'+tr("Kernel")+'</option>\
<option value="RAMDISK">'+tr("Ramdisk")+'</option>\
<option value="CONTEXT">'+tr("Context")+'</option>\
</select>\
</div>\
<br>\
<div class="file_param row">\
<div class="large-12 columns">\
<label for="file_path">'+tr("Path")+
'<span class="tip">'+tr("Path to the original file that will be copied to the file repository.")+'</span>'+
'</label>\
<input type="text" name="file_path" id="file_path" />\
</div>\
<div class="large-1 columns">\
<div class="tip">'+tr("Type of the file, explained in detail in the following section. If omitted, the default value is the one defined in oned.conf (install default is OS).")+'</div>\
</div>\
<div class="row">\
<div id="files_file-uploader" class="large-12 columns text-center">\
</div>\
</div>\
<div class="row">\
<div class="large-4 columns">\
<label class="right inline" for="file_datastore">'+tr("Datastore")+':</label>\
</div>\
<div class="large-7 columns">\
<select id="file_datastore" name="file_datastore">\
</select>\
</div>\
<div class="large-1 columns">\
<div class="tip">'+tr("Select the datastore for this file")+'</div>\
</div>\
</div>\
</div>\
</div>\
</fieldset>\
<div class="reveal-footer">\
<div class="form_buttons">\
<button class="button success radius right" id="create_file_submit" type="button" value="file/create">'+tr("Create")+'</button>\
<button id="wizard_file_reset_button" class="button secondary radius" type="reset" value="reset">'+tr("Reset")+'</button>\
</div>\
<div class="row">\
<fieldset>\
<legend>'+tr("File location")+':</legend>\
<div class="row" id="src_path_select">\
<div class="large-5 columns centered">\
<input type="radio" name="src_path" id="path_img" value="path">'+ tr("Provide a path")+'&emsp;</input> \
<input type="radio" name="src_path" id="upload_img" value="upload"> '+tr("Upload")+'</input> &emsp;\
</div>\
</div>\
<hr>\
<div class="img_param row">\
<div class="large-8 columns centered">\
<div class="large-2 columns">\
<label class="right inline" for="img_path">'+tr("Path")+':</label>\
</div>\
<div class="large-9 columns">\
<input type="text" name="img_path" id="img_path" />\
</div>\
<div class="large-1 columns">\
<div class="tip">'+tr("Path to the original file that will be copied to the file repository. If not specified for a DATABLOCK type file, an empty file will be created.")+'</div>\
</div>\
</div>\
</div>\
<div class="img_param" id="files_upload_div">\
<div class="row">\
<div class="columns eight centered">\
<div id="files_file-uploader"></div>\
</div>\
</div>\
</div>\
</fieldset>\
</div>\
<div class="reveal-footer">\
<hr>\
<div class="form_buttons">\
<button class="button success radius right" id="create_file_submit" value="file/create">'+tr("Create")+'</button>\
<button class="button secondary radius" type="reset" value="reset">'+tr("Reset")+'</button>\
</div>\
</div>\
</div>\
<div id="file_manualTab" class="content">\
<div class="reveal-body">\
<div class="columns three">\
<label class="inline left" for="file_datastores_raw">'+tr("Datastore")+':</label>\
</div>\
<div class="columns nine">\
<div class="reveal-body">\
<div class="row">\
<div class="columns large-12">\
<label for="file_datastores_raw">'+tr("Datastore")+':</label>\
<select id="file_datastore_raw" name="file_datastore_raw"></select>\
</div>\
<textarea id="template" rows="15" style="width:100%;"></textarea>\
</div>\
<div class="row">\
<div class="columns large-12">\
<textarea id="template" rows="15" style="height:180px !important; width:100%;"></textarea>\
</div>\
</div>\
</div>\
<div class="reveal-footer">\
<hr>\
<div class="form_buttons">\
<button class="button success radius right" id="create_file_submit_manual" value="file/create">'+tr("Create")+'</button>\
<button class="button secondary radius" type="reset" value="reset">'+tr("Reset")+'</button>\
<button id="advanced_file_reset_button" class="button secondary radius" type="reset" value="reset">'+tr("Reset")+'</button>\
</div>\
</div>\
</div>\
</div>\
<a class="close-reveal-modal">&#215;</a>\
</form>\
</div>';
<a class="close-reveal-modal">&#215;</a>\
</form>\
</div>';
var dataTable_files;
var $create_file_dialog;
@ -469,26 +453,26 @@ function updateFilesView(request, files_list){
}
// Callback to update the information panel tabs and pop it up
function updateFileInfo(request,img){
var img_info = img.IMAGE;
function updateFileInfo(request,file){
var file_info = file.IMAGE;
var info_tab = {
title : tr("Info"),
icon: "fa-info-circle",
content:
'<form class="custom"><div class="">\
<div class="large-6 columns">\
<table id="info_img_table" class="dataTable extended_table">\
<table id="info_file_table" class="dataTable extended_table">\
<thead>\
<tr><th colspan="3">'+tr("File")+' - '+img_info.NAME+'</th></tr>\
<tr><th colspan="3">'+tr("File")+' - '+file_info.NAME+'</th></tr>\
</thead>\
<tr>\
<td class="key_td">'+tr("ID")+'</td>\
<td class="value_td">'+img_info.ID+'</td>\
<td class="value_td">'+file_info.ID+'</td>\
<td></td>\
</tr>\
<tr>\
<td class="key_td">'+tr("Name")+'</td>\
<td class="value_td_rename">'+img_info.NAME+'</td>\
<td class="value_td_rename">'+file_info.NAME+'</td>\
<td><div id="div_edit_rename">\
<a id="div_edit_rename_link_files" class="edit_e" href="#"><i class="fa fa-pencil-square-o right"/></a>\
</div>\
@ -496,12 +480,12 @@ function updateFileInfo(request,img){
</tr>\
<tr>\
<td class="key_td">'+tr("Datastore")+'</td>\
<td class="value_td">'+img_info.DATASTORE+'</td>\
<td class="value_td">'+file_info.DATASTORE+'</td>\
<td></td>\
</tr>\
<tr>\
<td class="key_td">'+tr("Type")+'</td>\
<td class="value_td_type">'+OpenNebula.Helper.image_type(img_info.TYPE)+'</td>\
<td class="value_td_type">'+OpenNebula.Helper.image_type(file_info.TYPE)+'</td>\
<td><div id="div_edit_chg_type_files">\
<a id="div_edit_chg_type_files_link" class="edit_e" href="#"><i class="fa fa-pencil-square-o right"/></a>\
</div>\
@ -509,27 +493,27 @@ function updateFileInfo(request,img){
</tr>\
<tr>\
<td class="key_td">'+tr("Register time")+'</td>\
<td class="value_td">'+pretty_time(img_info.REGTIME)+'</td>\
<td class="value_td">'+pretty_time(file_info.REGTIME)+'</td>\
<td></td>\
</tr>\
<tr>\
<td class="key_td">'+tr("Filesystem type")+'</td>\
<td class="value_td">'+(typeof img_info.FSTYPE === "string" ? img_info.FSTYPE : "--")+'</td>\
<td class="value_td">'+(typeof file_info.FSTYPE === "string" ? file_info.FSTYPE : "--")+'</td>\
<td></td>\
</tr>\
<tr>\
<td class="key_td">'+tr("Size")+'</td>\
<td class="value_td">'+humanize_size_from_mb(img_info.SIZE)+'</td>\
<td class="value_td">'+humanize_size_from_mb(file_info.SIZE)+'</td>\
<td></td>\
</tr>\
<tr>\
<td class="key_td">'+tr("State")+'</td>\
<td class="value_td">'+OpenNebula.Helper.resource_state("file",img_info.STATE)+'</td>\
<td class="value_td">'+OpenNebula.Helper.resource_state("file",file_info.STATE)+'</td>\
<td></td>\
</tr>\
<tr>\
<td class="key_td">'+tr("Running VMS")+'</td>\
<td class="value_td">'+img_info.RUNNING_VMS+'</td>\
<td class="value_td">'+file_info.RUNNING_VMS+'</td>\
<td></td>\
</tr>\
</table>\
@ -537,14 +521,14 @@ function updateFileInfo(request,img){
<div class="large-6 columns">'
+ insert_permissions_table('files-tab',
"File",
img_info.ID,
img_info.UNAME,
img_info.GNAME,
img_info.UID,
img_info.GID) +
insert_extended_template_table(img_info.TEMPLATE,
file_info.ID,
file_info.UNAME,
file_info.GNAME,
file_info.UID,
file_info.GID) +
insert_extended_template_table(file_info.TEMPLATE,
"File",
img_info.ID,
file_info.ID,
"Configuration & Tags") +
'</div>\
</div></form>'
@ -570,7 +554,7 @@ function updateFileInfo(request,img){
{
// Let OpenNebula know
var name_template = {"name": value_str};
Sunstone.runAction("File.rename",img_info.ID,name_template);
Sunstone.runAction("File.rename",file_info.ID,name_template);
}
});
@ -588,8 +572,8 @@ function updateFileInfo(request,img){
$("#chg_type_select_files").live("change", function() {
var new_value=$("option:selected", this).text();
Sunstone.runAction("File.chtype", img_info.ID, new_value);
Sunstone.runAction("File.showinfo", img_info.ID);
Sunstone.runAction("File.chtype", file_info.ID, new_value);
Sunstone.runAction("File.showinfo", file_info.ID);
});
@ -598,10 +582,10 @@ function updateFileInfo(request,img){
$("#file_info_panel_refresh", $("#file_info_panel")).click(function(){
$(this).html(spinner);
Sunstone.runAction('File.showinfo', img_info.ID);
Sunstone.runAction('File.showinfo', file_info.ID);
})
setPermissionsTable(img_info,'');
setPermissionsTable(file_info,'');
}
@ -615,80 +599,33 @@ function enable_all_datastores()
// Prepare the file creation dialog
function setupCreateFileDialog(){
dialogs_context.append('<div title="'+tr("Create File")+'" id="create_file_dialog"></div>');
dialogs_context.append('<div id="create_file_dialog"></div>');
$create_file_dialog = $('#create_file_dialog',dialogs_context);
var dialog = $create_file_dialog;
dialog.html(create_file_tmpl);
var height = Math.floor($(window).height()*0.8); //set height to a percentage of the window
dialog.addClass("reveal-modal medium max-height").attr("data-reveal", "");
dialog.addClass("reveal-modal large max-height").attr("data-reveal", "");
$('select#img_type',dialog).change(function(){
var value = $(this).val();
var context = $create_file_dialog;
switch (value){
case "DATABLOCK":
$('#datablock_img',context).removeAttr("disabled");
//$('#empty_datablock', context).show();
break;
default:
$('#datablock_img',context).attr('disabled','disabled');
//$('#empty_datablock', context).hide();
$('#path_img',context).click();
}
});
$('#img_path,#img_fstype,#img_size,#files_file-uploader',dialog).closest('.row').hide();
$('#files_file-uploader',dialog).closest('.row').hide();
$("input[name='src_path']", dialog).change(function(){
var context = $create_file_dialog;
var value = $(this).val();
switch (value){
case "path":
$('#img_fstype,#img_size,#files_file-uploader',context).closest('.row').hide();
$('#img_path',context).closest('.row').show();
break;
case "datablock":
$('#img_path,#files_file-uploader',context).closest('.row').hide();
$('#img_fstype,#img_size',context).closest('.row').show();
$('#files_file-uploader',context).closest('.row').hide();
$('#file_path',context).closest('.row').show();
break;
case "upload":
$('#img_path,#img_fstype,#img_size',context).closest('.row').hide();
$('#file_path',context).closest('.row').hide();
$('#files_file-uploader',context).closest('.row').show();
break;
};
});
$('#path_img',dialog).click();
$('#add_custom_var_file_button', dialog).click(
function(){
var name = $('#custom_var_file_name',$create_file_dialog).val();
var value = $('#custom_var_file_value',$create_file_dialog).val();
if (!name.length || !value.length) {
notifyError(tr("Custom attribute name and value must be filled in"));
return false;
}
option= '<option value=\''+value+'\' name=\''+name+'\'>'+
name+'='+value+
'</option>';
$('select#custom_var_file_box',$create_file_dialog).append(option);
return false;
}
);
$('#remove_custom_var_file_button', dialog).click(
function(){
$('select#custom_var_file_box :selected',$create_file_dialog).remove();
return false;
}
);
$('#path_file',dialog).click();
$('#upload-progress',dialog).css({
border: "1px solid #AAAAAA",
@ -701,7 +638,7 @@ function setupCreateFileDialog(){
});
$('#upload-progress div',dialog).css("border","1px solid #AAAAAA");
var img_obj;
var file_obj;
// Upload is handled by FileUploader vendor plugin
var uploader = new qq.FileUploaderBasic({
@ -718,25 +655,12 @@ function setupCreateFileDialog(){
//since the body is the upload, we need the pass
//the file info here
uploader.setParams({
img : JSON.stringify(img_obj),
img : JSON.stringify(file_obj),
file: fileName
});
//we pop up an upload progress dialog
var pos_top = $(window).height() - 120;
var pos_left = 220;
//var pb_dialog = $('<div id="pb_dialog" title="'+
// tr("Uploading...")+'">'+
// '<div id="upload-progress"></div>'+
// '</div>').dialog({
// draggable:true,
// modal:false,
// resizable:false,
// buttons:{},
// width: 460,
// minHeight: 50,
// position: [pos_left, pos_top]
// });
$('#files_upload_progress_bars').append('<div id="files'+id+'progressBar" class="row" style="margin-bottom:10px">\
<div class="large-2 columns dataTables_info">\
@ -753,8 +677,6 @@ function setupCreateFileDialog(){
$('#files'+id+'cancel_upload').click(function(){
uploader.cancel();
})
//$('#upload-progress',pb_dialog).progressbar({value:0});
},
onProgress: function(id, fileName, loaded, total){
//update upload dialog with current progress
@ -773,7 +695,7 @@ function setupCreateFileDialog(){
$('#files'+id+'progressBar').remove();
}
//Inform complete upload, destroy upload dialog, refresh img list
//Inform complete upload, destroy upload dialog, refresh file list
$('div#pb_dialog').foundation('reveal', 'close')
return false;
@ -787,19 +709,8 @@ function setupCreateFileDialog(){
file_input = input; return false;
};
$('#create_file_submit',dialog).click(function(){
var exit = false;
var upload = false;
$('.img_man',this).each(function(){
if (!$('input',this).val().length){
notifyError(tr("There are mandatory parameters missing"));
exit = true;
return false;
}
});
if (exit) { return false; }
var ds_id = $('#file_datastore',dialog).val();
if (!ds_id){
@ -807,47 +718,39 @@ function setupCreateFileDialog(){
return false;
};
var img_json = {};
var file_json = {};
var name = $('#img_name',dialog).val();
img_json["NAME"] = name;
var name = $('#file_name',dialog).val();
file_json["NAME"] = name;
var desc = $('#img_desc',dialog).val();
var desc = $('#file_desc',dialog).val();
if (desc.length){
img_json["DESCRIPTION"] = desc;
file_json["DESCRIPTION"] = desc;
}
var type = $('#img_type',dialog).val();
img_json["TYPE"]= type;
var type = $('#file_type',dialog).val();
file_json["TYPE"]= type;
switch ($('#src_path_select input:checked',dialog).val()){
case "path":
path = $('#img_path',dialog).val();
if (path) img_json["PATH"] = path;
path = $('#file_path',dialog).val();
if (path) file_json["PATH"] = path;
break;
case "upload":
upload=true;
break;
}
//Time to add custom attributes
$('#custom_var_file_box option',$create_file_dialog).each(function(){
var attr_name = $(this).attr('name');
var attr_value = $(this).val();
img_json[attr_name] = attr_value;
});
img_obj = { "image" : img_json,
file_obj = { "image" : file_json,
"ds_id" : ds_id};
//we this is an file upload we trigger FileUploader
//to start the upload
if (upload){
uploader._onInputChange(file_input);
} else {
Sunstone.runAction("File.create", img_obj);
Sunstone.runAction("File.create", file_obj);
};
$create_file_dialog.foundation('reveal', 'close')
@ -863,13 +766,13 @@ function setupCreateFileDialog(){
return false;
};
var img_obj = {
var file_obj = {
"image" : {
"image_raw" : template
},
"ds_id" : ds_id
};
Sunstone.runAction("File.create",img_obj);
Sunstone.runAction("File.create",file_obj);
$create_file_dialog.foundation('reveal', 'close')
return false;
});
@ -892,7 +795,7 @@ function popUpCreateFileDialog(){
$('#file_datastore_raw',$create_file_dialog).html(datastores_str);
$create_file_dialog.foundation().foundation('reveal', 'open');
$("input#img_name",$create_file_dialog).focus();
$("input#file_name",$create_file_dialog).focus();
}
// Set the autorefresh interval for the datatable

View File

@ -33,172 +33,172 @@ var create_image_tmpl ='<div class="row">\
<form id="create_image" action="" class="custom creation">\
<div class="tabs-content">\
<div id="img_easyTab" class="content active">\
<div class="row vm_param">\
<div class="large-6 columns">\
<div class="row">\
<div class="large-12 columns">\
<label for="img_name">'+tr("Name")+
'<span class="tip">'+tr("Name that the Image will get. Every image must have a unique name.")+'</span>\
</label>\
<input type="text" name="img_name" id="img_name" />\
</div>\
</div>\
<div class="row">\
<div class="large-12 columns">\
<label for="img_desc">'+tr("Description")+
'<span class="tip">'+tr("Human readable description of the image for other users.")+'</span>\
</label>\
<textarea name="img_desc" id="img_desc" rows="4"></textarea>\
</div>\
</div>\
</div>\
<div class="large-6 columns">\
<div class="row">\
<div class="large-12 columns">\
<label for="img_type">'+tr("Type")+
'<span class="tip">'+tr("Type of the image, explained in detail in the following section. If omitted, the default value is the one defined in oned.conf (install default is OS).")+'</span>'+
'</label>\
<select name="img_type" id="img_type">\
<option value="OS">'+tr("OS")+'</option>\
<option value="CDROM">'+tr("CDROM")+'</option>\
<option value="DATABLOCK">'+tr("DATABLOCK")+'</option>\
</select>\
</div>\
</div>\
<div class="row">\
<div class="large-12 columns">\
<label for="img_datastore">'+tr("Datastore")+
'<span class="tip">'+tr("Select the datastore for this image")+'</span>'+
'</label>\
<select id="img_datastore" name="img_datastore">\
</select>\
</div>\
</div>\
<div class="row">\
<div class="large-12 columns">\
<input type="checkbox" id="img_persistent" name="img_persistent" value="YES" />\
<label for="img_persistent">'+tr("Persistent")+
'<span class="tip">'+tr("Persistence of the image")+'</span>'+
'</label>\
</div>\
</div>\
<div class="row vm_param">\
<div class="large-6 columns">\
<div class="row">\
<div class="large-12 columns">\
<label for="img_name">'+tr("Name")+
'<span class="tip">'+tr("Name that the Image will get. Every image must have a unique name.")+'</span>\
</label>\
<input type="text" name="img_name" id="img_name" />\
</div>\
</div>\
<fieldset>\
<legend>'+tr("Image location")+':</legend>\
<div class="row" id="src_path_select">\
<div class="large-12 columns text-center">\
<input type="radio" name="src_path" id="path_image" value="path"><label for="path_image">'+ tr("Provide a path")+'</label> \
<input type="radio" name="src_path" id="upload_image" value="upload"> <label for="upload_image">'+tr("Upload")+'</label> \
<input type="radio" name="src_path" id="datablock_img" value="datablock" disabled> <label for="datablock_img">'+tr("Empty datablock")+'</label> \
</div>\
</div>\
<br>\
<div class="img_param row">\
<div class="large-12 columns">\
<label for="img_path">'+tr("Path")+
'<span class="tip">'+tr("Path to the original file that will be copied to the image repository. If not specified for a DATABLOCK type image, an empty image will be created.")+'</span>'+
'</label>\
<input type="text" name="img_path" id="img_path" />\
</div>\
</div>\
<div class="row">\
<div id="file-uploader" class="large-12 columns text-center">\
</div>\
</div>\
<div class="img_size row">\
<div class="large-6 columns">\
<label for="img_size">'+tr("Size")+
'<span class="tip">'+tr("Size of the datablock in MB.")+'</span>'+
'</label>\
<input type="text" name="img_size" id="img_size" />\
</div>\
<div class="large-6 columns">\
<label for="img_fstype">'+tr("FS type")+
'<span class="tip">'+tr("Type of file system to be built.")+'<br><br>'
+ tr(" Plain. When the disk image is used directly by the hypervisor we can format the image, and so it is ready to be used by the guest OS. Values: ext2, ext3, ext4, ntfs, reiserfs, jfs, swap. Any other fs supported by mkfs will work if no special option is needed. .")+'<br><br>'
+ tr(" Formatted. The disk image is stored in a hypervisor specific format VMDK or Qcow2. Then we cannot really make a filesystem on the image, just create the device and let the guest OS format the disk. Use raw to not to format the new image. Values: raw, qcow2, vmdk_*.")+
'</span>'+
'</label>\
<input type="text" name="img_fstype" id="img_fstype" />\
</div>\
<div class="row">\
<div class="large-12 columns">\
<label for="img_desc">'+tr("Description")+
'<span class="tip">'+tr("Human readable description of the image for other users.")+'</span>\
</label>\
<textarea name="img_desc" id="img_desc" rows="4"></textarea>\
</div>\
</fieldset>\
<div class="show_hide" id="advanced_image_create">\
<h4><small><i class=" fa fa-caret-down"/> '+tr("Advanced options")+'<a id="add_os_boot_opts" class="icon_left" href="#"></a></small></h4>\
</div>\
</div>\
<div class="advanced">\
<div class="large-6 columns">\
<div class="row">\
<div class="large-6 columns">\
<div class="row">\
<div class="large-12 columns">\
<label for="img_dev_prefix">'+tr("Device prefix")+
'<span class="tip">'+tr("Prefix for the emulated device this image will be mounted at. For instance, “hd”, “sd”. If omitted, the default value is the one defined in oned.conf (installation default is “hd”).")+'</span>'+
'</label>\
<input type="text" name="img_dev_prefix" id="img_dev_prefix" />\
</div>\
</div>\
<div class="row">\
<div class="large-12 columns">\
<label for="img_driver">'+tr("Driver")+
'<span class="tip">'+tr("Specific image mapping driver. KVM: raw, qcow2. XEN: tap:aio, file:")+'</span>'+
'</label>\
<input type="text" name="img_driver" id="img_driver" />\
</div>\
</div>\
</div>\
<div class="large-6 columns">\
<div class="row">\
<div class="large-12 columns">\
<label for="img_target">'+tr("Target")+
'<span class="tip">'+tr("Target on which the image will be mounted at. For example: hda, sdb...")+'</span>'+
'</label>\
<input type="text" name="img_target" id="img_target" />\
</div>\
</div>\
<div class="large-12 columns">\
<label for="img_type">'+tr("Type")+
'<span class="tip">'+tr("Type of the image, explained in detail in the following section. If omitted, the default value is the one defined in oned.conf (install default is OS).")+'</span>'+
'</label>\
<select name="img_type" id="img_type">\
<option value="OS">'+tr("OS")+'</option>\
<option value="CDROM">'+tr("CDROM")+'</option>\
<option value="DATABLOCK">'+tr("DATABLOCK")+'</option>\
</select>\
</div>\
</div>\
<div class="row">\
<fieldset>\
<legend>' + tr("Custom attributes") + '</legend>\
<div class="row">\
<div class="large-6 columns">\
<div class="row">\
<div class="large-12 columns">\
<label for="custom_var_image_name">'+tr("Name")+'</label>\
<input type="text" id="custom_var_image_name" name="custom_var_image_name" />\
</div>\
</div>\
<div class="row">\
<div class="large-12 columns">\
<label for="custom_var_image_value">'+tr("Value")+'</label>\
<input type="text" id="custom_var_image_value" name="custom_var_image_value" />\
</div>\
</div>\
<div class="row">\
<div class="large-12 columns">\
<button class="add_remove_button add_button secondary button small radius" id="add_custom_var_image_button" value="add_custom_image_var">\
'+tr("Add")+'\
</button>\
<button class="add_remove_button secondary button small radius" id="remove_custom_var_image_button" value="remove_custom_image_var">\
'+tr("Remove selected")+'\
</button>\
</div>\
</div>\
</div>\
<div class="large-6 columns">\
<div class="row">\
<div class="eight centered columns">\
<select id="custom_var_image_box" name="custom_var_image_box" style="height:180px !important; width:100%" multiple>\
<!-- insert leases -->\
</select>\
</div>\
</div>\
</div>\
</div>\
</fieldset>\
<div class="large-12 columns">\
<label for="img_datastore">'+tr("Datastore")+
'<span class="tip">'+tr("Select the datastore for this image")+'</span>'+
'</label>\
<select id="img_datastore" name="img_datastore">\
</select>\
</div>\
</div>\
<div class="row">\
<div class="large-12 columns">\
<input type="checkbox" id="img_persistent" name="img_persistent" value="YES" />\
<label for="img_persistent">'+tr("Persistent")+
'<span class="tip">'+tr("Persistence of the image")+'</span>'+
'</label>\
</div>\
</div>\
</div>\
</div>\
<fieldset>\
<legend>'+tr("Image location")+':</legend>\
<div class="row" id="src_path_select">\
<div class="large-12 columns text-center">\
<input type="radio" name="src_path" id="path_image" value="path"><label for="path_image">'+ tr("Provide a path")+'</label> \
<input type="radio" name="src_path" id="upload_image" value="upload"> <label for="upload_image">'+tr("Upload")+'</label> \
<input type="radio" name="src_path" id="datablock_img" value="datablock" disabled> <label for="datablock_img">'+tr("Empty datablock")+'</label> \
</div>\
</div>\
<br>\
<div class="img_param row">\
<div class="large-12 columns">\
<label for="img_path">'+tr("Path")+
'<span class="tip">'+tr("Path to the original file that will be copied to the image repository. If not specified for a DATABLOCK type image, an empty image will be created.")+'</span>'+
'</label>\
<input type="text" name="img_path" id="img_path" />\
</div>\
</div>\
<div class="row">\
<div id="file-uploader" class="large-12 columns text-center">\
</div>\
</div>\
<div class="img_size row">\
<div class="large-6 columns">\
<label for="img_size">'+tr("Size")+
'<span class="tip">'+tr("Size of the datablock in MB.")+'</span>'+
'</label>\
<input type="text" name="img_size" id="img_size" />\
</div>\
<div class="large-6 columns">\
<label for="img_fstype">'+tr("FS type")+
'<span class="tip">'+tr("Type of file system to be built.")+'<br><br>'
+ tr(" Plain. When the disk image is used directly by the hypervisor we can format the image, and so it is ready to be used by the guest OS. Values: ext2, ext3, ext4, ntfs, reiserfs, jfs, swap. Any other fs supported by mkfs will work if no special option is needed. .")+'<br><br>'
+ tr(" Formatted. The disk image is stored in a hypervisor specific format VMDK or Qcow2. Then we cannot really make a filesystem on the image, just create the device and let the guest OS format the disk. Use raw to not to format the new image. Values: raw, qcow2, vmdk_*.")+
'</span>'+
'</label>\
<input type="text" name="img_fstype" id="img_fstype" />\
</div>\
</div>\
</fieldset>\
<div class="show_hide" id="advanced_image_create">\
<h4><small><i class=" fa fa-caret-down"/> '+tr("Advanced options")+'<a id="add_os_boot_opts" class="icon_left" href="#"></a></small></h4>\
</div>\
<div class="advanced">\
<div class="row">\
<div class="large-6 columns">\
<div class="row">\
<div class="large-12 columns">\
<label for="img_dev_prefix">'+tr("Device prefix")+
'<span class="tip">'+tr("Prefix for the emulated device this image will be mounted at. For instance, “hd”, “sd”. If omitted, the default value is the one defined in oned.conf (installation default is “hd”).")+'</span>'+
'</label>\
<input type="text" name="img_dev_prefix" id="img_dev_prefix" />\
</div>\
</div>\
<div class="row">\
<div class="large-12 columns">\
<label for="img_driver">'+tr("Driver")+
'<span class="tip">'+tr("Specific image mapping driver. KVM: raw, qcow2. XEN: tap:aio, file:")+'</span>'+
'</label>\
<input type="text" name="img_driver" id="img_driver" />\
</div>\
</div>\
</div>\
<div class="large-6 columns">\
<div class="row">\
<div class="large-12 columns">\
<label for="img_target">'+tr("Target")+
'<span class="tip">'+tr("Target on which the image will be mounted at. For example: hda, sdb...")+'</span>'+
'</label>\
<input type="text" name="img_target" id="img_target" />\
</div>\
</div>\
</div>\
</div>\
<div class="row">\
<fieldset>\
<legend>' + tr("Custom attributes") + '</legend>\
<div class="row">\
<div class="large-6 columns">\
<div class="row">\
<div class="large-12 columns">\
<label for="custom_var_image_name">'+tr("Name")+'</label>\
<input type="text" id="custom_var_image_name" name="custom_var_image_name" />\
</div>\
</div>\
<div class="row">\
<div class="large-12 columns">\
<label for="custom_var_image_value">'+tr("Value")+'</label>\
<input type="text" id="custom_var_image_value" name="custom_var_image_value" />\
</div>\
</div>\
<div class="row">\
<div class="large-12 columns">\
<button class="add_remove_button add_button secondary button small radius" id="add_custom_var_image_button" value="add_custom_image_var">\
'+tr("Add")+'\
</button>\
<button class="add_remove_button secondary button small radius" id="remove_custom_var_image_button" value="remove_custom_image_var">\
'+tr("Remove selected")+'\
</button>\
</div>\
</div>\
</div>\
<div class="large-6 columns">\
<div class="row">\
<div class="eight centered columns">\
<select id="custom_var_image_box" name="custom_var_image_box" style="height:180px !important; width:100%" multiple>\
<!-- insert leases -->\
</select>\
</div>\
</div>\
</div>\
</div>\
</fieldset>\
</div>\
</div>\
<div class="reveal-footer">\
<div class="form_buttons">\
<button class="button success radius right" id="create_image_submit" type="button" value="image/create">'+tr("Create")+'</button>\