from myslice.theme import ThemeView
+from portal.account import Account, get_expiration
#
-import json, os, re, itertools
+import json, os, re, itertools, time
from OpenSSL import crypto
from Crypto.PublicKey import RSA
if acc_user_cred == {} or acc_user_cred == 'N/A':
user_cred = 'no_creds'
else:
- user_cred = 'has_creds'
+ exp_date = get_expiration(acc_user_cred, 'timestamp')
+ if exp_date < time.time():
+ user_cred = 'creds_expired'
+ else:
+ user_cred = 'has_creds'
context = super(AccountView, self).get_context_data(**kwargs)
context['principal_acc'] = principal_acc_list
from myslice.configengine import ConfigEngine
from myslice.theme import ThemeView
+from portal.account import Account, get_expiration
from portal.models import PendingSlice
-import json
+import json, time
import activity.user
class HomeView (FreeAccessView, ThemeView):
if acc_user_cred == {} or acc_user_cred == 'N/A':
user_cred = 'no_creds'
else:
- user_cred = 'has_creds'
-
+ exp_date = get_expiration(acc_user_cred, 'timestamp')
+ if exp_date < time.time():
+ user_cred = 'creds_expired'
+ 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():
if acc_user_cred == {} or acc_user_cred == 'N/A':
user_cred = 'no_creds'
else:
- user_cred = 'has_creds'
+ exp_date = get_expiration(acc_user_cred, 'timestamp')
+ if exp_date < time.time():
+ user_cred = 'creds_expired'
+ else:
+ user_cred = 'has_creds'
# list the pending slices of this user
pending_slices = []
</div>
{%if 'no_creds' in user_cred %}
<p class="command"><a href="#" style="color:red" data-toggle="modal" data-target="#myModal">NO CREDENTIALS</a> are delegated to the portal!</p>
-{%endif%}
+ {%endif%}
+ {%if 'creds_expired' in user_cred %}
+ <p class="command"><a href="#" style="color:red" data-toggle="modal" data-target="#myModal">EXPIRED CREDENTIALS</a> Please delegate again your credentials to the portal!</p>
+ {%endif%}
</div>
{% if messages %}
{%if 'no_creds' in user_cred %}
<p class="command"><a href="#" style="color:red" data-toggle="modal" data-target="#myModal">NO CREDENTIALS</a> are delegated to the portal!</p>
{%endif%}
+ {%if 'creds_expired' in user_cred %}
+ <p class="command"><a href="#" style="color:red" data-toggle="modal" data-target="#myModal">EXPIRED CREDENTIALS</a> Please delegate again your credentials to the portal!</p>
+ {%endif%}
<div class="row">
{%if 'is_pi' in pi %}
$('button#slicerequestbtn').click(function() {
window.location="/portal/slice_request/";
});
-/*-------
-List of slices has been moved in
-portal/templates/base.html
-This should go into session
---------*/
+
+ /*
+ Launch queries to get the resources and leases in Manifold Cache
+ */
+
+ $.post("/rest/resource/", function( data ) {
+ });
+ $.post("/rest/lease/", function( data ) {
+ });
+
+ /*-------
+ List of slices has been moved in
+ portal/templates/base.html
+ This is now in localStorage
+ --------*/
+ // myslice.user is in LocalStorage
+ if(myslice.user.slices.length>0){
+ $.each( myslice.user.slices, function(i, val) {
+ /*
+ Launch a Query for each slice to get resources and leases in Manifold Cache
+ */
+ $.post("/rest/slice/", { 'filters': { 'slice_hrn' : val } }, function(data) {
+ });
+ });
+ }
});
</script>
{# widget "_widget-monitor.html" #}