deltacloud-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From martha.c.ch...@gmail.com
Subject [PATCH 2/2] Added network port routes and index.haml file
Date Thu, 10 Jan 2013 09:29:04 GMT
From: NjeriChelimo <martha.c.chumo@gmail.com>

NOTE: When I do a curl, it works fine, but returns a 404 in the browser.
---
 clients/cimi/Gemfile.lock                   |   12 ------------
 clients/cimi/app.rb                         |    1 +
 clients/cimi/lib/entities.rb                |    1 +
 clients/cimi/lib/entities/network_port.rb   |    4 ++--
 clients/cimi/views/network_ports/index.haml |   23 +++++++++++++++++++++++
 5 files changed, 27 insertions(+), 14 deletions(-)
 create mode 100644 clients/cimi/views/network_ports/index.haml

diff --git a/clients/cimi/Gemfile.lock b/clients/cimi/Gemfile.lock
index 5ce2c94..93cb338 100644
--- a/clients/cimi/Gemfile.lock
+++ b/clients/cimi/Gemfile.lock
@@ -1,8 +1,6 @@
 GEM
   remote: http://rubygems.org/
   specs:
-    backports (2.6.4)
-    eventmachine (1.0.0)
     haml (3.1.7)
     json (1.7.5)
     mime-types (1.19)
@@ -12,21 +10,12 @@ GEM
       rack (>= 0.4)
     rack-protection (1.2.0)
       rack
-    rack-test (0.6.1)
-      rack (>= 1.0)
     rest-client (1.6.7)
       mime-types (>= 1.16)
     sinatra (1.3.3)
       rack (~> 1.3, >= 1.3.6)
       rack-protection (~> 1.2)
       tilt (~> 1.3, >= 1.3.3)
-    sinatra-contrib (1.3.1)
-      backports (>= 2.0)
-      eventmachine
-      rack-protection
-      rack-test
-      sinatra (~> 1.3.0)
-      tilt (~> 1.3)
     tilt (1.3.3)
 
 PLATFORMS
@@ -39,4 +28,3 @@ DEPENDENCIES
   rack-accept
   rest-client
   sinatra
-  sinatra-contrib
diff --git a/clients/cimi/app.rb b/clients/cimi/app.rb
index e26f2b9..d6702d7 100644
--- a/clients/cimi/app.rb
+++ b/clients/cimi/app.rb
@@ -25,6 +25,7 @@ module CIMI::Frontend
     use CIMI::Frontend::Machine
     use CIMI::Frontend::MachineAdmin
     use CIMI::Frontend::MachineTemplate
+    use CIMI::Frontend::NetworkPort
     use CIMI::Frontend::VolumeConfiguration
     use CIMI::Frontend::VolumeImage
     use CIMI::Frontend::Volume
diff --git a/clients/cimi/lib/entities.rb b/clients/cimi/lib/entities.rb
index 3442360..75bd6bd 100644
--- a/clients/cimi/lib/entities.rb
+++ b/clients/cimi/lib/entities.rb
@@ -31,6 +31,7 @@ require 'entities/volume'
 require 'entities/network'
 require 'entities/network_configuration'
 require 'entities/network_template'
+require 'entities/network_port'
 require 'entities/routing_group'
 require 'entities/routing_group_template'
 require 'entities/vsp'
diff --git a/clients/cimi/lib/entities/network_port.rb b/clients/cimi/lib/entities/network_port.rb
index 16923ee..3f3da2c 100644
--- a/clients/cimi/lib/entities/network_port.rb
+++ b/clients/cimi/lib/entities/network_port.rb
@@ -21,10 +21,10 @@ class CIMI::Frontend::NetworkPort < CIMI::Frontend::Entity
     haml :'network_ports/show'
   end
 
-  get '/cimi/network_templates' do
+  get '/cimi/network_ports' do
     network_port_xml = get_entity_collection('network_ports', credentials)
     @network_ports = CIMI::Model::NetworkPortCollection.from_xml(network_port_xml)
     haml :'network_ports/index'
    end
 
-                                end
+end
diff --git a/clients/cimi/views/network_ports/index.haml b/clients/cimi/views/network_ports/index.haml
new file mode 100644
index 0000000..bfa34d4
--- /dev/null
+++ b/clients/cimi/views/network_ports/index.haml
@@ -0,0 +1,23 @@
+- @title=collection_name @network_ports
+  
+  - content_for :breadcrumb do
+    %ul.breadcrumb
+      %li
+        %a{ :href => "/cimi/cloudEntryPoint"} CloudEntryPoint
+        %span.divider="/"
+      %li.active
+         NetworkPortCollection
+  - content_for :actions do
+    %p
+      %a{ :href => "#{@network_ports.id}?format=xml", :class => 'label warning' } XML
+      %a{ :href => "#{@network_ports.id}?format=json", :class => 'label warning' }
JSON
+    
+  %ul
+    - @network_ports.network_ports.each do |port|
+      %li
+        %a{ :href => "/cimi/network_ports/#{href_to_id(port.id)}"}=href_to_id(port.id)
+    
+  -details do
+    -row 'ID', @network_ports.id
+    -row 'Count', @network_ports.count
+
-- 
1.7.9.5


Mime
View raw message