|
| 1 | +let xfr_todo = 2; |
| 2 | +let dev_info = null; |
| 3 | +let stability = null; |
| 4 | + |
| 5 | +function load_tables() |
| 6 | +{ |
| 7 | + // Turn stability into matrix by executor |
| 8 | + let rn_seen = new Set(); |
| 9 | + let tn_db = []; |
| 10 | + let sta_db = {}; |
| 11 | + |
| 12 | + for (ste of stability) { |
| 13 | + let tn = ste.grp + ':' + ste.test + ':' + ste.subtest; |
| 14 | + if (ste.subtest == null) |
| 15 | + tn = ste.grp + ':' + ste.test + ':'; |
| 16 | + let rn = ste.remote + ste.executor; |
| 17 | + |
| 18 | + if (!(tn in sta_db)) { |
| 19 | + sta_db[tn] = {}; |
| 20 | + tn_db.push(tn); |
| 21 | + } |
| 22 | + |
| 23 | + sta_db[tn][rn] = ste; |
| 24 | + rn_seen.add(rn); |
| 25 | + } |
| 26 | + |
| 27 | + // Simple sort by name |
| 28 | + tn_db.sort(); |
| 29 | + |
| 30 | + // Render device info |
| 31 | + let display_names = {}; |
| 32 | + let dev_table = document.getElementById("device_info"); |
| 33 | + |
| 34 | + for (dev of dev_info) { |
| 35 | + let rn = dev.remote + dev.executor; |
| 36 | + if (!rn_seen.has(rn)) |
| 37 | + continue; |
| 38 | + |
| 39 | + let row = dev_table.insertRow(); |
| 40 | + |
| 41 | + row.insertCell(0).innerText = dev.remote; |
| 42 | + row.insertCell(1).innerText = dev.executor; |
| 43 | + |
| 44 | + const info = JSON.parse(dev.info); |
| 45 | + const driver = info.driver; |
| 46 | + row.insertCell(2).innerText = driver; |
| 47 | + |
| 48 | + delete info.driver; |
| 49 | + const versions = JSON.stringify(info); |
| 50 | + row.insertCell(3).innerText = versions; |
| 51 | + |
| 52 | + display_names[dev.remote + dev.executor] = |
| 53 | + dev.remote + '<br />' + dev.executor + '<br />' + driver; |
| 54 | + } |
| 55 | + |
| 56 | + // Create headers |
| 57 | + let sta_tb = document.getElementById("stability"); |
| 58 | + |
| 59 | + const hdr = sta_tb.createTHead().insertRow(); |
| 60 | + hdr.insertCell().innerText = 'Group'; |
| 61 | + hdr.insertCell().innerText = 'Test'; |
| 62 | + hdr.insertCell().innerText = 'Subtest'; |
| 63 | + for (rn of Object.keys(display_names)) { |
| 64 | + let cell = hdr.insertCell(); |
| 65 | + |
| 66 | + cell.innerHTML = display_names[rn]; |
| 67 | + cell.setAttribute("style", "writing-mode: tb-rl;"); |
| 68 | + } |
| 69 | + |
| 70 | + // Display |
| 71 | + for (tn of tn_db) { |
| 72 | + let row = sta_tb.insertRow(); |
| 73 | + |
| 74 | + row.insertCell(0).innerText = tn.split(':')[0]; |
| 75 | + row.insertCell(1).innerText = tn.split(':')[1]; |
| 76 | + let cell = row.insertCell(2); |
| 77 | + if (tn.split(':').length == 3) |
| 78 | + cell.innerText = tn.split(':')[2]; |
| 79 | + |
| 80 | + let i = 3; |
| 81 | + for (rn of Object.keys(display_names)) { |
| 82 | + cell = row.insertCell(i++); |
| 83 | + if (rn in sta_db[tn]) { |
| 84 | + let ste = sta_db[tn][rn]; |
| 85 | + |
| 86 | + if (ste.passing) |
| 87 | + cell.setAttribute("class", "box-pass"); |
| 88 | + else |
| 89 | + cell.setAttribute("class", "box-skip"); |
| 90 | + } |
| 91 | + } |
| 92 | + } |
| 93 | +} |
| 94 | + |
1 | 95 | function do_it()
|
2 | 96 | {
|
| 97 | + $(document).ready(function() { |
| 98 | + $.get("query/device-info", function(data_raw) { |
| 99 | + dev_info = data_raw; |
| 100 | + if (!--xfr_todo) |
| 101 | + load_tables(); |
| 102 | + }) |
| 103 | + }); |
| 104 | + $(document).ready(function() { |
| 105 | + $.get("query/stability?auto=1", function(data_raw) { |
| 106 | + stability = data_raw; |
| 107 | + if (!--xfr_todo) |
| 108 | + load_tables(); |
| 109 | + }) |
| 110 | + }); |
3 | 111 | }
|
0 commit comments