Skip to content

Commit 2f78976

Browse files
#3160 fix search on bad input after record lookup
1 parent d26345e commit 2f78976

1 file changed

Lines changed: 11 additions & 7 deletions

File tree

src/components/cveRecordSearchModule.vue

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
The Test website (test.cve.org) has a new drop-down menu below.
1717
<span class="button is-ghost cve-inner-btn">Read {{ showSearchHelpText ? 'less...' : 'more...' }}</span>
1818
</button>
19-
<div v-if="showSearchHelpText" id="searchHelpText" class="cve-help-text" style="max-width: 860px">
19+
<div v-if="showSearchHelpText" id="searchHelpText" class="cve-help-text" style="max-width: 810px">
2020
<ol>
2121
<li>
2222
<span class="has-text-weight-bold">Search Capability (Beta) Community testers</span> – To beta-test the new search feature, select
@@ -65,7 +65,7 @@
6565
<button @click="validate" class="button cve-button cve-button-accent-warm"
6666
:class="{ 'is-loading': cveListSearchStore.isSearching, 'disabled': cveListSearchStore.isSeachButtonDisabled }"
6767
:aria-disabled="cveListSearchStore.isSeachButtonDisabled">
68-
Search
68+
{{ searchTypeBoolean ? 'Search' : 'Find'}}
6969
</button>
7070
</div>
7171
</div>
@@ -112,10 +112,7 @@ let searchTypeBoolean = computed(() => {
112112
});
113113
114114
watch(searchType, () => {
115-
cveListSearchStore.searchType = (searchType.value === 'Search CVE List (Beta)') ? true : false;
116-
cveId = cveRecordStore.cveId = '';
117-
queryString.value = cveListSearchStore.query = '';
118-
errorMessage.value = '';
115+
resetStates();
119116
});
120117
121118
watch(
@@ -131,6 +128,14 @@ watch(
131128
}
132129
)
133130
131+
function resetStates() {
132+
cveListSearchStore.searchType = cveGenericGlobalsStore.useSearch = searchTypeBoolean.value;
133+
cveId = '';
134+
queryString.value = cveListSearchStore.query = '';
135+
errorMessage.value = '';
136+
cveListSearchStore.showHelpText = false;
137+
cveListSearchStore.isSeachButtonDisabled = true;
138+
}
134139
135140
function startSearch() {
136141
// We only want to flip the search item _When we actually do a search_ otherwise we should default back to what we were on a page refresh
@@ -156,7 +161,6 @@ function startSearch() {
156161
const lookupPath = `/CVERecord?id=${cveId}`;
157162
router.push(lookupPath)
158163
}
159-
160164
}
161165
162166
function validateQueryString() {

0 commit comments

Comments
 (0)