deltacloud-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From martha.c.ch...@gmail.com
Subject [PATCH 3/3] DTACLOUD_404 Added view file for machine disks
Date Tue, 22 Jan 2013 08:39:23 GMT
From: NjeriChelimo <martha.c.chumo@gmail.com>

---
 clients/cimi/app.rb                          |    4 +--
 clients/cimi/lib/entities/machine.rb         |   14 +++++++++++
 clients/cimi/views/machines/disks/index.haml |   34 ++++++++++++++++++++++++++
 clients/cimi/views/machines/show.haml        |    2 --
 4 files changed, 50 insertions(+), 4 deletions(-)
 create mode 100644 clients/cimi/views/machines/disks/index.haml

diff --git a/clients/cimi/app.rb b/clients/cimi/app.rb
index 9f29980..465ad90 100644
--- a/clients/cimi/app.rb
+++ b/clients/cimi/app.rb
@@ -22,6 +22,8 @@ module CIMI::Frontend
     use CIMI::Frontend::Address
     use CIMI::Frontend::AddressTemplate
     use CIMI::Frontend::CloudEntryPoint
+    use CIMI::Frontend::ForwardingGroup
+    use CIMI::Frontend::ForwardingGroupTemplate
     use CIMI::Frontend::MachineConfiguration
     use CIMI::Frontend::MachineImage
     use CIMI::Frontend::Machine
@@ -41,8 +43,6 @@ module CIMI::Frontend
     use CIMI::Frontend::VSP
     use CIMI::Frontend::VSPConfiguration
     use CIMI::Frontend::VSPTemplate
-    use CIMI::Frontend::ForwardingGroup
-    use CIMI::Frontend::ForwardingGroupTemplate
     use Rack::Session::Cookie
 
     helpers CIMI::Frontend::Helper
diff --git a/clients/cimi/lib/entities/machine.rb b/clients/cimi/lib/entities/machine.rb
index 941f738..2708e4b 100644
--- a/clients/cimi/lib/entities/machine.rb
+++ b/clients/cimi/lib/entities/machine.rb
@@ -21,6 +21,20 @@ class CIMI::Frontend::Machine < CIMI::Frontend::Entity
     haml :'machines/show'
   end
 
+  get '/cimi/machines/:id/disks' do
+    machine_xml = get_entity('machines', params[:id], credentials)
+    @machine= CIMI::Model::Machine.from_xml(machine_xml)
+    @disks = @machine.disks
+    haml :'machines/disks/index'
+  end
+
+  get '/cimi/machines/:id/volumes' do
+    machine_xml = get_entity('machines', params[:id], credentials)
+    @machine= CIMI::Model::Machine.from_xml(machine_xml)
+    @volumes = @machine.volumes
+    haml :'volumes/index'
+  end
+
   get '/cimi/machines' do
     # We need to include this stuff for new Machine Form
     machine_image_xml = get_entity_collection('machine_images', credentials)
diff --git a/clients/cimi/views/machines/disks/index.haml b/clients/cimi/views/machines/disks/index.haml
new file mode 100644
index 0000000..b2dd41b
--- /dev/null
+++ b/clients/cimi/views/machines/disks/index.haml
@@ -0,0 +1,34 @@
+- @title=collection_name @disks
+
+- content_for :breadcrumb do
+  %ul.breadcrumb
+    %li
+      %a{ :href => "/cimi/cloudEntryPoint"} CloudEntryPoint
+      %span.divider="/"
+    %li
+      %a{ :href => "/cimi/machines"} MachineCollection
+      %span.divider="/"
+    %li
+      %a{ :href => "/cimi/machines/:id"}= @machine.name
+      %span.divider="/"
+    %li.active
+      MachineDisksCollection
+
+- content_for :actions do
+  %p
+    %a{ :href => "#{@disks.id}?format=xml", :class => 'label warning' } XML
+    %a{ :href => "#{@disks.id}?format=json", :class => 'label warning' } JSON
+
+%ul
+  - @disks.disks.each do |disk|
+    %li
+      %a{ :href => "cimi/machines/#{href_to_id @machine.id}/disks/#{href_to_id(disk.id)}"
}
+
+- if @disks.disks.empty?
+  .alert-message.block-message.warning
+    %p
+      There are no disks defined for this machine.
+
+-details do
+  -row 'ID', @disks.id
+  -row 'Count', @disks.count
diff --git a/clients/cimi/views/machines/show.haml b/clients/cimi/views/machines/show.haml
index c7e5599..cc31f0c 100644
--- a/clients/cimi/views/machines/show.haml
+++ b/clients/cimi/views/machines/show.haml
@@ -42,7 +42,6 @@
   -row 'Disks', url("/cimi/machines/#{href_to_id @machine.id}/disks")
   -row 'Volumes', url("/cimi/machines/#{href_to_id @machine.id}/volumes")
 
-
 %h5 Properties
 %table{ :class => 'table table-bordered table-striped' }
   %thead
@@ -55,4 +54,3 @@
         %td
           %code=name
         %td=convert_urls value
-
-- 
1.7.9.5


Mime
View raw message