list pending slices in dashboard
authorYasin <mohammed-yasin.rahman@lip6.fr>
Wed, 22 Oct 2014 15:17:42 +0000 (17:17 +0200)
committerYasin <mohammed-yasin.rahman@lip6.fr>
Wed, 22 Oct 2014 15:17:42 +0000 (17:17 +0200)
README
portal/homeview.py
portal/templates/onelab/onelab_home-view.html

diff --git a/README b/README
index 4e0b471..b1f201d 100644 (file)
--- a/README
+++ b/README
@@ -11,7 +11,7 @@ See the devel/ subdir for more devel-oriented doc.
 ** see devel/django-install.txt in case of trouble
 $ apt-get install python-django
 $ apt-get install python-django-south
-$ apt-get install python-pip
+$ apt-get install python-pip or sudo easy_install pip==1.4.1
 $ pip install requests
 $ pip install djangorestframework
 * git clone git://git.onelab.eu/myslice.git
index 00b279d..f1ac37c 100644 (file)
@@ -1,24 +1,25 @@
 # this somehow is not used anymore - should it not be ?
-from django.core.context_processors import csrf
-from django.http import HttpResponseRedirect
-from django.contrib.auth import authenticate, login, logout
-from django.template import RequestContext
-from django.shortcuts import render_to_response
-from django.shortcuts import render
+from django.core.context_processors     import csrf
+from django.http                        import HttpResponseRedirect
+from django.contrib.auth                import authenticate, login, logout
+from django.template                    import RequestContext
+from django.shortcuts                   import render_to_response
+from django.shortcuts                   import render
 
-import json
 
-from unfold.loginrequired import FreeAccessView
+from unfold.loginrequired               import FreeAccessView
 
 from manifold.core.query                import Query
 from manifoldapi.manifoldapi            import execute_query
 
-from manifoldapi.manifoldresult import ManifoldResult
-from ui.topmenu import topmenu_items, the_user
-from myslice.configengine import ConfigEngine
+from manifoldapi.manifoldresult         import ManifoldResult
+from ui.topmenu                         import topmenu_items, the_user
+from myslice.configengine               import ConfigEngine
 
-from myslice.theme import ThemeView
+from myslice.theme                      import ThemeView
+from portal.models                      import PendingSlice
 
+import json
 import activity.user
 
 class HomeView (FreeAccessView, ThemeView):
@@ -97,8 +98,13 @@ class HomeView (FreeAccessView, ThemeView):
                         user_cred = 'no_creds'
                     else:
                         user_cred = 'has_creds'
+                    
+                    # list the pending slices of this user
+                    pending_slices = []
+                    for slices in PendingSlice.objects.filter(type_of_nodes__iexact=self.request.user).all():
+                        pending_slices.append(slices.slice_name)
 
-
+                    env['pending_slices'] = pending_slices
                     env['pi'] = pi
                     env['user_cred'] = user_cred                
                 else: 
@@ -155,8 +161,13 @@ class HomeView (FreeAccessView, ThemeView):
                 user_cred = 'no_creds'
             else:
                 user_cred = 'has_creds'
-           
 
+            # list the pending slices of this user
+            pending_slices = []
+            for slices in PendingSlice.objects.filter(type_of_nodes__iexact=self.request.user).all():
+                pending_slices.append(slices.slice_name)
+        
+            env['pending_slices'] = pending_slices
             env['pi'] = pi
             env['user_cred'] = user_cred                
             env['person'] = self.request.user
index a7871ba..944bcbe 100644 (file)
                        <div>   
                                <div id="home-slice-list"><img src="{{ STATIC_URL }}img/loading.gif" alt="Loading Slices" /></div>
                        </div>
+                       {% if pending_slices %}
+                       <p><strong>Pending slices</strong>
+                       <span title="Slices that you have requested and are pending for validation by the contact person of your organization."
+                               class="glyphicon glyphicon-info-sign">
+                       <ul>
+                       {% for slices in pending_slices %}
+                       <li>{{slices}}</li>
+                       {% endfor %}
+                       </ul>
+                       </span>
+                       </p>
+                       {%endif%}       
                </div>
                <div class="col-md-4">
                        <h3>