4 <div id="slice-info"><img src="{{ STATIC_URL }}img/loading.gif" alt="Loading Slices" /></div>
9 $(document).ready(function() {
10 $.post("/rest/slice/",{'filters':{'slice_hrn':'{{slice}}'}}, function( data ) {
11 var table_slices = [];
12 /* "slice_hrn", "slice_description", "slice_type", "parent_authority", "created", "nodes", "slice_url", "slice_last_updated", "user", "slice_urn", "slice_expires" */
13 $.each( data, function( key, val ) {
15 if(val.nodes=="undefined" || val.nodes==null){
18 nodes_length=val.nodes.length;
21 if(val.users=="undefined" || val.users==null){
24 user_length=val.users.length;
27 if(val.slice_url=="undefined" || val.slice_url==null){
30 slice_url="<a href='"+val.slice_url+"' target='_blank'>"+val.slice_url+"</a>";
33 // slice_row = "<tr><td>Description:</b></td><td>"+val.slice_description+"</td></tr>";
34 // slice_row += "<tr><td>url:</td><td><a href='"+val.slice_url+" target='_blank'>"+val.slice_url+"</a></td></tr>";
35 slice_row = "<tr><td>users:</td><td>"+user_length+"</td></tr>";
36 //slice_row += "<tr><td>resources:</td><td>"+nodes_length+"</td></tr>";
37 //slice_row += "<tr><td>created:</td><td>"+val.created+"</td></tr>";
38 slice_row += "<tr><td>last update:</td><td>"+val.slice_last_updated+"</td></tr>";
39 //slice_row += "<tr><td>expires:</td><td>"+val.slice_expires+"</td></tr>";
40 table_slices.push(slice_row);
42 $("div#slice-info").html("<table>" + table_slices.join( "" ) + "</table>");
44 $('button#renewslices').click(function() {
46 /* In Javascript getMonth() gives month[0] = january, month[1] = february, and so on... */
47 var month = now.getMonth()+2;
48 var one_month_later = now.getFullYear()+"-"+month+"-"+now.getDate()+" "+now.getHours()+":"+now.getMinutes()+":"+now.getSeconds();
49 $.post("/update/slice/",{'filters':{'slice_hrn':'{{slice}}'},'params':{'expires':one_month_later}}, function(data) {
51 mysliceAlert('Success: slice renewed','success', true);
54 mysliceAlert('Rest Error for: '+data.error,'warning', true);
58 $('button#deleteslices').click(function() {
59 if (confirm('Are you sure? It will remove the slice permanently.')) {
60 $.post("/delete/slice/",{'filters':{'slice_hrn':'{{slice}}'}}, function(data) {
64 user_email.push ('{{username}}');
65 $.post("/credentials/clear/",{'emails':user_email}, function(data) {
66 }); // post credentials clear
67 mysliceAlert('Success: slice deleted','success', true);
69 mysliceAlert('Rest Error for: '+data.error,'warning', true);
71 window.location.replace("/");
83 <button id="renewslices" type="button" class="btn btn-primary"><span class="glyphicon glyphicon-refresh"></span> Renew slice</button>
84 <button id="deleteslices" type="button" class="btn btn-danger"><span class="glyphicon glyphicon-remove"></span> Delete slice</button>