source: tmcsimulator/trunk/webapps/unifiedlog.html @ 440

Revision 440, 1.8 KB checked in by jdalbey, 7 years ago (diff)

Move unified logger to python folder under src. Create a separate web app to display the log file in a formatted html page. Fix sanitize defect in cms and har layers.

Line 
1<!DOCTYPE html>
2<html>
3  <head>
4  <meta http-equiv="Content-Type" content="text/html;charset=utf-8">
5    <title>Unified Logger v</title> 
6<style>
7* {
8  box-sizing: border-box;
9}
10body {
11   background-color: #000033;
12   color: goldenrod
13}
14/* styling for messages */
15#msgs{
16  padding: 15px 10% 15px 10%;
17  font-size: 20px;
18  font-family: monospace;
19  font-weight:lighter;
20  color: white;
21  padding-left: 2%;
22  padding-right: 2%;
23}
24</style>
25</head>
26<body>
27<div class="row">
28    <p id="msgs"></p>
29</div>
30    <script  src="common/js/fileutils.js"></script>
31    <script  src="common/js/revision_number.dat"></script>
32    <script  src="common/js/displayutils.js"></script> 
33   <script>
34// Load the unified log
35function loadLog()
36{
37    var display = document.getElementById("msgs");
38    display.innerHTML = ""
39    // Asynchronous file read of unified log data
40    loadJSON("dynamicdata/unifiedlog.csv", function(response)
41    {
42        // Format the csv data into an HTML table
43        var allRows = response.split(/\r?\n|\r/);
44        var table = '<table>';
45        // Put the last log entry at the TOP of the table
46        for (var singleRow = allRows.length-1; singleRow > 0; singleRow--)
47        {
48            table += '<tr>';
49            var rowCells = allRows[singleRow].split(',');
50            for (var rowCell = 0; rowCell < rowCells.length; rowCell++)
51            {
52                table += '<td>';
53                table += rowCells[rowCell];
54                table += '</td>';
55            }
56            table += '</tr>';
57        }
58        table += '</table>';
59        // Add the table to the messages div
60        display.innerHTML += table;
61    }
62    );
63}
64// Start
65showRevision();
66loadLog();
67// start an interval timer to refresh the log every 10 seconds
68var displayTimer = setInterval(loadLog, 10000);
69   </script>
70  </body>
71</html>
Note: See TracBrowser for help on using the repository browser.