From fa2edd70da439e7a2fc4406f3e51b354477af1c0 Mon Sep 17 00:00:00 2001 From: Hector Sanjuan Date: Thu, 21 Jul 2011 15:26:35 +0200 Subject: [PATCH] Feature #578: Allow creating multiple VMs at once. --- src/sunstone/public/js/plugins/vms-tab.js | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/src/sunstone/public/js/plugins/vms-tab.js b/src/sunstone/public/js/plugins/vms-tab.js index 76592e1fff..bff69b1a60 100644 --- a/src/sunstone/public/js/plugins/vms-tab.js +++ b/src/sunstone/public/js/plugins/vms-tab.js @@ -77,9 +77,11 @@ var create_vm_tmpl ='
\
\ \
\ - \ - \ + \ +
\ + \ + \
\ \
\ @@ -767,8 +769,21 @@ function setupCreateVMDialog(){ $('#create_vm_dialog #create_vm_proceed').click(function(){ var vm_name = $('#create_vm_form #vm_name').val(); var template_id = $('#create_vm_form #template_id').val(); + var n_times = $('#create_vm_form #vm_n_times').val(); + var n_times_int=1; + if (n_times.length){ + n_times_int=parseInt(n_times,10); + } - Sunstone.runAction("VM.create",template_id,vm_name); + if (n_times_int>1){ + for (var i=0; i< n_times_int; i++){ + Sunstone.runAction("Template.instantiate",template_id,vm_name+"_"+i); + }; + } else { + Sunstone.runAction("Template.instantiate",template_id,vm_name); + }; + + Sunstone.runAction("VM.list"); $('#create_vm_dialog').dialog('close'); return false; });