Changeset 551 in tmcsimulator for trunk/webapps/unifiedlogmonitor.html
- Timestamp:
- 12/26/2019 03:14:52 PM (6 years ago)
- File:
-
- 1 edited
-
trunk/webapps/unifiedlogmonitor.html (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/webapps/unifiedlogmonitor.html
r512 r551 4 4 <meta http-equiv="Content-Type" content="text/html;charset=utf-8"> 5 5 <title>Unified Logger v</title> 6 <style> 7 * { 8 box-sizing: border-box; 9 } 10 body { 11 background-color: #000033; 12 color: goldenrod 13 } 14 15 /* Color Code for unified logger */ 16 .CAD-log{ 17 color: #00FFFF; 18 } 19 .Activity-log{ 20 color: #32CD32; 21 } 22 .CMS-Activated{ 23 color: #FFFF00; 24 } 25 26 /* Padding for table cells */ 27 td { padding-top:2px; padding-right:10px; padding-bottom:2px; padding-left:10px; } 28 /* styling for messages */ 29 #msgs{ 30 padding: 15px 10% 15px 10%; 31 font-size: 20px; 32 font-family: monospace; 33 font-weight:lighter; 34 color: white; 35 padding-left: 2%; 36 padding-right: 2%; 37 } 38 </style> 6 <link href="common/unifiedlog.css" rel="stylesheet" type="text/css"> 39 7 </head> 40 8 <body> 41 9 <div class="row"> 42 <p id=" msgs"></p>10 <p id="display"></p> 43 11 </div> 44 12 <script src="common/js/fileutils.js"></script> … … 46 14 <script src="common/js/displayutils.js"></script> 47 15 <script> 48 // Load the unified log 49 function loadLog() 16 function showLog() 50 17 { 51 var display = document.getElementById("msgs"); 52 display.innerHTML = "" 53 // Asynchronous file read of unified log data 54 loadJSON("dynamicdata/unifiedlog.csv", function(response) 55 { 56 // Format the csv data into an HTML table 57 var allRows = response.split(/\r?\n|\r/); 58 var table = '<table>'; 59 // Put the last log entry at the TOP of the table 60 for (var singleRow = allRows.length-1; singleRow >= 0; singleRow--) 61 { 62 var rowCells = allRows[singleRow].split(','); 63 var msg_type = ""; 64 65 // trimming white space in the type of messages 66 // ingore the emtpy line 67 if (rowCells.length > 1) { 68 console.log("row cell " , rowCells[1]); 69 rowCells[1] = rowCells[1].trim(); 70 } 71 // Implement ticket #190 72 // Checking for the type of logging information 73 if (rowCells[1] == "CAD log") { 74 msg_type = "class=\"CAD-log\""; 75 } else if (rowCells[1] == "Activity Log.") { 76 msg_type = "class=\"Activity-log\""; 77 } else if (rowCells[1] == "CMS Activated.") { 78 msg_type = "class=\"CMS-Activated\""; 79 } 80 // add the message type class to that row 81 table += '<tr ' + msg_type + '>'; 82 for (var rowCell = 0; rowCell < rowCells.length; rowCell++) 83 { 84 table += '<td>'; 85 table += rowCells[rowCell]; 86 table += '</td>'; 87 } 88 table += '</tr>'; 89 } 90 table += '</table>'; 91 // Add the table to the messages div 92 display.innerHTML += table; 93 } 94 ); 18 var display = document.getElementById("display"); 19 // Utility reads from given file and puts into given DIV 20 loadLog("unifiedlog.csv", display); 21 // Start a timer to do this again in 5 seconds 22 var x = setTimeout(showLog, 5000); 95 23 } 96 24 // Start 97 25 showRevision(); 98 loadLog(); 99 // start an interval timer to refresh the log every 5 seconds 100 var displayTimer = setInterval(loadLog, 5000); 26 showLog(); 101 27 </script> 102 28 </body>
Note: See TracChangeset
for help on using the changeset viewer.
