You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@deltacloud.apache.org by mf...@redhat.com on 2011/12/07 14:13:11 UTC

[PATCH core 1/2] CIMI: Added links to JSON and XML in CIMI UI

From: Michal Fojtik <mf...@redhat.com>


Signed-off-by: Michal fojtik <mf...@redhat.com>
---
 clients/cimi/public/app.css                        |    4 ++++
 clients/cimi/views/cloud_entry_point/index.haml    |    5 +++++
 clients/cimi/views/layout.haml                     |    6 ++----
 .../cimi/views/machine_configurations/index.haml   |    4 ++++
 .../cimi/views/machine_configurations/show.haml    |    5 +++++
 clients/cimi/views/machine_images/index.haml       |    4 ++++
 clients/cimi/views/machine_images/show.haml        |    5 +++++
 clients/cimi/views/machines/index.haml             |    4 ++++
 clients/cimi/views/machines/show.haml              |    3 +++
 .../cimi/views/volume_configurations/index.haml    |    5 ++++-
 clients/cimi/views/volume_configurations/show.haml |    7 ++++++-
 clients/cimi/views/volume_images/index.haml        |    5 +++++
 clients/cimi/views/volume_images/show.haml         |    7 ++++++-
 clients/cimi/views/volumes/index.haml              |    4 ++++
 clients/cimi/views/volumes/show.haml               |    7 ++++++-
 15 files changed, 67 insertions(+), 8 deletions(-)

diff --git a/clients/cimi/public/app.css b/clients/cimi/public/app.css
index 1cabc0f..45580d6 100644
--- a/clients/cimi/public/app.css
+++ b/clients/cimi/public/app.css
@@ -58,3 +58,7 @@ body {
 .content .row .span10 div.alert-message {
   margin-right : 30px;
 }
+
+#toolbar p:first-child {
+  text-align : right;
+}
diff --git a/clients/cimi/views/cloud_entry_point/index.haml b/clients/cimi/views/cloud_entry_point/index.haml
index 0867d31..33321fc 100644
--- a/clients/cimi/views/cloud_entry_point/index.haml
+++ b/clients/cimi/views/cloud_entry_point/index.haml
@@ -5,6 +5,11 @@
     %li.active
       CloudEntryPoint
 
+- content_for :actions do
+  %p
+    %a{ :href => "#{@entry_point.uri}?format=xml", :class => 'label warning' } XML
+    %a{ :href => "#{@entry_point.uri}?format=json", :class => 'label warning' } JSON
+
 %blockquote
   %p
     The Cloud Entry Point represents the entry point into the cloud defined by
diff --git a/clients/cimi/views/layout.haml b/clients/cimi/views/layout.haml
index 1978f83..87cdd3a 100644
--- a/clients/cimi/views/layout.haml
+++ b/clients/cimi/views/layout.haml
@@ -21,13 +21,11 @@
             %h1=@title || 'no-title-fix-me'
             = yield_content :breadcrumb
           .row
-            .span10
+            .span10#main
               - [ :info, :error, :success ].map do |message|
                 = flash_block_for message
               =yield
-            .span4
-              %h3 Operations
-              =yield_content :actions
+            .span4#toolbar=yield_content :actions
         %footer
           %p
             &copy; 2009-2011 The Apache Software Foundation and individual contributors.
diff --git a/clients/cimi/views/machine_configurations/index.haml b/clients/cimi/views/machine_configurations/index.haml
index 6b3452e..d24bd75 100644
--- a/clients/cimi/views/machine_configurations/index.haml
+++ b/clients/cimi/views/machine_configurations/index.haml
@@ -8,6 +8,10 @@
     %li.active
       MachineConfigurationCollection
 
+- content_for :actions do
+  %p
+    %a{ :href => "#{@machine_configurations.uri}?format=xml", :class => 'label warning' } XML
+    %a{ :href => "#{@machine_configurations.uri}?format=json", :class => 'label warning' } JSON
 
 %blockquote
   %p 
diff --git a/clients/cimi/views/machine_configurations/show.haml b/clients/cimi/views/machine_configurations/show.haml
index 06663cf..387de62 100644
--- a/clients/cimi/views/machine_configurations/show.haml
+++ b/clients/cimi/views/machine_configurations/show.haml
@@ -11,6 +11,11 @@
     %li.active
       = @machine_configuration.name
 
+- content_for :actions do
+  %p
+    %a{ :href => "#{@machine_configuration.uri}?format=xml", :class => 'label warning' } XML
+    %a{ :href => "#{@machine_configuration.uri}?format=json", :class => 'label warning' } JSON
+
 %blockquote
   %p
     The Machine Configuration entity represents the set of configuration values
diff --git a/clients/cimi/views/machine_images/index.haml b/clients/cimi/views/machine_images/index.haml
index 6bfb7fa..54f3711 100644
--- a/clients/cimi/views/machine_images/index.haml
+++ b/clients/cimi/views/machine_images/index.haml
@@ -8,6 +8,10 @@
     %li.active
       MachineImageCollection
 
+- content_for :actions do
+  %p
+    %a{ :href => "#{@machine_images.uri}?format=xml", :class => 'label warning' } XML
+    %a{ :href => "#{@machine_images.uri}?format=json", :class => 'label warning' } JSON
 
 %blockquote
   %p 
diff --git a/clients/cimi/views/machine_images/show.haml b/clients/cimi/views/machine_images/show.haml
index 3a6a75d..b3c4120 100644
--- a/clients/cimi/views/machine_images/show.haml
+++ b/clients/cimi/views/machine_images/show.haml
@@ -11,6 +11,11 @@
     %li.active
       = @machine_image.name
 
