Skip to content

Commit 19e26af

Browse files
authored
Merge pull request #394 from CVEProject/tat-39-40
Tat #39 #40 fixes from NPO test results
2 parents b71f42d + 0f6dd35 commit 19e26af

File tree

2 files changed

+16
-15
lines changed

2 files changed

+16
-15
lines changed

src/components/cveRecordLookupModule.vue

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<div class="field mt-1" style="">
33
<div class="field has-addons mb-1">
44
<div class="control is-expanded">
5-
<input v-model="cveId" @keyup.enter="lookupId" @keyup="validateCveId" @blur="removeHelpText" type="text" class="input cve-id-input"
5+
<input v-model="cveId" @keyup.enter="onKeyUpEnter" @keyup="validateCveId" @blur="removeHelpText" type="text" class="input cve-id-input"
66
placeholder="Enter CVE ID (CVE-YYYY-NNNN)"/>
77
</div>
88
<div class="control">
@@ -303,6 +303,11 @@ export default ({
303303
304304
this.formatCveRecord();
305305
},
306+
onKeyUpEnter() {
307+
this.validateCveId();
308+
309+
if (!this.disabled) this.lookupId();
310+
},
306311
},
307312
});
308313
</script>

src/views/CVERecord.vue

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -36,24 +36,25 @@
3636
<section class="cve-accordian">
3737
<div class="message">
3838
<div class="message-header cve-base-light-gray-borders-bg">
39-
<p style="margin-top: auto !important; margin-bottom: auto !important">{{showRecord ? 'Hide' : 'View'}} full JSON 4.0 record</p>
40-
<button class="button" @click="toggleRecord" :aria-expanded="!true ? 'true' : 'false'" aria-controls="cve-id">
39+
<p style="margin-top: auto !important; margin-bottom: auto !important">
40+
{{this.$store.state.showJsonRecord ? 'Hide' : 'View'}} full JSON 4.0 record
41+
</p>
42+
<button class="button" @click="toggleRecord"
43+
:aria-expanded="!this.$store.state.showJsonRecord ? 'true' : 'false'" aria-controls="cve-id">
4144
<span class="icon is-small">
4245
<p id="cve-id-alttext" class="is-hidden">
4346
{{true ? 'collapse' : 'expand'}}
4447
</p>
45-
<font-awesome-icon :icon="showRecord ? 'minus' : 'plus'"
48+
<font-awesome-icon :icon="this.$store.state.showJsonRecord ? 'minus' : 'plus'"
4649
aria-hidden="false" focusable="true" aria-labelledby="cve-id-alttext"/>
4750
</span>
4851
</button>
4952
</div>
5053
<div class="message-body pb-0" :class="{'is-hidden': false}" id="cve-id">
51-
<div class="block">
52-
<pre :class="[{'is-hidden': !showRecord}]" v-html="$sanitize(JSON.stringify(this.$store.state.recordData, null, 2))"></pre>
53-
</div>
54+
<pre :class="[{'is-hidden': !this.$store.state.showJsonRecord}]"
55+
v-html="$sanitize(JSON.stringify(this.$store.state.recordData, null, 2))"></pre>
5456
</div>
5557
</div>
56-
<pre :class="[{'is-hidden': !showRecord}]" v-html="$sanitize(JSON.stringify(this.$store.state.recordData, null, 2))"></pre>
5758
</section>
5859
<div class="cve-scrollx-table-container">
5960
<table class="table is-striped is-hoverable cve-border-dark-blue">
@@ -117,7 +118,7 @@
117118
<ul v-for="reference in this.$store.state.recordData.reference_data" :key="reference.index">
118119
<li v-if="reference.url !== undefined" class="cve-task-tile-list-item">
119120
<a :href="$sanitize(reference.url)" class="cve-word-wrap" target="_blank">
120-
{{reference.name === undefined ? $sanitize(reference.url) : $sanitize(reference.name)}}
121+
{{$sanitize(reference.url)}}
121122
</a>
122123
</li>
123124
</ul>
@@ -151,14 +152,9 @@
151152
<script>
152153
export default {
153154
name: 'CVERecord',
154-
data() {
155-
return {
156-
showRecord: false,
157-
};
158-
},
159155
methods: {
160156
toggleRecord() {
161-
this.showRecord = !this.showRecord;
157+
this.$store.commit('updateState', { showJsonRecord: !this.$store.state.showJsonRecord });
162158
},
163159
},
164160
};

0 commit comments

Comments
 (0)