Scott Baker | 5c4ce2b | 2014-07-08 09:35:40 -0700 | [diff] [blame] | 1 | {% load admin_static %} |
| 2 | |
Scott Baker | f53a0ca | 2015-01-13 00:33:45 -0800 | [diff] [blame^] | 3 | <script> |
| 4 | admin_object_name = "{{ opts.object_name }}"; |
| 5 | admin_object_id = "{{ original.id }}"; |
| 6 | if (admin_object_id == "") { |
| 7 | admin_object_id = undefined; |
| 8 | } else { |
| 9 | admin_object_id = parseInt(admin_object_id, 10); |
| 10 | } |
| 11 | {% if opts.object_name == "Site" %} |
| 12 | admin_controller_sites = []; |
| 13 | {% for record in original.controllersite.all %} |
| 14 | admin_controller_sites.push( {{ record.id }} ); |
| 15 | {% endfor %} |
| 16 | {% endif %} |
| 17 | {% if opts.object_name == "Slice" %} |
| 18 | admin_controller_slices = []; |
| 19 | {% for record in original.controllerslice.all %} |
| 20 | admin_controller_slices.push( {{ record.id }} ); |
| 21 | {% endfor %} |
| 22 | {% endif %} |
| 23 | </script> |
| 24 | |
Scott Baker | a226eb4 | 2014-06-09 11:55:26 -0700 | [diff] [blame] | 25 | {% if not DISABLE_MINIDASHBOARD %} |
| 26 | |
Scott Baker | 38ece4a | 2014-03-27 09:08:36 -0700 | [diff] [blame] | 27 | <div id="newMiniDashboard"> |
Scott Baker | 61aefcf | 2014-04-25 15:21:18 -0700 | [diff] [blame] | 28 | <div class="hide" id="selectedMainNav">{{ opts.verbose_name_plural|capfirst }}</div> |
| 29 | <div class="hide" id="currentOriginalNode">{{ original|truncatewords:"18" }}</div> |
Scott Baker | f2c26de | 2014-06-10 20:37:40 -0700 | [diff] [blame] | 30 | <div class="hide" id="minidashStatus"></div> |
Scott Baker | 38ece4a | 2014-03-27 09:08:36 -0700 | [diff] [blame] | 31 | <div class="miniDashPair"> |
| 32 | <button type="button" name="nodeCount" id="miniDashNodeCount" class="minidashbutton">--</button> |
Scott Baker | f4f7bf9 | 2014-05-13 17:04:40 -0700 | [diff] [blame] | 33 | <label for="nodeCount" id="miniDashNodeCountLabel">Active Nodes</label> |
Scott Baker | 38ece4a | 2014-03-27 09:08:36 -0700 | [diff] [blame] | 34 | </div> |
| 35 | <div class="miniDashPair"> |
| 36 | <button type="button" name="avgLoad" id="miniDashAvgLoad" class="minidashbutton">--</button> |
| 37 | <label for="avgLoad" id="miniDashAvgLoadLabel">Average Load</label> |
| 38 | </div> |
| 39 | <div class="miniDashPair"> |
| 40 | <button type="button" name="bandwidth" id="miniDashBandwidth" class="minidashbutton">--</button> |
| 41 | <label for="bandwidth" id="miniDashBandwidthLabel">Bandwidth</label> |
| 42 | </div> |
| 43 | <div class="endDashPair"> |
| 44 | </div> |
| 45 | </div> |
| 46 | |
| 47 | <div id="nodeCountDialog" class="miniDashModal" > |
| 48 | <div id="nodeCountGraph" ></div> |
| 49 | </div> |
| 50 | |
| 51 | <div id="bandwidthDialog" class="miniDashModal" > |
| 52 | <div id="bandwidthGraph" ></div> |
| 53 | </div> |
| 54 | |
| 55 | <div id="avgLoadDialog" class="miniDashModal" > |
| 56 | <div id="avgLoadGraph" ></div> |
| 57 | </div> |
| 58 | |
Scott Baker | 5c4ce2b | 2014-07-08 09:35:40 -0700 | [diff] [blame] | 59 | <script src="{% static 'page_analytics.js' %}"></script> |
| 60 | |
Scott Baker | 38ece4a | 2014-03-27 09:08:36 -0700 | [diff] [blame] | 61 | <script> |
| 62 | /** If the analytics have already been set -- read them in on page load **/ |
| 63 | if (typeof window != "undefined") { |
| 64 | if (typeof window.pageAnalyticsData != "undefined") { |
| 65 | updatePageAnalyticsData(window.pageAnalyticsData); |
| 66 | } |
| 67 | } |
| 68 | |
| 69 | var loadingDiv = '<div class="loading">Loading ...</div>'; |
| 70 | |
| 71 | $( "#nodeCountDialog" ).dialog({ title: "OpenCloud Node Count", modal: true, position: ['middle', 40], resizable: true, autoOpen: false, width: 527, height: 400}); |
| 72 | $( "#miniDashNodeCount" ).click(function() { |
| 73 | $( "#nodeCountGraph" ).html(loadingDiv); |
| 74 | $( "#nodeCountDialog" ).dialog("open"); |
| 75 | var options = {"title": "Node Count", "vAxis": {"title": "Number of Nodes", "minValue": 0, "maxValue": 250}}; |
Scott Baker | 38ece4a | 2014-03-27 09:08:36 -0700 | [diff] [blame] | 76 | renderChart(true,"#nodeCountDialog", "#nodeCountGraph", window.pageAnalyticsUrl, 0, 2, google.visualization.data.sum, options); |
| 77 | }); |
| 78 | |
| 79 | $( "#bandwidthDialog" ).dialog({ title: "OpenCloud Bandwidth", modal: true, position: ['middle', 40], resizable: true, autoOpen: false, width: 527, height: 400}); |
| 80 | $( "#miniDashBandwidth" ).click(function() { |
| 81 | $("#bandwidthGraph").html(loadingDiv); |
| 82 | $( "#bandwidthDialog" ).dialog("open"); |
| 83 | var options = {"title": "Total Bandwidth", "vAxis": {"title": "Total Bandwidth (Gbps)"}}; |
| 84 | renderChart(true,"#bandwidthDialog", "#bandwidthGraph", window.pageBandwidthUrl, 0, 1, agg_bandwidth, options); |
| 85 | }); |
| 86 | |
| 87 | $( "#avgLoadDialog" ).dialog({ title: "OpenCloud Average Load", modal: true, position: ['middle', 40], resizable: true, autoOpen: false, width: 527, height: 400}); |
| 88 | $( "#miniDashAvgLoad" ).click(function() { |
| 89 | $("#avgLoadGraph").html(loadingDiv); |
| 90 | $( "#avgLoadDialog" ).dialog("open"); |
| 91 | var options = {"title": "Average CPU Utilization", "vAxis": {"title": "CPU Utilization (%)"}}; |
| 92 | renderChart(true,"#avgLoadDialog", "#avgLoadGraph", window.pageAnalyticsUrl, 0, 1, google.visualization.data.sum, options); |
| 93 | }); |
| 94 | |
| 95 | </script> |
| 96 | |
Scott Baker | a226eb4 | 2014-06-09 11:55:26 -0700 | [diff] [blame] | 97 | {% endif %} |