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(() => {
6767watch (
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
108108function 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
149149function 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
162162const 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>
0 commit comments