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 2011/12/14 18:02:16 UTC
[PATCH] Add links to provider in HTML UI /api when available JIRA DTACLOUD-105 (EC2 Regions)
From: marios <ma...@redhat.com>
Addresses https://issues.apache.org/jira/browse/DTACLOUD-105
Signed-off-by: marios <ma...@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
Re: [PATCH] Add links to provider in HTML UI /api when available
JIRA DTACLOUD-105 (EC2 Regions)
Posted by "marios@redhat.com" <ma...@redhat.com>.
pls ignore - new version of patch attached to the jira ticket
https://issues.apache.org/jira/browse/DTACLOUD-105
On 14/12/11 19:02, marios@redhat.com wrote:
> From: marios <ma...@redhat.com>
>
> Addresses https://issues.apache.org/jira/browse/DTACLOUD-105
>
> Signed-off-by: marios <ma...@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'}