deltacloud-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dko...@apache.org
Subject [9/9] git commit: CIMI: added resource metadata to client UI
Date Tue, 09 Jul 2013 06:25:15 GMT
CIMI: added resource metadata to client UI


Project: http://git-wip-us.apache.org/repos/asf/deltacloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/deltacloud/commit/9e36a229
Tree: http://git-wip-us.apache.org/repos/asf/deltacloud/tree/9e36a229
Diff: http://git-wip-us.apache.org/repos/asf/deltacloud/diff/9e36a229

Branch: refs/heads/master
Commit: 9e36a22966c96c80f8e24763b325103e3e3bea11
Parents: 3306c61
Author: Dies Koper <diesk@fast.au.fujitsu.com>
Authored: Sat Jun 22 21:49:45 2013 +1000
Committer: Dies Koper <diesk@fast.au.fujitsu.com>
Committed: Mon Jul 8 22:27:16 2013 +1000

----------------------------------------------------------------------
 clients/cimi/app.rb                             |  1 +
 clients/cimi/lib/entities.rb                    |  1 +
 clients/cimi/lib/entities/resource_metadata.rb  | 30 ++++++++
 clients/cimi/views/resource_metadata/index.haml | 24 +++++++
 clients/cimi/views/resource_metadata/show.haml  | 76 ++++++++++++++++++++
 5 files changed, 132 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/deltacloud/blob/9e36a229/clients/cimi/app.rb
----------------------------------------------------------------------
diff --git a/clients/cimi/app.rb b/clients/cimi/app.rb
index ea6a3c7..104afde 100644
--- a/clients/cimi/app.rb
+++ b/clients/cimi/app.rb
@@ -38,6 +38,7 @@ module CIMI::Frontend
     use CIMI::Frontend::NetworkPortTemplate
     use CIMI::Frontend::NetworkTemplate
     use CIMI::Frontend::NetworkPort
+    use CIMI::Frontend::ResourceMetadata
     use Rack::Session::Cookie
 
     helpers CIMI::Frontend::Helper

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/9e36a229/clients/cimi/lib/entities.rb
----------------------------------------------------------------------
diff --git a/clients/cimi/lib/entities.rb b/clients/cimi/lib/entities.rb
index 6099802..680d52d 100644
--- a/clients/cimi/lib/entities.rb
+++ b/clients/cimi/lib/entities.rb
@@ -38,3 +38,4 @@ require 'entities/network_port'
 require 'entities/network_port_configuration'
 require 'entities/network_port_template'
 require 'entities/network_template'
