|
1 | | - |
2 | | -function render_queue() { |
3 | | - var q = document.getElementById("queue"); |
4 | | - var hdr = elt_txt_class("td", "Bors queue: " + bors.length, "header"); |
5 | | - hdr.setAttribute("colspan", "5"); |
6 | | - var row = elt("tr"); |
7 | | - row.appendChild(hdr); |
8 | | - q.appendChild(row); |
9 | | - |
10 | | - hdr = elt_txt_class("td", "updated " + updated.toISOString(), "header"); |
11 | | - hdr.setAttribute("colspan", "5"); |
12 | | - row = elt("tr"); |
13 | | - row.appendChild(hdr); |
14 | | - q.appendChild(row); |
15 | | - |
16 | | - for (var i = bors.length - 1; i >= 0; --i) { |
17 | | - var e = bors[i]; |
18 | | - row = elt("tr"); |
19 | | - |
20 | | - var num = e["num"].toString(); |
21 | | - var num_cell = elt("td"); |
22 | | - var repo = e["src_owner"] + "/" + e["src_repo"] + "/" |
23 | | - num_cell.appendChild(a_txt_class_url(num, "pull", "https://github.com/" + repo + "pull/" + num)); |
24 | | - row.appendChild(num_cell); |
25 | | - |
26 | | - var state = e["state"]; |
27 | | - row.appendChild(elt_txt_class("td", state, e["state"])); |
28 | | - |
29 | | - row.appendChild(elt_txt_class("td", e["prio"].toString(), "priority")); |
30 | | - |
31 | | - var ref = repo + e["ref"]; |
32 | | - row.appendChild(elt_txt_class("td", ref, "ref")); |
33 | | - |
34 | | - var t = e["title"] |
35 | | - |
36 | | - if (e["num_comments"] == 0 || |
37 | | - e["last_comment"][2].indexOf("r+") == 0) { |
38 | | - row.appendChild(elt_txt_class("td", t, "details")); |
39 | | - } else { |
40 | | - var last = e["last_comment"]; |
41 | | - var when = last[0]; |
42 | | - var who = last[1]; |
43 | | - var what = last[2]; |
44 | | - |
45 | | - var td = elt_class("td", "details"); |
46 | | - td.appendChild(elt_txt_class("p", t, "title")); |
47 | | - |
48 | | - var c = elt_class("div", "comment"); |
49 | | - c.appendChild(elt_txt_class("div", |
50 | | - who + " " + when + " #" + e["num_comments"], |
51 | | - "commentheader")); |
52 | | - c.appendChild(elt_txt_class("div", what, "commentbody")); |
53 | | - td.appendChild(c); |
54 | | - |
55 | | - row.appendChild(td); |
56 | | - } |
57 | | - |
58 | | - |
59 | | - q.appendChild(row); |
60 | | - } |
61 | | -} |
62 | | - |
63 | | - |
64 | | -window.onload = render_queue; |
| 1 | + |
| 2 | +function render_queue(queue) { |
| 3 | + var q = document.getElementById("queue"); |
| 4 | + var hdr = elt_txt_class("td", "Bors queue: " + queue.length, "header"); |
| 5 | + hdr.setAttribute("colspan", "5"); |
| 6 | + var row = elt("tr"); |
| 7 | + row.appendChild(hdr); |
| 8 | + q.appendChild(row); |
| 9 | + |
| 10 | + hdr = elt_txt_class("td", "updated " + updated.toISOString(), "header"); |
| 11 | + hdr.setAttribute("colspan", "5"); |
| 12 | + row = elt("tr"); |
| 13 | + row.appendChild(hdr); |
| 14 | + q.appendChild(row); |
| 15 | + |
| 16 | + for (var i = queue.length - 1; i >= 0; --i) { |
| 17 | + var e = queue[i]; |
| 18 | + row = elt("tr"); |
| 19 | + |
| 20 | + var num = e["num"].toString(); |
| 21 | + var num_cell = elt("td"); |
| 22 | + var repo = e["src_owner"] + "/" + e["src_repo"] + "/" |
| 23 | + num_cell.appendChild(a_txt_class_url(num, "pull", "https://github.com/" + repo + "pull/" + num)); |
| 24 | + row.appendChild(num_cell); |
| 25 | + |
| 26 | + var state = e["state"]; |
| 27 | + row.appendChild(elt_txt_class("td", state, e["state"])); |
| 28 | + |
| 29 | + row.appendChild(elt_txt_class("td", e["prio"].toString(), "priority")); |
| 30 | + |
| 31 | + var ref = repo + e["ref"]; |
| 32 | + row.appendChild(elt_txt_class("td", ref, "ref")); |
| 33 | + |
| 34 | + var t = e["title"] |
| 35 | + |
| 36 | + if (e["num_comments"] == 0 || |
| 37 | + e["last_comment"][2].indexOf("r+") == 0) { |
| 38 | + row.appendChild(elt_txt_class("td", t, "details")); |
| 39 | + } else { |
| 40 | + var last = e["last_comment"]; |
| 41 | + var when = last[0]; |
| 42 | + var who = last[1]; |
| 43 | + var what = last[2]; |
| 44 | + |
| 45 | + var td = elt_class("td", "details"); |
| 46 | + td.appendChild(elt_txt_class("p", t, "title")); |
| 47 | + |
| 48 | + var c = elt_class("div", "comment"); |
| 49 | + c.appendChild(elt_txt_class("div", |
| 50 | + who + " " + when + " #" + e["num_comments"], |
| 51 | + "commentheader")); |
| 52 | + c.appendChild(elt_txt_class("div", what, "commentbody")); |
| 53 | + td.appendChild(c); |
| 54 | + |
| 55 | + row.appendChild(td); |
| 56 | + } |
| 57 | + |
| 58 | + |
| 59 | + q.appendChild(row); |
| 60 | + } |
| 61 | +} |
| 62 | + |
| 63 | +var qs = (function(a) { |
| 64 | + if (a == "") return {}; |
| 65 | + var b = {}; |
| 66 | + for (var i = 0; i < a.length; ++i) { |
| 67 | + var p=a[i].split('='); |
| 68 | + if (p.length != 2) continue; |
| 69 | + b[p[0]] = decodeURIComponent(p[1].replace(/\+/g, " ")); |
| 70 | + } |
| 71 | + return b; |
| 72 | +})(window.location.search.substr(1).split('&')); |
| 73 | + |
| 74 | +function render_status() { |
| 75 | + var k = Object.keys(bors).sort(); |
| 76 | + console.log(qs); |
| 77 | + if (k.length > 1) { |
| 78 | + console.log(qs["repo"], bors[qs["repo"]]); |
| 79 | + if (qs["repo"] && bors[qs["repo"]]) { |
| 80 | + render_queue(bors[qs["repo"]]); |
| 81 | + } else { |
| 82 | + console.log("feh"); |
| 83 | + // render a list of repos |
| 84 | + var q = document.getElementById("queue"); |
| 85 | + var hdr0 = elt_txt_class("td", "Repo", "header"); |
| 86 | + var hdr1 = elt_txt_class("td", "PRs", "header"); |
| 87 | + var row = elt("tr"); |
| 88 | + row.appendChild(hdr0); |
| 89 | + row.appendChild(hdr1); |
| 90 | + q.appendChild(row); |
| 91 | + for (var i = 0; i < k.length; i++) { |
| 92 | + // TODO |
| 93 | + row = elt_class("tr", "summary"); |
| 94 | + |
| 95 | + var name = k[i]; |
| 96 | + var name_cell = elt("td"); |
| 97 | + name_cell.appendChild(a_txt_class_url(name, "pull", "?repo="+name)); |
| 98 | + row.appendChild(name_cell); |
| 99 | + |
| 100 | + var count = bors[k[i]].length |
| 101 | + row.appendChild(elt_txt_class("td", count, "")); |
| 102 | + |
| 103 | + q.appendChild(row); |
| 104 | + } |
| 105 | + } |
| 106 | + } else { |
| 107 | + // render the first one |
| 108 | + render_queue(bors[keys[0]]); |
| 109 | + } |
| 110 | +} |
| 111 | + |
| 112 | + |
| 113 | +window.onload = render_status; |
0 commit comments