Scott Baker | 9416013 | 2014-05-18 18:49:20 -0700 | [diff] [blame^] | 1 | <div id="developerview"></div> |
| 2 | |
| 3 | <div id="confirmNodeAdded" title="Added Node to Site"><p>Added Node to Site</p></div> |
| 4 | <div id="confirmNodeRemoved" title="Removed Node from Site"><p>Added Node to Site</p></div> |
| 5 | <script> |
| 6 | var oTable; |
| 7 | |
| 8 | function updateUserSliceTable(){ |
| 9 | log.debug("Should grab user slice info"); |
| 10 | jQuery.ajax({ |
| 11 | async:true, |
| 12 | dataType: 'json', |
| 13 | url: '/hpcdashuserslices', |
| 14 | success: function(data){ |
| 15 | log.info("Got Data back for User SliceTable"); |
| 16 | //parseData(data); |
| 17 | //createUserSliceTable(data); |
| 18 | setTimeout(function () { updateUserSliceTable() }, 5000); |
| 19 | }, |
| 20 | error: function(data){ |
| 21 | log.debug("COULDNT GET DATA BACK"); |
| 22 | setTimeout(function () { updateUserSliceTable() }, 5000); |
| 23 | } |
| 24 | }); |
| 25 | } |
| 26 | |
| 27 | function createUserSliceTable(data) { |
| 28 | log.debug("Creating User Slice Table"); |
| 29 | |
| 30 | //Add check for #dynamicusersliceinfo_filter label-> input having focus here |
| 31 | |
| 32 | $('#developerview').html( '<table cellpadding="0" cellspacing="0" border="0" class="display" id="dynamicusersliceinfo"></table>' ); |
| 33 | var actualEntries = []; |
| 34 | log.debug(data['userSliceInfo']['rows'][0]['slicename']); |
| 35 | |
| 36 | var rows = data['userSliceInfo']['rows']; |
| 37 | for (row in rows) { |
| 38 | log.debug(row[0]); |
| 39 | slicename = rows[row]['slicename']; |
| 40 | sliceid = rows[row]['sliceid']; |
| 41 | role = rows[row]['role']; |
| 42 | slivercount = rows[row]['slivercount']; |
| 43 | sitecount = rows[row]['sitecount']; |
| 44 | actualEntries.push(['<a href="http://{{request.get_host}}/admin/core/slice/' + sliceid + '">' + slicename + '</a>', |
| 45 | role, slivercount, sitecount]); |
| 46 | } |
| 47 | oTable = $('#dynamicusersliceinfo').dataTable( { |
| 48 | "bJQueryUI": true, |
| 49 | "aaData": actualEntries , |
| 50 | "bStateSave": true, |
| 51 | "aoColumns": [ |
| 52 | { "sTitle": "Slice" }, |
| 53 | { "sTitle": "Privilege" , sClass: "alignCenter"}, |
| 54 | { "sTitle": "Number of Slivers" , sClass: "alignCenter"}, |
| 55 | { "sTitle": "Number of Sites" , sClass: "alignCenter"}, |
| 56 | ] |
| 57 | } ); |
| 58 | |
| 59 | // If the filter had focus, reapply here |
| 60 | |
| 61 | setTimeout(function() { |
| 62 | jQuery.ajax({ |
| 63 | url: '/hpcdashuserslices', |
| 64 | dataType: 'json', |
| 65 | success: function(data){ createUserSliceTable(data); }, |
| 66 | complete: function(){ }, |
| 67 | }); |
| 68 | }, 10000); |
| 69 | } |
| 70 | |
| 71 | function initTable(){ |
| 72 | log.debug("Initializing Table") |
| 73 | jQuery.ajax({ |
| 74 | url: '/hpcdashuserslices', |
| 75 | dataType: 'json', |
| 76 | success: function(data){ createUserSliceTable(data); }, |
| 77 | complete: function(){ |
| 78 | } |
| 79 | }); |
| 80 | updateUserSliceTable(); |
| 81 | } |
| 82 | |
| 83 | |
| 84 | initTable(); |
| 85 | |
| 86 | </script> |