From: Loic Baron Date: Fri, 23 Jan 2015 16:14:28 +0000 (+0100) Subject: Institution page both for Authority and Projects, using _widget as partial templates... X-Git-Tag: myslice-1.3~104^2 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=75100a6b42855f7004db7200e796d2680f1add91;p=myslice.git Institution page both for Authority and Projects, using _widget as partial templates to clean the code --- diff --git a/portal/actions.py b/portal/actions.py index 8965a9fe..64d814aa 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 @@ -101,7 +101,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 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%}