added missing link to accounts on show page
---
src/app/controllers/portal_pool_controller.rb | 5 ++++
src/app/views/portal_pool/accounts.html.erb | 23 ++++++++++++++++++++
src/app/views/portal_pool/show.html.erb | 1 +
.../controllers/portal_pool_controller_spec.rb | 8 +++++++
4 files changed, 37 insertions(+), 0 deletions(-)
create mode 100644 src/app/views/portal_pool/accounts.html.erb
diff --git a/src/app/controllers/portal_pool_controller.rb
b/src/app/controllers/portal_pool_controller.rb
index 5e42d55..1897fc9 100644
--- a/src/app/controllers/portal_pool_controller.rb
+++ b/src/app/controllers/portal_pool_controller.rb
@@ -44,6 +44,11 @@ class PortalPoolController < ApplicationController
require_privilege(Privilege::POOL_VIEW, @pool)
end
+ def accounts
+ @pool = PortalPool.find(params[:id])
+ require_privilege(Privilege::ACCOUNT_VIEW,@pool)
+ end
+
def new
require_privilege(Privilege::POOL_MODIFY)
@portal_pool = PortalPool.new
diff --git a/src/app/views/portal_pool/accounts.html.erb
b/src/app/views/portal_pool/accounts.html.erb
new file mode 100644
index 0000000..81a8a76
--- /dev/null
+++ b/src/app/views/portal_pool/accounts.html.erb
@@ -0,0 +1,23 @@
+<% if @pool.cloud_accounts.size == 0 %>
+<h1>There are no accounts to display</h1>
+<% else %>
+ <table>
+ <thead>
+ <tr>
+ <th scope="col">Provider</th>
+ <th scope="col">Username</th>
+ </tr>
+ </thead>
+ <tbody>
+ <%[email protected]_accounts.each {|account| %>
+ <tr>
+ <td><%= account.provider.name %></td>
+ <td><%= account.username %></td>
+ </tr>
+ <% } %>
+ </tbody>
+ </table>
+<% end %>
+<%= link_to "View/Add Existing Cloud Accounts", {:controller =>
"cloud_accounts",:action => "accounts_for_pool", :pool_id => @pool},
:class=>"actionlink" %>
+<%= link_to "Add a New Cloud Account", {:controller =>
"cloud_accounts",:action => "new_from_pool", :pool_id => @pool},
:class=>"actionlink" %><br/>
+
diff --git a/src/app/views/portal_pool/show.html.erb
b/src/app/views/portal_pool/show.html.erb
index 5a29875..77f8b3b 100644
--- a/src/app/views/portal_pool/show.html.erb
+++ b/src/app/views/portal_pool/show.html.erb
@@ -37,3 +37,4 @@
<% end %>
<%= link_to "Add a new instance", {:controller => "instance", :action =>
"new", :id => @pool}, :class=>"actionlink"%>
<%= link_to "Hardware Profiles", {:action => "hardware_profiles", :id =>
@pool.id}, :class=>"actionlink"%>
+<%= link_to "Accounts", {:action => "accounts", :id => @pool.id},
:class=>"actionlink"%>
diff --git a/src/spec/controllers/portal_pool_controller_spec.rb
b/src/spec/controllers/portal_pool_controller_spec.rb
index 512127d..802017f 100644
--- a/src/spec/controllers/portal_pool_controller_spec.rb
+++ b/src/spec/controllers/portal_pool_controller_spec.rb
@@ -39,5 +39,13 @@ describe PortalPoolController do
response.should render_template("hardware_profiles")
end
+ it "should get cloud accounts" do
+ @pool = Factory :tpool
+ UserSession.create(@admin)
+ get :accounts, :id => @pool.id
+ response.should be_success
+ response.should render_template("accounts")
+ @pool.should_not == nil
+ end
end
--
1.6.2.5
_______________________________________________
deltacloud-devel mailing list
[email protected]
https://fedorahosted.org/mailman/listinfo/deltacloud-devel