diff --git a/ui/css/cloudstack3.css b/ui/css/cloudstack3.css index 1f862b06656..f233095a6bc 100644 --- a/ui/css/cloudstack3.css +++ b/ui/css/cloudstack3.css @@ -11210,11 +11210,20 @@ div.ui-dialog div.autoscaler div.field-group div.form-container form div.form-it background-position: -168px -31px; } +.reset .icon{ +background-position: -168px -31px; +} + .restoreVM:hover .icon, .restore:hover .icon { background-position: -168px -613px; } + +.reset:hover .icon { + background-position: -168px -613px; +} + .enableVPN .icon { background-position: -198px -3px; } diff --git a/ui/scripts/instances.js b/ui/scripts/instances.js index dc4768b2601..5b5ed1853e7 100644 --- a/ui/scripts/instances.js +++ b/ui/scripts/instances.js @@ -475,6 +475,39 @@ } }, + reset: { + label: 'Reset VM', + messages:{ + confirm:function(args) { + return 'Do you want to restore the VM ?'; + }, + notification:function(args) { + return 'Reset VM'; + } + }, + + action:function(args){ + $.ajax({ + url: createURL("restoreVirtualMachine&virtualmachineid=" + args.context.instances[0].id), + dataType: "json", + async: true, + success: function(json) { + var item = json.restorevmresponse; + args.response.success({data:item}); + } + }); + + }, + + notification: { + poll: function(args) { + args.complete({ data: { state: 'Stopped' }}); + } + } + + }, + + edit: { label: 'label.edit', action: function(args) { @@ -1201,6 +1234,7 @@ allowedActions.push("restart"); allowedActions.push("destroy"); allowedActions.push("changeService"); + allowedActions.push("reset"); if (isAdmin()) allowedActions.push("migrate"); @@ -1222,6 +1256,7 @@ allowedActions.push("edit"); allowedActions.push("start"); allowedActions.push("destroy"); + allowedActions.push("reset"); if(isAdmin()) allowedActions.push("migrateToAnotherStorage");