From 9e8552374710bbb551c32408b5350206162f052c Mon Sep 17 00:00:00 2001 From: Yasin Date: Wed, 22 Oct 2014 17:17:42 +0200 Subject: [PATCH] list pending slices in dashboard --- README | 2 +- portal/homeview.py | 39 ++++++++++++------- portal/templates/onelab/onelab_home-view.html | 12 ++++++ 3 files changed, 38 insertions(+), 15 deletions(-) diff --git a/README b/README index 4e0b4716..b1f201da 100644 --- 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 diff --git a/portal/homeview.py b/portal/homeview.py index 00b279d2..f1ac37cc 100644 --- a/portal/homeview.py +++ b/portal/homeview.py @@ -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 diff --git a/portal/templates/onelab/onelab_home-view.html b/portal/templates/onelab/onelab_home-view.html index a7871ba2..944bcbe6 100644 --- a/portal/templates/onelab/onelab_home-view.html +++ b/portal/templates/onelab/onelab_home-view.html @@ -143,6 +143,18 @@
Loading Slices
+ {% if pending_slices %} +

Pending slices + +

+ +

+ {%endif%}

-- 2.43.0