From sseago@redhat.com Thu Aug 20 00:06:26 2015 From: Scott Seago To: deltacloud-devel@lists.fedorahosted.org Subject: Re: [deltacloud-devel] [PATCH aggregator] instances index/list view and backend Date: Thu, 03 Jun 2010 14:39:05 -0400 Message-ID: <4C07F6C9.3010400@redhat.com> In-Reply-To: =?utf-8?q?=3C1194160652=2E2378831275586527305=2EJavaMail=2Eroot?= =?utf-8?q?=40zmail07=2Ecollab=2Eprod=2Eint=2Ephx2=2Eredhat=2Ecom=3E?= MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============5079910286121176858==" --===============5079910286121176858== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Tomas Sedovic wrote: > ACK with a caveat inline. > > Also, it would be great if it looked and behaved the same way as the pool-s= pecific instance table does now (using the DataTables jquery thingy). > > But that can be in another patch and I'm not sure how important it is for n= ow. > > Thomas > > =20 Actually we probably do want it using the same jquery bits for now, if=20 possible. Scott > ----- Original Message ----- > From: "Mohammed Morsi" > To: deltacloud-devel(a)lists.fedorahosted.org > Sent: Wednesday, June 2, 2010 9:00:14 PM GMT +01:00 Amsterdam / Berlin / Be= rn / Rome / Stockholm / Vienna > Subject: [deltacloud-devel] [PATCH aggregator] instances index/list view an= d backend > > navigating to http://localhost:3000/instance/ when running deltacloud > locally now brings the user to a list of instances in pools which > they have the instance_view permission on > --- > src/app/controllers/instance_controller.rb | 5 +++++ > src/app/views/dashboard/summary.haml | 2 ++ > src/app/views/instance/_list.html.erb | 24 ++++++++++++++++++++++++ > src/app/views/instance/index.html.erb | 3 +-- > 4 files changed, 32 insertions(+), 2 deletions(-) > create mode 100644 src/app/views/instance/_list.html.erb > > diff --git a/src/app/controllers/instance_controller.rb b/src/app/controlle= rs/instance_controller.rb > index c898691..c1c56e9 100644 > --- a/src/app/controllers/instance_controller.rb > +++ b/src/app/controllers/instance_controller.rb > @@ -25,6 +25,11 @@ class InstanceController < ApplicationController > before_filter :require_user > =20 > def index > + @instances =3D current_user.permissions.all.find_all { |perm| > + !perm.role.privileges.all.find { |priv| > + priv.name =3D=3D Privilege::INSTANCE_VIEW > + }.nil? && perm.permission_object_type =3D=3D "Pool" > + }.collect { |perm| perm.permission_object.instances }.fla= tten > end > =20 > # Right now this is essentially a duplicate of PoolController#show, > diff --git a/src/app/views/dashboard/summary.haml b/src/app/views/dashboard= /summary.haml > index 4eeb58b..b64ffb5 100644 > --- a/src/app/views/dashboard/summary.haml > +++ b/src/app/views/dashboard/summary.haml > @@ -38,6 +38,8 @@ > Create a Template > %a{:href =3D> url_for(:controller =3D> "users", :action =3D> "new")} > Create a User > + %a{:href =3D> url_for(:controller =3D> "instance", :action =3D> "index= ")} > + View Instances > - else > %a{:href =3D> url_for(:controller =3D> "", :action =3D> "")} > Launch Instances > diff --git a/src/app/views/instance/_list.html.erb b/src/app/views/instance= /_list.html.erb > new file mode 100644 > index 0000000..66f6eeb > --- /dev/null > +++ b/src/app/views/instance/_list.html.erb > @@ -0,0 +1,24 @@ > +<% if @instances.size =3D=3D 0 %> > +

There are no instances to display

> +<% else %> > + > + > + > + > + > + > + > + > + > + > + <%@instances.each {|instance| %> > + > + > + > + > + > > This outputs something like: # > to the webpage instead of the real image name (e.g. Fedora 10). > > + > + <% } %> > + > +
NamePoolHardware ProfileImage
<%=3D instance.name %><%=3D instance.pool.name if instance.pool %><%=3D instance.hardware_profile.name if instance.hardware_pr= ofile %><%=3D instance.image if instance.image %>
> +<% end %> > diff --git a/src/app/views/instance/index.html.erb b/src/app/views/instance= /index.html.erb > index a632f6c..c19c3fa 100644 > --- a/src/app/views/instance/index.html.erb > +++ b/src/app/views/instance/index.html.erb > @@ -1,2 +1 @@ > -

Instance#index

> -

Find me in app/views/instance/index.html.erb

> +<%=3D render :partial =3D> 'list' %> > =20 --===============5079910286121176858==--