diff --git a/ui/scripts/system.js b/ui/scripts/system.js index 8acc751c680..1cfa1c84b0f 100644 --- a/ui/scripts/system.js +++ b/ui/scripts/system.js @@ -1444,267 +1444,7 @@ 'Error': 'off' } } - }, - actions: { - start: { - label: 'Start router', - messages: { - confirm: function(args) { - return 'Are you sure you want to start router?'; - }, - notification: function(args) { - return 'Starting router'; - } - }, - action: function(args) { - $.ajax({ - url: createURL('startRouter&id=' + args.context.routers[0].id), - dataType: 'json', - async: true, - success: function(json) { - var jid = json.startrouterresponse.jobid; - args.response.success({ - _custom: { - jobId: jid, - getUpdatedItem: function(json) { - return json.queryasyncjobresultresponse.jobresult.domainrouter; - }, - getActionFilter: function() { - return routerActionfilter; - } - } - }); - } - }); - }, - notification: { - poll: pollAsyncJobResult - } - }, - - stop: { - label: 'Stop router', - messages: { - confirm: function(args) { - return 'Are you sure you want to stop router?'; - }, - notification: function(args) { - return 'Stopping router'; - } - }, - action: function(args) { - $.ajax({ - url: createURL('stopRouter&id=' + args.context.routers[0].id), - dataType: 'json', - async: true, - success: function(json) { - var jid = json.stoprouterresponse.jobid; - args.response.success({ - _custom: { - jobId: jid, - getUpdatedItem: function(json) { - return json.queryasyncjobresultresponse.jobresult.domainrouter; - }, - getActionFilter: function() { - return routerActionfilter; - } - } - }); - } - }); - }, - notification: { - poll: pollAsyncJobResult - } - }, - - restart: { - label: 'reboot router', - messages: { - confirm: function(args) { - return 'Are you sure you want to reboot router?'; - }, - notification: function(args) { - return 'rebooting router'; - } - }, - action: function(args) { - $.ajax({ - url: createURL('rebootRouter&id=' + args.context.routers[0].id), - dataType: 'json', - async: true, - success: function(json) { - var jid = json.rebootrouterresponse.jobid; - args.response.success({ - _custom: { - jobId: jid, - getUpdatedItem: function(json) { - return json.queryasyncjobresultresponse.jobresult.domainrouter; - }, - getActionFilter: function() { - return routerActionfilter; - } - } - }); - } - }); - }, - notification: { - poll: pollAsyncJobResult - } - }, - - changeService: { - label: 'Change service offering', - messages: { - confirm: function(args) { - return 'Are you sure you want to change service offering?'; - }, - success: function(args) { - return 'Service offering is being changed.'; - }, - notification: function(args) { - return 'Changing service offering'; - }, - complete: function(args) { - return 'Service offering has been changed.'; - } - }, - createForm: { - title: 'Change Service Offering', - desc: '', - fields: { - serviceOfferingId: { - label: 'Service offering', - select: function(args) { - $.ajax({ - url: createURL("listServiceOfferings&issystem=true&systemvmtype=domainrouter"), - dataType: "json", - async: true, - success: function(json) { - var serviceofferings = json.listserviceofferingsresponse.serviceoffering; - var items = []; - $(serviceofferings).each(function() { - if(this.id != args.context.routers[0].serviceofferingid) { - items.push({id: this.id, description: this.displaytext}); - } - }); - args.response.success({data: items}); - } - }); - } - } - } - }, - action: function(args) { - $.ajax({ - url: createURL("changeServiceForRouter&id=" + args.context.routers[0].id + "&serviceofferingid=" + args.data.serviceOfferingId), - dataType: "json", - async: true, - success: function(json) { - var jsonObj = json.changeserviceforrouterresponse.domainrouter; - args.response.success({data: jsonObj}); - }, - error: function(XMLHttpResponse) { - var errorMsg = parseXMLHttpResponse(XMLHttpResponse); - args.response.error(errorMsg); - } - }); - }, - notification: { - poll: function(args) { - args.complete(); - } - } - }, - - migrate: { - label: 'Migrate router', - messages: { - confirm: function(args) { - return 'Are you sure you want to migrate router?'; - }, - success: function(args) { - return 'Router is being migrated.'; - }, - notification: function(args) { - return 'Migrating router'; - }, - complete: function(args) { - return 'Router has been migrated.'; - } - }, - createForm: { - title: 'Migrate router', - desc: '', - fields: { - hostId: { - label: 'Host', - validation: { required: true }, - select: function(args) { - $.ajax({ - url: createURL("listHosts&VirtualMachineId=" + args.context.routers[0].id), - //url: createURL("listHosts"), //for testing only, comment it out before checking in. - dataType: "json", - async: true, - success: function(json) { - var hostObjs = json.listhostsresponse.host; - var items = []; - $(hostObjs).each(function() { - items.push({id: this.id, description: (this.name + ": " +(this.hasEnoughCapacity? "Available" : "Full"))}); - }); - args.response.success({data: items}); - } - }); - }, - error: function(XMLHttpResponse) { - var errorMsg = parseXMLHttpResponse(XMLHttpResponse); - args.response.error(errorMsg); - } - } - } - }, - action: function(args) { - if(args.data.hostId == null) { - args.response.error("Host field is required"); - return; - } - $.ajax({ - url: createURL("migrateSystemVm&hostid=" + args.data.hostId + "&virtualmachineid=" + args.context.routers[0].id), - dataType: "json", - async: true, - success: function(json) { - var jid = json.migratesystemvmresponse.jobid; - args.response.success({ - _custom: { - jobId: jid, - getUpdatedItem: function(json) { - //return json.queryasyncjobresultresponse.jobresult.systemvminstance; //not all properties returned in systemvminstance - $.ajax({ - url: createURL("listRouters&id=" + json.queryasyncjobresultresponse.jobresult.systemvminstance.id), - dataType: "json", - async: false, - success: function(json) { - var items = json.listroutersresponse.router; - if(items != null && items.length > 0) { - return items[0]; - } - } - }); - }, - getActionFilter: function() { - return routerActionfilter; - } - } - }); - } - }); - }, - notification: { - poll: pollAsyncJobResult - } - } - }, + }, dataProvider: function(args) { $.ajax({ url: createURL("listRouters&zoneid=" + selectedZoneObj.id + "&page=" + args.page + "&pagesize=" + pageSize), @@ -1804,22 +1544,17 @@ return 'rebooting router'; } }, - action: function(args) { + action: function(args) { $.ajax({ - url: createURL('rebootRouter&id=' + args.context.routers[0].id), + url: createURL('restartNetwork&id=' + args.context.routers[0].guestnetworkid), + //url: createURL('rebootRouter&id=' + args.context.routers[0].id), dataType: 'json', async: true, success: function(json) { - var jid = json.rebootrouterresponse.jobid; + var jid = json.restartnetworkresponse.jobid; args.response.success({ _custom: { - jobId: jid, - getUpdatedItem: function(json) { - return json.queryasyncjobresultresponse.jobresult.domainrouter; - }, - getActionFilter: function() { - return routerActionfilter; - } + jobId: jid } }); }