requires "spec fixes and updates" patch to be applied first --- src/app/controllers/portal_pool_controller.rb | 5 ++++ src/app/views/portal_pool/accounts.html.erb | 21 ++++++++++++++++++++ .../controllers/portal_pool_controller_spec.rb | 8 +++++++ 3 files changed, 34 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 90df8a5..1cdb96a 100644 --- a/src/app/controllers/portal_pool_controller.rb +++ b/src/app/controllers/portal_pool_controller.rb @@ -38,6 +38,11 @@ class PortalPoolController < ApplicationController @instances = @pool.instances end
+ def accounts + @pool = PortalPool.find(params[:id]) + require_privilege(Privilege::INSTANCE_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..b6042d6 --- /dev/null +++ b/src/app/views/portal_pool/accounts.html.erb @@ -0,0 +1,21 @@ +<% 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> + <%@pool.cloud_accounts.each {|account| %> + <tr> + <td><%= account.provider.name %></td> + <td><%= account.username %></td> + </tr> + <% } %> + </tbody> + </table> +<% end %> +<%= link_to "Add an account", {:controller => "portal_pool", :action => "new_account", :pool => @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 bc01a31..a65fe83 100644 --- a/src/spec/controllers/portal_pool_controller_spec.rb +++ b/src/spec/controllers/portal_pool_controller_spec.rb @@ -29,5 +29,13 @@ describe PortalPoolController do response.should redirect_to("http://test.host/portal_pool/show/#%7Bid%7D") 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
Mohammed Morsi wrote:
requires "spec fixes and updates" patch to be applied first
src/app/controllers/portal_pool_controller.rb | 5 ++++ src/app/views/portal_pool/accounts.html.erb | 21 ++++++++++++++++++++ .../controllers/portal_pool_controller_spec.rb | 8 +++++++ 3 files changed, 34 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 90df8a5..1cdb96a 100644 --- a/src/app/controllers/portal_pool_controller.rb +++ b/src/app/controllers/portal_pool_controller.rb @@ -38,6 +38,11 @@ class PortalPoolController < ApplicationController @instances = @pool.instances end
- def accounts
- @pool = PortalPool.find(params[:id])
- require_privilege(Privilege::INSTANCE_VIEW,@pool)
This should be ACCOUNT_VIEW
- 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..b6042d6 --- /dev/null +++ b/src/app/views/portal_pool/accounts.html.erb @@ -0,0 +1,21 @@ +<% 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>
- <%@pool.cloud_accounts.each {|account| %>
<tr>
<td><%= account.provider.name %></td>
<td><%= account.username %></td>
</tr>
<% } %>
</tbody>
</table>
+<% end %> +<%= link_to "Add an account", {:controller => "portal_pool", :action => "new_account", :pool => @pool.id}, :class => "actionlink" %>
I guess this link needs to be hooked up to slinabery's new account UI -- i.e. his patch (once done) will have two links to 'add new account' and 'add existing account' -- both selectively hidden based on permissions.
In addition, you should provide a link _to_ this page from the pool show page.
Scott
diff --git a/src/spec/controllers/portal_pool_controller_spec.rb b/src/spec/controllers/portal_pool_controller_spec.rb index bc01a31..a65fe83 100644 --- a/src/spec/controllers/portal_pool_controller_spec.rb +++ b/src/spec/controllers/portal_pool_controller_spec.rb @@ -29,5 +29,13 @@ describe PortalPoolController do response.should redirect_to("http://test.host/portal_pool/show/#%7Bid%7D") 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
On 03/18/2010 03:01 PM, Scott Seago wrote:
Mohammed Morsi wrote:
requires "spec fixes and updates" patch to be applied first
src/app/controllers/portal_pool_controller.rb | 5 ++++ src/app/views/portal_pool/accounts.html.erb | 21 ++++++++++++++++++++ .../controllers/portal_pool_controller_spec.rb | 8 +++++++ 3 files changed, 34 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 90df8a5..1cdb96a 100644 --- a/src/app/controllers/portal_pool_controller.rb +++ b/src/app/controllers/portal_pool_controller.rb @@ -38,6 +38,11 @@ class PortalPoolController < ApplicationController @instances = @pool.instances end
- def accounts
- @pool = PortalPool.find(params[:id])
- require_privilege(Privilege::INSTANCE_VIEW,@pool)
This should be ACCOUNT_VIEW
Changed
- 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..b6042d6 --- /dev/null +++ b/src/app/views/portal_pool/accounts.html.erb @@ -0,0 +1,21 @@ +<% 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>
- <%@pool.cloud_accounts.each {|account| %>
<tr>
<td><%= account.provider.name %></td>
<td><%= account.username %></td>
</tr>
- <% } %>
</tbody>
</table>
+<% end %> +<%= link_to "Add an account", {:controller => "portal_pool", :action => "new_account", :pool => @pool.id}, :class => "actionlink" %>
I guess this link needs to be hooked up to slinabery's new account UI -- i.e. his patch (once done) will have two links to 'add new account' and 'add existing account' -- both selectively hidden based on permissions.
In addition, you should provide a link _to_ this page from the pool show page.
Scott
Both updated and patch resent.
-Mo
deltacloud-devel@lists.fedorahosted.org