www/mon_node.php

Thu, 13 Dec 2018 20:32:36 +0100

author
Michiel Broek <mbroek@mbse.eu>
date
Thu, 13 Dec 2018 20:32:36 +0100
changeset 139
eb1ac7487710
parent 75
1a3c6480e057
child 181
db4e62482d0b
permissions
-rw-r--r--

Added EBC color examples. Added simple progessbars for hop flavour and aroma contribution. We need something better. In the fermentables tab, above the grid display the malt color and OG estimates. Display supplier as well in the fermentables grid.

<?php
require_once($_SERVER['DOCUMENT_ROOT'].'/includes/global.inc.php');
page_header('Hoofdmenu', NULL);
$uuid = $_GET["uuid"];
?>
   <script>
   $(document).ready(function () {

     var uuid = "<?php echo $uuid; ?>";
     var url = "getnode.php?uuid='" + uuid + "'";
     var source = {
       datatype: "json",
       datafields: [
     	{ name: 'record', type: 'int' },
	{ name: 'uuid', type: 'string' },
	{ name: 'node', type: 'string' },
	{ name: 'online', type: 'bool' },
	{ name: 'group_id', type: 'string' },
	{ name: 'hardwaremake', type: 'string' },
	{ name: 'hardwaremodel', type: 'string' },
	{ name: 'os', type: 'string' },
	{ name: 'os_version', type: 'string' },
	{ name: 'firmware', type: 'string' },
	{ name: 'firstseen', type: 'string' },
	{ name: 'lastseen', type: 'string' },
	{ name: 'temperature', type: 'float' },
	{ name: 'humidity', type: 'float' },
	{ name: 'barometer', type: 'float' },
	{ name: 'gps_latitude', type: 'float' },
	{ name: 'gps_longitude', type: 'float' },
	{ name: 'gps_altitude', type: 'float' },
	{ name: 'net_address', type: 'string' },
	{ name: 'net_ifname', type: 'string' },
	{ name: 'net_rssi', type: 'int' }
       ],
       id: 'record',
       url: url
     };
     var dataAdapter = new $.jqx.dataAdapter(source, {
       loadComplete: function (records) {
	 var record = dataAdapter.records[0];
	 var html  = "<div id='node_table'>";
	     html += "<table style='width: 100%; padding: 10px;'>";
	     html += "<tr><th colspan=2>Systeem overzicht</th></tr>";
	     html += "<tr><td>Uuid</td><td>" + record.uuid + "</td></tr>";
	     html += "<tr><td>Systeem</td><td>" + record.node + "</td></tr>";
	     html += "<tr><td>Online</td><td>" + record.online + "</td></tr>";
	     html += "<tr><td>Type</td><td>" + record.group_id + "</td></tr>";
	     html += "<tr><td>Eerst gezien</td><td>" + record.firstseen + "</td></tr>";
	     html += "<tr><td>Laatst gezien</td><td>" + record.lastseen + "</td></tr>";
	     html += "<tr><td>Hardware maker</td><td>" + record.hardwaremake+ "</td></tr>";
	     html += "<tr><td>Hardware model</td><td>" + record.hardwaremodel+ "</td></tr>";
	     html += "<tr><td>OS</td><td>" + record.os + " versie: " + record.os_version + "</td></tr>";
	     html += "<tr><td>Firmware</td><td>" + record.firmware + "</td></tr>";
	     if (record.online) {
	       html += "<tr><td>Temperatuur</td><td>" + record.temperature.toFixed(1) + "&deg;C</td></tr>";
	       if (record.humidity > 0) {
	         html += "<tr><td>Vochtigheid</td><td>" + record.humidity.toFixed(1) + "%</td></tr>";
	       }
	       if (record.barometer > 0) {
	         html += "<tr><td>Luchtdruk</td><td>" + record.barometer.toFixed(0) + "</td></tr>";
	       }
	       if ((record.gps_latitude != 0) && (record.gps_longitude != 0)) {
	         html += "<tr><td>GPS</td><td>"+ record.gps_latitude + " " + record.gps_longitude + " " + record.gps_altitude + "</td></tr>";
	       }
	       html += "<tr><td>Netwerk</td><td>"+ record.net_ifname + " " + record.net_address + "</td></tr>";
	     }
	     html += "</<table>";
	     html += "</div>";
	     $("#ContentPanel").html(html);
       }
     });

     // Get the data immediatly and then at regular intervals to refresh.
     dataAdapter.dataBind();
     setInterval(function(){
       dataAdapter.dataBind();
     }, 30000);
   });
   </script>

   <div id="MainPanel">
    <div id="ContentPanel"></div>
   </div>

<?php
page_footer();
?>

mercurial