From c1101eb695e4d1ea201ccd884a3acceb2539b201 Mon Sep 17 00:00:00 2001 From: Jessica Wang Date: Mon, 30 Dec 2013 14:51:35 -0800 Subject: [PATCH] CLOUDSTACK-5606: UI > copy template, copy ISO action > when a template/ISO to be copied is not associated with a specific zone, UI does not pass sourcezoneid parameter to API. --- ui/scripts/templates.js | 38 ++++++++++++++++++++++++++++---------- 1 file changed, 28 insertions(+), 10 deletions(-) diff --git a/ui/scripts/templates.js b/ui/scripts/templates.js index 0f8f1155252..8c63ce2b678 100644 --- a/ui/scripts/templates.js +++ b/ui/scripts/templates.js @@ -795,11 +795,20 @@ } } }, - action: function(args) { - $.ajax({ - url: createURL("copyTemplate&id=" + args.context.templates[0].id + "&sourcezoneid=" + args.context.templates[0].zoneid + "&destzoneid=" + args.data.destinationZoneId), - dataType: "json", - async: true, + action: function(args) { + var data = { + id: args.context.templates[0].id, + destzoneid: args.data.destinationZoneId + }; + if (args.context.templates[0].zoneid != undefined) { + $.extend(data, { + sourcezoneid: args.context.templates[0].zoneid + }); + } + + $.ajax({ + url: createURL('copyTemplate'), + data: data, success: function(json) { var jid = json.copytemplateresponse.jobid; args.response.success({ @@ -1557,11 +1566,20 @@ } } }, - action: function(args) { - $.ajax({ - url: createURL("copyIso&id=" + args.context.isos[0].id + "&sourcezoneid=" + args.context.isos[0].zoneid + "&destzoneid=" + args.data.destinationZoneId), - dataType: "json", - async: true, + action: function(args) { + var data = { + id: args.context.isos[0].id, + destzoneid: args.data.destinationZoneId + }; + if (args.context.isos[0].zoneid != undefined) { + $.extend(data, { + sourcezoneid: args.context.isos[0].zoneid + }); + } + + $.ajax({ + url: createURL('copyIso'), + data: data, success: function(json) { var jid = json.copytemplateresponse.jobid; args.response.success({