CLOUDSTACK-2113:System VM scaleUp UI support
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/6bf67c9f Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/6bf67c9f Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/6bf67c9f Branch: refs/heads/internallb Commit: 6bf67c9f682740f22952a648d13e294cb97879c1 Parents: b633353 Author: Pranav Saxena <pranav.sax...@citrix.com> Authored: Mon Apr 29 16:21:49 2013 +0530 Committer: Pranav Saxena <pranav.sax...@citrix.com> Committed: Mon Apr 29 16:21:49 2013 +0530 ---------------------------------------------------------------------- ui/scripts/system.js | 160 ++++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 158 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6bf67c9f/ui/scripts/system.js ---------------------------------------------------------------------- diff --git a/ui/scripts/system.js b/ui/scripts/system.js index 8c962fc..7aa0566 100644 --- a/ui/scripts/system.js +++ b/ui/scripts/system.js @@ -5424,6 +5424,83 @@ poll: pollAsyncJobResult } }, + + scaleUp:{ + label:'scaleUp System VM', + createForm: { + title: 'label.change.service.offering', + desc: '', + fields: { + serviceOfferingId: { + label: 'label.compute.offering', + select: function(args) { + var apiCmd = "listServiceOfferings&issystem=true"; + if(args.context.systemVMs[0].systemvmtype == "secondarystoragevm") + apiCmd += "&systemvmtype=secondarystoragevm"; + else if(args.context.systemVMs[0].systemvmtype == "consoleproxy") + apiCmd += "&systemvmtype=consoleproxy"; + $.ajax({ + url: createURL(apiCmd), + dataType: "json", + async: true, + success: function(json) { + var serviceofferings = json.listserviceofferingsresponse.serviceoffering; + var items = []; + $(serviceofferings).each(function() { + if(this.id != args.context.systemVMs[0].serviceofferingid) { + items.push({id: this.id, description: this.name}); + } + }); + args.response.success({data: items}); + } + }); + } + } + } + }, + + action: function(args) { + $.ajax({ + url: createURL("scaleVirtualMachine&id=" + args.context.systemVMs[0].id + "&serviceofferingid=" + args.data.serviceOfferingId), + dataType: "json", + async: true, + success: function(json) { + var jid = json.scalevirtualmachineresponse.jobid; + args.response.success( + {_custom: + {jobId: jid, + getUpdatedItem: function(json) { + return json.queryasyncjobresultresponse.jobresult.virtualmachine; + }, + getActionFilter: function() { + return vmActionfilter; + } + + } + } + ); + }, + error:function(json){ + args.response.error(parseXMLHttpResponse(json)); + } + + }); + }, + messages: { + confirm: function(args) { + return 'Do you really want to scale up the system VM ?'; + }, + notification: function(args) { + + return 'System VM Scaled Up'; + } + }, + notification: { + poll: pollAsyncJobResult + } + + }, + viewConsole: { label: 'label.view.console', @@ -6658,6 +6735,83 @@ } }, + scaleUp:{ + label:'scaleUp System VM', + createForm: { + title: 'label.change.service.offering', + desc: '', + fields: { + serviceOfferingId: { + label: 'label.compute.offering', + select: function(args) { + var apiCmd = "listServiceOfferings&issystem=true"; + if(args.context.systemVMs[0].systemvmtype == "secondarystoragevm") + apiCmd += "&systemvmtype=secondarystoragevm"; + else if(args.context.systemVMs[0].systemvmtype == "consoleproxy") + apiCmd += "&systemvmtype=consoleproxy"; + $.ajax({ + url: createURL(apiCmd), + dataType: "json", + async: true, + success: function(json) { + var serviceofferings = json.listserviceofferingsresponse.serviceoffering; + var items = []; + $(serviceofferings).each(function() { + if(this.id != args.context.systemVMs[0].serviceofferingid) { + items.push({id: this.id, description: this.name}); + } + }); + args.response.success({data: items}); + } + }); + } + } + } + }, + + action: function(args) { + $.ajax({ + url: createURL("scaleVirtualMachine&id=" + args.context.systemVMs[0].id + "&serviceofferingid=" + args.data.serviceOfferingId), + dataType: "json", + async: true, + success: function(json) { + var jid = json.scalevirtualmachineresponse.jobid; + args.response.success( + {_custom: + {jobId: jid, + getUpdatedItem: function(json) { + return json.queryasyncjobresultresponse.jobresult.virtualmachine; + }, + getActionFilter: function() { + return vmActionfilter; + } + } + } + ); + }, + error:function(json){ + args.response.error(parseXMLHttpResponse(json)); + } + + }); + }, + messages: { + confirm: function(args) { + return 'Do you really want to scale up the system VM ?'; + }, + notification: function(args) { + + return 'System VM Scaled Up'; + } + }, + notification: { + poll: pollAsyncJobResult + } + + }, + + + viewConsole: { label: 'label.view.console', action: { @@ -11687,14 +11841,16 @@ if (jsonObj.state == 'Running') { allowedActions.push("stop"); allowedActions.push("restart"); - allowedActions.push("remove"); + allowedActions.push("remove"); + allowedActions.push("scaleUp"); allowedActions.push("viewConsole"); if (isAdmin()) allowedActions.push("migrate"); } else if (jsonObj.state == 'Stopped') { allowedActions.push("start"); - allowedActions.push("changeService"); + allowedActions.push("scaleUp"); + allowedActions.push("changeService"); allowedActions.push("remove"); } else if (jsonObj.state == 'Error') {