diff --git a/src/sunstone/models/OpenNebulaJSON/VirtualMachineJSON.rb b/src/sunstone/models/OpenNebulaJSON/VirtualMachineJSON.rb index 5fcef2fb4f..6cc98c0404 100644 --- a/src/sunstone/models/OpenNebulaJSON/VirtualMachineJSON.rb +++ b/src/sunstone/models/OpenNebulaJSON/VirtualMachineJSON.rb @@ -64,6 +64,7 @@ module OpenNebulaJSON when "chmod" then self.chmod_octet(action_hash['params']) when "attachdisk" then self.attachdisk(action_hash['params']) when "detachdisk" then self.detachdisk(action_hash['params']) + when "update" then self.update(action_hash['params']) else error_msg = "#{action_hash['perform']} action not " << " available for this resource" @@ -108,5 +109,9 @@ module OpenNebulaJSON def detachdisk(params=Hash.new) super(params['disk_id'].to_i) end + + def update(params=Hash.new) + super(params['template_raw']) + end end end diff --git a/src/sunstone/public/js/opennebula.js b/src/sunstone/public/js/opennebula.js index f65e26bcc3..4da64bd64e 100644 --- a/src/sunstone/public/js/opennebula.js +++ b/src/sunstone/public/js/opennebula.js @@ -713,6 +713,13 @@ var OpenNebula = { "startvnc" : function(params){ OpenNebula.VM.vnc(params,"startvnc"); }, + "update": function(params){ + var action_obj = {"template_raw" : params.data.extra_param }; + OpenNebula.Action.simple_action(params, + OpenNebula.VM.resource, + "update", + action_obj); + }, "monitor" : function(params){ OpenNebula.Action.monitor(params,OpenNebula.VM.resource,false); }, diff --git a/src/sunstone/public/js/plugins/vms-tab.js b/src/sunstone/public/js/plugins/vms-tab.js index bbae7a97f0..64715a6e48 100644 --- a/src/sunstone/public/js/plugins/vms-tab.js +++ b/src/sunstone/public/js/plugins/vms-tab.js @@ -488,7 +488,17 @@ var vm_actions = { hideDialog(); $('div#vms_tab div.legend_div').slideToggle(); } - } + }, + + "VM.update_template" : { // Update template + type: "single", + call: OpenNebula.VM.update, + callback: function(request,response){ + notifyMessage(tr("Template updated correctly")); + Sunstone.runAction('VM.showinfo',request.request.data[0]); + }, + error: onError + }, }; @@ -964,7 +974,7 @@ function updateVMInfo(request,vm){ }; var info_tab = { - title : tr("VM information"), + title : tr("Information"), content: '\ \ @@ -1007,22 +1017,12 @@ function updateVMInfo(request,vm){ \ \ \ - \ - \ - \ - \ - \ - \ - \ - \ - \ - \ - \ - \ - \ - \ -
'+tr("Deploy ID")+''+(typeof(vm_info.DEPLOY_ID) == "object" ? "-" : vm_info.DEPLOY_ID)+'
Permissions
     '+tr("Owner")+''+ownerPermStr(vm_info)+'
     '+tr("Group")+''+groupPermStr(vm_info)+'
     '+tr("Other")+''+otherPermStr(vm_info)+'
\ - \ + \ +
' + insert_extended_template_table(vm_info.USER_TEMPLATE, + "VM", + vm_info.ID) + + insert_permissions_table("VM",vm_info.ID) + + '\ \ \ \
'+tr("Monitoring information")+'