deltacloud-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mfoj...@apache.org
Subject [1/4] git commit: Don't display [Additional parameters] if there aren't (backported dkoper patch)
Date Wed, 23 May 2012 10:42:02 GMT
Updated Branches:
  refs/heads/master 3cef4959a -> e6312c3e9


Don't display [Additional parameters] if there aren't (backported dkoper patch)


Project: http://git-wip-us.apache.org/repos/asf/deltacloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/deltacloud/commit/e6312c3e
Tree: http://git-wip-us.apache.org/repos/asf/deltacloud/tree/e6312c3e
Diff: http://git-wip-us.apache.org/repos/asf/deltacloud/diff/e6312c3e

Branch: refs/heads/master
Commit: e6312c3e942f894c8a2d6febddbd6fd9dada4eef
Parents: 0e5ddb5
Author: Michal Fojtik <mfojtik@redhat.com>
Authored: Wed May 23 12:42:10 2012 +0200
Committer: Michal fojtik <mfojtik@redhat.com>
Committed: Wed May 23 12:42:10 2012 +0200

----------------------------------------------------------------------
 server/lib/deltacloud/helpers/deltacloud_helper.rb |    5 +
 server/views/instances/new.html.haml               |   75 ++++++++-------
 2 files changed, 43 insertions(+), 37 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/deltacloud/blob/e6312c3e/server/lib/deltacloud/helpers/deltacloud_helper.rb
----------------------------------------------------------------------
diff --git a/server/lib/deltacloud/helpers/deltacloud_helper.rb b/server/lib/deltacloud/helpers/deltacloud_helper.rb
index 4ad0be9..7d31b68 100644
--- a/server/lib/deltacloud/helpers/deltacloud_helper.rb
+++ b/server/lib/deltacloud/helpers/deltacloud_helper.rb
@@ -277,6 +277,11 @@ module Deltacloud::Helpers
       end
     end
 
+    def additional_instance_features?
+      features_arr = [ :user_data, :instance_count, :authentication_key, :register_to_load_balancer,
:firewalls ]
+      features_arr.any? { |f| driver.class.has_feature?(:instances, f) }
+    end
+
 
     private
     def hardware_property_unit(prop)

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/e6312c3e/server/views/instances/new.html.haml
----------------------------------------------------------------------
diff --git a/server/views/instances/new.html.haml b/server/views/instances/new.html.haml
index 5ca775c..3a1d90c 100644
--- a/server/views/instances/new.html.haml
+++ b/server/views/instances/new.html.haml
@@ -26,48 +26,49 @@
         %label{ :for => :name} Instance name:
         %input{ :type => :text, :id => :name, :name => :name, :value => '' }
 
-    %div{ 'data-role' => :collapsible, 'data-collapsed' => "true"}
-      %h3 Additional parameters
+    - if additional_instance_features?
+      %div{ 'data-role' => :collapsible, 'data-collapsed' => "true"}
+        %h3 Additional parameters
 
-      - if driver.class.has_feature?(:instances, :user_data)
-        %div{ 'data-role' => :fieldcontain }
-          %label{ :for => :user_data} Base64 encoded user-data:
-          %textarea{ :id => :user_data, :name => :user_data, :value => '' }
-          %br/
-          %a{ :href => "", :onclick => 'encodeb64();', :'data-ajax' => 'false'}
Encode data
+        - if driver.class.has_feature?(:instances, :user_data)
+          %div{ 'data-role' => :fieldcontain }
+            %label{ :for => :user_data} Base64 encoded user-data:
+            %textarea{ :id => :user_data, :name => :user_data, :value => '' }
+            %br/
+            %a{ :href => "", :onclick => 'encodeb64();', :'data-ajax' => 'false'}
Encode data
 
