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 2011/08/16 11:13:54 UTC
[PATCH core] Show images list when no image_id is given on new instance page
From: Michal Fojtik <mf...@redhat.com>
Signed-off-by: Michal fojtik <mf...@redhat.com>
---
server/server.rb | 4 ++--
server/views/instances/index.html.haml | 4 +++-
server/views/instances/new.html.haml | 13 ++++++++++---
3 files changed, 15 insertions(+), 6 deletions(-)
diff --git a/server/server.rb b/server/server.rb
index 2355278..5f31391 100644
--- a/server/server.rb
+++ b/server/server.rb
@@ -393,8 +393,8 @@ END
end
control do
@instance = Instance.new( { :id=>params[:id], :image_id=>params[:image_id] } )
- @image = Image.new( :id => params[:image_id] )
- @hardware_profiles = driver.hardware_profiles(credentials, :architecture => @image.architecture )
+ @images = driver.images(credentials) unless params[:image_id]
+ @hardware_profiles = driver.hardware_profiles(credentials)
@realms = [Realm.new(:id => params[:realm_id])] if params[:realm_id]
@realms ||= driver.realms(credentials)
@keys = driver.keys(credentials) if driver_has_feature?(:authentication_key)
diff --git a/server/views/instances/index.html.haml b/server/views/instances/index.html.haml
index faf0d41..9b371ed 100644
--- a/server/views/instances/index.html.haml
+++ b/server/views/instances/index.html.haml
@@ -1,4 +1,6 @@
-=header "Instances"
+=header "Instances" do
+ %a{ :href => new_instance_url, :'data-icon' => :plus, :'data-role' => :button, :class => 'ui-btn-right', :'data-ajax' => "false" } Create new instance
+
=subheader "#{Thread::current[:provider] || ENV['API_PROVIDER'] || 'default'}"
%div{ :'data-role' => :content, :'data-theme' => 'c'}
diff --git a/server/views/instances/new.html.haml b/server/views/instances/new.html.haml
index 3b1b667..af7f17f 100644
--- a/server/views/instances/new.html.haml
+++ b/server/views/instances/new.html.haml
@@ -1,9 +1,16 @@
=header "Launch new instance"
-=subheader @image.description
%div{ :'data-role' => :content, :'data-theme' => 'c', :class => 'middle-dialog'}
%form{ :action => instances_url, :method => :post, :class => :new_instance }
- %input{ :name => :image_id, :type => :hidden, :value => @instance.image_id }/
+ - if params[:image_id]
+ %input{ :name => :image_id, :type => :hidden, :value => @instance.image_id }/
+ - else
+ %div{ 'data-role' => :fieldcontain }
+ %label{ :for => :image, :class => 'ui-input-text' } Image:
+ %select{:name => 'image_id', :'data-native-menu' => "true", :'data-native-menu' => "false" }
+ %option{ :'data-placeholder' => 'true', :value => '' } Choose image
+ - @images.each do |image|
+ %option{ :value => image.id } #{image.name}
%div{ 'data-role' => :fieldcontain }
%label{ :for => :name} Instance name:
@@ -61,7 +68,7 @@
%label{ :for => profile.name}=profile.name
- profile.properties.reject { |prop| prop.fixed? }.each do |prop|
%div{ :'data-role' => :fieldcontain}
- %label{ :for => "#{prop.param}_#{profile.name}" }=prop.name
+ %label{ :for => "#{prop.param}_#{profile.name}", :class => 'ui-input-text' }=prop.name.to_s.capitalize+":"
%span.radio-group-details
- if prop.kind == :enum
%select{ :size => 1, :name => prop.param }
--
1.7.4.1