From 650301fc9400fb96ce7d154d4796b6727433ac0d Mon Sep 17 00:00:00 2001 From: bfederle Date: Thu, 22 Dec 2011 12:27:49 -0800 Subject: [PATCH] Fix createForm actions for template section --- ui/scripts/templates.js | 41 +++++++++++++++++++++-------------------- 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/ui/scripts/templates.js b/ui/scripts/templates.js index ad5311d8ea5..a3e4ef23d29 100644 --- a/ui/scripts/templates.js +++ b/ui/scripts/templates.js @@ -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);