|
| 1 | +<% content_for(:title) { "Search failures - RubyCI" } %> |
| 2 | + |
| 3 | +<h3>Search failure logs</h3> |
| 4 | + |
| 5 | +<%= form_with url: search_path, method: :get, local: true, html: { class: "search-form" } do %> |
| 6 | + <p class="search-row search-text-row"> |
| 7 | + <label>Text: <%= text_field_tag :q, @q, placeholder: "test name, exception class, error message ..." %></label> |
| 8 | + <%# The revision query parameter is kept for machine clients (planned MCP |
| 9 | + server) but intentionally has no visible form field. %> |
| 10 | + <%= hidden_field_tag :revision, @revision if @revision.present? %> |
| 11 | + <%= submit_tag "Search" %> |
| 12 | + </p> |
| 13 | + <p class="search-row search-filter-row"> |
| 14 | + <label>Server: <%= select_tag :server, options_for_select(@servers.map {|s| [s.name, s.id] }, @server_id), include_blank: "(all)" %></label> |
| 15 | + <label>Branch: <%= text_field_tag :branch, @branch, size: 10, placeholder: "master" %></label> |
| 16 | + <label>From: <%= date_field_tag :from, params[:from] %></label> |
| 17 | + <label>To: <%= date_field_tag :to, params[:to] %></label> |
| 18 | + </p> |
| 19 | +<% end %> |
| 20 | + |
| 21 | +<% if @searched %> |
| 22 | + <% if @reports.empty? %> |
| 23 | + <p>No matching failure logs found<%= " on page #{@page}" if @page > 1 %>.</p> |
| 24 | + <% else %> |
| 25 | + <div class="table-responsive table-responsive-border"> |
| 26 | + <table class="reports search-results table table-striped table-bordered"> |
| 27 | + <thead> |
| 28 | + <tr> |
| 29 | + <th>Server</th> |
| 30 | + <th>Datetime</th> |
| 31 | + <th>Branch</th> |
| 32 | + <th>Option</th> |
| 33 | + <th>Revision</th> |
| 34 | + <th>Summary</th> |
| 35 | + <th>Match</th> |
| 36 | + <th>Diff</th> |
| 37 | + </tr> |
| 38 | + </thead> |
| 39 | + <tbody> |
| 40 | + <% @reports.each do |report| %> |
| 41 | + <% |
| 42 | + failuri = report.failuri || report.loguri |
| 43 | + if report.revision&.match?(/\A\d+\z/) |
| 44 | + revision = "r#{report.revision}" |
| 45 | + elsif report.sha1 |
| 46 | + revision = report.sha1[0, 11] |
| 47 | + end |
| 48 | + revision_link = link_to revision, report.revisionuri if revision |
| 49 | + snippet = report.log_excerpt&.matching_line(@q) |
| 50 | + %> |
| 51 | + <tr> |
| 52 | + <td class="server"><%= report.server.name %></td> |
| 53 | + <td class="datetime"><%= link_to report.sjstdt, report.loguri, title: report.jstdt %></td> |
| 54 | + <td class="branch"><%= report.branch %></td> |
| 55 | + <td class="option"><%= report.option %></td> |
| 56 | + <td class="revision"><%= revision_link %></td> |
| 57 | + <td class="summary failure"><div><%= link_to report.shortsummary, failuri, title: report.shortsummary %></div></td> |
| 58 | + <td class="match"><code title="<%= snippet %>"><%= snippet %></code></td> |
| 59 | + <td class="diff"><div><%= link_to report.diffstat, report.diffuri, title: report.diffstat %></div></td> |
| 60 | + </tr> |
| 61 | + <% end %> |
| 62 | + </tbody> |
| 63 | + </table> |
| 64 | + </div> |
| 65 | + <p> |
| 66 | + <% if @page > 1 %> |
| 67 | + <%= link_to "Prev", search_path(request.query_parameters.merge("page" => @page - 1)) %> |
| 68 | + <% end %> |
| 69 | + <% if @has_next %> |
| 70 | + <%= link_to "Next", search_path(request.query_parameters.merge("page" => @page + 1)) %> |
| 71 | + <% end %> |
| 72 | + </p> |
| 73 | + <% end %> |
| 74 | +<% else %> |
| 75 | + <p>Search the excerpted fail/diff logs of failed builds. Datetimes are UTC.</p> |
| 76 | +<% end %> |
0 commit comments