deltacloud-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mar...@redhat.com
Subject [PATCH] Add links to provider in HTML UI /api when available JIRA DTACLOUD-105 (EC2 Regions)
Date Wed, 14 Dec 2011 17:02:16 GMT
From: marios <marios@redhat.com>

Addresses https://issues.apache.org/jira/browse/DTACLOUD-105

Signed-off-by: marios <marios@redhat.com>
---
 server/lib/deltacloud/server.rb |    2 ++
 server/views/api/show.html.haml |    2 ++
 2 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/server/lib/deltacloud/server.rb b/server/lib/deltacloud/server.rb
index 88250a6..c6e5622 100644
--- a/server/lib/deltacloud/server.rb
+++ b/server/lib/deltacloud/server.rb
@@ -106,6 +106,8 @@ get "#{settings.root_url}\/?" do
     return [401, 'Authentication failed'] unless driver.valid_credentials?(credentials)
   end
   @collections = [:drivers] + driver.supported_collections
+  #could use driver.providers - but that will require credentials for /api ...
+  @providers = Deltacloud::Drivers::driver_config["#{driver.name}".to_sym][:entrypoints]["#{driver.name}"].keys
unless driver_provider(Deltacloud::Drivers::driver_config["#{driver.name}".to_sym]).empty?
   respond_to do |format|
     format.xml { haml :"api/show" }
     format.json do
diff --git a/server/views/api/show.html.haml b/server/views/api/show.html.haml
index 19526c2..c1417c1 100644
--- a/server/views/api/show.html.haml
+++ b/server/views/api/show.html.haml
@@ -1,5 +1,7 @@
 =header "Deltacloud API #{settings.version}", :back => 'false'
 =subheader "#{driver_symbol}@#{Thread::current[:provider] || ENV['API_PROVIDER'] || 'default'}"
+- if @providers
+  =subheader @providers.map{|p| link_to "#{p} ", "#{settings.root_url}\;provider=#{p}" }
 
 %div{ :'data-role' => :content, :'data-theme' => 'c'}
   %ul{ :'data-role' => :listview, :'data-inset' => 'true'}
-- 
1.7.6.4


Mime
View raw message