Fix createForm actions for template section

This commit is contained in:
bfederle 2011-12-22 12:27:49 -08:00
parent 27a552278f
commit 650301fc94
1 changed files with 21 additions and 20 deletions

View File

@ -1,4 +1,4 @@
(function(cloudStack, testData) {
(function(cloudStack, $, testData) {
cloudStack.sections.templates = {
title: 'Templates',
@ -290,18 +290,13 @@
copyTemplate: {
label: 'Copy template',
addRow: 'false',
messages: {
confirm: function(args) {
return 'Are you sure you want to copy template?';
},
success: function(args) {
return 'Template is being copied.';
},
notification: function(args) {
return 'Copying template';
},
complete: function(args) {
return 'Template has been copied.';
}
},
createForm: {
@ -310,6 +305,7 @@
fields: {
destinationZoneId: {
label: 'Destination zone',
validation: { required: true },
select: function(args) {
$.ajax({
url: createURL("listZones&available=true"),
@ -317,12 +313,21 @@
async: true,
success: function(json) {
args.response.success({
data: $.map(json.listzonesresponse.zone, function(zone) {
return {
id: zone.id,
description: zone.name
};
})
data: $.map(
$.grep(
json.listzonesresponse.zone ? json.listzonesresponse.zone : [],
function(zone) {
return zone.id != args.context.templates[0].zoneid;
}
),
function(zone) {
return {
id: zone.id,
description: zone.name
};
}
)
});
}
});
@ -562,6 +567,7 @@
fields: {
destinationZoneId: {
label: 'Destination zone',
validation: { required: true },
select: function(args) {
$.ajax({
url: createURL("listZones&available=true"),
@ -1005,19 +1011,14 @@
confirm: function(args) {
return 'Are you sure you want to copy ISO?';
},
success: function(args) {
return 'ISO is being copied.';
},
notification: function(args) {
return 'Copying ISO';
},
complete: function(args) {
return 'ISO has been copied.';
}
},
createForm: {
title: 'Copy ISO',
desc: '',
addRow: 'false',
fields: {
destinationZoneId: {
label: 'Destination zone',
@ -1629,4 +1630,4 @@
return allowedActions;
}
})(cloudStack, testData);
})(cloudStack, jQuery, testData);