Changeset 551 in tmcsimulator for trunk/webapps/common/js/displayutils.js
- Timestamp:
- 12/26/2019 03:14:52 PM (6 years ago)
- File:
-
- 1 edited
-
trunk/webapps/common/js/displayutils.js (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/webapps/common/js/displayutils.js
r386 r551 14 14 } 15 15 16 // Load a CSV file and convert to a string of formatted HTML 17 // @param filename the file containing the CSV input 18 // @param targetDiv the div element in which the HTML should be placed. 19 function loadLog(filename, targetDiv) 20 { 21 // Asynchronous file read of unified log data 22 loadJSON("dynamicdata/" + filename, function(response) 23 { 24 // Format the csv data into an HTML table 25 var allRows = response.split(/\r?\n|\r/); 26 var table = '<table>'; 27 // Put the last log entry at the TOP of the table 28 for (var singleRow = allRows.length-1; singleRow >= 0; singleRow--) 29 { 30 var rowCells = allRows[singleRow].split(','); 31 var msg_type = ""; // color white is default 32 33 // trimming white space in the type field 34 // ingore the empty line 35 if (rowCells.length > 1) 36 { 37 rowCells[1] = rowCells[1].trim(); 38 } 39 var label = String(rowCells[1]); 40 var info = String(rowCells[3]).trim(); 41 // Implement ticket #190 42 // Checking for the type of logging information 43 if (label.startsWith("CAD")) { 44 msg_type = "class=\"CAD\""; 45 if (info.startsWith("Detail")) { 46 msg_type = "class=\"CADdetail\""; 47 } 48 } else if (label.startsWith("Activity")) { 49 msg_type = "class=\"Activity\""; 50 //} else if (rowCells[1] == "CMS Activated.") { 51 } else if (label.startsWith("CMS")) { 52 msg_type = "class=\"CMS\""; 53 } else if (label.startsWith("Eval")) { 54 msg_type = "class=\"Evaluation\""; 55 } 56 57 // add the message type class to that row 58 table += '<tr ' + msg_type + '>'; 59 for (var rowCell = 0; rowCell < rowCells.length; rowCell++) 60 { 61 table += '<td>'; 62 table += rowCells[rowCell]; 63 table += '</td>'; 64 } 65 table += '</tr>'; 66 } 67 table += '</table>'; 68 targetDiv.innerHTML = table; 69 } 70 ); 71 }
Note: See TracChangeset
for help on using the changeset viewer.
