CLOUDSTACK-1065: cloudstack UI - regions menu - implement create region action.
Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/b1a25cf9 Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/b1a25cf9 Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/b1a25cf9 Branch: refs/heads/cisco-vnmc-api-integration Commit: b1a25cf917da1fa427e76f71c1cc19de2c4d55d0 Parents: 1369104 Author: Jessica Wang <[email protected]> Authored: Tue Mar 19 13:14:29 2013 -0700 Committer: Jessica Wang <[email protected]> Committed: Tue Mar 19 13:15:04 2013 -0700 ---------------------------------------------------------------------- ui/scripts/regions.js | 30 +++++++++++++++++++----------- 1 files changed, 19 insertions(+), 11 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/b1a25cf9/ui/scripts/regions.js ---------------------------------------------------------------------- diff --git a/ui/scripts/regions.js b/ui/scripts/regions.js index 42a3e9d..902d3f8 100644 --- a/ui/scripts/regions.js +++ b/ui/scripts/regions.js @@ -55,26 +55,34 @@ fields: { id: { label: 'label.id', validation: { required: true } }, name: { label: 'label.name', validation: { required: true } }, - endpoint: { label: 'label.endpoint', validation: { required: true } }, - userapikey: { label: 'label.api.key' }, - userapisecretkey: { label: 'label.s3.secret_key' } + endpoint: { label: 'label.endpoint', validation: { required: true } } } }, - action: function(args) { + action: function(args) { + var data = { + id: args.data.id, + name: args.data.name, + endpoint: args.data.endpoint + }; + $.ajax({ url: createURL('addRegion'), - data: args.data, - success: function(json) { - var jobID = json.addregionresponse.jobid; - - args.response.success({ _custom: { jobId: jobID }}); - $(window).trigger('cloudStack.refreshRegions'); + data: data, + success: function(json) { + var item = json.addregionresponse.region; + args.response.success({data: item}); + //$(window).trigger('cloudStack.refreshRegions'); }, error: function(json) { args.response.error(parseXMLHttpResponse(json)); } }); - } + }, + notification: { + poll: function(args) { + args.complete(); + } + } } }, dataProvider: function(args) {
