You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@deltacloud.apache.org by ma...@redhat.com on 2012/03/12 18:14:35 UTC

[PATCH 2/3] CIMI Client - updated views to use the new 'row' and 'details' helpers - tabular views

From: marios <ma...@redhat.com>


Signed-off-by: marios <ma...@redhat.com>
---
 clients/cimi/views/machine_templates/index.haml    |   14 ++----
 clients/cimi/views/machine_templates/show.haml     |   12 ++---
 clients/cimi/views/machines/show.haml              |   46 +++++--------------
 .../cimi/views/network_configurations/index.haml   |   14 ++----
 .../cimi/views/network_configurations/show.haml    |   30 ++++---------
 clients/cimi/views/networks/index.haml             |   14 ++----
 clients/cimi/views/networks/show.haml              |   33 +++++---------
 .../cimi/views/volume_configurations/index.haml    |    6 +++
 clients/cimi/views/volume_configurations/show.haml |   26 ++++-------
 clients/cimi/views/volume_images/index.haml        |   12 ++---
 clients/cimi/views/volume_images/show.haml         |   23 +++------
 clients/cimi/views/volumes/index.haml              |    2 +-
 12 files changed, 80 insertions(+), 152 deletions(-)

diff --git a/clients/cimi/views/machine_templates/index.haml b/clients/cimi/views/machine_templates/index.haml
index cb14ac0..3daff47 100644
--- a/clients/cimi/views/machine_templates/index.haml
+++ b/clients/cimi/views/machine_templates/index.haml
@@ -15,17 +15,13 @@
     Machine Template entities within a Provider. This entity can be used to
     locate and create Machine Templates.
 
+%h3 MachineTemplateCollection
 %ul
   - @machine_templates.machine_templates.each do |temp|
     %li
       %a{ :href => "/cimi/machine_templates/#{temp.href.split('/').last}"}=temp.href.split('/').last
 
-%h3 Collection details
-
-%dl
-  %dt id
-  %dd=@machine_templates.id
-  %dt Description
-  %dd=@machine_templates.description
-  %dt Created
-  %dd=@machine_templates.created
+-details 'MachineTemplateCollection details' do
+  -row 'id',@machine_templates.id
+  -row 'Description',@machine_templates.description
+  -row 'Created',@machine_templates.created
diff --git a/clients/cimi/views/machine_templates/show.haml b/clients/cimi/views/machine_templates/show.haml
index 1bfe803..bc7d587 100644
--- a/clients/cimi/views/machine_templates/show.haml
+++ b/clients/cimi/views/machine_templates/show.haml
@@ -18,11 +18,7 @@
     Instance. Machine Configurations are created by Providers and MAY, at the
     Providers discretion, be created by Consumers.
 
-%dl
-  %dt id
-  %dd
-    %a{ :href => @machine_template.id }=@machine_template.id
-  %dt Description
-  %dd=@machine_template.description
-  %dt Created
-  %dd #{@machine_template.created}&nbsp;
+-details 'MachineTemplate details' do
+  -row 'id',@machine_template.id
+  -row 'Description',@machine_template.description
+  -row 'Created',@machine_template.created
diff --git a/clients/cimi/views/machines/show.haml b/clients/cimi/views/machines/show.haml
index 24f86d8..a847710 100644
--- a/clients/cimi/views/machines/show.haml
+++ b/clients/cimi/views/machines/show.haml
@@ -28,41 +28,19 @@
       %input{ :type => :hidden, :name => '_method', :value => 'delete'}
       %button{ :class => 'btn danger'} Destroy
 
-%h3 Details
+%blockquote
+  %p
+    This entity represents an instantiated compute resource
 
