diff --git a/src/sunstone/public/js/plugins/vms-tab.js b/src/sunstone/public/js/plugins/vms-tab.js index b6212f5a94..a82143572e 100644 --- a/src/sunstone/public/js/plugins/vms-tab.js +++ b/src/sunstone/public/js/plugins/vms-tab.js @@ -1878,97 +1878,6 @@ function printActionsTable(vm_info) Sunstone.runAction("VM.update_actions",vm_info.ID,template_str); }); - //// Listener for key,value pair edit action - //$(".edit_e").live("click", function() { - // // Action - // $("#add_scheduling_action").attr("disabled", "disabled"); -// - // var index=this.id.substring(5,this.id.length); -// - // var value_str = $(".tr_action_"+index+" .action_row").text(); - // $(".tr_action_"+index+" .action_row").html('') - // $(".select_action").val(value_str); -// - // // Time - // var time_value_str = $(".tr_action_"+index+" .time_row").text(); - // $(".tr_action_"+index+" .time_row").html('
\ - // t
'); -// - // $(".date_time_picker_link").die(); - // $(".date_time_picker_link").live("click", function() { - // setupDateTimePicker('#input_edit_time_'+index, time_value_str); - // }); - //}); -// - // $(".select_action").live("change", function() { - // var index = $.trim(this.id.substring(14,this.id.length)); - // var tmp_tmpl = new Array(); - // var value_str = $(this).val(); -// - // if(vm_info.USER_TEMPLATE.SCHED_ACTION.length) - // { - // $.each(vm_info.USER_TEMPLATE.SCHED_ACTION, function(i,element){ - // tmp_tmpl[i] = element; - // if(element.ID==index) - // tmp_tmpl[i].ACTION = value_str; - // }) - // vm_info.USER_TEMPLATE.SCHED_ACTION = tmp_tmpl; - // } - // else - // { - // vm_info.USER_TEMPLATE.SCHED_ACTION.ACTION = value_str; - // } -// - // var template_str = convert_template_to_string(vm_info.USER_TEMPLATE); -// - // // Let OpenNebula know - // Sunstone.runAction("VM.update_template",vm_info.ID,template_str); - // $("#add_scheduling_action").removeAttr("disabled"); - //}); -// - //$(".input_edit_time").live("change", function() { - // var index = $.trim(this.id.substring(16,this.id.length)); - // var tmp_tmpl = new Array(); - // var epoch_str = new Date($(this).val()); -// - // if(vm_info.USER_TEMPLATE.SCHED_ACTION.length) - // { - // $.each(vm_info.USER_TEMPLATE.SCHED_ACTION, function(i,element){ - // if(element.ID==index) - // { - // element.TIME = parseInt(epoch_str.getTime())/1000; - // } - // tmp_tmpl.push(element); - // }) - // vm_info.USER_TEMPLATE.SCHED_ACTION = tmp_tmpl; - // } - // else - // { - // vm_info.USER_TEMPLATE.SCHED_ACTION.TIME = parseInt(epoch_str.getTime())/1000; - // } -// - // var template_str = convert_template_to_string(vm_info.USER_TEMPLATE); -// - // // Let OpenNebula know - // Sunstone.runAction("VM.update_template",vm_info.ID,template_str); - // $("#add_scheduling_action").removeAttr("disabled"); - //}); - return str; } @@ -2020,10 +1929,8 @@ function setupDateTimePicker(input_to_fill, time_str){ $date_time_picker_dialog = $('#date_time_picker_dialog',dialogs_context); var dialog = $date_time_picker_dialog; - dialog.html( '
\ -

\ - '+tr("Date Time Picker")+'\ -

