Skip to content

Commit

Permalink
Update blast radius display in advisory views
Browse files Browse the repository at this point in the history
  • Loading branch information
andrew committed Apr 14, 2024
1 parent a1b64e4 commit 9e9398c
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/views/advisories/_advisory.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
Ecosystems: <%= advisory.ecosystems.join(', ') %><br>
Packages: <%= advisory.package_names.join(', ') %><br>
Source: <%= advisory.source %><br>
Blast Radius: <%= advisory.blast_radius %><br>
Blast Radius: <%= advisory.blast_radius.round(1) %><br>
<span title="<%= advisory.published_at %>">Published: <%= time_ago_in_words advisory.published_at %> ago</span>
<% if advisory.withdrawn? %>
<br>
Expand Down
12 changes: 12 additions & 0 deletions app/views/advisories/_sort.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<li class="nav-item ms-auto">
<div class="dropdown">
<button class="btn btn-light dropdown-toggle" type="button" data-bs-toggle="dropdown" aria-expanded="false">
Sort
</button>
<ul class="dropdown-menu">
<% [['severity', 'desc', 'Highest Severity'],['severity', 'asc', 'Lowest Severity'],['blast_radius', 'desc', 'Blast Radius'],['published_at', 'desc', 'Recently Published'],['cvss_score','desc','CVSS Score']].each do |sort, order, name| %>
<li><a class="dropdown-item <%= 'active' if params[:sort] == sort %>" href="<%= url_for(request.params.merge(sort: sort, order: order)) %>"><%= name %></a></li>
<% end %>
</ul>
</div>
</li>
5 changes: 5 additions & 0 deletions app/views/advisories/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@
<%= line_chart recent_advisories_data_path %>
</div>

<ul class="nav nav-tabs my-3">

<%= render 'sort' %>
</ul>

<div class="row">
<div class="col-lg-8">
<%= render @advisories %>
Expand Down
2 changes: 1 addition & 1 deletion app/views/advisories/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
Repository: <%= link_to @advisory.repository_url, @advisory.repository_url, target: :_blank %><br>
<% end %>

Blast Radius: <%= @advisory.blast_radius %><br>
Blast Radius: <%= @advisory.blast_radius.round(1) %><br>

<h3 class='mt-3'>Affected Packages</h3>

Expand Down

0 comments on commit 9e9398c

Please sign in to comment.