Mohammed Morsi wrote: > --- > .../controllers/hardware_profiles_controller.rb | 39 > ++++++++++++++++++++ > src/app/controllers/portal_pool_controller.rb | 6 +++ > src/app/controllers/provider_controller.rb | 6 +++ > src/app/views/hardware_profiles/_list.html.erb | 24 ++++++++++++ > src/app/views/hardware_profiles/index.html.erb | 1 + > .../views/portal_pool/hardware_profiles.html.erb | 1 + > src/app/views/provider/hardware_profiles.html.erb | 1 + > 7 files changed, 78 insertions(+), 0 deletions(-) > create mode 100644 src/app/controllers/hardware_profiles_controller.rb > create mode 100644 src/app/views/hardware_profiles/_list.html.erb > create mode 100644 src/app/views/hardware_profiles/index.html.erb > create mode 100644 src/app/views/portal_pool/hardware_profiles.html.erb > create mode 100644 src/app/views/provider/hardware_profiles.html.erb > > diff --git a/src/app/controllers/hardware_profiles_controller.rb > b/src/app/controllers/hardware_profiles_controller.rb > new file mode 100644 > index 0000000..523a72c > --- /dev/null > +++ b/src/app/controllers/hardware_profiles_controller.rb > @@ -0,0 +1,39 @@ > +# Copyright (C) 2010 Red Hat, Inc. > +# > +# This program is free software; you can redistribute it and/or modify > +# it under the terms of the GNU General Public License as published by > +# the Free Software Foundation; version 2 of the License. > +# > +# This program is distributed in the hope that it will be useful, > +# but WITHOUT ANY WARRANTY; without even the implied warranty of > +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the > +# GNU General Public License for more details. > +# > +# You should have received a copy of the GNU General Public License > +# along with this program; if not, write to the Free Software > +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, > +# MA 02110-1301, USA. A copy of the GNU General Public License is > +# also available at http://www.gnu.org/copyleft/gpl.html. > + > +# Filters added to this controller apply to all controllers in the > application. > +# Likewise, all the methods added will be available for all controllers. > + > +require 'util/taskomatic' > + > +class HardwareProfilesController < ApplicationController > + before_filter :require_user > + > + def index > + @hardware_profiles = HardwareProfile.find(:all) > + #require_privilege(Privilege::PROVIDER_VIEW, @hardware_profile) ? > + end > Can we get rid of 'index' ? I'm not sure a flat list of all profiles for all providers makes sense -- or maybe 'index' should require a provider ID? Anyway it's not a big deal for this patch -- we just need to decide how to handle this sort of page/request > + > + def new > + end > + > + def create > + end > + > + def delete > + end > +end > diff --git a/src/app/controllers/portal_pool_controller.rb > b/src/app/controllers/portal_pool_controller.rb > index 90df8a5..449f96c 100644 > --- a/src/app/controllers/portal_pool_controller.rb > +++ b/src/app/controllers/portal_pool_controller.rb > @@ -38,6 +38,12 @@ class PortalPoolController < ApplicationController > @instances = @pool.instances > end > > + def hardware_profiles > + @pool = PortalPool.find(params[:id]) > + @hardware_profiles = @pool.hardware_profiles > + require_privilege(Privilege::INSTANCE_VIEW,@pool) > + end > + > Change this to POOL_VIEW > def new > require_privilege(Privilege::POOL_MODIFY) > @portal_pool = PortalPool.new > diff --git a/src/app/controllers/provider_controller.rb > b/src/app/controllers/provider_controller.rb > index 53056f5..b676fa7 100644 > --- a/src/app/controllers/provider_controller.rb > +++ b/src/app/controllers/provider_controller.rb > @@ -50,6 +50,12 @@ class ProviderController < ApplicationController > redirect_to :action => "index" > end > > + def hardware_profiles > + @provider = Provider.find(params[:id]) > + @hardware_profiles = @provider.hardware_profiles > + require_privilege(Privilege::PROVIDER_VIEW, @provider) > + end > + > def accounts > @provider = Provider.find(params[:id]) > require_privilege(Privilege::ACCOUNT_VIEW, @provider) > diff --git a/src/app/views/hardware_profiles/_list.html.erb > b/src/app/views/hardware_profiles/_list.html.erb > new file mode 100644 > index 0000000..6b53194 > --- /dev/null > +++ b/src/app/views/hardware_profiles/_list.html.erb > @@ -0,0 +1,24 @@ > +<% if @hardware_profiles.size == 0 %> > +<h1>There are no hardware profiles to display</h1> > +<% else %> > + <table> > + <thead> > + <tr> > + <th scope="col">Name</th> > + <th scope="col">Memory</th> > + <th scope="col">Storage</th> > + <th scope="col">Architecture</th> > + </tr> > + </thead> > + <tbody> > + <%...@hardware_profiles.each {|hp| %> > + <tr> > + <td><%= hp.name %></td> > + <td><%= hp.memory %></td> > + <td><%= hp.storage %></td> > + <td><%= hp.architecture %></td> > + </tr> > + <% } %> > + </tbody> > + </table> > +<% end %> > diff --git a/src/app/views/hardware_profiles/index.html.erb > b/src/app/views/hardware_profiles/index.html.erb > new file mode 100644 > index 0000000..c19c3fa > --- /dev/null > +++ b/src/app/views/hardware_profiles/index.html.erb > @@ -0,0 +1 @@ > +<%= render :partial => 'list' %> > diff --git a/src/app/views/portal_pool/hardware_profiles.html.erb > b/src/app/views/portal_pool/hardware_profiles.html.erb > new file mode 100644 > index 0000000..579d796 > --- /dev/null > +++ b/src/app/views/portal_pool/hardware_profiles.html.erb > @@ -0,0 +1 @@ > +<%= render :partial => 'hardware_profiles/list' %> > diff --git a/src/app/views/provider/hardware_profiles.html.erb > b/src/app/views/provider/hardware_profiles.html.erb > new file mode 100644 > index 0000000..579d796 > --- /dev/null > +++ b/src/app/views/provider/hardware_profiles.html.erb > @@ -0,0 +1 @@ > +<%= render :partial => 'hardware_profiles/list' %> > Conditional ACK. Make the one permission change, add a link to this on the pool show page and push
Scott _______________________________________________ deltacloud-devel mailing list [email protected] https://fedorahosted.org/mailman/listinfo/deltacloud-devel
