feature #1664: Add CONTEXT files

This commit is contained in:
Daniel Molina committed 2013-01-24 17:23:23 +01:00
1 parent 9554a3a124
commit c42ceeb36a
3 files changed
+227 -87

No files matched your search

+1 -1
View File
@@ -90,7 +90,7 @@ if CloudServer.is_port_open?(settings.config[:host],
settings.config[:port])
settings.logger.error {
"Port #{settings.config[:port]} busy, please shutdown " <<
"the service or move occi server port."
"the service or move econe server port."
}
exit -1
end
+196 -85
View File
@@ -679,7 +679,7 @@ function setupCreateTemplateDialog(){
'<div class="tip">'+tr("Name that the VM will get for description purposes. If NAME is not supplied a name generated by one will be in the form of one-&lt;VID&gt;.")+'</div>'+
'</div>'+
'</div>'+
'<br>'+
'<hr>'+
'<br>'+
'<div class="row vm_param">'+
'<div class="two columns">'+
@@ -878,10 +878,16 @@ function setupCreateTemplateDialog(){
'<div class="three columns pull-three">'+
'<input id="'+str_disk_tab_id+'radioVolatile" type="radio" name="'+str_disk_tab_id+'" value="volatile"> Volatile Disk '+
'</div>'+
'</div>'+
'</div>'+
'<hr>'+
'<div id="disk_type" class="vm_param image">'+
'<fieldset>'+
'<legend>'+tr("Please select an image from the list")+'</legend>'+
'<div class="vm_param kvm_opt xen_opt vmware_opt">'+
'<span id="select_image" class="radius secondary label">'+tr("Please select an image from the list")+'</span>'+
'<span id="image_selected" class="radius secondary label hidden">You selected the following image: '+
'</span>'+
'<span class="radius label" type="text" id="IMAGE" name="image"></span>'+
'<input type="hidden" id="IMAGE_ID" name="image_id" size="2"/>'+
'</div>'+
'<table id="'+str_datatable_id+'" class="display">'+
'<thead>'+
'<tr>'+
@@ -903,13 +909,7 @@ function setupCreateTemplateDialog(){
'<tbody id="tbodyimages">'+
'</tbody>'+
'</table>'+
'<div class="vm_param kvm_opt xen_opt vmware_opt">'+
'<p>You selected the following image: '+
'<span type="text" id="IMAGE" name="image"></span>'+
'</p>'+
'<input type="hidden" id="IMAGE_ID" name="image_id" size="2"/>'+
'</div>'+
'</fieldset>'+
'<br>'+
'<div class="show_hide" id="advanced_image">'+
'<h4>'+tr("Advanced options")+'<a id="add_os_boot_opts" class="icon_left" href="#"><span class="ui-icon ui-icon-plus" /></a></h4>'+
'</div>'+
@@ -1094,7 +1094,7 @@ function setupCreateTemplateDialog(){
"bSortClasses": false,
"bAutoWidth":false,
"iDisplayLength": 4,
"sDom" : '<"H"frC>t<"F"ip>',
"sDom" : '<"H"fr>t<"F"ip>',
"oColVis": {
"aiExclude": [ 0 ]
},
@@ -1147,8 +1147,14 @@ function setupCreateTemplateDialog(){
var aData = dataTable_template_images.fnGetData(this);
if (previous_row)
if (previous_row) {
$("td:first", previous_row).parent().children().each(function(){$(this).removeClass('markrow');});
}
else {
$('#image_selected', disk_section).toggle();
$('#select_image', disk_section).hide();
}
previous_row = this;
$("td:first", this).parent().children().each(function(){$(this).addClass('markrow');});
@@ -1849,13 +1855,16 @@ function setupCreateTemplateDialog(){
'<div class="six columns graphics">'+
'<fieldset>'+
'<legend>'+tr("Graphics")+'</legend>'+
'<div class="row vm_param">'+
'<input type="radio" name="graphics_type" ID="TYPE" value="VNC"> VNC '+
'<input type="radio" name="graphics_type" ID="TYPE" value="SDL"> SDL'+
'<input type="radio" name="graphics_type" ID="TYPE" value="SPICE"> SPICE'+
'<div class="row">'+
'<div class="eight columns push-two">'+
'<input type="radio" name="graphics_type" ID="radioVncType" value="VNC"> VNC '+
'<input type="radio" name="graphics_type" ID="radioSdlType" value="SDL"> SDL'+
'<input type="radio" name="graphics_type" ID="radioSpiceType" value="SPICE"> SPICE'+
'</div>'+
'</div>'+
'<br>'+
'<hr>'+
'<div class="row vm_param">'+
'<input type="hidden" name="graphics_type" ID="TYPE">'+
'<div class="four columns">'+
'<label class="right inline" for="LISTEN">'+tr("Listen IP")+':</label>'+
'</div>'+
@@ -1906,39 +1915,25 @@ function setupCreateTemplateDialog(){
'<legend>'+tr("Inputs")+'</legend>'+
'<div class="row">'+
'<div class="four columns">'+
'<label class="right inline" for="TYPE">'+tr("Type")+':</label>'+
'</div>'+
'<div class="six columns">'+
'<select id="TYPE" name="input_type">'+
'<option value="mouse">'+tr("Mouse")+'</option>'+
'<option value="tablet">'+tr("Tablet")+'</option>'+
'</select>'+
'</div>'+
'<div class="two columns">'+
'<div class="tip"></div>'+
'</div>'+
'</div>'+
'<div class="row">'+
'<div class="four columns">'+
'<label class="right inline" for="BUS">'+tr("Bus")+':</label>'+
'</div>'+
'<div class="six columns">'+
'<select id="BUS" name="input_bus">'+
'<option value="usb">'+tr("USB")+'</option>'+
'<option value="ps2">'+tr("PS2")+'</option>'+
'<option value="xen">'+tr("XEN")+'</option>'+
'</select>'+
'</div>'+
'<div class="two columns">'+
'<div class="tip"></div>'+
'<div class="three columns">'+
'<button href="#" id="add_input" action="" onclick="return false">'+tr("Add")+'</button>'+
'</div>'+
'</div>'+
'<hr>'+
'<div class="row">'+
'<button href="#" id="add_input" class="push-four six" action="" onclick="return false">'+tr("Add")+'</button>'+
'</div>'+
'<br>'+
'<div class="row">'+
'<table id="input_table" class="table-custom display">'+
'<table id="input_table" class="table display">'+
'<thead>'+
'<tr>'+
'<th>'+tr("TYPE")+'</th>'+
@@ -1947,6 +1942,10 @@ function setupCreateTemplateDialog(){
'</tr>'+
'</thead>'+
'<tbody id="tbodyinput">'+
'<tr>'+
'</tr>'+
'<tr>'+
'</tr>'+
'</tbody>'+
'</table>'+
'<br>'+
@@ -1961,6 +1960,8 @@ function setupCreateTemplateDialog(){
tabs.append(html_tab_content).tabs('add', '#io_tab', 'Input/Output');
$("input[name='graphics_type']").change(function(){
console.log(this)
$("#TYPE", $('div#io_tab .graphics')).val($(this).attr("value"))
$("#LISTEN", $('div#io_tab')).val("0.0.0.0")
});
@@ -1968,7 +1969,7 @@ function setupCreateTemplateDialog(){
var table = $('#input_table', $('div#io_tab'))[0];
console.log(table)
var rowCount = table.rows.length;
var row = table.insertRow(rowCount);
var row = table.insertRow(-1);
$(row).addClass("vm_param");
var cell1 = row.insertCell(0);
@@ -1994,6 +1995,7 @@ function setupCreateTemplateDialog(){
$(this).closest("tr").remove()
});
setupTips($('div#io_tab'));
}
@@ -2034,49 +2036,73 @@ function setupCreateTemplateDialog(){
'</div>'+
'<div class="six columns">'+
'<fieldset>'+
'<legend>'+tr("Custom CONTEXT")+'</legend>'+
'<legend>'+tr("Context Files")+'</legend>'+
'<div class="row">'+
'<div class="four columns">'+
'<label class="right inline" for="KEY">'+tr("Key")+':</label>'+
'</div>'+
'<div class="six columns">'+
'<input type="text" id="KEY" name="key" />'+
'</div>'+
'<div class="two columns">'+
'<div class="tip"></div>'+
'</div>'+
'</div>'+
'<div class="row">'+
'<div class="four columns">'+
'<label class="right inline" for="VALUE">'+tr("Value")+':</label>'+
'</div>'+
'<div class="six columns">'+
'<input type="text" id="VALUE" name="value" />'+
'</div>'+
'<div class="two columns">'+
'<div class="tip"></div>'+
'</div>'+
'</div>'+
'<div class="row">'+
'<button id="add_context" class="push-four six" class="kvm_opt" onclick="return false">'+tr("Add")+'</button>'+
'</div>'+
'<br>'+
'<div class="row">'+
'<table id="context_table" class="display">'+
'<thead>'+
'<tr>'+
'<th>'+tr("KEY")+'</th>'+
'<th>'+tr("VALUE")+'</th>'+
'<th></th>'+
'</tr>'+
'</thead>'+
'<tbody id="tbodyinput">'+
'</tbody>'+
'</table>'+
'<br>'+
'<table id="datatable_context" class="display">'+
'<thead>'+
'<tr>'+
'<th class="check"><input type="checkbox" class="check_all" value=""></input></th>'+
'<th>'+tr("ID")+'</th>'+
'<th>'+tr("Owner")+'</th>'+
'<th>'+tr("Group")+'</th>'+
'<th>'+tr("Name")+'</th>'+
'<th>'+tr("Datastore")+'</th>'+
'<th>'+tr("Size")+'</th>'+
'<th>'+tr("Type")+'</th>'+
'<th>'+tr("Registration time")+'</th>'+
'<th>'+tr("Persistent")+'</th>'+
'<th>'+tr("Status")+'</th>'+
'<th>'+tr("#VMS")+'</th>'+
'<th>'+tr("Target")+'</th>'+
'</tr>'+
'</thead>'+
'<tbody id="tbodyimages">'+
'</tbody>'+
'</table>'+
'<div id="files_ds_inputs" class="vm_param kvm_opt xen_opt vmware_opt">'+
'<p>You selected the following FILES: '+
'<span type="text" id="FILES" name="context_files"></span>'+
'</p>'+
'<input type="hidden" id="FILES_DS" name="context_files" size="2"/>'+
'</div>'+
'</div>'+
'</fieldset>'+
'</div>'+
'</div>'+
'</div>'+
'<div class="row">'+
'<fieldset>'+
'<legend>'+tr("Custom CONTEXT")+'</legend>'+
'<div class="row">'+
'<div class="three columns">'+
'<input type="text" id="KEY" name="key" />'+
'</div>'+
'<div class="seven columns">'+
'<input type="text" id="VALUE" name="value" />'+
'</div>'+
'<div class="two columns">'+
'<button id="add_context" class="push-four six" class="kvm_opt" onclick="return false">'+tr("Add")+'</button>'+
'</div>'+
'</div>'+
'<hr>'+
'<div class="row">'+
'<table id="context_table" class="table display">'+
'<thead>'+
'<tr>'+
'<th>'+tr("KEY")+'</th>'+
'<th>'+tr("VALUE")+'</th>'+
'<th></th>'+
'</tr>'+
'</thead>'+
'<tbody id="tbodyinput">'+
'<tr>'+
'</tr>'+
'<tr>'+
'</tr>'+
'</tbody>'+
'</table>'+
'<br>'+
'</div>'+
'</fieldset>'+
'</div>'+
'</form>'+
'</div>'
@@ -2113,6 +2139,72 @@ function setupCreateTemplateDialog(){
$( "#context_tab span.ui-icon-close" ).live( "click", function() {
$(this).closest("tr").remove()
});
var datTable_template_context = $('#datatable_context', dialog).dataTable({
"bJQueryUI": true,
"bSortClasses": false,
"bAutoWidth":false,
"iDisplayLength": 4,
"sDom" : '<"H"fr>t<"F"p>',
"oColVis": {
"aiExclude": [ 0 ]
},
"sPaginationType": "full_numbers",
"aoColumnDefs": [
{ "bSortable": false, "aTargets": ["check"] },
{ "sWidth": "60px", "aTargets": [0,2,3,9,10] },
{ "sWidth": "35px", "aTargets": [1,6,11,12] },
{ "sWidth": "100px", "aTargets": [5,7] },
{ "sWidth": "150px", "aTargets": [8] },
{ "bVisible": false, "aTargets": [0,2,3,5,6,7,9,8,10,11,12]}
],
"oLanguage": (datatable_lang != "") ?
{
sUrl: "locale/"+lang+"/"+datatable_lang
} : ""
});
datTable_template_context.fnClearTable();
addElement([spinner,'','','','','','','','','','','',''],datTable_template_context);
// Retrieve the images to fill the datatable
OpenNebula.Image.list({
timeout: true,
success: function (request, images_list){
var image_list_array = [];
$.each(images_list,function(){
image_list_array.push(imageElementArray(this));
});
updateView(image_list_array, datTable_template_context);
datTable_template_context.fnFilter("CONTEXT", 6)
},
error: onError
});
// TBD More than one file
// TBD Add refresh button for the datatable
// When a row is selected the background color is updated. If a previous row
// was selected (previous_row) the background color is removed.
// #IMAGE and #IMAGE_ID inputs are updated using the row information
if (typeof previous_context_row === 'undefined') {
var previous_context_row = 0;
}
$('#datatable_context tbody', dialog).delegate("tr", "click", function(e){
if ($(e.target).is('input') ||
$(e.target).is('select') ||
$(e.target).is('option')) return true;
var aData = datTable_template_context.fnGetData(this);
if (previous_context_row)
$("td:first", previous_context_row).parent().children().each(function(){$(this).removeClass('markrow');});
previous_context_row = this;
$("td:first", this).parent().children().each(function(){$(this).addClass('markrow');});
$('#FILES', $('div#context_tab')).text(aData[4]);
$('#FILES_DS', $('div#context_tab')).val("$FILE[IMAGE_ID="+ aData[1] +"]");
return false;
});
}
@@ -2134,7 +2226,8 @@ function setupCreateTemplateDialog(){
'<div class="three columns pull-three">'+
'<input type="radio" name="req_select" value="cluster_select"> Select Clusters '+
'</div>'+
'</div>'+
'</div>'+
'<hr>'+
'<div id="req_type" class="host_select row">'+
'<table id="datatable_template_hosts" class="display">'+
'<thead>'+
@@ -2568,7 +2661,10 @@ function setupCreateTemplateDialog(){
hash["ICMP"] = "drop"
}
vm_json["NIC"].push(hash);
console.log(hash)
if (!$.isEmptyObject(hash)) {
vm_json["NIC"].push(hash);
}
});
//
@@ -2614,18 +2710,20 @@ function setupCreateTemplateDialog(){
};
if ($("#network_context", $('div#context_tab')).is(":checked")) {
var nic_id = 1;
var nic_id = 0;
console.log("nic")
console.log(vm_json["NIC"])
$.each(vm_json["NIC"], function(){
var vnet_id = this["NETWORK_ID"]
var eth_str = "ETH"+nic_id+"_"
var net_str = 'NETWORK_ID=\\"'+ vnet_id +'\\"'
vm_json["CONTEXT"][eth_str+"IP"] = "$NIC[IP,"+ net_str +"]";
vm_json["CONTEXT"][eth_str+"NETWORK"] = "$NIC[NETWORK,"+ net_str +"]";
vm_json["CONTEXT"][eth_str+"MASK"] = "$NIC[MASK,"+ net_str +"]";
vm_json["CONTEXT"][eth_str+"GATEWAY"] = "$NIC[GATEWAY,"+ net_str +"]";
vm_json["CONTEXT"][eth_str+"DNS"] = "$NIC[DNS,"+ net_str +"]";
vm_json["CONTEXT"][eth_str+"NETWORK"] = "$NETWORK[NETWORK_ADDRESS,"+ net_str +"]";
vm_json["CONTEXT"][eth_str+"MASK"] = "$NETWORK[NETWORK_MASK,"+ net_str +"]";
vm_json["CONTEXT"][eth_str+"GATEWAY"] = "$NETWORK[GATEWAY,"+ net_str +"]";
vm_json["CONTEXT"][eth_str+"DNS"] = "$NETWORK[DNS,"+ net_str +"]";
nic_id++;
});
@@ -3045,9 +3143,22 @@ function fillTemplatePopUp(request, response){
autoFillInputs(os, os_section);
}
//
// INPUT/OUTPUT
//
var graphics = template.GRAPHICS;
var graphics_section = $('div#io_tab .graphics', $create_template_dialog);
if (graphics) {
var type = graphics.TYPE;
if (graphics.TYPE) {
$("input[value='"+ type + "']").click();
autoFillInputs(graphics, graphics_section);
}
}
popUpCreateTemplateDialog();
}
+30 -1
View File
@@ -76,7 +76,7 @@
*, *:before, *:after { -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; }
html { font-size: 62.5%; }
html { font-size: 62.5%; }
body { background: white; font-family: "Helvetica Neue", "Helvetica", Helvetica, Arial, sans-serif; font-weight: normal; font-style: normal; font-size: 14px; line-height: 1; color: #222222; position: relative; -webkit-font-smoothing: antialiased; }
@@ -267,6 +267,35 @@ img { -ms-interpolation-mode: bicubic; }
.ui-slider-range { background: #4d4d4d; }
/* Tables ---------------------- */
.table { background: #fff; -webkit-border-radius: 3px; -moz-border-radius: 3px; -ms-border-radius: 3px; -o-border-radius: 3px; border-radius: 3px; margin: 0 0 18px; border: 1px solid #ddd; }
.table thead, .table tfoot { background: #f5f5f5; }
.table thead tr th, .table tfoot tr th, .table tbody tr td, .table tr td, .table tfoot tr td { display: table-cell; font-size: 12; line-height: 10px; text-align: left; }
.table thead tr th, .table tfoot tr td { padding: 8px 10px 9px; font-size: 12px; font-weight: bold; color: #222; }
.table thead tr th:first-child, .table tfoot tr td:first-child { border-left: none; }
.table thead tr th:last-child, .table tfoot tr td:last-child { border-right: none; }
.table tbody tr.even, .table tbody tr.alt { background: #f9f9f9; }
.table tbody tr:nth-child(even) { background: #f9f9f9; }
.table tbody tr td { color: #333; padding: 9px 10px; vertical-align: top; border: none; }
hr{margin:18px 0;border:0;border-top:1px solid #eee;border-bottom:1px solid #fff}
/* Labels ---------------------- */
.label { padding: 1px 4px 2px; font-size: 12px; font-weight: bold; text-align: center; text-decoration: none; line-height: 1; white-space: nowrap; display: inline; position: relative; bottom: 1px; color: #fff; background: #2ba6cb; }
.label.radius { -webkit-border-radius: 3px; -moz-border-radius: 3px; -ms-border-radius: 3px; -o-border-radius: 3px; border-radius: 3px; }
.label.round { padding: 1px 7px 2px; -webkit-border-radius: 1000px; -moz-border-radius: 1000px; -ms-border-radius: 1000px; -o-border-radius: 1000px; border-radius: 1000px; }
.label.alert { background-color: #c60f13; }
.label.success { background-color: #5da423; }
.label.secondary { background-color: #e9e9e9; color: #505050; }
.markrow { background-color:#ffbba9 !important; }
</style>
<!--Languages-->