From 50b903c99c3a28b4630b36f49ccb3e6c598d615a Mon Sep 17 00:00:00 2001 From: Yasin Date: Fri, 23 Jan 2015 17:49:21 +0100 Subject: [PATCH] Institution.html: Upgrade to PI added --- .../fed4fire/fed4fire_institution.html | 30 ++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/portal/templates/fed4fire/fed4fire_institution.html b/portal/templates/fed4fire/fed4fire_institution.html index 021e3ee2..b9a4a8e4 100644 --- a/portal/templates/fed4fire/fed4fire_institution.html +++ b/portal/templates/fed4fire/fed4fire_institution.html @@ -143,7 +143,7 @@ $(document).ready(function() { }else{ nodes_length=val.nodes.length; } - console.log(val); + //console.log(val); if(val.users=="undefined" || val.users==null){ users_length=0; }else{ @@ -260,5 +260,33 @@ $(document).ready(function() { $('.nav-tabs a[href=#about]').click(); } }); + +//upgrade users to PI +$(document).ready(function() { + $('button#makepi').click(function() { + var flag = false; + var pi_users = []; + $.post("/rest/myslice:authority/",{'filters':{'authority_hrn': '{{user_details.parent_authority}}'}}, function( data ) { + pi_users = data[0]["pi_users"]; + $('input:checkbox.user').each(function (index) { + if(this.checked){ + var record_id = this.id; + pi_users.push(record_id) + flag = true; + } + }); + if(flag == true){ + $.post("/update/myslice:authority/",{'filters':{'authority_hrn':'fed4fire.upmc'},'params':{'pi_users':pi_users}}, function(data) { + if(data.success){ + mysliceAlert('Success: slice renewed','success', true); + }else{ + mysliceAlert('Rest Error for: '+data.error,'warning', true); + //alert("Rest Error for "+record_id+": "+data.error); + } + }); + } + }); + }); +}); {% endblock %} -- 2.43.0