Skip to content

Commit 258bbab

Browse files
author
David T Rocca
committed
fix github comments
1 parent 4e018d9 commit 258bbab

3 files changed

Lines changed: 37 additions & 37 deletions

File tree

src/components/cveRecordSearchModule.vue

Lines changed: 35 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,38 @@
11
<template>
22
<div class="field mt-1">
33
<div class="field has-addons">
4-
<div class="control">
5-
<span v-if="websiteEnv !== 'prd'" class="select cve-search-selector">
4+
<div class="control">
5+
<span v-if="websiteEnv !== 'prd'" class="select cve-search-selector">
66
<select v-model="searchType">
7-
<option>Search CVE List (Beta)</option>
8-
<option>Find a Test CVE Record/ID (Legacy)</option>
7+
<option>Search CVE List (Beta)</option>
8+
<option>Find a Test CVE Record/ID (Legacy)</option>
99
</select>
10-
</span>
11-
</div>
12-
<div class="control is-expanded">
13-
<input v-if="searchTypeBoolean" v-model.trim="queryString" @keyup.enter="onKeyUpEnter" @keyup="validateQueryString" type="text" class="input cve-id-input"
14-
placeholder="Enter keywords (e.g.: CVE ID, sql injection, etc.)"/>
15-
<input v-else v-model="cveId" @keyup.enter="onKeyUpEnter" @keyup="validateQueryString" @blur="removeHelpText" type="text" class="input cve-id-input"
16-
placeholder="Enter CVE ID (CVE-YYYY-NNNN)"/>
17-
</div>
18-
<div class="control">
19-
<button @click="validate"
20-
class="button cve-button cve-button-accent-warm"
21-
:class="{'is-loading': cveListSearchStore.isSearching, 'disabled': cveListSearchStore.isSeachButtonDisabled}"
10+
</span>
11+
</div>
12+
<div class="control is-expanded">
13+
<input v-if="searchTypeBoolean" v-model.trim="queryString" @keyup.enter="onKeyUpEnter"
14+
@keyup="validateQueryString" type="text" class="input cve-id-input"
15+
placeholder="Enter keywords (e.g.: CVE ID, sql injection, etc.)" />
16+
<input v-else v-model="cveId" @keyup.enter="onKeyUpEnter" @keyup="validateQueryString" @blur="removeHelpText"
17+
type="text" class="input cve-id-input" placeholder="Enter CVE ID (CVE-YYYY-NNNN)" />
18+
</div>
19+
<div class="control">
20+
<button @click="validate" class="button cve-button cve-button-accent-warm"
21+
:class="{ 'is-loading': cveListSearchStore.isSearching, 'disabled': cveListSearchStore.isSeachButtonDisabled }"
2222
:aria-disabled="cveListSearchStore.isSeachButtonDisabled">
23-
Search {{ websiteEnv === 'test' ? 'CVE List in Test' : ''}}
23+
Search {{ websiteEnv === 'test' ? 'CVE List in Test' : '' }}
2424
</button>
25+
</div>
2526
</div>
26-
</div>
2727
<div class="notification is-warning is-light" role="alert" v-if="errorMessage.length > 0">
2828
<div class="is-flex is-align-content-flex-start">
2929
<p id="alertIcon" class="is-hidden">alert</p>
30-
<font-awesome-icon style="flex: 0 0 40px; margin-top:3px" size="lg" icon="exclamation-triangle" role="alert"
30+
<font-awesome-icon style="flex: 0 0 40px; margin-top:3px" size="lg" icon="exclamation-triangle" role="alert"
3131
aria-labelledby="alertIcon" aria-hidden="false" />
32-
<p class="cve-help-text">
33-
{{errorMessage}}
34-
<router-link to="/About/Process#request"> Learn more</router-link>
35-
</p>
32+
<p class="cve-help-text">
33+
{{ errorMessage }}
34+
<router-link to="/About/Process#request"> Learn more</router-link>
35+
</p>
3636
</div>
3737
</div>
3838
</div>
@@ -67,7 +67,7 @@ let searchTypeBoolean = computed(() => {
6767
watch(
6868
() => route.query,
6969
() => {
70-
if (route.query?.query){
70+
if (route.query?.query) {
7171
queryString.value = route.query.query.trim();
7272
validate();
7373
} else {
@@ -86,23 +86,23 @@ function startSearch() {
8686
}
8787
else {
8888
cveGenericGlobalsStore.setUseSearch(false);
89-
cveGenericGlobalsStore.setCurrentServicesUrl("https://cveawg-test.mitre.org")
89+
cveGenericGlobalsStore.setCurrentServicesUrl(cveGenericGlobalsStore.cveServiceTestBaseUrl)
9090
}
9191
if (cveGenericGlobalsStore.useSearch) {
9292
if (queryString.value !== cveListSearchStore.query) {
93-
cveListSearchStore.$reset();
94-
cveListSearchStore.query = queryString.value;
93+
cveListSearchStore.$reset();
94+
cveListSearchStore.query = queryString.value;
9595
router.push({
9696
name: 'SearchResults',
97-
query: {query: cveListSearchStore.query}
97+
query: { query: cveListSearchStore.query }
9898
});
9999
cveListSearchStore.search();
100-
}
100+
}
101101
} else {
102102
const lookupPath = `/CVERecord?id=${cveId}`;
103-
router.push(lookupPath)
103+
router.push(lookupPath)
104104
}
105-
105+
106106
}
107107
108108
function validateQueryString() {
@@ -125,7 +125,7 @@ function validateQueryString() {
125125
}
126126
} else {
127127
//Basic Checking
128-
const cveIdPattern = new RegExp(/^CVE-\d{4}-\d{4,7}$/, 'i').test(cveId);
128+
const cveIdPattern = new RegExp(/^CVE-\d{4}-\d{4,7}$/, 'i').test(cveId);
129129
if (cveId.length > 0 && !cveIdPattern) {
130130
cveListSearchStore.isSeachButtonDisabled = true;
131131
errorMessage.value = 'Only CVE IDs (CVE-YYYY-NNNN) are allowed.';
@@ -147,7 +147,7 @@ function onKeyUpEnter() {
147147
}
148148
149149
function validate() {
150-
150+
151151
validateQueryString();
152152
if (cveGenericGlobalsStore.useSearch) {
153153
if (!cveListSearchStore.isSeachButtonDisabled) {
@@ -156,7 +156,7 @@ function validate() {
156156
} else {
157157
startSearch();
158158
}
159-
159+
160160
}
161161
162162
const websiteEnv = computed(() => {
@@ -175,13 +175,12 @@ const websiteEnv = computed(() => {
175175
176176
.notification {
177177
margin: 0 0 2px 0 !important;
178-
padding: 2px 10px 2px 10px !important;
178+
padding: 2px 10px 2px 10px !important;
179179
}
180180
181181
@media screen and (min-width: $desktop) {
182182
.cve-id-input {
183183
width: 470px;
184184
}
185185
}
186-
187186
</style>

src/stores/genericGlobals.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ export const useGenericGlobalsStore = defineStore('genericGlobals', {
77
return {
88
useSearch: storedUseSearch ? JSON.parse(storedUseSearch) : true,
99
currentServicesUrl: storedCurrentServicesUrl ? JSON.parse(storedCurrentServicesUrl) : `https://${import.meta.env.VITE_CVE_SERVICES_BASE_URL}`,
10+
cveServiceTestBaseUrl: 'https://cveawg-test.mitre.org',
1011
legacyCveWebsiteLink: 'https://cve.mitre.org/cve/search_cve_list.html'
1112
};
1213
},

src/views/CVERecord/CVERecord.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ export default {
9494
return {
9595
isResultFromProd: false,
9696
// There is a special case when the website deals with some cached data. This ensures that the correct value is shown, even though it is not pretty
97-
resultUrl: this.GenericGlobalsStore.useSearch ? `https://${import.meta.env.VITE_CVE_SERVICES_BASE_URL}` : `https://cveawg-test.mitre.org`,
97+
resultUrl: this.GenericGlobalsStore.useSearch ? `https://${import.meta.env.VITE_CVE_SERVICES_BASE_URL}` : this.GenericGlobalsStore.cveServiceTestBaseUrl,
9898
usecveRecordStore: usecveRecordStore(),
9999
cveId: usecveRecordStore().cveId,
100100
showHelpText: false,

0 commit comments

Comments
 (0)