From eb9973d344df4b279530de4e62c52f2a9930939a Mon Sep 17 00:00:00 2001 From: Jessica Wang Date: Tue, 20 Dec 2011 18:50:07 -0800 Subject: [PATCH] cloudStack 3.0 - extract template, extract ISO - zoneId is no longer required. --- .../com/cloud/api/commands/ExtractIsoCmd.java | 2 +- .../api/commands/ExtractTemplateCmd.java | 2 +- ui/scripts/templates.js | 28 +++++++++++++++---- 3 files changed, 24 insertions(+), 8 deletions(-) diff --git a/api/src/com/cloud/api/commands/ExtractIsoCmd.java b/api/src/com/cloud/api/commands/ExtractIsoCmd.java index 94c64e9d847..53ef27ceeb0 100755 --- a/api/src/com/cloud/api/commands/ExtractIsoCmd.java +++ b/api/src/com/cloud/api/commands/ExtractIsoCmd.java @@ -52,7 +52,7 @@ public class ExtractIsoCmd extends BaseAsyncCmd { private String url; @IdentityMapper(entityTableName="data_center") - @Parameter(name=ApiConstants.ZONE_ID, type=CommandType.LONG, required=true, description="the ID of the zone where the ISO is originally located") + @Parameter(name=ApiConstants.ZONE_ID, type=CommandType.LONG, required=false, description="the ID of the zone where the ISO is originally located") private Long zoneId; @Parameter(name=ApiConstants.MODE, type=CommandType.STRING, required=true, description="the mode of extraction - HTTP_DOWNLOAD or FTP_UPLOAD") diff --git a/api/src/com/cloud/api/commands/ExtractTemplateCmd.java b/api/src/com/cloud/api/commands/ExtractTemplateCmd.java index 391cbd77778..80f4bfcc1ab 100755 --- a/api/src/com/cloud/api/commands/ExtractTemplateCmd.java +++ b/api/src/com/cloud/api/commands/ExtractTemplateCmd.java @@ -52,7 +52,7 @@ public class ExtractTemplateCmd extends BaseAsyncCmd { private String url; @IdentityMapper(entityTableName="data_center") - @Parameter(name=ApiConstants.ZONE_ID, type=CommandType.LONG, required=true, description="the ID of the zone where the ISO is originally located" ) + @Parameter(name=ApiConstants.ZONE_ID, type=CommandType.LONG, required=false, description="the ID of the zone where the ISO is originally located" ) private Long zoneId; @Parameter(name=ApiConstants.MODE, type=CommandType.STRING, required=true, description="the mode of extraction - HTTP_DOWNLOAD or FTP_UPLOAD") diff --git a/ui/scripts/templates.js b/ui/scripts/templates.js index f91305f1931..8711eca3d54 100644 --- a/ui/scripts/templates.js +++ b/ui/scripts/templates.js @@ -376,8 +376,12 @@ } }, action: function(args) { + var apiCmd = "extractTemplate&mode=HTTP_DOWNLOAD&id=" + args.context.templates[0].id; + if(args.context.templates[0].zoneid != null) + apiCmd += "&zoneid=" + args.context.templates[0].zoneid; + $.ajax({ - url: createURL("extractTemplate&id=" + args.context.templates[0].id + "&zoneid=" + args.context.templates[0].zoneid + "&mode=HTTP_DOWNLOAD"), + url: createURL(apiCmd), dataType: "json", async: true, success: function(json) { @@ -622,9 +626,13 @@ return htmlMsg2; } }, - action: function(args) { + action: function(args) { + var apiCmd = "extractTemplate&mode=HTTP_DOWNLOAD&id=" + args.context.templates[0].id; + if(args.context.templates[0].zoneid != null) + apiCmd += "&zoneid=" + args.context.templates[0].zoneid; + $.ajax({ - url: createURL("extractTemplate&id=" + args.context.templates[0].id + "&zoneid=" + args.context.templates[0].zoneid + "&mode=HTTP_DOWNLOAD"), + url: createURL(apiCmd), dataType: "json", async: true, success: function(json) { @@ -1065,8 +1073,12 @@ } }, action: function(args) { + var apiCmd = "extractIso&mode=HTTP_DOWNLOAD&id=" + args.context.isos[0].id; + if(args.context.isos[0].zoneid != null) + apiCmd += "&zoneid=" + args.context.isos[0].zoneid; + $.ajax({ - url: createURL("extractIso&id=" + args.context.isos[0].id + "&zoneid=" + args.context.isos[0].zoneid + "&mode=HTTP_DOWNLOAD"), + url: createURL(apiCmd), dataType: "json", async: true, success: function(json) { @@ -1311,9 +1323,13 @@ return htmlMsg2; } }, - action: function(args) { + action: function(args) { + var apiCmd = "extractIso&mode=HTTP_DOWNLOAD&id=" + args.context.isos[0].id; + if(args.context.isos[0].zoneid != null) + apiCmd += "&zoneid=" + args.context.isos[0].zoneid; + $.ajax({ - url: createURL("extractIso&id=" + args.context.isos[0].id + "&zoneid=" + args.context.isos[0].zoneid + "&mode=HTTP_DOWNLOAD"), + url: createURL(apiCmd), dataType: "json", async: true, success: function(json) {