\ + dialog.html( '
\ +

'+tr("Date Time Picker")+'

\
\
\ \ @@ -2062,31 +1969,9 @@ function updateActionsInfo(request,vm){ // This is a list of disks with the save_as, detach options. // And a form to attach a new disk to the VM, if it is running. function printDisks(vm_info){ - var html ='\ -
\ -
\ - \ -
' - - if (Config.isTabActionEnabled("vms-tab", "VM.attachdisk")) { - // If VM is not RUNNING, then we forget about the attach disk form. - if (vm_info.STATE == "3" && vm_info.LCM_STATE == "3"){ - html += '\ - ' - } else { - html += '\ - ' - } - } - - html += '\ -
\ -
\ -
' - - html += '\ + var html ='\
\ - \ +
\ \ \ \ @@ -2095,6 +1980,20 @@ function printDisks(vm_info){ \ \ \ + \ \ \ '; @@ -2188,8 +2087,9 @@ function printDisks(vm_info){ } html += '\ - \ -
'+tr("ID")+''+tr("Persistent")+''+tr("Save as")+''+tr("Actions")+''; + + if (Config.isTabActionEnabled("vms-tab", "VM.attachdisk")) { + // If VM is not RUNNING, then we forget about the attach disk form. + if (vm_info.STATE == "3" && vm_info.LCM_STATE == "3"){ + html += '\ + ' + } else { + html += '\ + ' + } + } + + html += '
\ + \ + \ +
\
\ '; @@ -2662,25 +2562,7 @@ function setup_vm_network_tab(){ function printCapacity(vm_info){ var html ='\ -
\ -
\ -
\ -
' - - if (Config.isTabActionEnabled("vms-tab", "VM.resize")) { - // If VM is not INIT, PENDING, HOLD, FAILED, POWEROFF, UNDEPLOYED, then we forget about the resize form. - if (vm_info.STATE == "0" || vm_info.STATE == "1" || vm_info.STATE == "2" || vm_info.STATE == "7" || vm_info.STATE == "8" || vm_info.STATE == "9"){ - html += '\ - ' - } else { - html += '\ - ' - } - } - - html += '
\ -
\ -
' + ' html += '\
\ @@ -2691,6 +2573,7 @@ function printCapacity(vm_info){ '+tr("CPU")+'\ '+tr("VCPU")+'\ '+tr("MEMORY")+'\ + \ \ \ \ @@ -2698,14 +2581,28 @@ function printCapacity(vm_info){ ' + vm_info.TEMPLATE.CPU + '\ ' + (vm_info.TEMPLATE.VCPU ? vm_info.TEMPLATE.VCPU : '-') + '\ ' + humanize_size_from_mb(vm_info.TEMPLATE.MEMORY) + '\ - \ + '; + + if (Config.isTabActionEnabled("vms-tab", "VM.resize")) { + // If VM is not INIT, PENDING, HOLD, FAILED, POWEROFF, UNDEPLOYED, then we forget about the resize form. + if (vm_info.STATE == "0" || vm_info.STATE == "1" || vm_info.STATE == "2" || vm_info.STATE == "7" || vm_info.STATE == "8" || vm_info.STATE == "9"){ + html += '\ + ' + } else { + html += '\ + ' + } + } + + html += '\ + \ \ \
\
\
\
\ -
\ +
\
\

'+tr("REAL CPU")+'

\
\ @@ -2722,7 +2619,7 @@ function printCapacity(vm_info){
\
\
\ -
\ +
\

'+tr("REAL MEMORY")+'

\
\
\ @@ -3567,9 +3464,8 @@ function setupVNC(){ var dialog = $vnc_dialog; dialog.html('\ -
\ -

\ - '+tr("VNC")+' \ +
\ +

'+tr("VNC")+' \ '+tr("Loading")+'\ \ \ @@ -3577,7 +3473,6 @@ function setupVNC(){ \ \ \ - \

\
\
\ @@ -3632,9 +3527,10 @@ function vncCallback(request,response){ $("#open_in_a_new_window").attr('href', url) rfb.connect(proxy_host, proxy_port, pw, path); - $vnc_dialog.reveal({"closed": function () { + $vnc_dialog.foundation("reveal", "open"); + $vnc_dialog.on("closed", function () { rfb.disconnect(); - }}); + }); } function vncIcon(vm){ diff --git a/src/sunstone/public/js/sunstone.js b/src/sunstone/public/js/sunstone.js index 770899a943..c6d2bb4ac4 100644 --- a/src/sunstone/public/js/sunstone.js +++ b/src/sunstone/public/js/sunstone.js @@ -128,14 +128,14 @@ var Sunstone = { var active_tab_href = active_tab.attr('href'); } - var dl_tabs = $('
\ -
\ + var dl_tabs = $('
\ +
\
\
\
\
\
\ -
\ +
\
\
');