From: Yasin Date: Fri, 23 Jan 2015 16:19:30 +0000 (+0100) Subject: conflict fix X-Git-Tag: myslice-1.3~104 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=87be70ddfd98c34b6d422368c244343a3b36e497;hp=28a58cb30aa9b552dbbf17f777e0aec7d5174eb6;p=myslice.git conflict fix --- diff --git a/myslice/urls.py b/myslice/urls.py index c815148e..da697cf7 100644 --- a/myslice/urls.py +++ b/myslice/urls.py @@ -92,6 +92,7 @@ urls = [ (r'^create/(?P[^/]+)/(?P[^/]+)?/?$', 'rest.create.dispatch'), (r'^delete/(?P[^/]+)/(?P[^/]+)?/?$', 'rest.delete.dispatch'), (r'^credentials/(?P[^/]+)/?$', 'rest.credentials.dispatch'), + (r'^cache/(?P[^/]+)/?$', 'rest.cache.dispatch'), (r'^initscript/(?P[^/]+)/?$', 'rest.initscript.dispatch'), # # REST monitoring diff --git a/portal/actions.py b/portal/actions.py index c80ba652..2075300d 100644 --- a/portal/actions.py +++ b/portal/actions.py @@ -88,7 +88,7 @@ def authority_add_pis(request, authority_hrn,user_hrn): updated_pi_list = pi_list.append(user_hrn) query = Query.update('authority').filter_by('authority_hrn', '==', authority_hrn).set({'pi_users':pi_list}) - results = execute_admin_query(request,query) + results = execute_query(request,query) newpis = authority_get_pis (request, authority_hrn) return newpis except Exception,e: @@ -105,7 +105,7 @@ def authority_remove_pis(request, authority_hrn,user_hrn): updated_pi_list = pi_list.remove(user_hrn) query = Query.update('authority').filter_by('authority_hrn', '==', authority_hrn).set({'pi_users':pi_list}) - results = execute_admin_query(request,query) + results = execute_query(request,query) newpis = authority_get_pis (request, authority_hrn) return newpis except Exception,e: @@ -113,7 +113,6 @@ def authority_remove_pis(request, authority_hrn,user_hrn): return None - def authority_get_pi_emails(request, authority_hrn): pi_users = authority_get_pis(request,authority_hrn) print "pi_users = %s" % pi_users diff --git a/portal/managementtababout.py b/portal/managementtababout.py index 1f5ceca2..ec39f8fc 100644 --- a/portal/managementtababout.py +++ b/portal/managementtababout.py @@ -21,10 +21,13 @@ class ManagementAboutView (FreeAccessView, ThemeView): def get (self, request): + authority_contacts = {} + authority = {'authority_hrn':'fed4fire.upmc'} if request.user.is_authenticated(): user_local_query = Query().get('local:user').select('config').filter_by('email','==',str(self.request.user)) user_local_details = execute_query(self.request, user_local_query) user_authority = json.loads(user_local_details[0]['config']).get('authority') + print "**************________ management about = ",user_authority # XXX Should be done using Metadata # select column.name from local:object where table=='authority' authority_query = Query().get('authority').select('authority_hrn', 'name', 'address', 'enabled','description', @@ -34,7 +37,6 @@ class ManagementAboutView (FreeAccessView, ThemeView): authority_details = execute_query(self.request, authority_query) if authority_details : - authority_contacts = {} authority = authority_details[0] if 'scientific' in authority and authority['scientific'] is not None: authority_contacts['scientific'] = [ x.strip()[1:-1] for x in authority['scientific'][1:-1].split(',') ] diff --git a/portal/static/css/fed4fire.css b/portal/static/css/fed4fire.css index b088b228..987d54e5 100644 --- a/portal/static/css/fed4fire.css +++ b/portal/static/css/fed4fire.css @@ -339,6 +339,7 @@ ul.nav-section li a { ul.nav-section li:first-child { padding:0; } +/* it used to give space for the icon, which has been removed ul.nav-section li:first-child a { font-weight:bold; padding:6px 15px 4px 15px; @@ -346,6 +347,8 @@ ul.nav-section li:first-child a { ul.nav-section li:first-child.active a { padding:6px 15px 3px 15px; } + +*/ ul.nav-section li:first-child img { margin:0 4px 1px 0; padding:0; diff --git a/portal/static/js/institution.js b/portal/static/js/institution.js index 2b2cfa3d..e8d5121c 100644 --- a/portal/static/js/institution.js +++ b/portal/static/js/institution.js @@ -36,11 +36,13 @@ $(document).ready(function() { /* TODO: factorize into functions */ $('button#deleteslices').click(function() { + var flag = false; $('input:checkbox.slice').each(function (index) { if(this.checked){ var record_id = this.id; $.post("/delete/slice/",{'filters':{'slice_hrn':this.id}}, function(data) { if(data.success){ + localStorage.clear(); $('tr[id="'+record_id+'"]').fadeOut("slow"); $('tr[id="'+record_id+'"]').remove(); mysliceAlert('Success: slice deleted','success', true); @@ -76,10 +78,34 @@ $(document).ready(function() { // TODO: refresh table //window.location="/portal/institution#slices"; }); + $('button#deleteprojects').click(function() { + var flag = false; + $('input:checkbox.project').each(function (index) { + if(this.checked){ + var record_id = this.id; + console.log(record_id); + $.post("/delete/myslice:authority/",{'filters':{'authority_hrn':this.id}}, function(data) { + if(data.success){ + localStorage.clear(); + $('tr[id="'+record_id+'"]').fadeOut("slow"); + $('tr[id="'+record_id+'"]').remove(); + mysliceAlert('Success: project deleted','success', true); + }else{ + mysliceAlert('Rest Error for: '+data.error,'warning', true); + //alert("Rest Error for "+record_id+": "+data.error); + } + }); + } + }); + }); $('button#createslice').click(function() { window.location="/portal/slice_request/"; }); + + $('button#createproject').click(function() { + window.location="/portal/project_request/"; + }); $('button#slicerequestbtn').click(function() { /* window.location="/portal/slice_request/"; diff --git a/portal/templates/_widget-no_credentials.html b/portal/templates/_widget-no_credentials.html new file mode 100644 index 00000000..ab07ce7f --- /dev/null +++ b/portal/templates/_widget-no_credentials.html @@ -0,0 +1,66 @@ + + + + + diff --git a/portal/templates/_widget-tradeoff.html b/portal/templates/_widget-tradeoff.html new file mode 100644 index 00000000..4e75ba3e --- /dev/null +++ b/portal/templates/_widget-tradeoff.html @@ -0,0 +1,39 @@ + + diff --git a/portal/templates/fed4fire/fed4fire_account-view.html b/portal/templates/fed4fire/fed4fire_account-view.html index 61634590..5a610f30 100644 --- a/portal/templates/fed4fire/fed4fire_account-view.html +++ b/portal/templates/fed4fire/fed4fire_account-view.html @@ -1,6 +1,8 @@ {% extends "layout.html" %} +{% load portal_filters %} {% block content %} - +{% widget "_widget-no_credentials.html" %} +{% widget "_widget-tradeoff.html" %}
- {%if 'Enabled' in user_status %}

Credentials Delegated to Principal Account

- - - - - - - {% for row in my_users %} - - - - - {%endfor%} -
Delegated User Credential
Expiration DateDownload
{{ row.cred_exp }} - - - -
-

- - - - - - - - {% for row in my_slices %} - - - - - - {%endfor%} -
Delegated Slice Credentials
Slice NameExpiration DateDownload
{{ row.slice_name }} {{ row.cred_exp }} - -
-

- - - - - - - - {% for row in my_auths %} - - - - - - {%endfor%} -
Delegated Authority Credentials
Authority NameExpiration DateDownload
{{ row.auth_name }} {{ row.cred_exp }} - -
-

- {%if '' not in my_users%} -

- {%else%} -

- {%endif%} + + + + + + + {% for row in my_users %} + + + + + {%endfor%} +
Delegated User Credential
Expiration DateDownload
{{ row.cred_exp }} + + + +
+

+ + + + + + + + {% for row in my_slices %} + + + + + + {%endfor%} +
Delegated Slice Credentials
Slice NameExpiration DateDownload
{{ row.slice_name }} {{ row.cred_exp }} + +
+

+ + + + + + + + {% for row in my_auths %} + + + + + + {%endfor%} +
Delegated Authority Credentials
Authority NameExpiration DateDownload
{{ row.auth_name }} {{ row.cred_exp }} + +
+

+ {%if '' not in my_users%} +

+ {%else%} +

+ {%endif%}
- - - - - - -
@@ -437,7 +355,6 @@ e.preventDefault(); $(this).tab('show'); id = $(this).attr('href').substr(1); - }); $('button#createslice').click(function() { diff --git a/portal/templates/fed4fire/fed4fire_home-view.html b/portal/templates/fed4fire/fed4fire_home-view.html index 4c1c6fbc..bb5b16c2 100644 --- a/portal/templates/fed4fire/fed4fire_home-view.html +++ b/portal/templates/fed4fire/fed4fire_home-view.html @@ -6,47 +6,7 @@ {% widget '_widget-news.html' %}
--> {% if username %} - - +{% widget "_widget-no_credentials.html" %}
{%if 'no_creds' in user_cred %} diff --git a/portal/templates/fed4fire/fed4fire_institution.html b/portal/templates/fed4fire/fed4fire_institution.html new file mode 100644 index 00000000..021e3ee2 --- /dev/null +++ b/portal/templates/fed4fire/fed4fire_institution.html @@ -0,0 +1,264 @@ +{% extends "layout_wide.html" %} + +{% block head %} + +{% endblock head %} + +{% block content %} +
+
+
+ +
+
+
+
+
+
+ +
+
+
+
+
+
+

{{user_details.parent_authority}}

+
+
+ +
+
+
Loading Slices
+ + {%if pi %} +
+ {% if project %} + + {% else %} + + + + {% endif %} +
+ {% endif %} +
+
+ + {% if not project %} +
+
+
Loading Projects
+ + {% if pi %} +
+ + + {% else %} + + {% endif %} +
+
+
+ {% endif %} +
+
+
Loading Slices
+ +
+ {% if pi %} + + + + {% else %} + + {% endif %} +
+
+
+
+
+
+ +{% endblock %} diff --git a/portal/templates/institution.html b/portal/templates/institution.html index 26fdf0a9..30fad6cf 100644 --- a/portal/templates/institution.html +++ b/portal/templates/institution.html @@ -28,6 +28,9 @@
+
+

{{user_details.parent_authority}}

+
@@ -50,8 +53,8 @@
{%if pi %}
- - + +
{% endif %} @@ -193,13 +196,13 @@ $(document).ready(function() { e.preventDefault(); $(this).tab('show'); var id = $(this).attr('href').substr(1); - /* if ((id == 'requests')){ $("#" + id).load('/management/' + id); } - */ + /* if ((id == 'requests') || (id == 'about')) $("#" + id).load('/management/' + id); + */ }); var hash = window.location.hash; if (hash) { diff --git a/portal/templates/onelab/onelab_account-view.html b/portal/templates/onelab/onelab_account-view.html index 13da1254..86071f1a 100644 --- a/portal/templates/onelab/onelab_account-view.html +++ b/portal/templates/onelab/onelab_account-view.html @@ -1,6 +1,8 @@ {% extends "layout.html" %} +{% load portal_filters %} {% block content %} - +{% widget "_widget-no_credentials.html" %} +{% widget "_widget-tradeoff.html" %}
- - - - - - - -
diff --git a/portal/templates/onelab/onelab_home-view.html b/portal/templates/onelab/onelab_home-view.html index 32e7373b..bacc2b23 100644 --- a/portal/templates/onelab/onelab_home-view.html +++ b/portal/templates/onelab/onelab_home-view.html @@ -6,53 +6,13 @@ {% widget '_widget-news.html' %}
--> {% if username %} - - +{% widget "_widget-no_credentials.html" %}
- {%if 'no_creds' in user_cred %} -

NO CREDENTIALS are delegated to the portal!

- {%endif%} - {%if 'creds_expired' in user_cred %} -

EXPIRED CREDENTIALS Please delegate again your credentials to the portal!

+ {%if 'no_creds' in user_cred %} +

NO CREDENTIALS are delegated to the portal!

+ {%endif%} + {%if 'creds_expired' in user_cred %} +

EXPIRED CREDENTIALS Please delegate again your credentials to the portal!

{%endif%}
diff --git a/rest/cache.py b/rest/cache.py new file mode 100644 index 00000000..39439469 --- /dev/null +++ b/rest/cache.py @@ -0,0 +1,22 @@ +from django.http import HttpResponse +from portal.actions import clear_user_creds + +from manifoldapi.manifoldapi import execute_query +from manifold.core.query import Query + +import json + +def dispatch(request, action): + + if (action == 'clear') : + query = Query.update('myslice:user').filter_by('user_hrn', '==', '$user_hrn').set({'user_email':str(request.user)}) + try: + res = execute_query(request, query) + except Exception, e: + ret = { "ret" : -1, "error" : "error clearing cache: %s" % e } + return HttpResponse(json.dumps(ret), content_type="application/json") + + ret = { "ret" : 1 } + else: + ret = { "ret" : 0, "error" : "action not supported" } + return HttpResponse(json.dumps(ret), content_type="application/json")