| {% load admin_static %} |
| |
| <script> |
| admin_object_name = "{{ opts.object_name }}"; |
| admin_object_id = "{{ original.id }}"; |
| if (admin_object_id == "") { |
| admin_object_id = undefined; |
| } else { |
| admin_object_id = parseInt(admin_object_id, 10); |
| } |
| {% if opts.object_name == "Site" %} |
| admin_controller_sites = []; |
| {% for record in original.controllersite.all %} |
| admin_controller_sites.push( {{ record.id }} ); |
| {% endfor %} |
| {% endif %} |
| {% if opts.object_name == "Slice" %} |
| admin_controller_slices = []; |
| {% for record in original.controllerslice.all %} |
| admin_controller_slices.push( {{ record.id }} ); |
| {% endfor %} |
| {% endif %} |
| </script> |
| |
| {% if not DISABLE_MINIDASHBOARD %} |
| |
| <div id="newMiniDashboard"> |
| <div class="hide" id="selectedMainNav">{{ opts.verbose_name_plural|capfirst }}</div> |
| <div class="hide" id="currentOriginalNode">{{ original|truncatewords:"18" }}</div> |
| <div class="hide" id="minidashStatus"></div> |
| <div class="miniDashPair"> |
| <button type="button" name="nodeCount" id="miniDashNodeCount" class="minidashbutton">--</button> |
| <label for="nodeCount" id="miniDashNodeCountLabel">Active Nodes</label> |
| </div> |
| <div class="miniDashPair"> |
| <button type="button" name="avgLoad" id="miniDashAvgLoad" class="minidashbutton">--</button> |
| <label for="avgLoad" id="miniDashAvgLoadLabel">Average Load</label> |
| </div> |
| <div class="miniDashPair"> |
| <button type="button" name="bandwidth" id="miniDashBandwidth" class="minidashbutton">--</button> |
| <label for="bandwidth" id="miniDashBandwidthLabel">Bandwidth</label> |
| </div> |
| <div class="endDashPair"> |
| </div> |
| </div> |
| |
| <div id="nodeCountDialog" class="miniDashModal" > |
| <div id="nodeCountGraph" ></div> |
| </div> |
| |
| <div id="bandwidthDialog" class="miniDashModal" > |
| <div id="bandwidthGraph" ></div> |
| </div> |
| |
| <div id="avgLoadDialog" class="miniDashModal" > |
| <div id="avgLoadGraph" ></div> |
| </div> |
| |
| <script src="{% static 'page_analytics.js' %}"></script> |
| |
| <script> |
| /** If the analytics have already been set -- read them in on page load **/ |
| if (typeof window != "undefined") { |
| if (typeof window.pageAnalyticsData != "undefined") { |
| updatePageAnalyticsData(window.pageAnalyticsData); |
| } |
| } |
| |
| var loadingDiv = '<div class="loading">Loading ...</div>'; |
| |
| $( "#nodeCountDialog" ).dialog({ title: "OpenCloud Node Count", modal: true, position: ['middle', 40], resizable: true, autoOpen: false, width: 527, height: 400}); |
| $( "#miniDashNodeCount" ).click(function() { |
| $( "#nodeCountGraph" ).html(loadingDiv); |
| $( "#nodeCountDialog" ).dialog("open"); |
| var options = {"title": "Node Count", "vAxis": {"title": "Number of Nodes", "minValue": 0, "maxValue": 250}}; |
| renderChart(true,"#nodeCountDialog", "#nodeCountGraph", window.pageAnalyticsUrl, 0, 2, google.visualization.data.sum, options); |
| }); |
| |
| $( "#bandwidthDialog" ).dialog({ title: "OpenCloud Bandwidth", modal: true, position: ['middle', 40], resizable: true, autoOpen: false, width: 527, height: 400}); |
| $( "#miniDashBandwidth" ).click(function() { |
| $("#bandwidthGraph").html(loadingDiv); |
| $( "#bandwidthDialog" ).dialog("open"); |
| var options = {"title": "Total Bandwidth", "vAxis": {"title": "Total Bandwidth (Gbps)"}}; |
| renderChart(true,"#bandwidthDialog", "#bandwidthGraph", window.pageBandwidthUrl, 0, 1, agg_bandwidth, options); |
| }); |
| |
| $( "#avgLoadDialog" ).dialog({ title: "OpenCloud Average Load", modal: true, position: ['middle', 40], resizable: true, autoOpen: false, width: 527, height: 400}); |
| $( "#miniDashAvgLoad" ).click(function() { |
| $("#avgLoadGraph").html(loadingDiv); |
| $( "#avgLoadDialog" ).dialog("open"); |
| var options = {"title": "Average CPU Utilization", "vAxis": {"title": "CPU Utilization (%)"}}; |
| renderChart(true,"#avgLoadDialog", "#avgLoadGraph", window.pageAnalyticsUrl, 0, 1, google.visualization.data.sum, options); |
| }); |
| |
| </script> |
| |
| {% endif %} |