mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
CS-16573: cloudstack UI - register template - encode data passed to API call.
This commit is contained in:
parent
8e2ebb26a8
commit
8fff59eb76
@ -286,34 +286,51 @@
|
|||||||
},
|
},
|
||||||
|
|
||||||
action: function(args) {
|
action: function(args) {
|
||||||
var array1 = [];
|
var data = {
|
||||||
array1.push("&name=" + todb(args.data.name));
|
name: args.data.name,
|
||||||
array1.push("&displayText=" + todb(args.data.description));
|
displayText: args.data.description,
|
||||||
array1.push("&url=" + todb(args.data.url));
|
url: args.data.url,
|
||||||
array1.push("&zoneid=" + args.data.zone);
|
zoneid: args.data.zone,
|
||||||
array1.push("&format=" + args.data.format);
|
format: args.data.format,
|
||||||
array1.push("&isextractable=" + (args.data.isExtractable=="on"));
|
isextractable: (args.data.isExtractable=="on"),
|
||||||
array1.push("&passwordEnabled=" + (args.data.isPasswordEnabled=="on"));
|
passwordEnabled: (args.data.isPasswordEnabled=="on"),
|
||||||
array1.push("&osTypeId=" + args.data.osTypeId);
|
osTypeId: args.data.osTypeId,
|
||||||
array1.push("&hypervisor=" + args.data.hypervisor);
|
hypervisor: args.data.hypervisor
|
||||||
|
};
|
||||||
|
|
||||||
if(args.$form.find('.form-item[rel=isPublic]').css("display") != "none")
|
if(args.$form.find('.form-item[rel=isPublic]').css("display") != "none") {
|
||||||
array1.push("&ispublic=" + (args.data.isPublic == "on"));
|
$.extend(data, {
|
||||||
if(args.$form.find('.form-item[rel=isFeatured]').css("display") != "none")
|
ispublic: (args.data.isPublic == "on")
|
||||||
array1.push("&isfeatured=" + (args.data.isFeatured == "on"));
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if(args.$form.find('.form-item[rel=isFeatured]').css("display") != "none") {
|
||||||
|
$.extend(data, {
|
||||||
|
isfeatured: (args.data.isFeatured == "on")
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
//VMware only (starts here)
|
//VMware only (starts here)
|
||||||
if(args.$form.find('.form-item[rel=rootDiskControllerType]').css("display") != "none" && args.data.rootDiskControllerType != "")
|
if(args.$form.find('.form-item[rel=rootDiskControllerType]').css("display") != "none" && args.data.rootDiskControllerType != "") {
|
||||||
array1.push("&details[0].rootDiskController=" + args.data.rootDiskControllerType);
|
$.extend(data, {
|
||||||
if(args.$form.find('.form-item[rel=nicAdapterType]').css("display") != "none" && args.data.nicAdapterType != "")
|
'details[0].rootDiskController': args.data.rootDiskControllerType
|
||||||
array1.push("&details[0].nicAdapter=" + args.data.nicAdapterType);
|
});
|
||||||
if(args.$form.find('.form-item[rel=keyboardType]').css("display") != "none" && args.data.keyboardType != "")
|
}
|
||||||
array1.push("&details[0].keyboard=" + args.data.keyboardType);
|
if(args.$form.find('.form-item[rel=nicAdapterType]').css("display") != "none" && args.data.nicAdapterType != "") {
|
||||||
|
$.extend(data, {
|
||||||
|
'details[0].nicAdapter': args.data.nicAdapterType
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if(args.$form.find('.form-item[rel=keyboardType]').css("display") != "none" && args.data.keyboardType != "") {
|
||||||
|
$.extend(data, {
|
||||||
|
'details[0].keyboard': args.data.keyboardType
|
||||||
|
});
|
||||||
|
}
|
||||||
//VMware only (ends here)
|
//VMware only (ends here)
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: createURL("registerTemplate" + array1.join("")),
|
url: createURL('registerTemplate'),
|
||||||
dataType: "json",
|
data: data,
|
||||||
success: function(json) {
|
success: function(json) {
|
||||||
var items = json.registertemplateresponse.template; //items might have more than one array element if it's create templates for all zones.
|
var items = json.registertemplateresponse.template; //items might have more than one array element if it's create templates for all zones.
|
||||||
args.response.success({data:items[0]});
|
args.response.success({data:items[0]});
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user