Changeset 643 in tmcsimulator for trunk/webapps/common/js
- Timestamp:
- 03/15/2021 04:53:11 PM (5 years ago)
- Location:
- trunk/webapps/common/js
- Files:
-
- 2 edited
-
displayutils.js (modified) (1 diff)
-
revision_number.dat (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/webapps/common/js/displayutils.js
r551 r643 17 17 // @param filename the file containing the CSV input 18 18 // @param targetDiv the div element in which the HTML should be placed. 19 function loadLog(filename, targetDiv) 19 // @param sortOrder true if the items are shown in ascending order by time 20 function loadLog(filename, targetDiv, sortOrder) 20 21 { 21 22 // Asynchronous file read of unified log data 22 23 loadJSON("dynamicdata/" + filename, function(response) 23 24 { 25 // Split the file into rows 26 var allRows = response.split(/\r?\n|\r/); 27 targetDiv.innerHTML = formatTable(allRows, sortOrder); 28 } 29 ); 30 } 31 32 function formatTable(allRows, sortOrder) 33 { 34 var table = '<table>'; 35 if (sortOrder) // ascending order of time (most recent last) 36 { 24 37 // Format the csv data into an HTML table 25 var allRows = response.split(/\r?\n|\r/); 26 var table = '<table>'; 38 // Put the last log entry at the BOTTOM of the table 39 for (var singleRow = 0; singleRow <= allRows.length-1; singleRow++) 40 { 41 // split each row into fields 42 var fields = allRows[singleRow].split(','); 43 table += formatRow(fields) 44 } 45 } 46 else // descending order of time (most recent first) 47 { 48 // Format the csv data into an HTML table 27 49 // Put the last log entry at the TOP of the table 28 50 for (var singleRow = allRows.length-1; singleRow >= 0; singleRow--) 29 51 { 30 var rowCells = allRows[singleRow].split(','); 31 var msg_type = ""; // color white is default 52 // split each row into fields 53 var fields = allRows[singleRow].split(','); 54 table += formatRow(fields) 55 } 56 } 57 58 table += '</table>'; 59 return table; 60 } 32 61 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(); 62 function formatRow(rowCells) 63 { 64 var msg_type = ""; // color white is default 65 66 // trimming white space in the type field 67 // ingore the empty line 68 if (rowCells.length > 1) 69 { 70 rowCells[1] = rowCells[1].trim(); 71 } 72 var label = String(rowCells[1]); 73 var info = String(rowCells[3]).trim(); 74 // Implement ticket #190 75 // Checking for the type of logging information 76 if (label.startsWith("CAD")) { 77 msg_type = "class=\"CAD\""; 78 if (info.startsWith("Detail")) { 79 msg_type = "class=\"CADdetail\""; 38 80 } 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 } 81 } else if (label.startsWith("Activity")) { 82 msg_type = "class=\"Activity\""; 83 //} else if (rowCells[1] == "CMS Activated.") { 84 } else if (label.startsWith("CMS")) { 85 msg_type = "class=\"CMS\""; 86 } else if (label.startsWith("Eval")) { 87 msg_type = "class=\"Evaluation\""; 88 } 56 89 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>'; 90 // add the message type class to that row 91 var row = '<tr ' + msg_type + '>'; 92 for (var rowCell = 0; rowCell < rowCells.length; rowCell++) 93 { 94 row += '<td>'; 95 row += rowCells[rowCell]; 96 row += '</td>'; 66 97 } 67 table += '</table>'; 68 targetDiv.innerHTML = table; 69 } 70 ); 98 row += '</tr>'; 99 return row; 71 100 } -
trunk/webapps/common/js/revision_number.dat
r631 r643 1 1 2 var revisionNumber = "6 16";2 var revisionNumber = "640"; 3 3
Note: See TracChangeset
for help on using the changeset viewer.
