| <div id="developerview"></div> |
| |
| <script> |
| var oTable; |
| |
| function updateUserSliceTable(){ |
| log.debug("Should grab user slice info"); |
| jQuery.ajax({ |
| async:true, |
| dataType: 'json', |
| url: '/hpcdashuserslices', |
| success: function(data){ |
| log.info("Got Data back for User SliceTable"); |
| //parseData(data); |
| //createUserSliceTable(data); |
| setTimeout(function () { updateUserSliceTable() }, 5000); |
| }, |
| error: function(data){ |
| log.debug("COULDNT GET DATA BACK"); |
| setTimeout(function () { updateUserSliceTable() }, 5000); |
| } |
| }); |
| } |
| |
| function createUserSliceTable(data) { |
| log.debug("Creating User Slice Table"); |
| |
| //Add check for #dynamicusersliceinfo_filter label-> input having focus here |
| |
| $('#developerview').html( '<table cellpadding="0" cellspacing="0" border="0" class="display" id="dynamicusersliceinfo"></table>' ); |
| var actualEntries = []; |
| //log.debug(data['userSliceInfo']['rows'][0]['slicename']); |
| |
| var rows = data['userSliceInfo']['rows']; |
| for (row in rows) { |
| log.debug(row[0]); |
| slicename = rows[row]['slicename']; |
| sliceid = rows[row]['sliceid']; |
| role = rows[row]['role']; |
| slivercount = rows[row]['slivercount']; |
| sitecount = rows[row]['sitecount']; |
| actualEntries.push(['<a href="http://{{request.get_host}}/admin/core/slice/' + sliceid + '">' + slicename + '</a>', |
| role, slivercount, sitecount]); |
| } |
| oTable = $('#dynamicusersliceinfo').dataTable( { |
| "bJQueryUI": true, |
| "aaData": actualEntries , |
| "bStateSave": true, |
| "aoColumns": [ |
| { "sTitle": "Slice" }, |
| { "sTitle": "Privilege" , sClass: "alignCenter"}, |
| { "sTitle": "Number of Slivers" , sClass: "alignCenter"}, |
| { "sTitle": "Number of Sites" , sClass: "alignCenter"}, |
| ] |
| } ); |
| |
| // If the filter had focus, reapply here |
| |
| setTimeout(function() { |
| jQuery.ajax({ |
| url: '/hpcdashuserslices', |
| dataType: 'json', |
| success: function(data){ createUserSliceTable(data); }, |
| complete: function(){ }, |
| }); |
| }, 10000); |
| } |
| |
| function initTable(){ |
| log.debug("Initializing Table") |
| jQuery.ajax({ |
| url: '/hpcdashuserslices', |
| dataType: 'json', |
| success: function(data){ createUserSliceTable(data); }, |
| complete: function(){ |
| } |
| }); |
| updateUserSliceTable(); |
| } |
| |
| |
| initTable(); |
| |
| </script> |