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/01/19 15:14:54 UTC

[PATCH core 2/2] Minor UI fixes in launch instance form

From: Michal Fojtik <mf...@redhat.com>

---
 server/lib/deltacloud/models/instance.rb           |   12 ++++++++
 server/lib/deltacloud/models/instance_profile.rb   |    4 ++
 server/public/stylesheets/compiled/application.css |   30 ++++++++++++++++++++
 server/server.rb                                   |    1 +
 server/views/images/index.html.haml                |    3 +-
 server/views/instances/index.html.haml             |    4 +-
 6 files changed, 50 insertions(+), 4 deletions(-)

diff --git a/server/lib/deltacloud/models/instance.rb b/server/lib/deltacloud/models/instance.rb
index 3c052b9..467d93f 100644
--- a/server/lib/deltacloud/models/instance.rb
+++ b/server/lib/deltacloud/models/instance.rb
@@ -31,6 +31,18 @@ class Instance < BaseModel
   attr_accessor :keyname
   attr_accessor :authn_error
 
+  def to_s
+    name
+  end
+
+  def hardware_profile
+    instance_profile
+  end
+
+  def hardware_profile=(profile)
+    instance_profile = profile
+  end
+
   def initialize(init=nil)
     super(init)
     self.actions = [] if self.actions.nil?
diff --git a/server/lib/deltacloud/models/instance_profile.rb b/server/lib/deltacloud/models/instance_profile.rb
index 4e0ce74..ac6081e 100644
--- a/server/lib/deltacloud/models/instance_profile.rb
+++ b/server/lib/deltacloud/models/instance_profile.rb
@@ -38,6 +38,10 @@ class InstanceProfile < BaseModel
     id
   end
 
+  def to_s
+    name
+  end
+
   def overrides
     [:memory, :storage, :architecture, :cpu].inject({}) do |h, p|
       if v = instance_variable_get("@#{p}")
diff --git a/server/public/stylesheets/compiled/application.css b/server/public/stylesheets/compiled/application.css
index dd8e763..e354d41 100644
--- a/server/public/stylesheets/compiled/application.css
+++ b/server/public/stylesheets/compiled/application.css
@@ -637,3 +637,33 @@ li.docs {
   border : 1px solid #c00;
   background : #fbd1d1;
 }
+
+.new_instance {
+  border : 1px solid #ccc;
+  border-radius : 5px;
+  background : #eee;
+  clear : both;
+}
+
+.new_instance p {
+  margin : 5px;
+  clear : both;
+}
+
+.new_instance p label {
+  float : left;
+  width : 190px;
+}
+
+.new_instance p input[type=text]{
+  border : 1px solid #ccc;
+  font-size : 115%;
+  border-radius : 5px;
+  width : 220px;
+}
+
+h3.description {
+  float : right;
+  font-size : 70%;
+  color : #ccc;
+}
diff --git a/server/server.rb b/server/server.rb
index 8c3b72c..b5460a8 100644
--- a/server/server.rb
+++ b/server/server.rb
@@ -203,6 +203,7 @@ get "/api/instances/new" do
   @image   = driver.image( credentials, :id => params[:image_id] )
   @hardware_profiles = driver.hardware_profiles(credentials, :architecture => @image.architecture )
   @realms = driver.realms(credentials)
+  @keys = driver.keys(credentials) if driver_has_feature?(:authentication_key)
   if driver_has_feature?(:register_to_load_balancer)
     @load_balancers = driver.load_balancers(credentials)
   end
diff --git a/server/views/images/index.html.haml b/server/views/images/index.html.haml
index a713259..b9ef869 100644
--- a/server/views/images/index.html.haml
+++ b/server/views/images/index.html.haml
@@ -1,5 +1,4 @@
-%h1
-  Images
+%h1 Images
 
 %table.display
   %thead
diff --git a/server/views/instances/index.html.haml b/server/views/instances/index.html.haml
index 2bd4607..e07c174 100644
--- a/server/views/instances/index.html.haml
+++ b/server/views/instances/index.html.haml
@@ -7,7 +7,7 @@
       %th Owner
       %th Name
       %th Image
-      %th Realm
+      %th Profile
       %th State
       %th Actions
   %tbody
@@ -22,7 +22,7 @@
         %td
           = link_to instance.image_id, image_url( instance.image_id )
         %td
-          = instance.realm_id ? link_to(instance.realm_id, realm_url( instance.realm_id )) : 'default'
+          = instance.hardware_profile ? link_to(instance.hardware_profile, hardware_profile_url( instance.instance_profile.id )) : 'default'
         %td
           = instance.state
         %td
-- 
1.7.3.4