-%table{ :class => 'table table-bordered table-striped' }
-  %tbody
-    %tr
-      %th ID
-      %td
-        %a{ :href => @machine.id }=@machine.id
-    %tr
-      %th Description
-      %td=@machine.description
-    %tr
-      %th Created
-      %td #{@machine.created}&nbsp;
-    %tr
-      %th State
-      %td=state_span_for @machine.state
-    %tr
-      %th CPU
-      %td=boolean_span_for @machine.cpu
-    %tr
-      %th RAM
-      %td
-        - if @machine.memory.quantity.nil?
-          %span.label Not specified
-        - else
-          =[@machine.memory.quantity, @machine.memory.units].join("&nbsp;")
-    %tr
-      %th Meters
-      %td
-        - if @machine.meters.empty?
-          %span.label No meters
-        - else
-          - @machine.meters.each do |meters|
-            %dd=meters.ref
+
+-details 'Machine details' do
+  -row 'ID', @machine.id
+  -row 'Description',@machine.description
+  -row 'Created', @machine.created
+  -row 'State',state_span_for(@machine.state)
+  -row 'CPU', boolean_span_for(@machine.cpu)
+  -row 'RAM',(@machine.memory.quantity.nil? ? "Not specified" : ([@machine.memory.quantity, @machine.memory.units].join("&nbsp;")))
+  -row 'Meters', (@machine.meters.empty? ? "No meters" : ( @machine.meters.each{|meter| meters.id}))
 
 
 %h3 Properties
diff --git a/clients/cimi/views/network_configurations/index.haml b/clients/cimi/views/network_configurations/index.haml
index 9b7a370..de6d42f 100644
--- a/clients/cimi/views/network_configurations/index.haml
+++ b/clients/cimi/views/network_configurations/index.haml
@@ -18,17 +18,13 @@
     of Network Configurations within a Provider. This entity can be used
     to locate and create Network Configurations
 
+%h3 NetworkConfigurationCollection
 %ul
   - @network_configs.network_configurations.each do |conf|
     %li
       %a{ :href => "/cimi/network_configurations/#{conf.href.split('/').last}"}=conf.href.split('/').last
 
-%h3 Collection details
-
-%dl
-  %dt id
-  %dd=@network_configs.id
-  %dt Description
-  %dd=@network_configs.description
-  %dt Created
-  %dd=@network_configs.created
+-details 'NetworkConfigurationCollection details' do
+  -row 'ID', @network_configs.id
+  -row 'Description', @network_configs.description
+  -row 'Created', @network_configs.created
diff --git a/clients/cimi/views/network_configurations/show.haml b/clients/cimi/views/network_configurations/show.haml
index e35952e..9c1a0b1 100644
--- a/clients/cimi/views/network_configurations/show.haml
+++ b/clients/cimi/views/network_configurations/show.haml
@@ -21,23 +21,13 @@
     A Network Configuration entity is the set of configuration values representing
     the information needed to create a Network with certain characteristics.
 
-%dl
-  %dt id
-  %dd
-    %a{ :href => @network_config.id }=@network_config.id
-  %dt Description
-  %dd=@network_config.description
-  %dt Created
-  %dd=@network_config.created
-  %dt Access
-  %dd=@network_config.access
-  %dt Bandwidth Limit
-  %dd=@network_config.bandwidth_limit
-  %dt Traffic Priority
-  %dd=@network_config.traffic_priority
-  %dt Maximum Traffic Delay
-  %dd=@network_config.max_traffic_delay
-  %dt Maximum Traffic Loss
-  %dd=@network_config.max_traffic_loss
-  %dt Maximum Traffic Jitter
-  %dd=@network_config.max_traffic_jitter
+-details 'NetworkConfiguration details' do
+  -row 'id', @network_config.id
+  -row 'Description',@network_config.description
+  -row 'Created',@network_config.created
+  -row 'Access',@network_config.access
+  -row 'Bandwidth Limit',@network_config.bandwidth_limit
+  -row 'Traffic Priority',@network_config.traffic_priority
+  -row 'Maximum Traffic Delay',@network_config.max_traffic_delay
+  -row 'Maximum Traffic Loss',@network_config.max_traffic_loss
+  -row 'Maximum Traffic Jitter',@network_config.max_traffic_jitter
diff --git a/clients/cimi/views/networks/index.haml b/clients/cimi/views/networks/index.haml
index 75d80ee..74ecb1d 100644
--- a/clients/cimi/views/networks/index.haml
+++ b/clients/cimi/views/networks/index.haml
@@ -18,17 +18,13 @@
     A Network Collection entity represents the collection of Networks
     within a Provider. This entity can be used to locate and create Networks.
 
