blob: 1c87c579252031c06ee103bf7ea05f0f2b86d775 [file] [log] [blame]
Scott Baker5c4ce2b2014-07-08 09:35:40 -07001{% load admin_static %}
2
Scott Bakerf53a0ca2015-01-13 00:33:45 -08003<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 Bakera226eb42014-06-09 11:55:26 -070025{% if not DISABLE_MINIDASHBOARD %}
26
Scott Baker38ece4a2014-03-27 09:08:36 -070027<div id="newMiniDashboard">
Scott Baker61aefcf2014-04-25 15:21:18 -070028 <div class="hide" id="selectedMainNav">{{ opts.verbose_name_plural|capfirst }}</div>
29 <div class="hide" id="currentOriginalNode">{{ original|truncatewords:"18" }}</div>
Scott Bakerf2c26de2014-06-10 20:37:40 -070030 <div class="hide" id="minidashStatus"></div>
Scott Baker38ece4a2014-03-27 09:08:36 -070031 <div class="miniDashPair">
32 <button type="button" name="nodeCount" id="miniDashNodeCount" class="minidashbutton">--</button>
Scott Bakerf4f7bf92014-05-13 17:04:40 -070033 <label for="nodeCount" id="miniDashNodeCountLabel">Active Nodes</label>
Scott Baker38ece4a2014-03-27 09:08:36 -070034 </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 Baker5c4ce2b2014-07-08 09:35:40 -070059<script src="{% static 'page_analytics.js' %}"></script>
60
Scott Baker38ece4a2014-03-27 09:08:36 -070061<script>
62/** If the analytics have already been set -- read them in on page load **/
63if (typeof window != "undefined") {
64 if (typeof window.pageAnalyticsData != "undefined") {
65 updatePageAnalyticsData(window.pageAnalyticsData);
66 }
67}
68
69var 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 Baker38ece4a2014-03-27 09:08:36 -070076 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 Bakera226eb42014-06-09 11:55:26 -070097{% endif %}