Skip to content

Commit 30dd34d

Browse files
committed
CLOUDSTACK-588:restoreVirtualMachine api functionality on the UI while the VMs are in running or stopped state
1 parent 40682fc commit 30dd34d

2 files changed

Lines changed: 44 additions & 0 deletions

File tree

ui/css/cloudstack3.css

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11210,11 +11210,20 @@ div.ui-dialog div.autoscaler div.field-group div.form-container form div.form-it
1121011210
background-position: -168px -31px;
1121111211
}
1121211212

11213+
.reset .icon{
11214+
background-position: -168px -31px;
11215+
}
11216+
1121311217
.restoreVM:hover .icon,
1121411218
.restore:hover .icon {
1121511219
background-position: -168px -613px;
1121611220
}
1121711221

11222+
11223+
.reset:hover .icon {
11224+
background-position: -168px -613px;
11225+
}
11226+
1121811227
.enableVPN .icon {
1121911228
background-position: -198px -3px;
1122011229
}

ui/scripts/instances.js

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -475,6 +475,39 @@
475475
}
476476
},
477477

478+
reset: {
479+
label: 'Reset VM',
480+
messages:{
481+
confirm:function(args) {
482+
return 'Do you want to restore the VM ?';
483+
},
484+
notification:function(args) {
485+
return 'Reset VM';
486+
}
487+
},
488+
489+
action:function(args){
490+
$.ajax({
491+
url: createURL("restoreVirtualMachine&virtualmachineid=" + args.context.instances[0].id),
492+
dataType: "json",
493+
async: true,
494+
success: function(json) {
495+
var item = json.restorevmresponse;
496+
args.response.success({data:item});
497+
}
498+
});
499+
500+
},
501+
502+
notification: {
503+
poll: function(args) {
504+
args.complete({ data: { state: 'Stopped' }});
505+
}
506+
}
507+
508+
},
509+
510+
478511
edit: {
479512
label: 'label.edit',
480513
action: function(args) {
@@ -1201,6 +1234,7 @@
12011234
allowedActions.push("restart");
12021235
allowedActions.push("destroy");
12031236
allowedActions.push("changeService");
1237+
allowedActions.push("reset");
12041238

12051239
if (isAdmin())
12061240
allowedActions.push("migrate");
@@ -1222,6 +1256,7 @@
12221256
allowedActions.push("edit");
12231257
allowedActions.push("start");
12241258
allowedActions.push("destroy");
1259+
allowedActions.push("reset");
12251260

12261261
if(isAdmin())
12271262
allowedActions.push("migrateToAnotherStorage");

0 commit comments

Comments
 (0)