+%h3 NetworkCollection
 %ul
   - @networks.networks.each do |network|
     %li
       %a{ :href => "/cimi/networks/#{network.href.split('/').last}"}=network.href.split('/').last
 
-%h3 Collection details
-
-%dl
-  %dt id
-  %dd=@networks.id
-  %dt Description
-  %dd=@networks.description
-  %dt Created
-  %dd=@networks.created
+-details 'NetworkCollection details' do
+  -row 'ID', @networks.id
+  -row 'Description', @networks.description
+  -row 'Created', @networks.created
diff --git a/clients/cimi/views/networks/show.haml b/clients/cimi/views/networks/show.haml
index 44bca74..7aaf37e 100644
--- a/clients/cimi/views/networks/show.haml
+++ b/clients/cimi/views/networks/show.haml
@@ -21,25 +21,14 @@
     This entity represents a Network - a realized entity
     that represents an abstraction of a layer 2 broadcast domain.
 
-%dl
-  %dt id
-  %dd
-    %a{ :href => @network.id }=@network.id
-  %dt Description
-  %dd=@network.description
-  %dt Created
-  %dd=@network.created
-  %dt State
-  %dd=@network.state
-  %dt Access
-  %dd=@network.access
-  %dt Bandwidth Limit
-  %dd=@network.bandwidth_limit
-  %dt Traffic Priority
-  %dd=@network.traffic_priority
-  %dt Maximum Traffic Delay
-  %dd=@network.max_traffic_delay
-  %dt Maximum Traffic Loss
-  %dd=@network.max_traffic_loss
-  %dt Maximum Traffic Jitter
-  %dd=@network.max_traffic_jitter
+-details 'Network details' do
+  -row 'ID', @network.id
+  -row 'Description', @network.description
+  -row 'Created', @network.created
+  -row 'State', @network.state
+  -row 'Access', @network.access
+  -row 'Bandwidth Limit', @network.bandwidth_limit
+  -row 'Traffic Priority', @network.traffic_priority
+  -row 'Maximum Traffic Delay', @network.max_traffic_delay
+  -row 'Maximum Traffic Loss', @network.max_traffic_loss
+  -row 'Maximum Traffic Jitter', @network.max_traffic_jitter
diff --git a/clients/cimi/views/volume_configurations/index.haml b/clients/cimi/views/volume_configurations/index.haml
index 71af308..7f636ec 100644
--- a/clients/cimi/views/volume_configurations/index.haml
+++ b/clients/cimi/views/volume_configurations/index.haml
@@ -18,7 +18,13 @@
     Volume Configuration entities within a Provider. This entity can be used to
     locate and create Volume Configurations.
 
+%h3 VolumeConfigurationsCollection
 %ul
   - @volume_configurations.volume_configurations.each do |conf|
     %li
       %a{ :href => "/cimi/volume_configurations/#{conf.href.split('/').last}"}=conf.href.split('/').last
+
+- details 'VolumeConfigurationCollection details' do
+  -row 'ID', @volume_configurations.id
+  -row 'Description', @volume_configurations.description
+  -row 'Created', @volume_configurations.created
diff --git a/clients/cimi/views/volume_configurations/show.haml b/clients/cimi/views/volume_configurations/show.haml
index 2465423..58783a6 100644
--- a/clients/cimi/views/volume_configurations/show.haml
+++ b/clients/cimi/views/volume_configurations/show.haml
@@ -23,20 +23,12 @@
     Instance. Volume Configurations are created by Providers and MAY, at the
     Providers discretion, be created by Consumers.
 
