2 $('input:checkbox').each(function (index) {
4 this.nextElementSibling.style.display = "none";
9 $('input:checkbox').each(function (index) {
11 this.nextElementSibling.style.display = "inline";
15 function post_renew(obj){
16 var record_id = obj.id;
17 $.post("/sfa/Renew/",{'hrn':record_id,'type':'slice'}, function(data) {
20 $.each(data, function (index, val) {
21 console.log(index, val);
22 if (index != 'columns' && !('error' in val)){
23 if('code' in val && val['code']['geni_code']==0){
24 if('output' in val && val['output']!=''){
25 txt += index+': '+val['output']+'<br>';
27 if('value' in val && val['value']!=''){
28 if(typeof val['value'] == 'string' || val['value'] instanceof String){
29 txt += index+': '+val['value']+'<br>';
31 txt += index+': expiration = '+val['value'][0]['geni_expires']+'<br>';
35 if('output' in val && val['output']!=''){
36 errors += index+': '+val['output']+'<br>';
38 if('value' in val && val['value']!=''){
39 errors += index+': '+val['value']+'<br>';
44 errors += index+': '+val['error_msg']+'<br>';
48 console.log(record_id);
50 mysliceAlert('Success: '+record_id+'<br>'+txt,'success', false, record_id);
53 mysliceAlert('Warning: '+record_id+'<br>'+errors,'warning', false, record_id);
58 $(document).ready(function() {
61 $('.nav-tabs a').click(function (e) {
64 id = $(this).attr('href').substr(1);
65 if (!(id in loadedTabs)) {
69 loadedTabs[id] = true;
76 $('button#deleteusers').click(function() {
78 $('input:checkbox.user').each(function (index) {
80 var record_id = this.id;
81 var user_email = this.dataset.email;
83 // Delete in SFA Registry
84 $.post("/delete/user/",{'filters':{'user_hrn':record_id}}, function(data) {
86 $.post("/local_user/delete/",{'email':user_email}, function(data) {
89 mysliceAlert('Success: user deleted','success', true);
91 mysliceAlert('Local DB Error for: '+record_id,'warning', true);
93 $('tr[id="'+record_id+'"]').fadeOut("slow");
94 $('tr[id="'+record_id+'"]').remove();
96 //$.post("/delete/local:user/",{'filters':{'user_hrn':this.id}}, function(data) {
98 mysliceAlert('Rest Error for: '+data.error,'warning', true);
99 //alert("Rest Error for "+record_id+": "+data.error);
107 /* TODO: factorize into functions */
108 $('button#deleteslices').click(function() {
111 $('input:checkbox.slice').each(function (index) {
113 var record_id = this.id;
114 $('#'+record_id+'-loading').spin();
115 $.post("/delete/slice/",{'filters':{'slice_hrn':this.id}}, function(data) {
117 localStorage.clear();
118 $('tr[id="'+record_id+'"]').fadeOut("slow");
119 $('tr[id="'+record_id+'"]').remove();
120 mysliceAlert('Success: slice deleted','success', true);
122 mysliceAlert('Rest Error for: '+data.error,'warning', true);
123 //alert("Rest Error for "+record_id+": "+data.error);
130 $('button#renewslices').click(function() {
133 var now = new Date();
134 /* In Javascript getMonth() gives month[0] = january, month[1] = february, and so on... */
135 var month = now.getMonth()+2;
136 var one_month_later = now.getFullYear()+"-"+month+"-"+now.getDate()+" "+now.getHours()+":"+now.getMinutes()+":"+now.getSeconds();
137 $('input:checkbox.slice').each(function (index) {
139 console.log(this.id);
140 record_id = $(this).attr('id');
141 $('#'+this.id+'-loading').spin();
142 // /sfa/Renew?hrn=onelab.upmc.projectx.slicex&type=slice
146 // TODO: refresh table
147 //window.location="/portal/institution#slices";
149 $('button#deleteprojects').click(function() {
152 $('input:checkbox.project').each(function (index) {
154 var record_id = this.id;
155 $('#'+record_id+'-loading').spin();
156 console.log(record_id);
157 $.post("/delete/myslice:authority/",{'filters':{'authority_hrn':this.id}}, function(data) {
159 localStorage.clear();
160 $('tr[id="'+record_id+'"]').fadeOut("slow");
161 $('tr[id="'+record_id+'"]').remove();
162 mysliceAlert('Success: project deleted','success', true);
164 mysliceAlert('Rest Error for: '+data.error,'warning', true);
165 //alert("Rest Error for "+record_id+": "+data.error);
173 $('button#createslice').click(function() {
174 window.location="/portal/slice_request/";
177 $('button#createproject').click(function() {
178 window.location="/portal/project_request/";
180 $('button#slicerequestbtn').click(function() {
182 window.location="/portal/slice_request/";
187 /*function loadUsers() {
188 $('div#users table').load('/table/user/',
190 'fields' : [ 'user_hrn', 'user_first_name', 'user_last_name', 'user_email', 'user_phone' ],
191 'filters' : { 'parent_authority' : $('div#users').data('authority') },
192 'options' : [ 'checkbox' ]