From dd0f7c8f5e8c4147687b26d77d09ae6f420e52b3 Mon Sep 17 00:00:00 2001 From: Harsh Master Date: Sat, 30 Sep 2023 08:49:36 +0530 Subject: [PATCH 1/3] Issue #13093 & #12478 resolved Issue #13093 & #12478 have been resolved and search works on enter press --- static/js/src/cve/cve.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/static/js/src/cve/cve.js b/static/js/src/cve/cve.js index 8df30a93a7b..c099c586d72 100644 --- a/static/js/src/cve/cve.js +++ b/static/js/src/cve/cve.js @@ -68,6 +68,11 @@ function handleSearchInput(event) { searchInput.addEventListener("keyup", handleSearchInput); +searchForm.addEventListener("submit", function (event) { + event.preventDefault(); // Prevent the default form submission + handleCveIdInput(searchInput.value); +}); + attachEvents(); handleButtons(); disableSelectedVersions(); From 788c6cf9319ea08b9cbe4e1b7424576bfc574ef0 Mon Sep 17 00:00:00 2001 From: Harsh Master Date: Thu, 12 Oct 2023 11:17:28 +0530 Subject: [PATCH 2/3] Fixing PR Fixed PR --- static/js/src/cve/cve.js | 10 +++++----- templates/security/cve/index.html | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/static/js/src/cve/cve.js b/static/js/src/cve/cve.js index c099c586d72..df35a7898a9 100644 --- a/static/js/src/cve/cve.js +++ b/static/js/src/cve/cve.js @@ -8,6 +8,7 @@ import { } from "./cve-search.js"; const searchInput = document.querySelector("#q"); +const searchForm = document.querySelector("#searchForm"); function handleCveIdInput(value) { const packageInput = document.querySelector("#package"); @@ -63,16 +64,15 @@ function handleCveIdInput(value) { handleCveIdInput(searchInput.value); function handleSearchInput(event) { + if (event.key === "Enter"){ + searchForm.submit(); + }else{ handleCveIdInput(event.target.value); + } } searchInput.addEventListener("keyup", handleSearchInput); -searchForm.addEventListener("submit", function (event) { - event.preventDefault(); // Prevent the default form submission - handleCveIdInput(searchInput.value); -}); - attachEvents(); handleButtons(); disableSelectedVersions(); diff --git a/templates/security/cve/index.html b/templates/security/cve/index.html index 19bd850bbfb..e1770baacc8 100644 --- a/templates/security/cve/index.html +++ b/templates/security/cve/index.html @@ -32,7 +32,7 @@

CVE reports

Search

{% endif %} -
+
From b47ff87ceb16929b953254796dda2f0679a6bc5b Mon Sep 17 00:00:00 2001 From: Harsh Master <80234396+Harsh0707005@users.noreply.github.com> Date: Mon, 16 Oct 2023 13:08:59 +0530 Subject: [PATCH 3/3] Update static/js/src/cve/cve.js Co-authored-by: MariaPaula Trujillo --- static/js/src/cve/cve.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/static/js/src/cve/cve.js b/static/js/src/cve/cve.js index df35a7898a9..d10fc4920e0 100644 --- a/static/js/src/cve/cve.js +++ b/static/js/src/cve/cve.js @@ -64,10 +64,10 @@ function handleCveIdInput(value) { handleCveIdInput(searchInput.value); function handleSearchInput(event) { - if (event.key === "Enter"){ + if (event.key === "Enter") { searchForm.submit(); - }else{ - handleCveIdInput(event.target.value); + } else { + handleCveIdInput(event.target.value); } }