pulls.html 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <style>
  6. * { font-family: sans-serif; }
  7. h1 { font-size: 20px; }
  8. h2 { font-size: 16px; }
  9. p { font-size: 15px; }
  10. li { font-size: 13px; }
  11. table { border-collapse: collapse; }
  12. td, th { border-bottom: 1px solid #ddd; padding: 5px 6px; font-size: 13px; text-align: left; vertical-align: baseline; }
  13. tr:nth-child(even) { background: #eee; }
  14. .dot:before {
  15. content: "";
  16. display: inline-block;
  17. width: 0.4em;
  18. height: 0.4em;
  19. border-radius: 50% 50%;
  20. margin-right: 0.3em;
  21. border: 1px solid transparent;
  22. }
  23. .need-triage-red:before {
  24. background: #FF0000;
  25. border-color: black;
  26. border-radius:2;
  27. }
  28. .need-triage-yellow:before {
  29. background: #FFFF00;
  30. border-color: black;
  31. border-radius:2;
  32. }
  33. .need-triage-green:before {
  34. background: #90EE90;
  35. border-color: black;
  36. border-radius:2;
  37. }
  38. </style>
  39. <script>
  40. function filter() {
  41. var input, filter, table, tr, i, txtValue;
  42. input = document.getElementById("filter-input");
  43. filter = input.value;
  44. table = document.getElementById("pr-table");
  45. tr = table.getElementsByTagName("tr");
  46. filters = filter.split(' ').map(function(x) {
  47. return x.split(':');
  48. });
  49. for (i = 0; i < tr.length; i++) {
  50. filters.forEach(function(flt) {
  51. if (flt.length == 2) {
  52. var td;
  53. switch (flt[0]) {
  54. case 'label':
  55. case '-label':
  56. td = tr[i].getElementsByTagName("td")[6];
  57. break;
  58. case 'assignee':
  59. case '-assignee':
  60. td = tr[i].getElementsByTagName("td")[5];
  61. break;
  62. case 'author':
  63. case '-author':
  64. td = tr[i].getElementsByTagName("td")[4];
  65. break;
  66. }
  67. if (td) {
  68. txtValue = td.textContent || td.innerText;
  69. console.log(flt[0].charAt(0));
  70. if ((flt[0].charAt(0) != '-' && txtValue.indexOf(flt[1]) > -1)
  71. || (flt[0].charAt(0) == '-' && txtValue.indexOf(flt[1]) <= -1)) {
  72. tr[i].style.display = "";
  73. } else {
  74. tr[i].style.display = "none";
  75. }
  76. }
  77. } else {
  78. tr[i].style.display = "";
  79. }
  80. });
  81. }
  82. }
  83. </script>
  84. </head>
  85. <body>
  86. <h1>Triage dashboard - <a href="https://github.com/{{ owner }}/{{ repo }}">{{ owner }}/{{ repo }}</a></h1>
  87. <input id="filter-input" type="search" style="width: 400px;">
  88. <input type="submit" value="filter" onclick="filter()">
  89. <table id="pr-table">
  90. <thead>
  91. <tr>
  92. <th>#</th>
  93. <th>Need triage</th>
  94. <th>Wait for</th>
  95. <th>Title</th>
  96. <th>Author</th>
  97. <th>Assignee</th>
  98. <th>Labels</th>
  99. <th>Updated at</th>
  100. </tr>
  101. </thead>
  102. <tbody>
  103. {% for pull in pulls %}
  104. <tr>
  105. <td><a href="{{ pull.html_url }}">{{ pull.number }}</a></td>
  106. <td class='dot need-triage-{{ pull.need_triage }}'>{{ pull.days_from_last_updated_at }} {% if pull.days_from_last_updated_at > 1 %}days{% else %}day{% endif %}</td>
  107. <td>{% if pull.wait_for_author %}<b>{{ pull.author }}</b>{% elif pull.wait_for_review %}<b>{{ pull.assignee }}</b>{% endif %}</td>
  108. <td>{{ pull.title }}</td>
  109. <!-- Author or reviewer name become bold because we can faster spot whether `Wait for` is author or reviewer. -->
  110. <td {% if pull.wait_for_author %} style='font-weight: bold;'{% endif %}>{{ pull.author }}</td>
  111. <td {% if pull.wait_for_review %} style='font-weight: bold;'{% endif %}>{{ pull.assignee }}</td>
  112. <td>{{ pull.labels }}</td>
  113. <td>{{ pull.updated_at }}</td>
  114. </tr>
  115. {% endfor %}
  116. </tbody>
  117. </table>
  118. <div>
  119. <p>From the last updated at</p>
  120. <ul>
  121. <li class='dot need-triage-red'>14 days or more</li>
  122. <li class='dot need-triage-yellow'>7 days or more</li>
  123. <li class='dot need-triage-green'>less than 7days</li>
  124. </ul>
  125. </div>
  126. <footer>
  127. <nav>
  128. {% if prev %}
  129. <a href="{{ prev }}">Prev</a>
  130. {% endif %}
  131. {% if next %}
  132. <a href="{{ next }}">Next</a>
  133. {% endif %}
  134. </nav>
  135. </footer>
  136. </body>
  137. </html>