| {% extends "admin/base.html" %} |
| {% load admin_static %} |
| |
| {% block content %} |
| <h1>Welcome <a href="core/user/{{user.id}}">{{user.email}}</a> from Site: <a href="core/site/{{site.id}}">{{site}}</a></h1> |
| <table class="table table-striped table-bordered table-hover table-condensed"> |
| <thead><tr> |
| <th class="sortable">Slices</th><th class="sortable">Privilege</th> |
| <th class="sortable">Reservations</th> |
| </tr></thead> |
| {% for entry in userSliceInfo %} |
| <tr><td> <a href="core/slice/{{entry.slice.id}}">{{entry.slice.name}}</a><br> |
| </td><td>{{entry.role}}</td> |
| {% if entry.reservations %} |
| <td><a href="core/slice/{{entry.slice.id}}/#reservations"> |
| {% for resSlot in entry.reservations.1 %} |
| {{resSlot}} <br> |
| {% endfor %} |
| </a></td></tr> |
| {% else %} |
| <td></td></tr> |
| {% endif %} |
| {% endfor %} |
| </table> |
| <script type="text/javascript" src="{% static 'log4javascript-1.4.6/log4javascript.js' %}"></script> |
| <h1>HPC Dashboard</h1> |
| <span id="hpcSummary"> |
| <span class="summary-attr"><b>Active Slivers:</b> 78 </span> |
| <span class="summary-attr"><b>Overall Throughput:</b> 58Gbps</span> |
| <span class="summary-attr-util"><b>CPU Utilization:</b> 45%</span> |
| |
| </span> |
| <div id="map-us" ></div> |
| <link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.7.2/leaflet.css" /> |
| <script src="http://cdn.leafletjs.com/leaflet-0.7.2/leaflet.js"></script> |
| |
| <script src="{% static 'js/Leaflet.MakiMarkers.js' %}" > </script> |
| |
| <script> |
| var consoleAppender = new log4javascript.BrowserConsoleAppender(); |
| var patternLayout = new log4javascript.PatternLayout("%d{HH:mm:ss,SSS} %l{s:l} %-5p - %m{1}%n"); |
| consoleAppender.setLayout(patternLayout); |
| |
| var log = log4javascript.getRootLogger(); |
| log.addAppender(consoleAppender); |
| log.setLevel(log4javascript.Level.ALL); |
| |
| |
| L.Map = L.Map.extend({ |
| openPopup: function(popup) { |
| this._popup = popup; |
| |
| return this.addLayer(popup).fire('popupopen', { |
| popup: this._popup |
| }); |
| } |
| }); |
| |
| |
| //Iterate through data and find the max/min coordinates to include all of our points to start |
| var map = L.map('map-us'); //.setView([0, 0], 1); |
| |
| L.tileLayer('http://{s}.tile.cloudmade.com/BC9A493B41014CAABB98F0471D759707/997/256/{z}/{x}/{y}.png', { |
| maxZoom: 18, |
| attribution: 'Test' |
| }).addTo(map); |
| |
| var arrayOfLatLngs = []; |
| var data = {{ cdnData|safe }}; |
| log.info( data ); |
| |
| for ( var key in data ) { |
| arrayOfLatLngs.push([data[key]['lat'],data[key]['long']]); |
| log.info( arrayOfLatLngs ); |
| var colorChoices = ["#007FFF", "#0000FF", "#7f00ff", "#FF00FF", "#FF007F", "#FF0000"]; |
| |
| var ratio = data[key]['numHPCSlivers']/data[key]['numNodes'] * 100; |
| var numColors = colorChoices.length; |
| var colorBands = 100/numColors; |
| |
| log.info("numColors: " + numColors); |
| log.info("colorBands: " + colorBands); |
| log.info("ratio: " + ratio); |
| |
| //Algorithm for color tone should consider the number of available nodes |
| // on the site, and then how much the current dedicated nodes are impacted |
| //var iconColor = 0; |
| var iconColor = 0; |
| for (;iconColor < numColors; iconColor ++) { |
| if (ratio < colorBands * iconColor+1) { |
| break; |
| } |
| } |
| |
| var icon = L.MakiMarkers.icon({icon: "star-stroked", color: colorChoices[iconColor] , size: "s"}); |
| |
| L.marker([data[key]['lat'], data[key]['long']], {icon: icon}).addTo(map) |
| .bindPopup( '<span class="SiteDetail"><b>' + key + '</b></span>' + |
| '</br><a href="' + data[key]['siteUrl'] + '">' + data[key]['siteUrl'] + '</a>' + |
| '</br><b>Available Nodes: </b>' + data[key]['numNodes'] + |
| '</br><b>Active HPC Slivers: </b>' + data[key]['numHPCSlivers'] + |
| '</br><span id="addSlivers">Add HPC Slivers</span>' + |
| '<span id="remSlivers">Remove HPC Slivers</span>' + |
| |
| '');//.openPopup(); |
| |
| } |
| var bounds = new L.LatLngBounds(arrayOfLatLngs); |
| map.fitBounds(bounds); |
| |
| var popup = L.popup(); |
| |
| function onMapClick(e) { |
| popup |
| .setLatLng(e.latlng) |
| .setContent("You clicked the map at " + e.latlng.toString()) |
| .openOn(map); |
| } |
| |
| </script> |
| {% endblock %} |