|
3698 | 3698 | poll: pollAsyncJobResult |
3699 | 3699 | } |
3700 | 3700 | }, |
3701 | | - |
| 3701 | + |
| 3702 | + changeService: { |
| 3703 | + label: 'label.change.service.offering', |
| 3704 | + createForm: { |
| 3705 | + title: 'label.change.service.offering', |
| 3706 | + desc: '', |
| 3707 | + fields: { |
| 3708 | + serviceOfferingId: { |
| 3709 | + label: 'label.compute.offering', |
| 3710 | + select: function(args) { |
| 3711 | + var apiCmd = "listServiceOfferings&issystem=true"; |
| 3712 | + if(args.context.systemVMs[0].systemvmtype == "secondarystoragevm") |
| 3713 | + apiCmd += "&systemvmtype=secondarystoragevm"; |
| 3714 | + else if(args.context.systemVMs[0].systemvmtype == "consoleproxy") |
| 3715 | + apiCmd += "&systemvmtype=consoleproxy"; |
| 3716 | + $.ajax({ |
| 3717 | + url: createURL(apiCmd), |
| 3718 | + dataType: "json", |
| 3719 | + async: true, |
| 3720 | + success: function(json) { |
| 3721 | + var serviceofferings = json.listserviceofferingsresponse.serviceoffering; |
| 3722 | + var items = []; |
| 3723 | + $(serviceofferings).each(function() { |
| 3724 | + if(this.id != args.context.systemVMs[0].serviceofferingid) { |
| 3725 | + items.push({id: this.id, description: this.displaytext}); |
| 3726 | + } |
| 3727 | + }); |
| 3728 | + args.response.success({data: items}); |
| 3729 | + } |
| 3730 | + }); |
| 3731 | + } |
| 3732 | + } |
| 3733 | + } |
| 3734 | + }, |
| 3735 | + messages: { |
| 3736 | + notification: function(args) { |
| 3737 | + return 'label.change.service.offering'; |
| 3738 | + } |
| 3739 | + }, |
| 3740 | + action: function(args) { |
| 3741 | + $.ajax({ |
| 3742 | + url: createURL("changeServiceForSystemVm&id=" + args.context.systemVMs[0].id + "&serviceofferingid=" + args.data.serviceOfferingId), |
| 3743 | + dataType: "json", |
| 3744 | + async: true, |
| 3745 | + success: function(json) { |
| 3746 | + var jsonObj = json.changeserviceforsystemvmresponse.systemvm; |
| 3747 | + args.response.success({data: jsonObj}); |
| 3748 | + }, |
| 3749 | + error: function(XMLHttpResponse) { |
| 3750 | + var errorMsg = parseXMLHttpResponse(XMLHttpResponse); |
| 3751 | + args.response.error(errorMsg); |
| 3752 | + } |
| 3753 | + }); |
| 3754 | + }, |
| 3755 | + notification: { |
| 3756 | + poll: function(args) { |
| 3757 | + args.complete(); |
| 3758 | + } |
| 3759 | + } |
| 3760 | + }, |
| 3761 | + |
3702 | 3762 | remove: { |
3703 | 3763 | label: 'label.action.destroy.systemvm', |
3704 | 3764 | messages: { |
|
7448 | 7508 | if (jsonObj.state == 'Running') { |
7449 | 7509 | allowedActions.push("stop"); |
7450 | 7510 | allowedActions.push("restart"); |
7451 | | - allowedActions.push("remove"); |
| 7511 | + allowedActions.push("remove"); |
7452 | 7512 | allowedActions.push("viewConsole"); |
7453 | 7513 | if (isAdmin()) |
7454 | 7514 | allowedActions.push("migrate"); |
7455 | 7515 | } |
7456 | 7516 | else if (jsonObj.state == 'Stopped') { |
7457 | 7517 | allowedActions.push("start"); |
| 7518 | + allowedActions.push("changeService"); |
7458 | 7519 | allowedActions.push("remove"); |
7459 | 7520 | } |
7460 | 7521 | else if (jsonObj.state == 'Error') { |
|
0 commit comments