pulls.html 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  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. td = tr[i].getElementsByTagName("td")[6];
  56. break;
  57. case 'assignee':
  58. td = tr[i].getElementsByTagName("td")[5];
  59. break;
  60. case 'author':
  61. td = tr[i].getElementsByTagName("td")[4];
  62. break;
  63. }
  64. if (td) {
  65. txtValue = td.textContent || td.innerText;
  66. if (txtValue.indexOf(flt[1]) > -1) {
  67. tr[i].style.display = "";
  68. } else {
  69. tr[i].style.display = "none";
  70. }
  71. }
  72. } else {
  73. tr[i].style.display = "";
  74. }
  75. });
  76. }
  77. }
  78. </script>
  79. </head>
  80. <body>
  81. <h1>Triage dashboard - <a href="https://github.com/{{ owner }}/{{ repo }}">{{ owner }}/{{ repo }}</a></h1>
  82. <input id="filter-input" type="search" style="width: 400px;">
  83. <input type="submit" value="filter" onclick="filter()">
  84. <table id="pr-table">
  85. <thead>
  86. <tr>
  87. <th>#</th>
  88. <th>Need triage</th>
  89. <th>Wait for</th>
  90. <th>Title</th>
  91. <th>Author</th>
  92. <th>Assignee</th>
  93. <th>Labels</th>
  94. <th>Updated at</th>
  95. </tr>
  96. </thead>
  97. <tbody>
  98. {% for pull in pulls %}
  99. <tr>
  100. <td><a href="{{ pull.html_url }}">{{ pull.number }}</a></td>
  101. <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>
  102. <td>{% if pull.wait_for_author %}<b>{{ pull.author }}</b>{% elif pull.wait_for_review %}<b>{{ pull.assignee }}</b>{% endif %}</td>
  103. <td>{{ pull.title }}</td>
  104. <!-- Author or reviewer name become bold because we can faster spot whether `Wait for` is author or reviewer. -->
  105. <td {% if pull.wait_for_author %} style='font-weight: bold;'{% endif %}>{{ pull.author }}</td>
  106. <td {% if pull.wait_for_review %} style='font-weight: bold;'{% endif %}>{{ pull.assignee }}</td>
  107. <td>{{ pull.labels }}</td>
  108. <td>{{ pull.updated_at }}</td>
  109. </tr>
  110. {% endfor %}
  111. </tbody>
  112. </table>
  113. <div>
  114. <p>From the last updated at</p>
  115. <ul>
  116. <li class='dot need-triage-red'>14 days or more</li>
  117. <li class='dot need-triage-yellow'>7 days or more</li>
  118. <li class='dot need-triage-green'>less than 7days</li>
  119. </ul>
  120. </div>
  121. <footer>
  122. <nav>
  123. {% if prev %}
  124. <a href="{{ prev }}">Prev</a>
  125. {% endif %}
  126. {% if next %}
  127. <a href="{{ next }}">Next</a>
  128. {% endif %}
  129. </nav>
  130. </footer>
  131. </body>
  132. </html>