1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-02-28 17:57:22 +03:00

feature #1664: Fix VNet creation

This commit is contained in:
Daniel Molina 2013-03-01 19:01:51 +01:00
parent 96781714cf
commit 018cc8529c
5 changed files with 88 additions and 60 deletions

View File

@ -630,7 +630,7 @@ function updateImageInfo(request,img){
<div class="six columns">\
<table id="info_img_table" class="twelve datatable extended_table">\
<thead>\
<tr><th colspan="3">'+tr("Image")+' "'+img_info.NAME+'</th></tr>\
<tr><th colspan="3">'+tr("Image")+' - '+img_info.NAME+'</th></tr>\
</thead>\
<tr>\
<td class="key_td">'+tr("ID")+'</td>\

View File

@ -2992,7 +2992,7 @@ function setupCreateTemplateDialog(){
vm_json["DISK"] = [];
$('div.disk div#disk_type.vm_param ',dialog).each(function(){
$('.disk div#disk_type.vm_param ',dialog).each(function(){
var hash = {};
addSectionJSON(hash, this);
vm_json["DISK"].push(hash);
@ -3004,7 +3004,7 @@ function setupCreateTemplateDialog(){
vm_json["NIC"] = [];
$('div.nic',dialog).each(function(){
$('.nic',dialog).each(function(){
var hash = {};
addSectionJSON(hash, this);

View File

@ -691,9 +691,9 @@ function updateUserInfo(request,user){
<table class="twelve datatable extended_table">\
<thead>\
<tr>\
<th>'+tr("Datastore ID")+'</th>\
<th>'+tr("Images")+'</th>\
<th>'+tr("Size")+'</th>\
<th style="width:24%">'+tr("Datastore ID")+'</th>\
<th style="width:38%">'+tr("Images")+'</th>\
<th style="width:38%">'+tr("Size")+'</th>\
</tr>\
</thead>\
<tbody>';
@ -1037,8 +1037,7 @@ function popUpUpdatePasswordDialog(){
function setUserAutorefresh(){
setInterval(function(){
var checked = $('input.check_item:checked',dataTable_users);
var filter = $("#datatable_users_filter input",
dataTable_users.parents("#datatable_users_wrapper")).attr('value');
var filter = $("#user_search").attr('value');
if (!checked.length && !filter.length){
Sunstone.runAction("User.autorefresh");
}

View File

@ -114,32 +114,52 @@ var vms_tab_content = '\
</div>\
</form>';
var create_vm_tmpl ='<form id="create_vm_form" action="">\
<fieldset>\
<div>\
<div>\
<label for="vm_name">'+tr("VM Name")+':</label>\
<input type="text" name="vm_name" id="vm_name" />\
<div class="tip">'+tr("Defaults to template name when emtpy")+'.</div>\
</div>\
<div>\
<label for="template_id">'+tr("Select template")+':</label>\
<select id="template_id">\
</select>\
</div>\
<div>\
<label for="vm_n_times">'+tr("Deploy # VMs")+':</label>\
<input type="text" name="vm_n_times" id="vm_n_times" value="1">\
<div class="tip">'+tr("You can use the wildcard &#37;i. When creating several VMs, &#37;i will be replaced with a different number starting from 0 in each of them")+'.</div>\
</div>\
var create_vm_tmpl ='\
<div class="panel">\
<h3>\
<small id="create_vnet_header">'+tr("Create Virtual Network")+'</small>\
</h3>\
</div>\
</fieldset>\
<fieldset>\
<form id="create_vm_form" action="">\
<div class="row centered">\
<div class="four columns">\
<label class="inline right" for="vm_name">'+tr("VM Name")+':</label>\
</div>\
<div class="seven columns">\
<input type="text" name="vm_name" id="vm_name" />\
</div>\
<div class="one columns">\
<div class="tip">'+tr("Defaults to template name when emtpy")+'.</div>\
</div>\
</div>\
<div class="row centered">\
<div class="four columns">\
<label class="inline right" for="template_id">'+tr("Select template")+':</label>\
</div>\
<div class="seven columns">\
<select id="template_id">\
</select>\
</div>\
<div class="one columns">\
<div class=""></div>\
</div>\
</div>\
<div class="row centered">\
<div class="four columns">\
<label class="inline right" for="vm_n_times">'+tr("Deploy # VMs")+':</label>\
</div>\
<div class="seven columns">\
<input type="text" name="vm_n_times" id="vm_n_times" value="1">\
</div>\
<div class="one columns">\
<div class="tip">'+tr("You can use the wildcard &#37;i. When creating several VMs, &#37;i will be replaced with a different number starting from 0 in each of them")+'.</div>\
</div>\
</div>\
<hr>\
<div class="form_buttons">\
<button class="button" id="create_vm_proceed" value="VM.create">'+tr("Create")+'</button>\
<button class="button" type="reset" value="reset">'+tr("Reset")+'</button>\
<button class="button radius right success" id="create_vm_proceed" value="VM.create">'+tr("Create")+'</button>\
<button class="close-reveal-modal button secondary radius" type="close" value="close">' + tr("Close") + '</button>\
</div>\
</fieldset>\
<a class="close-reveal-modal">&#215;</a>\
</form>';
@ -963,58 +983,54 @@ function updateVMInfo(request,vm){
var info_tab = {
title : tr("Information"),
content:
'<table id="info_vm_table" class="info_table">\
'<div class="">\
<div class="six columns">\
<table id="info_vm_table" class="twelve datatable extended_table">\
<thead>\
<tr><th colspan="2">'+tr("Virtual Machine information")+' - '+vm_info.NAME+'</th></tr>\
<tr><th colspan="3">'+tr("Virtual Machine information")+' - '+vm_info.NAME+'</th></tr>\
</thead>\
<tbody>\
<tr>\
<td class="key_td">'+tr("ID")+'</td>\
<td class="value_td">'+vm_info.ID+'</td>\
<td></td>\
</tr>\
<tr>\
<td class="key_td">'+tr("Name")+'</td>\
<td class="value_td_rename">'+vm_info.NAME+'</td>\
<td><div id="div_edit_rename">\
<a id="div_edit_rename_link" class="edit_e" href="#">e</a>\
<a id="div_edit_rename_link" class="edit_e" href="#"><i class="icon-edit right"/></a>\
</div>\
</td>\
</tr>\
<tr>\
<td class="key_td">'+tr("State")+'</td>\
<td class="value_td">'+tr(vm_state)+'</td>\
<td></td>\
</tr>\
<tr>\
<td class="key_td">'+tr("LCM State")+'</td>\
<td class="value_td">'+tr(OpenNebula.Helper.resource_state("vm_lcm",vm_info.LCM_STATE))+'</td>\
<td></td>\
</tr>\
<tr>\
<td class="key_td">'+tr("Host")+'</td>\
<td class="value_td">'+ hostname +'</td>\
<td></td>\
</tr>\
<tr>\
<td class="key_td">'+tr("Start time")+'</td>\
<td class="value_td">'+pretty_time(vm_info.STIME)+'</td>\
<td></td>\
</tr>\
<tr>\
<td class="key_td">'+tr("Deploy ID")+'</td>\
<td class="value_td">'+(typeof(vm_info.DEPLOY_ID) == "object" ? "-" : vm_info.DEPLOY_ID)+'</td>\
<td></td>\
</tr>\
</tbody>\
</table>' +
insert_extended_template_table(stripped_vm_template,
"VM",
vm_info.ID,
unshown_values) +
insert_permissions_table("VM",
vm_info.ID,
vm_info.UNAME,
vm_info.GNAME,
vm_info.UID,
vm_info.GID) +
'<table id="vm_monitoring_table" class="info_table">\
</table>\
<table id="vm_monitoring_table" class="twelve datatable extended_table">\
<thead>\
<tr><th colspan="2">'+tr("Monitoring information")+'</th></tr>\
</thead>\
@ -1040,7 +1056,22 @@ function updateVMInfo(request,vm){
<td class="value_td">'+vncIcon(vm_info)+'</td>\
</tr>\
</tbody>\
</table>'
</table>\
</div>\
<div class="six columns">' +
insert_permissions_table("VM",
vm_info.ID,
vm_info.UNAME,
vm_info.GNAME,
vm_info.UID,
vm_info.GID) +
insert_extended_template_table(stripped_vm_template,
"VM",
vm_info.ID,
unshown_values) +
'</div>\
</div>'
};
var hotplugging_tab = {
@ -1510,10 +1541,10 @@ function vncIcon(vm){
if (graphics && graphics.TYPE == "vnc" && $.inArray(state, VNCstates)!=-1){
gr_icon = '<a class="vnc" href="#" vm_id="'+vm.ID+'">';
gr_icon += '<img src="images/vnc_on.png" alt=\"'+tr("Open VNC Session")+'\" /></a>';
gr_icon += '<img style="height:15px" src="images/vnc_on.png" alt=\"'+tr("Open VNC Session")+'\" /></a>';
}
else {
gr_icon = '<img src="images/vnc_off.png" alt=\"'+tr("VNC Disabled")+'\" />';
gr_icon = '<img style="height:15px" src="images/vnc_off.png" alt=\"'+tr("VNC Disabled")+'\" />';
}
return gr_icon;
}

View File

@ -870,10 +870,8 @@ function printLeases(vn_info){
if (!leases) //empty
{
html+='<tr id="no_leases_tr"><td class="key_td">\
html+='<tr id="no_leases_tr"><td colspan="5" class="key_td">\
'+tr("No leases to show")+'\
</td>\
<td class="value_td">\
</td></tr>';
html += '</tbody></table></div></form>';
return html;
@ -1149,7 +1147,7 @@ function setupCreateVNetDialog() {
break;
};
var type = $('input:checked',dialog).val();
var type = $('input[name="fixed_ranged"]:checked',dialog).val();
network_json['type']=type;
//TODO: Name and bridge provided?!
@ -1159,7 +1157,7 @@ function setupCreateVNetDialog() {
//for each specified lease we prepare the JSON object
$.each(leases,function(){
var lease_str = $(dialog).val().split(",");
var lease_str = $(this).val().split(",");
if (lease_str[1])
leases_obj.push({"ip": lease_str[0],
"mac": lease_str[1]});
@ -1199,8 +1197,8 @@ function setupCreateVNetDialog() {
//Time to add custom attributes
$('#custom_var_vnet_box option',$create_vn_dialog).each(function(){
var attr_name = $(dialog).attr('name');
var attr_value = $(dialog).val();
var attr_name = $(this).attr('name');
var attr_value = $(this).val();
network_json[attr_name] = attr_value;
});
@ -1233,7 +1231,7 @@ function popUpCreateVnetDialog() {
// extended information panel.
function setupLeasesOps(){
$('button#panel_add_lease_button').live("click",function(){
var lease = $(this).prev().val();
var lease = $('input#panel_add_lease', dialog).val();
//var mac = $(this).previous().val();
var id = $(this).parents('form').attr('vnid');
if (lease.length){
@ -1245,7 +1243,7 @@ function setupLeasesOps(){
//ranged networks hold lease
$('button#panel_hold_lease_button').live("click",function(){
var lease = $(this).prev().val();
var lease = $('input#panel_hold_lease', dialog).val();
//var mac = $(this).previous().val();
var id = $(this).parents('form').attr('vnid');
if (lease.length){