You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@deltacloud.apache.org by mf...@redhat.com on 2010/08/24 16:04:32 UTC

[PATCH core 3/4] Added JQuery code to display select box for keys when creating a new instance

---
 server/public/javascripts/application.js |    9 +++++++++
 server/views/instances/new.html.haml     |    8 +++++++-
 2 files changed, 16 insertions(+), 1 deletions(-)

diff --git a/server/public/javascripts/application.js b/server/public/javascripts/application.js
index 80e1d1c..32d77d7 100644
--- a/server/public/javascripts/application.js
+++ b/server/public/javascripts/application.js
@@ -29,4 +29,13 @@ $(document).ready(function() {
     return false;
   })
 
+  if ($("select[name=keyname]").length) {
+    $.getJSON('/api/keys?format=json', function(data) {
+      $("select[name=keyname]").empty()
+      $.each(data.keys, function(i, key){
+        $("select[name=keyname]").append('<option value="'+key.id+'">'+key.id+'</option>')
+      })
+    })
+  }
+
 })
diff --git a/server/views/instances/new.html.haml b/server/views/instances/new.html.haml
index 6d67c2d..3846886 100644
--- a/server/views/instances/new.html.haml
+++ b/server/views/instances/new.html.haml
@@ -13,7 +13,13 @@
     %p
       %label
         Instance Keyname:
-        %input{:name => 'keyname', :size => 30 }
+        %select{:name => 'keyname'}
+          %option loading...
+  -if driver_has_feature?(:create_multiple_instance)
+    %p
+      %label
+        Number of instances to launch:
+        %input{:name => 'amount', :size => 30, :value => '1' }
   - if !@hardware_profiles.empty?
     %h3 What size machine?
     - for hwp in @hardware_profiles
-- 
1.7.2