deltacloud-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mfoj...@apache.org
Subject svn commit: r1199711 - in /incubator/deltacloud/trunk/server: lib/deltacloud/helpers/application_helper.rb views/instances/show.html.haml views/instances/show.xml.haml
Date Wed, 09 Nov 2011 12:36:11 GMT
Author: mfojtik
Date: Wed Nov  9 12:36:11 2011
New Revision: 1199711

URL: http://svn.apache.org/viewvc?rev=1199711&view=rev
Log:
Core: Updated views to support InstanceAddress. Get rid of address type guessing and formating

Signed-off-by: Michal fojtik <mfojtik@redhat.com>

Modified:
    incubator/deltacloud/trunk/server/lib/deltacloud/helpers/application_helper.rb
    incubator/deltacloud/trunk/server/views/instances/show.html.haml
    incubator/deltacloud/trunk/server/views/instances/show.xml.haml

Modified: incubator/deltacloud/trunk/server/lib/deltacloud/helpers/application_helper.rb
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/server/lib/deltacloud/helpers/application_helper.rb?rev=1199711&r1=1199710&r2=1199711&view=diff
==============================================================================
--- incubator/deltacloud/trunk/server/lib/deltacloud/helpers/application_helper.rb (original)
+++ incubator/deltacloud/trunk/server/lib/deltacloud/helpers/application_helper.rb Wed Nov
 9 12:36:11 2011
@@ -248,31 +248,6 @@ module ApplicationHelper
     end
   end
 
-  # FIXME: It would be cleaner if we stored the type of address explicitly in
-  # public_addresses instead of guessing it; especially since now a RHEV-M
-  # vnc address in theory could look like type ipv4.
-  #
-  # Instead of pushing just the address onto public_addresses, we should
-  # just push a pair [type, address], i.e. [:vnc, "172.16.0.1"] or a hash
-  # { :vnc => "172.16.0.1" }
-  #
-  def address_type(address)
-    case address
-      when /^(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})?$/; :ipv4
-      when /^(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}:[\-\d]+)$/; :vnc
-      when /^(\S{1,2}:\S{1,2}:\S{1,2}:\S{1,2}:\S{1,2}:\S{1,2})?$/; :mac
-      else :hostname
-    end
-  end
-
-  def format_address(address, opts={})
-    capture_haml do
-      haml_tag :address, { :type => address_type(address) }.merge(opts) do
-        haml_concat address
-      end
-    end
-  end
-
   def translate_error_code(code)
     case code
       when 400; { :message => "Bad Request" }

Modified: incubator/deltacloud/trunk/server/views/instances/show.html.haml
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/server/views/instances/show.html.haml?rev=1199711&r1=1199710&r2=1199711&view=diff
==============================================================================
--- incubator/deltacloud/trunk/server/views/instances/show.html.haml (original)
+++ incubator/deltacloud/trunk/server/views/instances/show.html.haml Wed Nov  9 12:36:11 2011
@@ -28,10 +28,10 @@
         default
     %li{ :'data-role' => 'list-divider'} Public addresses
     %li
-      %p{ :'data-role' => 'fieldcontain'}=@instance.public_addresses.map.join(',')
+      %p{ :'data-role' => 'fieldcontain'}=@instance.public_addresses.join(',')
     %li{ :'data-role' => 'list-divider'} Private addresses
     %li
-      %p{ :'data-role' => 'fieldcontain'}=@instance.private_addresses.map.join(',')
+      %p{ :'data-role' => 'fieldcontain'}=@instance.private_addresses.join(',')
     - if @instance.password or @instance.keyname
       %li{ :'data-role' => 'list-divider'} Authentication
     - if @instance.password

Modified: incubator/deltacloud/trunk/server/views/instances/show.xml.haml
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/server/views/instances/show.xml.haml?rev=1199711&r1=1199710&r2=1199711&view=diff
==============================================================================
--- incubator/deltacloud/trunk/server/views/instances/show.xml.haml (original)
+++ incubator/deltacloud/trunk/server/views/instances/show.xml.haml Wed Nov  9 12:36:11 2011
@@ -31,15 +31,12 @@
       =@instance.launch_time
   - if @instance.public_addresses
     %public_addresses<
-      - @instance.public_addresses.each do |address|
-        - if address.class.eql?(Hash) and address[:address]!=""
-          =format_address(address[:address], :port => address[:port], :type => address[:type],
:mac => address[:mac])
-        - elsif address.class.eql?(String)
-          =format_address(address)
+      - @instance.public_addresses.each do |a|
+        %address{ :type => a.address_type, :port => a.port }=a.address
   - if @instance.private_addresses
     %private_addresses<
-      - @instance.private_addresses.each do |address|
-        =format_address(address)
+      - @instance.private_addresses.each do |a|
+        %address{ :type => a.address_type, :port => a.port }=a.address
   - if @instance.firewalls
     %firewalls<
       - @instance.firewalls.each do |firewall|



Mime
View raw message