| 1 | /** Hide an html element given its id */ |
|---|
| 2 | function hideElementById(id) |
|---|
| 3 | { |
|---|
| 4 | // hide the element by setting css attribute |
|---|
| 5 | document.getElementById(id).style.display = 'none' |
|---|
| 6 | } |
|---|
| 7 | |
|---|
| 8 | // Show the subversion revision number in the page title |
|---|
| 9 | function showRevision() |
|---|
| 10 | { |
|---|
| 11 | var title = document.title; |
|---|
| 12 | title = title + revisionNumber; |
|---|
| 13 | document.title = title; |
|---|
| 14 | } |
|---|
| 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 | } |
|---|