diff --git a/package-lock.json b/package-lock.json index cb6d8878..e051ebfa 100644 --- a/package-lock.json +++ b/package-lock.json @@ -15,6 +15,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", @@ -2289,6 +2290,16 @@ "node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7" } }, + "node_modules/buefy": { + "name": "@ntohq/buefy-next", + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/@ntohq/buefy-next/-/buefy-next-0.1.4.tgz", + "integrity": "sha512-fRBRa9+OobiJZsHcKyQZj0CaVnHJnDstpv5dva+1xRaA06DC+MaOH1W0DK5EtSZo4pg/fH/vxO14Gs0jz3oXdg==", + "license": "MIT", + "peerDependencies": { + "vue": "^3.0.0" + } + }, "node_modules/bulma": { "version": "0.9.4", "resolved": "https://registry.npmjs.org/bulma/-/bulma-0.9.4.tgz", @@ -7978,6 +7989,12 @@ "update-browserslist-db": "^1.0.13" } }, + "buefy": { + "version": "npm:@ntohq/buefy-next@0.1.4", + "resolved": "https://registry.npmjs.org/@ntohq/buefy-next/-/buefy-next-0.1.4.tgz", + "integrity": "sha512-fRBRa9+OobiJZsHcKyQZj0CaVnHJnDstpv5dva+1xRaA06DC+MaOH1W0DK5EtSZo4pg/fH/vxO14Gs0jz3oXdg==", + "requires": {} + }, "bulma": { "version": "0.9.4", "resolved": "https://registry.npmjs.org/bulma/-/bulma-0.9.4.tgz", diff --git a/package.json b/package.json index 6f11331b..b89f08e8 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/src/main.ts b/src/main.ts index afc6143c..62f6f2bb 100644 --- a/src/main.ts +++ b/src/main.ts @@ -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'; @@ -31,6 +33,7 @@ library.add( const app = createApp(App); +app.use(Buefy); const pinia = createPinia(); pinia.use(({ store }) => { store.router = router; diff --git a/src/views/ReportRequest/ReportRequestForNonCNAs.vue b/src/views/ReportRequest/ReportRequestForNonCNAs.vue index c42ef2c8..7ba19543 100644 --- a/src/views/ReportRequest/ReportRequestForNonCNAs.vue +++ b/src/views/ReportRequest/ReportRequestForNonCNAs.vue @@ -31,7 +31,8 @@

Find the CVE Numbering Authority (CNA)

Find the CNA partner whose scope includes the product affected by the vulnerability on the - List of Partners page or in the search box below. + List of Partners + page or in the search box below.

( - 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: {