Skip to content

Commit

Permalink
Merge pull request #3324 from CVEProject/rl-2922-missing-cna-lookup
Browse files Browse the repository at this point in the history
Resolves #2922 - create CNA search box for non-CNA reporting/requests (int)
  • Loading branch information
jdaigneau5 authored Dec 17, 2024
2 parents 543e416 + 7739752 commit 9c5e5c9
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 10 deletions.
17 changes: 17 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"@fortawesome/free-solid-svg-icons": "^6.5.1",
"@fortawesome/vue-fontawesome": "^3.0.5",
"axios": "^1.6.5",
"buefy": "npm:@ntohq/buefy-next@^0.1.4",
"bulma": "^0.9.4",
"bulma-timeline": "^3.0.5",
"lodash": "^4.17.21",
Expand Down
3 changes: 3 additions & 0 deletions src/main.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@

import { createApp } from 'vue';
import Buefy from 'buefy';
import 'buefy/dist/buefy.css';
import { createPinia } from 'pinia';
import VueGtag from 'vue-gtag';
import LoadScript from 'vue-plugin-load-script';
Expand Down Expand Up @@ -31,6 +33,7 @@ library.add(


const app = createApp(App);
app.use(Buefy);
const pinia = createPinia();
pinia.use(({ store }) => {
store.router = router;
Expand Down
38 changes: 28 additions & 10 deletions src/views/ReportRequest/ReportRequestForNonCNAs.vue
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@
<h4 class="title">Find the CVE Numbering Authority (CNA)</h4>
<p>
Find the CNA partner whose scope includes the product affected by the vulnerability on the
<router-link to="/PartnerInformation/ListofPartners">List of Partners</router-link> page or in the search box below.
<router-link to="/PartnerInformation/ListofPartners">List of Partners</router-link>
page or in the search box below.
</p>
<b-field>
<b-autocomplete
Expand Down Expand Up @@ -188,17 +189,34 @@ export default {
},
computed: {
filteredDataObj() {
const results = this.data.filter((option) => (
option.organizationName
.toString()
.toLowerCase()
.indexOf(this.name.toLowerCase()) >= 0
));
const normalizedName = this.name.toLowerCase();
if (!normalizedName.length)
return;
if (results.length > 10) {
return results.splice(0, 10);
let results = this.data.filter((option) => (
option.organizationName.toLowerCase()
.indexOf(normalizedName) >= 0));
function cmp(cna1, cna2) {
// Sorts the list of organization names based on the characters
// entered by the user in the search box. For example, if the user
// has entered "br", then "Brocade Communications" is listed before
// "Jetbrains" because "br" is closest to the beginning of the
// string in "Brocade Communications".
const cna1NormalName = cna1.organizationName.toLowerCase();
const cna2NormalName = cna2.organizationName.toLowerCase()
const cna1Index = cna1NormalName.indexOf(normalizedName);
const cna2Index = cna2NormalName.indexOf(normalizedName);
return cna1Index < cna2Index ? -1 : cna1Index > cna2Index ? 1 :
cna1NormalName.localeCompare(cna2NormalName);
}
return results;
// Limit the choices presented to the user to the first 10 organizations
// in the list.
return results.sort(cmp).slice(0, 10);
},
},
methods: {
Expand Down

0 comments on commit 9c5e5c9

Please sign in to comment.