+require 'entities/resource_metadata'

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/9e36a229/clients/cimi/lib/entities/resource_metadata.rb
----------------------------------------------------------------------
diff --git a/clients/cimi/lib/entities/resource_metadata.rb b/clients/cimi/lib/entities/resource_metadata.rb
new file mode 100644
index 0000000..92d6677
--- /dev/null
+++ b/clients/cimi/lib/entities/resource_metadata.rb
@@ -0,0 +1,30 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.  The
+# ASF licenses this file to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance with the
+# License.  You may obtain a copy of the License at
+#
+#       http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+class CIMI::Frontend::ResourceMetadata < CIMI::Frontend::Entity
+
+  get '/cimi/resource_metadata/:id' do
+    resource_metadata_xml = get_entity('resource_metadata', params[:id], credentials)
+    @resource_metadata = CIMI::Model::ResourceMetadata.from_xml(resource_metadata_xml)
+    haml :'resource_metadata/show'
+  end
+
+  get '/cimi/resource_metadata' do
+    resource_metadata_xml = get_entity_collection('resource_metadata', credentials)
+    @resource_metadata = collection_class_for(:resource_metadata).from_xml(resource_metadata_xml)
+    haml :'resource_metadata/index'
+  end
+
+end

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/9e36a229/clients/cimi/views/resource_metadata/index.haml
----------------------------------------------------------------------
diff --git a/clients/cimi/views/resource_metadata/index.haml b/clients/cimi/views/resource_metadata/index.haml
new file mode 100644
index 0000000..55b3e34
--- /dev/null
+++ b/clients/cimi/views/resource_metadata/index.haml
@@ -0,0 +1,24 @@
+- @title=collection_name @resource_metadata
+
+- content_for :breadcrumb do
+  %ul.breadcrumb
+    %li
+      %a{ :href => "/cimi/cloudEntryPoint"} CloudEntryPoint
+      %span.divider="/"
+    %li.active
+      ResourceMetadataCollection
+
+- content_for :actions do
+  %p
+    %a{ :href => "#{@resource_metadata.id}?format=xml", :class => 'label warning' }
XML
+    %a{ :href => "#{@resource_metadata.id}?format=json", :class => 'label warning'
} JSON
+
+%h3 ResourceMetadataCollection
+%ul
+  - @resource_metadata.resource_metadata.each do |meta|
+    %li
+      %a{ :href => "/cimi/resource_metadata/#{href_to_id(meta.id)}"}=href_to_id(meta.id)
+
+- details do
+  - row 'ID', @resource_metadata.id
+  - row 'Count', @resource_metadata.count

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/9e36a229/clients/cimi/views/resource_metadata/show.haml
----------------------------------------------------------------------
diff --git a/clients/cimi/views/resource_metadata/show.haml b/clients/cimi/views/resource_metadata/show.haml
new file mode 100644
index 0000000..c96d1fa
--- /dev/null
+++ b/clients/cimi/views/resource_metadata/show.haml
@@ -0,0 +1,76 @@
+- @title="#{@resource_metadata.name}"
+
+- content_for :breadcrumb do
+  %ul.breadcrumb
+    %li
+      %a{ :href => "/cimi/cloudEntryPoint"} CloudEntryPoint
+      %span.divider="/"
+    %li
+      %a{ :href => "/cimi/resource_metadata"} ResourceMetadataCollection
+      %span.divider="/"
+    %li.active
+      = @resource_metadata.name
+
+- content_for :actions do
+  %p
+    %a{ :href => "#{@resource_metadata.id}?format=xml", :class => 'label warning' }
XML
+    %a{ :href => "#{@resource_metadata.id}?format=json", :class => 'label warning'
} JSON
+
+- details do
+  - row 'ID', @resource_metadata.id
+  - row 'Name', @resource_metadata.name
+  - row 'TypeURI', @resource_metadata.type_uri
+
+%h5 Attributes
+%table{ :class => 'table table-bordered table-striped' }
+  %thead
+    %tr
+      %th Name
+      %th Namespace
+      %th Type
+      %th Required
+      %th Constraints
+  %tbody
+    - @resource_metadata.attributes.each do |attribute|
+      %tr
+        %td=attribute.name
+        %td=attribute.namespace||'N/A'
+        %td=attribute.type||'N/A'
+        %td=attribute.required||'false'
+        %td=attribute.constraints.collect {|c| c.value}.join ', '
+
+%h5 Capabilities
+%table{ :class => 'table table-bordered table-striped' }
+  %thead
+    %tr
+      %th Name
+      %th URI
+      %th Description
+      %th Value
+  %tbody
+    - @resource_metadata.capabilities.each do |capability|
+      %tr
+        %td=capability.name
+        %td=capability.uri
+        %td=capability.description
+        %td=capability.value||'true'
+
+%h5 Actions
+%table{ :class => 'table table-bordered table-striped' }
+  %thead
+    %tr
+      %th Name
+      %th URI
+      %th Description
+      %th Method
+      %th InputMessage
+      %th OutputMessage
+  %tbody
+    - @resource_metadata.actions.each do |action|
+      %tr
+        %td=action.name
+        %td=action.uri
+        %td=action.description
+        %td=action.method
+        %td=action.inputMessage
+        %td=action.outputMessage


Mime
View raw message