Skip to content

Commit

Permalink
chg: [website] On the '/vuln/<vuln-id>' page the number of elements i…
Browse files Browse the repository at this point in the history
…n each tabs is now displayed in the tab name. This is a conveniency for the user.
  • Loading branch information
cedricbonhomme committed Jul 10, 2024
1 parent 639e8a9 commit c42aa87
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
6 changes: 3 additions & 3 deletions website/web/templates/vuln.html
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,13 @@ <h5 class="modal-title">Action not permitted</h5>
<br />
<ul class="nav nav-tabs" id="pageTab" role="tablist">
<li class="nav-item" role="presentation">
<button class="nav-link active" id="related-tab" data-bs-toggle="tab" data-bs-target="#related" type="button" role="tab" aria-controls="related" aria-selected="true">Related vulnerabilities</button>
<button class="nav-link active" id="related-tab" data-bs-toggle="tab" data-bs-target="#related" type="button" role="tab" aria-controls="related" aria-selected="true">Related vulnerabilities ({{ linked_vulns | count }})</button>
</li>
<li class="nav-item" role="presentation">
<button class="nav-link" id="comments-tab" data-bs-toggle="tab" data-bs-target="#comments" type="button" role="tab" aria-controls="comments" aria-selected="false" onclick="loadComments()">Comments</button>
<button class="nav-link" id="comments-tab" data-bs-toggle="tab" data-bs-target="#comments" type="button" role="tab" aria-controls="comments" aria-selected="false" onclick="loadComments()">Comments ({{ nb_comments }})</button>
</li>
<li class="nav-item" role="presentation">
<button class="nav-link" id="bundles-tab" data-bs-toggle="tab" data-bs-target="#bundles" type="button" role="tab" aria-controls="bundles" aria-selected="false" onclick="loadBundles()">Bundles</button>
<button class="nav-link" id="bundles-tab" data-bs-toggle="tab" data-bs-target="#bundles" type="button" role="tab" aria-controls="bundles" aria-selected="false" onclick="loadBundles()">Bundles ({{ nb_bundles }})</button>
</li>
</ul>
<div class="tab-content" id="pageTabContent">
Expand Down
6 changes: 6 additions & 0 deletions website/web/views/home.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
from vulnerabilitylookup.default import get_config
from vulnerabilitylookup import __version__
from website.models import get_db_info
from website.models import Comment
from website.models import Bundle
from website.web.bootstrap import application
from website.web.bootstrap import vulnerabilitylookup

Expand Down Expand Up @@ -175,12 +177,16 @@ def vulnerability_view(vulnerability_id: str) -> str:
# The search query was a vulnerability ID, just display that.
source = vulnerabilitylookup.get_vulnerability_source(vulnerability_id)
linked_vulns = vulnerabilitylookup.get_linked_vulnerabilities(vulnerability_id)
nb_comments = Comment.query.filter(Comment.vulnerability==vulnerability_id).count()
nb_bundles = Bundle.query.filter(Bundle.related_vulnerabilities.contains([vulnerability_id])).count()
return render_template(
"vuln.html",
source=source,
vulnerability_id=vulnerability_id,
vulnerability_data=vulnerability,
linked_vulns=linked_vulns,
nb_comments=nb_comments,
nb_bundles=nb_bundles,
)

flash(f"Nothing found in the database for {vulnerability_id}.", "warning")
Expand Down

0 comments on commit c42aa87

Please sign in to comment.