X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=portal%2Ftemplates%2Fslice-tab-info.html;h=b304ecaae67dcc081162cd59bbe7a1102ef4cd03;hb=485d5ae5ddd76213a6ba7d80a7a6d5048786b804;hp=bd10ac38566ad2e43e233639bf2984996da28247;hpb=5a40dbe074a307538769ae873e446323d6a75f39;p=unfold.git
diff --git a/portal/templates/slice-tab-info.html b/portal/templates/slice-tab-info.html
index bd10ac38..b304ecaa 100644
--- a/portal/templates/slice-tab-info.html
+++ b/portal/templates/slice-tab-info.html
@@ -11,16 +11,17 @@
var table_slices = [];
/* "slice_hrn", "slice_description", "slice_type", "parent_authority", "created", "nodes", "slice_url", "slice_last_updated", "user", "slice_urn", "slice_expires" */
$.each( data, function( key, val ) {
+ console.log(val);
if(val.nodes=="undefined" || val.nodes==null){
nodes_length=0;
}else{
nodes_length=val.nodes.length;
}
- if(val.user=="undefined" || val.user==null){
+ if(val.users=="undefined" || val.users==null){
user_length=0;
}else{
- user_length=val.user.length;
+ user_length=val.users.length;
}
if(val.slice_url=="undefined" || val.slice_url==null){
@@ -29,16 +30,52 @@
slice_url=""+val.slice_url+"";
}
- slice_row = "
Description: | "+val.slice_description+" |
";
- slice_row += "url: | "+val.slice_url+" |
";
- slice_row += "users: | "+user_length+" |
";
- slice_row += "resources: | "+nodes_length+" |
";
- slice_row += "created: | "+val.created+" |
";
+ // slice_row = "Description: | "+val.slice_description+" |
";
+ // slice_row += "url: | "+val.slice_url+" |
";
+ slice_row = "users: | "+user_length+" |
";
+ //slice_row += "resources: | "+nodes_length+" |
";
+ //slice_row += "created: | "+val.created+" |
";
slice_row += "last update: | "+val.slice_last_updated+" |
";
- slice_row += "expires: | "+val.slice_expires+" |
";
+ //slice_row += "expires: | "+val.slice_expires+" |
";
table_slices.push(slice_row);
});
$("div#slice-info").html("" + table_slices.join( "" ) + "
");
});
+ $('button#renewslices').click(function() {
+ var now = new Date();
+ /* In Javascript getMonth() gives month[0] = january, month[1] = february, and so on... */
+ var month = now.getMonth()+2;
+ var one_month_later = now.getFullYear()+"-"+month+"-"+now.getDate()+" "+now.getHours()+":"+now.getMinutes()+":"+now.getSeconds();
+ $.post("/update/slice/",{'filters':{'slice_hrn':'{{slice}}'},'params':{'expires':one_month_later}}, function(data) {
+ if(data.success){
+ mysliceAlert('Success: slice renewed','success', true);
+ }
+ else{
+ mysliceAlert('Rest Error for: '+data.error,'warning', true);
+ }
+ });
+ });
+ $('button#deleteslices').click(function() {
+ if (confirm('Are you sure? It will remove the slice permanently.')) {
+ $.post("/delete/slice/",{'filters':{'slice_hrn':'{{slice}}'}}, function(data) {
+ if(data.success){
+ localStorage.clear();
+ mysliceAlert('Success: slice deleted','success', true);
+ }else{
+ mysliceAlert('Rest Error for: '+data.error,'warning', true);
+ }
+ window.location.replace("/");
+ });
+ }
+ else {
+ return false;
+ }
+ });
});
-
\ No newline at end of file
+
+
+
+
+
+
+