-%dl
-  %dt id
-  %dd
-    %a{ :href => @volume_configuration.id }=@volume_configuration.id
-  %dt Description
-  %dd=@volume_configuration.description
-  %dt Created
-  %dd=@volume_configuration.created
-  %dt Format
-  %dd=boolean_span_for @volume_configuration.format
-  %dt Supports snapshots
-  %dd=boolean_span_for @volume_configuration.supports_snapshots
-  %dt Guest interface
-  %dd=boolean_span_for @volume_configuration.guest_interface
-  %dt Capacity
-  %dd
-    =[@volume_configuration.capacity.quantity, @volume_configuration.capacity.units].join('&nbsp;')
+- details 'VolumeConfiguration details' do
+  -row 'ID', @volume_configuration.id
+  -row 'Description', @volume_configuration.description
+  -row 'Created', @volume_configuration.created
+  -row 'Format', boolean_span_for(@volume_configuration.format)
+  -row 'Supports snapshots', boolean_span_for(@volume_configuration.supports_snapshots)
+  -row 'Guest interface', boolean_span_for(@volume_configuration.guest_interface)
+  -row 'Capacity', ([@volume_configuration.capacity.quantity, @volume_configuration.capacity.units].join('&nbsp;'))
+
diff --git a/clients/cimi/views/volume_images/index.haml b/clients/cimi/views/volume_images/index.haml
index 8a36205..b819daa 100644
--- a/clients/cimi/views/volume_images/index.haml
+++ b/clients/cimi/views/volume_images/index.haml
@@ -24,12 +24,8 @@
     %li
       %a{ :href => "/cimi/volume_images/#{image.href.split('/').last}"}=image.href.split('/').last
 
-%h3 Collection details
+- details 'VolumeImageCollection details' do
+  - row 'ID', @volume_images.id
+  - row ' Description', @volume_images.description
+  - row 'Created', @volume_images.created
 
-%dl
-  %dt id
-  %dd=@volume_images.id
-  %dt Description
-  %dd=@volume_images.description
-  %dt Created
-  %dd=@volume_images.created
diff --git a/clients/cimi/views/volume_images/show.haml b/clients/cimi/views/volume_images/show.haml
index d0257d7..7f32497 100644
--- a/clients/cimi/views/volume_images/show.haml
+++ b/clients/cimi/views/volume_images/show.haml
@@ -21,18 +21,11 @@
     This entity represents the information necessary for hardware virtualized
     resources to create a Volume Instance
 
-%dl
-  %dt id
-  %dd
-    %a{ :href => @volume_image.id }=@volume_image.id
-  %dt Description
-  %dd=@volume_image.description
-  %dt Created
-  %dd=@volume_image.created
-  %dt Bootable
-  %dd=boolean_span_for @volume_image.bootable
-  %dt Image Location
-  %dd
-    %a{:href => "/cimi/volumes/#{href_to_id(@volume_image.image_location.href)}"}=href_to_id @volume_image.image_location.href
-  %dt Image Data
-  %dd=boolean_span_for @volume_image.image_data
+- details 'VolumeImage details' do
+  -row 'ID', @volume_image.id
+  -row 'Description', @volume_image.description
+  -row 'Created', @volume_image.created
+  -row 'Bootable', boolean_span_for(@volume_image.bootable)
+  -row 'Image Location', "/cimi/volumes/#{href_to_id(@volume_image.image_location.href)}"
+  -row 'Image Data', boolean_span_for(@volume_image.image_data)
+
diff --git a/clients/cimi/views/volumes/index.haml b/clients/cimi/views/volumes/index.haml
index dc1b631..f645a9f 100644
--- a/clients/cimi/views/volumes/index.haml
+++ b/clients/cimi/views/volumes/index.haml
@@ -25,7 +25,7 @@
     %li
       %a{ :href => "/cimi/volumes/#{volume.href.split('/').last}"}=volume.href.split('/').last
 
-- details 'Collection details' do
+- details 'VolumeCollection details' do
   - row 'ID', @volumes.id
   - row 'Description', @volumes.description
   - row 'Created', @volumes.created
-- 
1.7.6.5