deltacloud-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mar...@apache.org
Subject git commit: Reinstate the post /api call for changing provider in HTML UI /api when available. Also adds changing of driver.
Date Fri, 25 May 2012 15:30:18 GMT
Updated Branches:
  refs/heads/master 3ba239871 -> 3952b80d4


Reinstate the post /api call for changing provider in HTML UI
/api when available. Also adds changing of driver.

(originally addressed in JIRA DTACLOUD-105 (EC2 Regions))


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

Branch: refs/heads/master
Commit: 3952b80d4592bd7cad973365ba73080573a6a5b2
Parents: 3ba2398
Author: marios <marios@redhat.com>
Authored: Fri May 25 18:26:50 2012 +0300
Committer: marios <marios@redhat.com>
Committed: Fri May 25 18:26:50 2012 +0300

----------------------------------------------------------------------
 server/lib/deltacloud/server.rb |   17 +++++++++++++++++
 server/views/api/show.html.haml |   12 ++++++++++++
 server/views/layout.html.haml   |    2 +-
 3 files changed, 30 insertions(+), 1 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/deltacloud/blob/3952b80d/server/lib/deltacloud/server.rb
----------------------------------------------------------------------
diff --git a/server/lib/deltacloud/server.rb b/server/lib/deltacloud/server.rb
index fced64b..e26f427 100644
--- a/server/lib/deltacloud/server.rb
+++ b/server/lib/deltacloud/server.rb
@@ -53,6 +53,23 @@ module Deltacloud
       end
     end
 
+    post Deltacloud[:root_url] + '/?' do
+      param_driver, param_provider = params["driver"], params["provider"]
+      if param_driver
+        redirect "#{Deltacloud[:root_url]}\;driver=#{param_driver}", 301
+      elsif param_provider && param_provider != "default"
+#FIXME NEEDS A BETTER WAY OF GRABBING CURRENT DRIVER FROM MATRIX PARAMS...
+        current_matrix_driver = env["HTTP_REFERER"].match(/\;(driver)=(\w*).*$/i)
+        if current_matrix_driver
+          redirect "#{Deltacloud[:root_url]}\;driver=#{$2}\;provider=#{param_provider}",
301
+        else
+          redirect "#{Deltacloud[:root_url]}\;provider=#{param_provider}", 301
+        end
+      else
+        redirect "#{Deltacloud[:root_url]}", 301
+      end
+    end
+
   end
 end
 

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/3952b80d/server/views/api/show.html.haml
----------------------------------------------------------------------
diff --git a/server/views/api/show.html.haml b/server/views/api/show.html.haml
index 4630a87..ef666d8 100644
--- a/server/views/api/show.html.haml
+++ b/server/views/api/show.html.haml
@@ -8,6 +8,18 @@
       %li
         %a{ :href => api_url_for(c.collection_name),  :'data-icon' => "arrow-r"}=c.collection_name.to_s.gsub('_',
' ').titlecase
 
+
+- unless Deltacloud::Drivers.driver_config.nil?
+  %div{ :'data-role' => :footer, :'data-theme' => 'a'}
+    %form{ :action => settings.root_url, :method => :post, :'data-ajax' => 'false'}
+      %fieldset{ :'data-type' => "horizontal", :'data-role' => "controlgroup", :id
=> "providers" }
+        %select{:name => 'driver', :'data-inline' => 'true', :'data-native-menu' =>
'false'}
+          %option{ :value => "#{driver_symbol.to_s}"} #{driver_symbol.to_s}
+          - Deltacloud::Drivers.driver_config.keys.each do |driver|
+            %option{ :value => driver } #{driver}
+        %button{ :type => :submit, :'data-inline' => "true"} Change Driver
+
+
 - unless driver.configured_providers.empty?
   %div{ :'data-role' => :footer, :'data-theme' => 'a'}
     %form{ :action => settings.root_url, :method => :post, :'data-ajax' => 'false'}

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/3952b80d/server/views/layout.html.haml
----------------------------------------------------------------------
diff --git a/server/views/layout.html.haml b/server/views/layout.html.haml
index 639c618..4806d59 100644
--- a/server/views/layout.html.haml
+++ b/server/views/layout.html.haml
@@ -18,7 +18,7 @@
         %div{ 'data-role' => :navbar}
           %ul
             %li
-              %a{ :'data-icon' => 'home', :href => api_url_for(''), :'data-ajax' =>
'false'} Home
+              %a{ :'data-icon' => 'home', :href => "#{api_url_for('').chomp("/")}",
:'data-ajax' => 'false'} Home
             %li=link_to_format(:xml)
             %li=link_to_format(:json)
         %div{ 'data-role' => :header, 'data-theme' => 'a' }


Mime
View raw message