deltacloud-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mar...@apache.org
Subject svn commit: r1226450 - in /deltacloud/trunk/server: lib/deltacloud/server.rb views/api/show.html.haml
Date Mon, 02 Jan 2012 16:04:18 GMT
Author: marios
Date: Mon Jan  2 16:04:18 2012
New Revision: 1226450

URL: http://svn.apache.org/viewvc?rev=1226450&view=rev
Log:
Add way to change provider in HTML UI /api when available JIRA DTACLOUD-105 (EC2 Regions)

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

Modified:
    deltacloud/trunk/server/lib/deltacloud/server.rb
    deltacloud/trunk/server/views/api/show.html.haml

Modified: deltacloud/trunk/server/lib/deltacloud/server.rb
URL: http://svn.apache.org/viewvc/deltacloud/trunk/server/lib/deltacloud/server.rb?rev=1226450&r1=1226449&r2=1226450&view=diff
==============================================================================
--- deltacloud/trunk/server/lib/deltacloud/server.rb (original)
+++ deltacloud/trunk/server/lib/deltacloud/server.rb Mon Jan  2 16:04:18 2012
@@ -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
@@ -122,6 +124,15 @@ get "#{settings.root_url}\/?" do
   end
 end
 
+post "#{settings.root_url}\/?"  do
+  provider = params["provider"]
+  if provider && provider != "default"
+    redirect "#{settings.root_url}\;provider=#{params['provider']}", 301
+  else
+    redirect settings.root_url, 301
+  end
+end
+
 # Rabbit DSL
 
 collection :drivers do

Modified: deltacloud/trunk/server/views/api/show.html.haml
URL: http://svn.apache.org/viewvc/deltacloud/trunk/server/views/api/show.html.haml?rev=1226450&r1=1226449&r2=1226450&view=diff
==============================================================================
--- deltacloud/trunk/server/views/api/show.html.haml (original)
+++ deltacloud/trunk/server/views/api/show.html.haml Mon Jan  2 16:04:18 2012
@@ -5,3 +5,15 @@
   %ul{ :'data-role' => :listview, :'data-inset' => 'true'}
     - @collections.sort_by { |k| k.to_s }.each do |key|
       %li= link_to key.to_s.gsub('_', ' ').titlecase, api_url_for(key), :'data-icon' =>
"arrow-r", :'data-ajax' => false
+
+- if @providers
+  %div{ :'data-role' => :footer, :'data-theme' => 'a'}
+    %form{ :action => settings.root_url, :method => :post, :'data-ajax' => 'false'}
+      %div{ :'data-role' => :footer, :'data-theme' => 'a' , :class => 'middle-dialog'}
+        %label{ :for => :provider, :class => 'ui-input-text'}
+        %select{:name => 'provider', :'data-native-menu' => "true" }
+          %option{ :value => 'default'} default
+          - @providers.each do |provider|
+            %option{ :value => provider } #{provider}
+        %button{ :type => :submit} Change Provider
+



Mime
View raw message