-      - if driver.class.has_feature?(:instances, :instance_count)
-        %div{ 'data-role' => :fieldcontain }
-          %label{ :for => :instance_count} # of instances to be launched:
-          %input{ :type => :text, :id => :instance_count, :name => :instance_count,
:value => '1' }
+        - if driver.class.has_feature?(:instances, :instance_count)
+          %div{ 'data-role' => :fieldcontain }
+            %label{ :for => :instance_count} # of instances to be launched:
+            %input{ :type => :text, :id => :instance_count, :name => :instance_count,
:value => '1' }
 
-      - if driver.class.has_feature?(:instances, :authentication_key)
-        %div{ 'data-role' => :fieldcontain }
-          %label{ :for => :keyname, :class => 'ui-input-text'} Instance SSH key:
-          %select{:name => 'keyname', :'data-native-menu' => "true" }
-            %option{ :value => ''} None
-            - @keys.each do |key|
-              %option{ :value => key.id } #{key.id}
+        - if driver.class.has_feature?(:instances, :authentication_key)
+          %div{ 'data-role' => :fieldcontain }
+            %label{ :for => :keyname, :class => 'ui-input-text'} Instance SSH key:
+            %select{:name => 'keyname', :'data-native-menu' => "true" }
+              %option{ :value => ''} None
+              - @keys.each do |key|
+                %option{ :value => key.id } #{key.id}
 
-      - if driver.class.has_feature?(:instances, :register_to_load_balancer)
-        %div{ 'data-role' => :fieldcontain }
-          %label{ :for => :load_balancer_id, :class => 'ui-input-text'} Register to
loadbalancer:
-          %select{:name => 'load_balancer_id', :'data-native-menu' => "true" }
-            %option{ :value => ''} None
-            - @load_balancers.each do |load_balancer|
-              %option{:value => load_balancer.id} #{load_balancer.id}
+        - if driver.class.has_feature?(:instances, :register_to_load_balancer)
+          %div{ 'data-role' => :fieldcontain }
+            %label{ :for => :load_balancer_id, :class => 'ui-input-text'} Register
to loadbalancer:
+            %select{:name => 'load_balancer_id', :'data-native-menu' => "true" }
+              %option{ :value => ''} None
+              - @load_balancers.each do |load_balancer|
+                %option{:value => load_balancer.id} #{load_balancer.id}
 
-      - if driver.class.has_feature?(:instances, :firewalls)
-        %div{ 'data-role' => :fieldcontain }
-          %fieldset{ :'data-role' => 'controlgroup'}
-            %legend Register to firewall:
-            - @firewalls.each_index do |i|
-              - if @firewalls[i].name == 'default'
-                %input{:type => :checkbox, :value => @firewalls[i].name, :name =>
"firewalls#{i}", :checked => :true, :id => "firewalls#{i}"}/
-                %label{:for => "firewalls#{i}"} Default
-              - else
-                %input{:type => :checkbox, :value => @firewalls[i].name, :name =>
"firewalls#{i}", :id => "firewalls#{i}"}/
-                %label{:for => "firewalls#{i}"}=@firewalls[i].name
+        - if driver.class.has_feature?(:instances, :firewalls)
+          %div{ 'data-role' => :fieldcontain }
+            %fieldset{ :'data-role' => 'controlgroup'}
+              %legend Register to firewall:
+              - @firewalls.each_index do |i|
+                - if @firewalls[i].name == 'default'
+                  %input{:type => :checkbox, :value => @firewalls[i].name, :name =>
"firewalls#{i}", :checked => :true, :id => "firewalls#{i}"}/
+                  %label{:for => "firewalls#{i}"} Default
+                - else
+                  %input{:type => :checkbox, :value => @firewalls[i].name, :name =>
"firewalls#{i}", :id => "firewalls#{i}"}/
+                  %label{:for => "firewalls#{i}"}=@firewalls[i].name
 
     - if !@hardware_profiles.empty?
       %div{ 'data-role' => :fieldcontain }


Mime
View raw message