Skip to content

Commit

Permalink
Fix clear filters bug and update link href
Browse files Browse the repository at this point in the history
  • Loading branch information
mtruj013 authored and akbarkz committed Sep 13, 2024
1 parent f879d8d commit 86a207e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
17 changes: 8 additions & 9 deletions static/js/src/cve/cve.js
Original file line number Diff line number Diff line change
Expand Up @@ -212,15 +212,14 @@ handleFilterPersist();
function handleClearFilters() {
if (clearFiltersButton) {
clearFiltersButton.addEventListener("click", function (event) {
for (const [param] of urlParams.entries()) {
if (urlParams.has("q")) {
if (param != "q") {
urlParams.delete(param);
}
} else {
urlParams.append("q", "");
}
}
let keys = [...urlParams.keys()];
keys.forEach((key) => {
urlParams.delete(key);
});
// Always leave this empty param on clear
// so the user is not redirected to the landing page
urlParams.set("q", "");

url.search = urlParams.toString();
window.location.href = url.href;
});
Expand Down
2 changes: 1 addition & 1 deletion templates/security/cves/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ <h1>CVE reports</h1>
</p>
<ul class="p-inline-list u-responsive-realign">
<li class="p-inline-list__item">
<a href="/cves/about">Learn more about CVEs</a>
<a href="/security/cves/about">Learn more about CVEs</a>
</li>
<li class="p-inline-list__item">
<a href="/security/oval">OVAL data</a>
Expand Down

0 comments on commit 86a207e

Please sign in to comment.