+- content_for :actions do
+  %p
+    %a{ :href => "#{@machine_image.uri}?format=xml", :class => 'label warning' } XML
+    %a{ :href => "#{@machine_image.uri}?format=json", :class => 'label warning' } JSON
+
 %blockquote
   %p
     This entity represents the information (e.g. an Open Virtualization Format
diff --git a/clients/cimi/views/machines/index.haml b/clients/cimi/views/machines/index.haml
index be18e65..08205bd 100644
--- a/clients/cimi/views/machines/index.haml
+++ b/clients/cimi/views/machines/index.haml
@@ -10,8 +10,12 @@
 
 - content_for :actions do
   %p
+    %a{ :href => "#{@machines.uri}?format=xml", :class => 'label warning' } XML
+    %a{ :href => "#{@machines.uri}?format=json", :class => 'label warning' } JSON
+  %p
     %a{ :href => '/cimi/machines/new', :class => 'btn info'} New machine 
 
+
 %blockquote
   %p
     A Machine Collection entity represents the collection of Machine
diff --git a/clients/cimi/views/machines/show.haml b/clients/cimi/views/machines/show.haml
index 620da17..fa637e5 100644
--- a/clients/cimi/views/machines/show.haml
+++ b/clients/cimi/views/machines/show.haml
@@ -13,6 +13,9 @@
 
 - content_for :actions do
   %p
+    %a{ :href => "#{@machine.uri}?format=xml", :class => 'label warning' } XML
+    %a{ :href => "#{@machine.uri}?format=json", :class => 'label warning' } JSON
+  %p
     - if @machine.state == 'STARTED'
       %form{ :action => "/cimi/machines/#{@machine.name}/stop", :method => :post, :style => 'display:inline'}
         %button{ :class => 'btn'} Stop
diff --git a/clients/cimi/views/volume_configurations/index.haml b/clients/cimi/views/volume_configurations/index.haml
index 602d230..88ed9c8 100644
--- a/clients/cimi/views/volume_configurations/index.haml
+++ b/clients/cimi/views/volume_configurations/index.haml
@@ -7,7 +7,10 @@
       %span.divider="/"
     %li.active
       VolumeConfigurationCollection
-
+- content_for :actions do
+  %p
+    %a{ :href => "#{@volume_configurations.uri}?format=xml", :class => 'label warning' } XML
+    %a{ :href => "#{@volume_configurations.uri}?format=json", :class => 'label warning' } JSON
 
 %blockquote
   %p
diff --git a/clients/cimi/views/volume_configurations/show.haml b/clients/cimi/views/volume_configurations/show.haml
index 373486c..6378ee7 100644
--- a/clients/cimi/views/volume_configurations/show.haml
+++ b/clients/cimi/views/volume_configurations/show.haml
@@ -11,6 +11,11 @@
     %li.active
       = @volume_configuration.name
 
+- content_for :actions do
+  %p
+    %a{ :href => "#{@volume_configuration.uri}?format=xml", :class => 'label warning' } XML
+    %a{ :href => "#{@volume_configuration.uri}?format=json", :class => 'label warning' } JSON
+
 %blockquote
   %p
     The Volume Configuration entity represents the set of configuration values
@@ -27,4 +32,4 @@
   %dt Created
   %dd #{@volume_configuration.created}&nbsp;
   %dt Details
-  %dd=@volume_configuration.inspect
\ No newline at end of file
+  %dd=@volume_configuration.inspect
diff --git a/clients/cimi/views/volume_images/index.haml b/clients/cimi/views/volume_images/index.haml
index e7ab56f..26be6c8 100644
--- a/clients/cimi/views/volume_images/index.haml
+++ b/clients/cimi/views/volume_images/index.haml
@@ -8,6 +8,11 @@
     %li.active
       VolumeImageCollection
 
+- content_for :actions do
+  %p
+    %a{ :href => "#{@volume_images.uri}?format=xml", :class => 'label warning' } XML
+    %a{ :href => "#{@volume_images.uri}?format=json", :class => 'label warning' } JSON
+
 %blockquote
   %p
     A Volume Image Collection entity represents the collection of Volume Image
diff --git a/clients/cimi/views/volume_images/show.haml b/clients/cimi/views/volume_images/show.haml
index ef396dc..20b3ef4 100644
--- a/clients/cimi/views/volume_images/show.haml
+++ b/clients/cimi/views/volume_images/show.haml
@@ -11,6 +11,11 @@
     %li.active
       = @volume_image.name
 
+- content_for :actions do
+  %p
+    %a{ :href => "#{@volume_image.uri}?format=xml", :class => 'label warning' } XML
+    %a{ :href => "#{@volume_image.uri}?format=json", :class => 'label warning' } JSON
+
 %blockquote
   %p
     This entity represents the information necessary for hardware virtualized
@@ -25,4 +30,4 @@
   %dt Created
   %dd=@volume_image.created
   %dt Details
-  %dd=@volume_image.inspect
\ No newline at end of file
+  %dd=@volume_image.inspect
diff --git a/clients/cimi/views/volumes/index.haml b/clients/cimi/views/volumes/index.haml
index e9bd529..eedb125 100644
--- a/clients/cimi/views/volumes/index.haml
+++ b/clients/cimi/views/volumes/index.haml
@@ -8,6 +8,10 @@
     %li.active
       VolumeCollection
 
+- content_for :actions do
+  %p
+    %a{ :href => "#{@volumes.uri}?format=xml", :class => 'label warning' } XML
+    %a{ :href => "#{@volumes.uri}?format=json", :class => 'label warning' } JSON
 
 %blockquote
   %p
diff --git a/clients/cimi/views/volumes/show.haml b/clients/cimi/views/volumes/show.haml
index 85a73f7..f08006b 100644
--- a/clients/cimi/views/volumes/show.haml
+++ b/clients/cimi/views/volumes/show.haml
@@ -11,6 +11,11 @@
     %li.active
       = @volume.name
 
+- content_for :actions do
+  %p
+    %a{ :href => "#{@volume.uri}?format=xml", :class => 'label warning' } XML
+    %a{ :href => "#{@volume.uri}?format=json", :class => 'label warning' } JSON
+
 %blockquote
   %p
     This entity represents a
@@ -25,4 +30,4 @@
   %dt Created
   %dd #{@volume.created}&nbsp;
   %dt Details
-  %dd=@volume.inspect
\ No newline at end of file
+  %dd=@volume.inspect
-- 
1.7.4.4


Re: [PATCH core 2/2] CIMI: Replaced .inspect in Details with formatted data

Posted by Michal Fojtik <mf...@redhat.com>.
On Dec 7, 2011, at 4:01 PM, Tong Li wrote:

> ACK. thanks.

Thanks. Pushing.

  -- Michal

> 
> Tong Li
> Emerging Technologies & Standards
> Building 501/B205
> litong01@us.ibm.com
> 
> mfojtik@redhat.com wrote on 12/07/2011 08:13:12 AM:
> 
>> From: mfojtik@redhat.com
>> To: dev@deltacloud.apache.org
>> Date: 12/07/2011 08:15 AM
>> Subject: [PATCH core 2/2] CIMI: Replaced .inspect in Details with
>> formatted data
>> 
>> From: Michal Fojtik <mf...@redhat.com>
>> 
>> 
>> Signed-off-by: Michal fojtik <mf...@redhat.com>
>> ---
>> clients/cimi/lib/cimi_frontend_helper.rb           |   17 ++++++++++
>> clients/cimi/views/machines/show.haml              |   32 +++++++++
>> ++++++++++-
>> clients/cimi/views/volume_configurations/show.haml |   13 ++++++--
>> clients/cimi/views/volume_images/show.haml         |    9 ++++-
>> clients/cimi/views/volumes/show.haml               |   24 ++++++++++++
> +--
>> 5 files changed, 86 insertions(+), 9 deletions(-)
>> 
>> diff --git a/clients/cimi/lib/cimi_frontend_helper.rb b/clients/
>> cimi/lib/cimi_frontend_helper.rb
>> index 8d1fba9..80ae9ed 100644
>> --- a/clients/cimi/lib/cimi_frontend_helper.rb
>> +++ b/clients/cimi/lib/cimi_frontend_helper.rb
>> @@ -46,6 +46,23 @@ module CIMI
>>         halt(*args)
>>       end
>> 
>> +      def boolean_span_for(bool)
>> +        return bool if !bool.nil? and bool!='true' and bool!='false'
>> +        capture_haml do
>> +          haml_tag :span, :class => [ 'label', bool.nil? ? '' :
>> (bool===false) ? 'important' : 'success' ] do
>> +            haml_concat bool.nil? ? 'not specified' :
>> (bool===false) ? 'no' : 'yes'
>> +          end
>> +        end
>> +      end
>> +
>> +      def state_span_for(state)
>> +        capture_haml do
>> +          haml_tag :span, :class => [ 'label', state=='STARTED' ?
>> 'success' : 'important' ] do
>> +            haml_concat state
>> +          end
>> +        end
>> +      end
>> +
>>     end
>>   end
>> end
>> diff --git a/clients/cimi/views/machines/show.haml b/clients/cimi/
>> views/machines/show.haml
>> index fa637e5..a5b7638 100644
>> --- a/clients/cimi/views/machines/show.haml
>> +++ b/clients/cimi/views/machines/show.haml
>> @@ -43,7 +43,22 @@
>>   %dt Created
>>   %dd #{@machine.created}&nbsp;
>>   %dt State
>> -  %dd=@machine.state
>> +  %dd=state_span_for @machine.state
>> +  %dt CPU
>> +  %dd=boolean_span_for @machine.cpu
>> +  %dt Memory
>> +  %dd
>> +    - if @machine.memory.quantity.nil?
>> +      %span.label Not specified
>> +    - else
>> +      =[@memory.quantity, @memory.units].join("&nbsp;")
>> +  %dt Meters
>> +  %dd
>> +    - if @machine.meters.empty?
>> +      %span.label No meters
>> +    - else
>> +      - @machine.meters.each do |meters|
>> +        %dd=meters.ref
>> 
>> %h3 Network Interfaces
>> 
>> @@ -76,3 +91,18 @@
>>           %a{:href => "/cimi/volumes/#{href_to_id(volume.href)}" }
>> =href_to_id(volume.href)
>>         %td=volume.attachment_point
>>         %td=volume.protocol
>> +
>> +%h3 Disks
>> +
>> +%table.bordered-table
>> +  %thead
>> +    %tr
>> +      %th Capacity
>> +      %th Format
>> +      %th Attachment point
>> +  %tbody
>> +    - @machine.disks.each do |disk|
>> +      %tr
>> +        %td=[boolean_span_for(disk.capacity.quantity),
>> disk.capacity.units].join("&nbsp;")
>> +        %td=boolean_span_for disk.format
>> +        %td=boolean_span_for disk.attachment_point
>> diff --git a/clients/cimi/views/volume_configurations/show.haml b/
>> clients/cimi/views/volume_configurations/show.haml
>> index 6378ee7..1e55473 100644
>> --- a/clients/cimi/views/volume_configurations/show.haml
>> +++ b/clients/cimi/views/volume_configurations/show.haml
>> @@ -30,6 +30,13 @@
>>   %dt Description
>>   %dd=@volume_configuration.description
>>   %dt Created
>> -  %dd #{@volume_configuration.created}&nbsp;
>> -  %dt Details
>> -  %dd=@volume_configuration.inspect
>> +  %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;')
>> diff --git a/clients/cimi/views/volume_images/show.haml b/clients/
>> cimi/views/volume_images/show.haml
>> index 20b3ef4..f76bf5e 100644
>> --- a/clients/cimi/views/volume_images/show.haml
>> +++ b/clients/cimi/views/volume_images/show.haml
>> @@ -29,5 +29,10 @@
>>   %dd=@volume_image.description
>>   %dt Created
>>   %dd=@volume_image.created
>> -  %dt Details
>> -  %dd=@volume_image.inspect
>> +  %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
>> diff --git a/clients/cimi/views/volumes/show.haml b/clients/cimi/
>> views/volumes/show.haml
>> index f08006b..0352d52 100644
>> --- a/clients/cimi/views/volumes/show.haml
>> +++ b/clients/cimi/views/volumes/show.haml
>> @@ -28,6 +28,24 @@
>>   %dt Description
>>   %dd=@volume.description
>>   %dt Created
>> -  %dd #{@volume.created}&nbsp;
>> -  %dt Details
>> -  %dd=@volume.inspect
>> +  %dd=@volume.created
>> +  %dt Bootable
>> +  %dd=boolean_span_for @volume.bootable
>> +  %dt Support Snapshots
>> +  %dd=boolean_span_for @volume.supports_snapshots
>> +  %dt Guest Interface
>> +  %dd=boolean_span_for @volume.guest_interface
>> +  %dt Snapshots
>> +  %dd
>> +    - if @volume.snapshots.empty?
>> +      %span.label No snapshots
>> +    - else
>> +      - @volume.snapshots.each do |snapshot|
>> +        %dd=snapshot.ref
>> +  %dt Meters
>> +  %dd
>> +    - if @volume.meters.empty?
>> +      %span.label No meters
>> +    - else
>> +      - @volume.meters.each do |meters|
>> +        %dd=meters.ref
>> --
>> 1.7.4.4
>> 
> 

------------------------------------------------------
Michal Fojtik, mfojtik@redhat.com
Deltacloud API: http://deltacloud.org


Re: [PATCH core 2/2] CIMI: Replaced .inspect in Details with formatted data

Posted by Tong Li <li...@us.ibm.com>.
ACK. thanks.

Tong Li
Emerging Technologies & Standards
Building 501/B205
litong01@us.ibm.com

mfojtik@redhat.com wrote on 12/07/2011 08:13:12 AM:

> From: mfojtik@redhat.com
> To: dev@deltacloud.apache.org
> Date: 12/07/2011 08:15 AM
> Subject: [PATCH core 2/2] CIMI: Replaced .inspect in Details with
> formatted data
>
> From: Michal Fojtik <mf...@redhat.com>
>
>
> Signed-off-by: Michal fojtik <mf...@redhat.com>
> ---
>  clients/cimi/lib/cimi_frontend_helper.rb           |   17 ++++++++++
>  clients/cimi/views/machines/show.haml              |   32 +++++++++
> ++++++++++-
>  clients/cimi/views/volume_configurations/show.haml |   13 ++++++--
>  clients/cimi/views/volume_images/show.haml         |    9 ++++-
>  clients/cimi/views/volumes/show.haml               |   24 ++++++++++++
+--
>  5 files changed, 86 insertions(+), 9 deletions(-)
>
> diff --git a/clients/cimi/lib/cimi_frontend_helper.rb b/clients/
> cimi/lib/cimi_frontend_helper.rb
> index 8d1fba9..80ae9ed 100644
> --- a/clients/cimi/lib/cimi_frontend_helper.rb
> +++ b/clients/cimi/lib/cimi_frontend_helper.rb
> @@ -46,6 +46,23 @@ module CIMI
>          halt(*args)
>        end
>
> +      def boolean_span_for(bool)
> +        return bool if !bool.nil? and bool!='true' and bool!='false'
> +        capture_haml do
> +          haml_tag :span, :class => [ 'label', bool.nil? ? '' :
> (bool===false) ? 'important' : 'success' ] do
> +            haml_concat bool.nil? ? 'not specified' :
> (bool===false) ? 'no' : 'yes'
> +          end
> +        end
> +      end
> +
> +      def state_span_for(state)
> +        capture_haml do
> +          haml_tag :span, :class => [ 'label', state=='STARTED' ?
> 'success' : 'important' ] do
> +            haml_concat state
> +          end
> +        end
> +      end
> +
>      end
>    end
>  end
> diff --git a/clients/cimi/views/machines/show.haml b/clients/cimi/
> views/machines/show.haml
> index fa637e5..a5b7638 100644
> --- a/clients/cimi/views/machines/show.haml
> +++ b/clients/cimi/views/machines/show.haml
> @@ -43,7 +43,22 @@
>    %dt Created
>    %dd #{@machine.created}&nbsp;
>    %dt State
> -  %dd=@machine.state
> +  %dd=state_span_for @machine.state
> +  %dt CPU
> +  %dd=boolean_span_for @machine.cpu
> +  %dt Memory
> +  %dd
> +    - if @machine.memory.quantity.nil?
> +      %span.label Not specified
> +    - else
> +      =[@memory.quantity, @memory.units].join("&nbsp;")
> +  %dt Meters
> +  %dd
> +    - if @machine.meters.empty?
> +      %span.label No meters
> +    - else
> +      - @machine.meters.each do |meters|
> +        %dd=meters.ref
>
>  %h3 Network Interfaces
>
> @@ -76,3 +91,18 @@
>            %a{:href => "/cimi/volumes/#{href_to_id(volume.href)}" }
> =href_to_id(volume.href)
>          %td=volume.attachment_point
>          %td=volume.protocol
> +
> +%h3 Disks
> +
> +%table.bordered-table
> +  %thead
> +    %tr
> +      %th Capacity
> +      %th Format
> +      %th Attachment point
> +  %tbody
> +    - @machine.disks.each do |disk|
> +      %tr
> +        %td=[boolean_span_for(disk.capacity.quantity),
> disk.capacity.units].join("&nbsp;")
> +        %td=boolean_span_for disk.format
> +        %td=boolean_span_for disk.attachment_point
> diff --git a/clients/cimi/views/volume_configurations/show.haml b/
> clients/cimi/views/volume_configurations/show.haml
> index 6378ee7..1e55473 100644
> --- a/clients/cimi/views/volume_configurations/show.haml
> +++ b/clients/cimi/views/volume_configurations/show.haml
> @@ -30,6 +30,13 @@
>    %dt Description
>    %dd=@volume_configuration.description
>    %dt Created
> -  %dd #{@volume_configuration.created}&nbsp;
> -  %dt Details
> -  %dd=@volume_configuration.inspect
> +  %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;')
> diff --git a/clients/cimi/views/volume_images/show.haml b/clients/
> cimi/views/volume_images/show.haml
> index 20b3ef4..f76bf5e 100644
> --- a/clients/cimi/views/volume_images/show.haml
> +++ b/clients/cimi/views/volume_images/show.haml
> @@ -29,5 +29,10 @@
>    %dd=@volume_image.description
>    %dt Created
>    %dd=@volume_image.created
> -  %dt Details
> -  %dd=@volume_image.inspect
> +  %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
> diff --git a/clients/cimi/views/volumes/show.haml b/clients/cimi/
> views/volumes/show.haml
> index f08006b..0352d52 100644
> --- a/clients/cimi/views/volumes/show.haml
> +++ b/clients/cimi/views/volumes/show.haml
> @@ -28,6 +28,24 @@
>    %dt Description
>    %dd=@volume.description
>    %dt Created
> -  %dd #{@volume.created}&nbsp;
> -  %dt Details
> -  %dd=@volume.inspect
> +  %dd=@volume.created
> +  %dt Bootable
> +  %dd=boolean_span_for @volume.bootable
> +  %dt Support Snapshots
> +  %dd=boolean_span_for @volume.supports_snapshots
> +  %dt Guest Interface
> +  %dd=boolean_span_for @volume.guest_interface
> +  %dt Snapshots
> +  %dd
> +    - if @volume.snapshots.empty?
> +      %span.label No snapshots
> +    - else
> +      - @volume.snapshots.each do |snapshot|
> +        %dd=snapshot.ref
> +  %dt Meters
> +  %dd
> +    - if @volume.meters.empty?
> +      %span.label No meters
> +    - else
> +      - @volume.meters.each do |meters|
> +        %dd=meters.ref
> --
> 1.7.4.4
>


[PATCH core 2/2] CIMI: Replaced .inspect in Details with formatted data

Posted by mf...@redhat.com.
From: Michal Fojtik <mf...@redhat.com>


Signed-off-by: Michal fojtik <mf...@redhat.com>
---
 clients/cimi/lib/cimi_frontend_helper.rb           |   17 ++++++++++
 clients/cimi/views/machines/show.haml              |   32 +++++++++++++++++++-
 clients/cimi/views/volume_configurations/show.haml |   13 ++++++--
 clients/cimi/views/volume_images/show.haml         |    9 ++++-
 clients/cimi/views/volumes/show.haml               |   24 +++++++++++++--
 5 files changed, 86 insertions(+), 9 deletions(-)

diff --git a/clients/cimi/lib/cimi_frontend_helper.rb b/clients/cimi/lib/cimi_frontend_helper.rb
index 8d1fba9..80ae9ed 100644
--- a/clients/cimi/lib/cimi_frontend_helper.rb
+++ b/clients/cimi/lib/cimi_frontend_helper.rb
@@ -46,6 +46,23 @@ module CIMI
         halt(*args)
       end
 
+      def boolean_span_for(bool)
+        return bool if !bool.nil? and bool!='true' and bool!='false'
+        capture_haml do
+          haml_tag :span, :class => [ 'label', bool.nil? ? '' : (bool===false) ? 'important' : 'success' ] do
+            haml_concat bool.nil? ? 'not specified' : (bool===false) ? 'no' : 'yes'
+          end
+        end
+      end
+
+      def state_span_for(state)
+        capture_haml do
+          haml_tag :span, :class => [ 'label', state=='STARTED' ? 'success' : 'important' ] do
+            haml_concat state
+          end
+        end
+      end
+
     end
   end
 end
diff --git a/clients/cimi/views/machines/show.haml b/clients/cimi/views/machines/show.haml
index fa637e5..a5b7638 100644
--- a/clients/cimi/views/machines/show.haml
+++ b/clients/cimi/views/machines/show.haml
@@ -43,7 +43,22 @@
   %dt Created
   %dd #{@machine.created}&nbsp;
   %dt State
-  %dd=@machine.state
+  %dd=state_span_for @machine.state
+  %dt CPU
+  %dd=boolean_span_for @machine.cpu
+  %dt Memory
+  %dd
+    - if @machine.memory.quantity.nil?
+      %span.label Not specified
+    - else
+      =[@memory.quantity, @memory.units].join("&nbsp;")
+  %dt Meters
+  %dd
+    - if @machine.meters.empty?
+      %span.label No meters
+    - else
+      - @machine.meters.each do |meters|
+        %dd=meters.ref
 
 %h3 Network Interfaces
 
@@ -76,3 +91,18 @@
           %a{:href => "/cimi/volumes/#{href_to_id(volume.href)}" }=href_to_id(volume.href)
         %td=volume.attachment_point
         %td=volume.protocol
+
+%h3 Disks
+
+%table.bordered-table
+  %thead
+    %tr
+      %th Capacity
+      %th Format
+      %th Attachment point
+  %tbody
+    - @machine.disks.each do |disk|
+      %tr
+        %td=[boolean_span_for(disk.capacity.quantity), disk.capacity.units].join("&nbsp;")
+        %td=boolean_span_for disk.format
+        %td=boolean_span_for disk.attachment_point
diff --git a/clients/cimi/views/volume_configurations/show.haml b/clients/cimi/views/volume_configurations/show.haml
index 6378ee7..1e55473 100644
--- a/clients/cimi/views/volume_configurations/show.haml
+++ b/clients/cimi/views/volume_configurations/show.haml
@@ -30,6 +30,13 @@
   %dt Description
   %dd=@volume_configuration.description
   %dt Created
-  %dd #{@volume_configuration.created}&nbsp;
-  %dt Details
-  %dd=@volume_configuration.inspect
+  %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;')
diff --git a/clients/cimi/views/volume_images/show.haml b/clients/cimi/views/volume_images/show.haml
index 20b3ef4..f76bf5e 100644
--- a/clients/cimi/views/volume_images/show.haml
+++ b/clients/cimi/views/volume_images/show.haml
@@ -29,5 +29,10 @@
   %dd=@volume_image.description
   %dt Created
   %dd=@volume_image.created
-  %dt Details
-  %dd=@volume_image.inspect
+  %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
diff --git a/clients/cimi/views/volumes/show.haml b/clients/cimi/views/volumes/show.haml
index f08006b..0352d52 100644
--- a/clients/cimi/views/volumes/show.haml
+++ b/clients/cimi/views/volumes/show.haml
@@ -28,6 +28,24 @@
   %dt Description
   %dd=@volume.description
   %dt Created
-  %dd #{@volume.created}&nbsp;
-  %dt Details
-  %dd=@volume.inspect
+  %dd=@volume.created
+  %dt Bootable
+  %dd=boolean_span_for @volume.bootable
+  %dt Support Snapshots
+  %dd=boolean_span_for @volume.supports_snapshots
+  %dt Guest Interface
+  %dd=boolean_span_for @volume.guest_interface
+  %dt Snapshots
+  %dd
+    - if @volume.snapshots.empty?
+      %span.label No snapshots
+    - else
+      - @volume.snapshots.each do |snapshot|
+        %dd=snapshot.ref
+  %dt Meters
+  %dd
+    - if @volume.meters.empty?
+      %span.label No meters
+    - else
+      - @volume.meters.each do |meters|
+        %dd=meters.ref
-- 
1.7.4.4


Re: [PATCH core 1/2] CIMI: Added links to JSON and XML in CIMI UI

Posted by Tong Li <li...@us.ibm.com>.
ACK.

Tong Li
Emerging Technologies & Standards
Building 501/B205
litong01@us.ibm.com

mfojtik@redhat.com wrote on 12/07/2011 08:13:11 AM:

> From: mfojtik@redhat.com
> To: dev@deltacloud.apache.org
> Date: 12/07/2011 08:15 AM
> Subject: [PATCH core 1/2] CIMI: Added links to JSON and XML in CIMI UI
>
> From: Michal Fojtik <mf...@redhat.com>
>
>
> Signed-off-by: Michal fojtik <mf...@redhat.com>
> ---
>  clients/cimi/public/app.css                        |    4 ++++
>  clients/cimi/views/cloud_entry_point/index.haml    |    5 +++++
>  clients/cimi/views/layout.haml                     |    6 ++----
>  .../cimi/views/machine_configurations/index.haml   |    4 ++++
>  .../cimi/views/machine_configurations/show.haml    |    5 +++++
>  clients/cimi/views/machine_images/index.haml       |    4 ++++
>  clients/cimi/views/machine_images/show.haml        |    5 +++++
>  clients/cimi/views/machines/index.haml             |    4 ++++
>  clients/cimi/views/machines/show.haml              |    3 +++
>  .../cimi/views/volume_configurations/index.haml    |    5 ++++-
>  clients/cimi/views/volume_configurations/show.haml |    7 ++++++-
>  clients/cimi/views/volume_images/index.haml        |    5 +++++
>  clients/cimi/views/volume_images/show.haml         |    7 ++++++-
>  clients/cimi/views/volumes/index.haml              |    4 ++++
>  clients/cimi/views/volumes/show.haml               |    7 ++++++-
>  15 files changed, 67 insertions(+), 8 deletions(-)
>
> diff --git a/clients/cimi/public/app.css b/clients/cimi/public/app.css
> index 1cabc0f..45580d6 100644
> --- a/clients/cimi/public/app.css
> +++ b/clients/cimi/public/app.css
> @@ -58,3 +58,7 @@ body {
>  .content .row .span10 div.alert-message {
>    margin-right : 30px;
>  }
> +
> +#toolbar p:first-child {
> +  text-align : right;
> +}
> diff --git a/clients/cimi/views/cloud_entry_point/index.haml b/
> clients/cimi/views/cloud_entry_point/index.haml
> index 0867d31..33321fc 100644
> --- a/clients/cimi/views/cloud_entry_point/index.haml
> +++ b/clients/cimi/views/cloud_entry_point/index.haml
> @@ -5,6 +5,11 @@
>      %li.active
>        CloudEntryPoint
>
> +- content_for :actions do
> +  %p
> +    %a{ :href => "#{@entry_point.uri}?format=xml", :class => 'label
> warning' } XML
> +    %a{ :href => "#{@entry_point.uri}?format=json", :class =>
> 'label warning' } JSON
> +
>  %blockquote
>    %p
>      The Cloud Entry Point represents the entry point into the
clouddefined by
> diff --git a/clients/cimi/views/layout.haml
b/clients/cimi/views/layout.haml
> index 1978f83..87cdd3a 100644
> --- a/clients/cimi/views/layout.haml
> +++ b/clients/cimi/views/layout.haml
> @@ -21,13 +21,11 @@
>              %h1=@title || 'no-title-fix-me'
>              = yield_content :breadcrumb
>            .row
> -            .span10
> +            .span10#main
>                - [ :info, :error, :success ].map do |message|
>                  = flash_block_for message
>                =yield
> -            .span4
> -              %h3 Operations
> -              =yield_content :actions
> +            .span4#toolbar=yield_content :actions
>          %footer
>            %p
>              &copy; 2009-2011 The Apache Software Foundation and
> individual contributors.
> diff --git a/clients/cimi/views/machine_configurations/index.haml b/
> clients/cimi/views/machine_configurations/index.haml
> index 6b3452e..d24bd75 100644
> --- a/clients/cimi/views/machine_configurations/index.haml
> +++ b/clients/cimi/views/machine_configurations/index.haml
> @@ -8,6 +8,10 @@
>      %li.active
>        MachineConfigurationCollection
>
> +- content_for :actions do
> +  %p
> +    %a{ :href => "#{@machine_configurations.uri}?format=xml",
> :class => 'label warning' } XML
> +    %a{ :href => "#{@machine_configurations.uri}?format=json",
> :class => 'label warning' } JSON
>
>  %blockquote
>    %p
> diff --git a/clients/cimi/views/machine_configurations/show.haml b/
> clients/cimi/views/machine_configurations/show.haml
> index 06663cf..387de62 100644
> --- a/clients/cimi/views/machine_configurations/show.haml
> +++ b/clients/cimi/views/machine_configurations/show.haml
> @@ -11,6 +11,11 @@
>      %li.active
>        = @machine_configuration.name
>
> +- content_for :actions do
> +  %p
> +    %a{ :href => "#{@machine_configuration.uri}?format=xml", :class
> => 'label warning' } XML
> +    %a{ :href => "#{@machine_configuration.uri}?format=json",
> :class => 'label warning' } JSON
> +
>  %blockquote
>    %p
>      The Machine Configuration entity represents the set of
> configuration values
> diff --git a/clients/cimi/views/machine_images/index.haml b/clients/
> cimi/views/machine_images/index.haml
> index 6bfb7fa..54f3711 100644
> --- a/clients/cimi/views/machine_images/index.haml
> +++ b/clients/cimi/views/machine_images/index.haml
> @@ -8,6 +8,10 @@
>      %li.active
>        MachineImageCollection
>
> +- content_for :actions do
> +  %p
> +    %a{ :href => "#{@machine_images.uri}?format=xml", :class =>
> 'label warning' } XML
> +    %a{ :href => "#{@machine_images.uri}?format=json", :class =>
> 'label warning' } JSON
>
>  %blockquote
>    %p
> diff --git a/clients/cimi/views/machine_images/show.haml b/clients/
> cimi/views/machine_images/show.haml
> index 3a6a75d..b3c4120 100644
> --- a/clients/cimi/views/machine_images/show.haml
> +++ b/clients/cimi/views/machine_images/show.haml
> @@ -11,6 +11,11 @@
>      %li.active
>        = @machine_image.name
>
> +- content_for :actions do
> +  %p
> +    %a{ :href => "#{@machine_image.uri}?format=xml", :class =>
> 'label warning' } XML
> +    %a{ :href => "#{@machine_image.uri}?format=json", :class =>
> 'label warning' } JSON
> +
>  %blockquote
>    %p
>      This entity represents the information (e.g. an Open
> Virtualization Format
> diff --git a/clients/cimi/views/machines/index.haml b/clients/cimi/
> views/machines/index.haml
> index be18e65..08205bd 100644
> --- a/clients/cimi/views/machines/index.haml
> +++ b/clients/cimi/views/machines/index.haml
> @@ -10,8 +10,12 @@
>
>  - content_for :actions do
>    %p
> +    %a{ :href => "#{@machines.uri}?format=xml", :class => 'label
> warning' } XML
> +    %a{ :href => "#{@machines.uri}?format=json", :class => 'label
> warning' } JSON
> +  %p
>      %a{ :href => '/cimi/machines/new', :class => 'btn info'} New machine

>
> +
>  %blockquote
>    %p
>      A Machine Collection entity represents the collection of Machine
> diff --git a/clients/cimi/views/machines/show.haml b/clients/cimi/
> views/machines/show.haml
> index 620da17..fa637e5 100644
> --- a/clients/cimi/views/machines/show.haml
> +++ b/clients/cimi/views/machines/show.haml
> @@ -13,6 +13,9 @@
>
>  - content_for :actions do
>    %p
> +    %a{ :href => "#{@machine.uri}?format=xml", :class => 'label
> warning' } XML
> +    %a{ :href => "#{@machine.uri}?format=json", :class => 'label
> warning' } JSON
> +  %p
>      - if @machine.state == 'STARTED'
>        %form{ :action => "/cimi/machines/#{@machine.name}/stop",
> :method => :post, :style => 'display:inline'}
>          %button{ :class => 'btn'} Stop
> diff --git a/clients/cimi/views/volume_configurations/index.haml b/
> clients/cimi/views/volume_configurations/index.haml
> index 602d230..88ed9c8 100644
> --- a/clients/cimi/views/volume_configurations/index.haml
> +++ b/clients/cimi/views/volume_configurations/index.haml
> @@ -7,7 +7,10 @@
>        %span.divider="/"
>      %li.active
>        VolumeConfigurationCollection
> -
> +- content_for :actions do
> +  %p
> +    %a{ :href => "#{@volume_configurations.uri}?format=xml", :class
> => 'label warning' } XML
> +    %a{ :href => "#{@volume_configurations.uri}?format=json",
> :class => 'label warning' } JSON
>
>  %blockquote
>    %p
> diff --git a/clients/cimi/views/volume_configurations/show.haml b/
> clients/cimi/views/volume_configurations/show.haml
> index 373486c..6378ee7 100644
> --- a/clients/cimi/views/volume_configurations/show.haml
> +++ b/clients/cimi/views/volume_configurations/show.haml
> @@ -11,6 +11,11 @@
>      %li.active
>        = @volume_configuration.name
>
> +- content_for :actions do
> +  %p
> +    %a{ :href => "#{@volume_configuration.uri}?format=xml", :class
> => 'label warning' } XML
> +    %a{ :href => "#{@volume_configuration.uri}?format=json", :class
> => 'label warning' } JSON
> +
>  %blockquote
>    %p
>      The Volume Configuration entity represents the set of
> configuration values
> @@ -27,4 +32,4 @@
>    %dt Created
>    %dd #{@volume_configuration.created}&nbsp;
>    %dt Details
> -  %dd=@volume_configuration.inspect
> \ No newline at end of file
> +  %dd=@volume_configuration.inspect
> diff --git a/clients/cimi/views/volume_images/index.haml b/clients/
> cimi/views/volume_images/index.haml
> index e7ab56f..26be6c8 100644
> --- a/clients/cimi/views/volume_images/index.haml
> +++ b/clients/cimi/views/volume_images/index.haml
> @@ -8,6 +8,11 @@
>      %li.active
>        VolumeImageCollection
>
> +- content_for :actions do
> +  %p
> +    %a{ :href => "#{@volume_images.uri}?format=xml", :class =>
> 'label warning' } XML
> +    %a{ :href => "#{@volume_images.uri}?format=json", :class =>
> 'label warning' } JSON
> +
>  %blockquote
>    %p
>      A Volume Image Collection entity represents the collection of
> Volume Image
> diff --git a/clients/cimi/views/volume_images/show.haml b/clients/
> cimi/views/volume_images/show.haml
> index ef396dc..20b3ef4 100644
> --- a/clients/cimi/views/volume_images/show.haml
> +++ b/clients/cimi/views/volume_images/show.haml
> @@ -11,6 +11,11 @@
>      %li.active
>        = @volume_image.name
>
> +- content_for :actions do
> +  %p
> +    %a{ :href => "#{@volume_image.uri}?format=xml", :class =>
> 'label warning' } XML
> +    %a{ :href => "#{@volume_image.uri}?format=json", :class =>
> 'label warning' } JSON
> +
>  %blockquote
>    %p
>      This entity represents the information necessary for hardware
virtualized
> @@ -25,4 +30,4 @@
>    %dt Created
>    %dd=@volume_image.created
>    %dt Details
> -  %dd=@volume_image.inspect
> \ No newline at end of file
> +  %dd=@volume_image.inspect
> diff --git a/clients/cimi/views/volumes/index.haml b/clients/cimi/
> views/volumes/index.haml
> index e9bd529..eedb125 100644
> --- a/clients/cimi/views/volumes/index.haml
> +++ b/clients/cimi/views/volumes/index.haml
> @@ -8,6 +8,10 @@
>      %li.active
>        VolumeCollection
>
> +- content_for :actions do
> +  %p
> +    %a{ :href => "#{@volumes.uri}?format=xml", :class => 'label
> warning' } XML
> +    %a{ :href => "#{@volumes.uri}?format=json", :class => 'label
> warning' } JSON
>
>  %blockquote
>    %p
> diff --git a/clients/cimi/views/volumes/show.haml b/clients/cimi/
> views/volumes/show.haml
> index 85a73f7..f08006b 100644
> --- a/clients/cimi/views/volumes/show.haml
> +++ b/clients/cimi/views/volumes/show.haml
> @@ -11,6 +11,11 @@
>      %li.active
>        = @volume.name
>
> +- content_for :actions do
> +  %p
> +    %a{ :href => "#{@volume.uri}?format=xml", :class => 'label
warning' } XML
> +    %a{ :href => "#{@volume.uri}?format=json", :class => 'label
> warning' } JSON
> +
>  %blockquote
>    %p
>      This entity represents a
> @@ -25,4 +30,4 @@
>    %dt Created
>    %dd #{@volume.created}&nbsp;
>    %dt Details
> -  %dd=@volume.inspect
> \ No newline at end of file
> +  %dd=@volume.inspect
> --
> 1.7.4.4
>