update pending badge
authorCiro Scognamiglio <ciro.scognamiglio@cslash.net>
Tue, 4 Mar 2014 18:20:02 +0000 (19:20 +0100)
committerCiro Scognamiglio <ciro.scognamiglio@cslash.net>
Tue, 4 Mar 2014 18:20:02 +0000 (19:20 +0100)
portal/static/img/testbeds/iotlab.png [new file with mode: 0644]
portal/static/img/testbeds/nitos.png [new file with mode: 0644]
portal/static/img/testbeds/planetlab.png [new file with mode: 0644]
portal/static/img/testbeds/plc.png [new file with mode: 0644]
portal/static/img/testbeds/ple.png [new file with mode: 0644]
portal/static/img/testbeds/wilab.png [new file with mode: 0644]
portal/static/js/institution.js
portal/static/js/myslice-ui.js
portal/templates/onelab/onelab_testbed-list.html

diff --git a/portal/static/img/testbeds/iotlab.png b/portal/static/img/testbeds/iotlab.png
new file mode 100644 (file)
index 0000000..0c373e6
Binary files /dev/null and b/portal/static/img/testbeds/iotlab.png differ
diff --git a/portal/static/img/testbeds/nitos.png b/portal/static/img/testbeds/nitos.png
new file mode 100644 (file)
index 0000000..311fbbb
Binary files /dev/null and b/portal/static/img/testbeds/nitos.png differ
diff --git a/portal/static/img/testbeds/planetlab.png b/portal/static/img/testbeds/planetlab.png
new file mode 100644 (file)
index 0000000..bb0a197
Binary files /dev/null and b/portal/static/img/testbeds/planetlab.png differ
diff --git a/portal/static/img/testbeds/plc.png b/portal/static/img/testbeds/plc.png
new file mode 100644 (file)
index 0000000..e44bf47
Binary files /dev/null and b/portal/static/img/testbeds/plc.png differ
diff --git a/portal/static/img/testbeds/ple.png b/portal/static/img/testbeds/ple.png
new file mode 100644 (file)
index 0000000..64e1cbf
Binary files /dev/null and b/portal/static/img/testbeds/ple.png differ
diff --git a/portal/static/img/testbeds/wilab.png b/portal/static/img/testbeds/wilab.png
new file mode 100644 (file)
index 0000000..4ce8035
Binary files /dev/null and b/portal/static/img/testbeds/wilab.png differ
index 17858fe..dc44870 100644 (file)
@@ -51,6 +51,29 @@ $(document).ready(function() {
             }
         });
     });
+    $('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();
+        console.log(one_month_later);
+        $('input:checkbox.slice').each(function (index) {
+            if(this.checked){
+                var record_id = this.id;
+                $.post("/update/slice/",{'filters':{'slice_hrn':this.id},'params':{'expires':one_month_later}}, function(data) {
+                    if(data.success){
+                        // TODO: highlight row after success
+                        //$('tr[id="'+record_id+'"]').highlight();
+                    }else{
+                        alert("Rest Error for "+record_id+": "+data.error);
+                    }
+                });
+                
+            }
+        });
+        // TODO: refresh table
+        //window.location="/portal/institution#slices";
+    });
 
     $('button#createslice').click(function() {
         window.location="/portal/slice_request/";
index ef95e46..4aa83ce 100644 (file)
@@ -8,20 +8,44 @@ $(document).ready(function() {
        
        
        /* Testbeds list */
-       $("table#testbedList").load("/table/network/", { "fields" : ["network_hrn","description"], "options": ["checkbox"] }, function() {
-                       $(this).dataTable( {
-                       "sScrollY": window.innerHeight - 275,
-                       "sDom": "frtiS",
-               "bScrollCollapse": true,
-               "bStateSave": true,
-               "bPaginate": false,
-               "bLengthChange": false,
-               "bFilter": false,
-               "bSort": true,
-               "bInfo": false,
-               "bAutoWidth": true,
-               "bAutoHeight": false
-               } );
+
+       $.post("/rest/network/", { "fields" : ["network_hrn", "network_longname", "description"]}, function(data) {
+                       var testbed_data = [];
+                       var testbed_row = "<thead>";
+                       testbed_row += "<tr>";
+                       testbed_row += "<th id=testbed_check><input type=\"checkbox\" name=\"network_hrn\" value=\"all\"/></th>";
+                       testbed_row += "<th id=testbed_icon></th>";
+                       testbed_row += "<th>network_hrn</th>";
+                       testbed_row += "<th>Full name</th>";
+                       testbed_row += "<th>Description</th>";
+                       testbed_row += "</tr>";
+                       testbed_row += "</thead>";
+                       testbed_data.push(testbed_row);
+                       $.each( data, function(key, val) {
+                               testbed_row = "<tr data-keys=\""+val.network_hrn+"\" class=\"odd\">"
+                               testbed_row += "<td><input type=\"checkbox\" name=\"network_hrn\" value=\""+val.network_hrn+"\"/></td>";
+                               testbed_row += "<td><img src='/static/img/testbeds/"+val.network_hrn+".png' alt='' /></td>";
+                               testbed_row += "<td>"+val.network_hrn+"</td>";
+                               testbed_row += "<td>"+val.network_longname+"</td>";
+                               testbed_row += "<td>"+val.description+"</td>";
+                               testbed_row += "</thead>";
+       
+                               testbed_data.push(testbed_row);
+                       });
+               $("table#testbedList").html(testbed_data.join(''));
+               $("div#testbed-list-loaded").css("display","block");
+               $("div#testbed-list-loading").css("display","none");
+                       
+               $("input[type=checkbox]").click(function() {
+                       var cnt = 0;
+                       var id = $(this).val();
+                       var row = $(this).parent().parent()
+                       if (row.hasClass("active")) {
+                               row.removeClass("active");
+                       } else {
+                               row.addClass("active");
+                               }
+               });
        });
        
        $("#objectList").load("/table/resource/", {"fields" : ["hostname","hrn","country","type"], "options": ["checkbox"] }, function(data) {
index a0872bf..e16b4e3 100644 (file)
@@ -13,6 +13,9 @@
                          <li><a href="#"></a></li>
                        </ul>
                </div>
-               <table cellpadding="0" cellspacing="0" border="0" class="table" id="testbedList"></table>
+               <div id="testbed-list-loading"><img src="{{ STATIC_URL }}img/loading.gif" alt="Loading Testbeds" /></d    iv>
+               <div id="testbed-list-loaded" style="display:none;">
+                       <table cellpadding="0" cellspacing="0" border="0" class="table" id="testbedList"></table>
+               </div>
        </div>
-{% endblock %}
\ No newline at end of file
+{% endblock %}