deltacloud-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lut...@apache.org
Subject svn commit: r1228521 - in /deltacloud/trunk/server: lib/deltacloud/server.rb views/api/show.html.haml
Date Sat, 07 Jan 2012 00:33:52 GMT
Author: lutter
Date: Sat Jan  7 00:33:51 2012
New Revision: 1228521

URL: http://svn.apache.org/viewvc?rev=1228521&view=rev
Log:
Preserve selected driver in HTML /api when switching providers

The 'driver' matrix parameter needs to be included in the URL, in addition
to the newly selected provider in the POST /api handler

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=1228521&r1=1228520&r2=1228521&view=diff
==============================================================================
--- deltacloud/trunk/server/lib/deltacloud/server.rb (original)
+++ deltacloud/trunk/server/lib/deltacloud/server.rb Sat Jan  7 00:33:51 2012
@@ -110,6 +110,7 @@ get "#{settings.root_url}\/?" do
     return [401, 'Authentication failed'] unless driver.valid_credentials?(credentials)
   end
   @collections = [:drivers] + driver.supported_collections
+  @driver_name = driver.name unless driver.name.to_sym == DRIVER
   @providers = driver.configured_providers
   respond_to do |format|
     format.xml { haml :"api/show" }
@@ -128,12 +129,12 @@ get "#{settings.root_url}\/?" do
 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
+  p = {}
+  ["provider", "driver"].each { |k| p[k] = params[k] if params[k] }
+  p.delete("provider") if p["provider"] == "default"
+  q = p.map { |k,v| "#{k}=#{v}" }.join(";")
+  q = ";" + q unless q.empty?
+  redirect "#{settings.root_url}#{q}", 301
 end
 
 # Rabbit DSL

Modified: deltacloud/trunk/server/views/api/show.html.haml
URL: http://svn.apache.org/viewvc/deltacloud/trunk/server/views/api/show.html.haml?rev=1228521&r1=1228520&r2=1228521&view=diff
==============================================================================
--- deltacloud/trunk/server/views/api/show.html.haml (original)
+++ deltacloud/trunk/server/views/api/show.html.haml Sat Jan  7 00:33:51 2012
@@ -9,6 +9,8 @@
 - if @providers.size > 1
   %div{ :'data-role' => :footer, :'data-theme' => 'a'}
     %form{ :action => settings.root_url, :method => :post, :'data-ajax' => 'false'}
+      - if @driver_name
+        %input{ :name => :driver, :type => :hidden, :value => @driver_name }/
       %div{ :'data-role' => :footer, :'data-theme' => 'a' , :class => 'middle-dialog'}
         %label{ :for => :provider, :class => 'ui-input-text'}
         %select{:name => 'provider', :'data-native-menu' => "true" }



Mime
View raw message