www/mon_node.php

changeset 16
522022b4fae4
child 40
b825c675987d
equal deleted inserted replaced
15:ccbe79db80b8 16:522022b4fae4
1 <?php
2 require_once($_SERVER['DOCUMENT_ROOT'].'/includes/global.inc.php');
3 page_header('Hoofdmenu', NULL);
4 $uuid = $_GET["uuid"];
5 ?>
6 <script>
7 $(document).ready(function () {
8
9 var uuid = "<?php echo $uuid; ?>";
10 var url = "getnode.php?uuid='" + uuid + "'";
11 var source = {
12 datatype: "json",
13 datafields: [
14 { name: 'record', type: 'int' },
15 { name: 'uuid', type: 'string' },
16 { name: 'node', type: 'string' },
17 { name: 'online', type: 'bool' },
18 { name: 'group_id', type: 'string' },
19 { name: 'hardwaremake', type: 'string' },
20 { name: 'hardwaremodel', type: 'string' },
21 { name: 'os', type: 'string' },
22 { name: 'os_version', type: 'string' },
23 { name: 'firmware', type: 'string' },
24 { name: 'firstseen', type: 'string' },
25 { name: 'lastseen', type: 'string' },
26 { name: 'temperature', type: 'float' },
27 { name: 'humidity', type: 'float' },
28 { name: 'barometer', type: 'float' },
29 { name: 'gps_latitude', type: 'float' },
30 { name: 'gps_longitude', type: 'float' },
31 { name: 'gps_altitude', type: 'float' },
32 { name: 'net_address', type: 'string' },
33 { name: 'net_ifname', type: 'string' },
34 { name: 'net_rssi', type: 'int' }
35 ],
36 id: 'record',
37 url: url
38 };
39 var dataAdapter = new $.jqx.dataAdapter(source, {
40 loadComplete: function (records) {
41 var record = dataAdapter.records[0];
42 var html = "<div id='node_table'>";
43 html += "<table style='width: 100%; padding: 10px;'>";
44 html += "<tr><th colspan=2>Systeem overzicht</th></tr>";
45 html += "<tr><td>Uuid</td><td>" + record.uuid + "</td></tr>";
46 html += "<tr><td>Systeem</td><td>" + record.node + "</td></tr>";
47 html += "<tr><td>Online</td><td>" + record.online + "</td></tr>";
48 html += "<tr><td>Type</td><td>" + record.group_id + "</td></tr>";
49 html += "<tr><td>Eerst gezien</td><td>" + record.firstseen + "</td></tr>";
50 html += "<tr><td>Laatst gezien</td><td>" + record.lastseen + "</td></tr>";
51 html += "<tr><td>Hardware maker</td><td>" + record.hardwaremake+ "</td></tr>";
52 html += "<tr><td>Hardware model</td><td>" + record.harwaremodel+ "</td></tr>";
53 html += "<tr><td>OS</td><td>" + record.os + " versie: " + record.os_version + "</td></tr>";
54 html += "<tr><td>Firmware</td><td>" + record.firmware + "</td></tr>";
55 if (record.online) {
56 html += "<tr><td>Temperatuur</td><td>" + record.temperature + "&deg;C</td></tr>";
57 if (record.humidity > 0) {
58 html += "<tr><td>Vochtigheid</td><td>" + record.humidity + "%</td></tr>";
59 }
60 if (record.barometer > 0) {
61 html += "<tr><td>Luchtdruk</td><td>" + record.barometer + "</td></tr>";
62 }
63 if ((record.gps_latitude != 0) && (record.gps_longitude != 0)) {
64 html += "<tr><td>GPS</td><td>"+ record.gps_latitude + " " + record.gps_longitude + " " + record.gps_altitude + "</td></tr>";
65 }
66 html += "<tr><td>Netwerk</td><td>"+ record.net_ifname + " " + record.net_address + "</td></tr>";
67 }
68 html += "</<table>";
69 html += "</div>";
70 $("#ContentPanel").html(html);
71 }
72 });
73
74 // Get the data immediatly and then at regular intervals to refresh.
75 dataAdapter.dataBind();
76 setInterval(function(){
77 dataAdapter.dataBind();
78 }, 30000);
79 });
80 </script>
81
82 <div id="MainPanel">
83 <div id="ContentPanel"></div>
84 </div>
85
86 <?php
87 page_footer();
88 ?>

mercurial