Skip to content
This repository was archived by the owner on Dec 8, 2025. It is now read-only.

Commit 7d8a4c5

Browse files
committed
fix: idnits results display + online checks
1 parent 53791ba commit 7d8a4c5

File tree

5 files changed

+67
-39
lines changed

5 files changed

+67
-39
lines changed

package-lock.json

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
},
2222
"dependencies": {
2323
"@electron/remote": "2.1.3",
24-
"@ietf-tools/idnits": "3.0.0-alpha.65",
24+
"@ietf-tools/idnits": "3.0.0-alpha.67",
2525
"@lydell/node-pty": "1.1.0",
2626
"@msgpack/msgpack": "3.1.2",
2727
"@opentelemetry/api": "1.9.0",

src/App.vue

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ import { useUserStore } from 'src/stores/user'
1616
import AppModeSidebar from 'components/AppModeSidebar.vue'
1717
import UpdaterDialog from 'components/UpdaterDialog.vue'
1818
19+
window.DRAFTFORGE = true
20+
1921
const $q = useQuasar()
2022
2123
const docsStore = useDocsStore()

src/components/DrawerChecks.vue

Lines changed: 15 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -163,25 +163,11 @@ q-list
163163
q-item-label.text-red-3 {{ state.idnitsErrors.length > 1 ? state.idnitsErrors.length + ' errors' : ' 1 error' }}
164164
.bg-dark-5.checkdetails
165165
q-list(dense, separator)
166-
q-item(
166+
idnits-result-item(
167167
v-for='nit of state.idnitsErrors'
168+
:nit='nit'
169+
color='red'
168170
)
169-
q-item-section.text-caption(style='max-width: 280px;')
170-
strong.text-red-4.ellipsis(style='max-width: 280px;') {{ nit.name }}
171-
q-tooltip {{ nit.name }}
172-
.text-blue-grey-2 {{ nit.message }}
173-
.text-blue-grey-1.q-mt-xs(v-if='nit.text') #[q-icon(name='mdi-transfer-right' color='white')] {{ nit.text }}
174-
.text-blue-grey-1.q-mt-xs(v-if='nit.path'): strong #[q-icon(name='mdi-transfer-right' color='white')] {{ nit.path }}
175-
.text-blue-grey-1.q-mt-xs(v-if='nit.lines')
176-
q-icon.q-mr-xs(name='mdi-transfer-right' color='teal-4')
177-
q-badge.text-teal-1(
178-
v-for="(ln, lnIdx) of nit.lines"
179-
:key="lnIdx"
180-
color='teal-10'
181-
) Ln {{ ln.line }}, Col {{ ln.pos }}
182-
q-item-section(side)
183-
q-btn(color='dark-2' text-color='white' icon='mdi-information-outline' padding='xs xs' size='sm' unelevated round)
184-
q-tooltip View Reference
185171

186172
q-expansion-item.bg-dark-5(
187173
v-if='state.idnitsWarnings.length > 0'
@@ -195,14 +181,11 @@ q-list
195181
q-item-label.text-orange-3 {{ state.idnitsWarnings.length > 1 ? state.idnitsWarnings.length + ' warnings' : ' 1 warning' }}
196182
.bg-dark-5.checkdetails
197183
q-list(dense, separator)
198-
q-item(
184+
idnits-result-item(
199185
v-for='nit of state.idnitsWarnings'
186+
:nit='nit'
187+
color='orange'
200188
)
201-
q-item-section
202-
.text-caption: strong.text-orange-4 {{ nit.name }}
203-
.text-caption.text-blue-grey-2 {{ nit.message }}
204-
q-item-section(side)
205-
q-btn(color='dark-2' text-color='white' icon='mdi-chevron-right' padding='sm xs' size='sm' unelevated)
206189
q-expansion-item.bg-dark-5(
207190
v-if='state.idnitsComments.length > 0'
208191
group='idnits'
@@ -215,14 +198,11 @@ q-list
215198
q-item-label.text-light-blue-3 {{ state.idnitsComments.length > 1 ? state.idnitsComments.length + ' comments' : ' 1 comment' }}
216199
.bg-dark-5.checkdetails
217200
q-list(dense, separator)
218-
q-item(
201+
idnits-result-item(
219202
v-for='nit of state.idnitsComments'
203+
:nit='nit'
204+
color='light-blue'
220205
)
221-
q-item-section
222-
.text-caption: strong.text-light-blue-4 {{ nit.name }}
223-
.text-caption.text-blue-grey-2 {{ nit.message }}
224-
q-item-section(side)
225-
q-btn(color='dark-2' text-color='white' icon='mdi-chevron-right' padding='sm xs' size='sm' unelevated)
226206
</template>
227207

228208
<script setup>
@@ -241,6 +221,8 @@ import { useEditorStore } from 'src/stores/editor'
241221
import { modelStore } from 'src/stores/models'
242222
import { MODES, ValidationError, ValidationComment, ValidationWarning } from '@ietf-tools/idnits'
243223
224+
import IdnitsResultItem from './IdnitsResultItem.vue'
225+
244226
const $q = useQuasar()
245227
246228
// STORES
@@ -503,12 +485,12 @@ async function idnitsCheck () {
503485
const results = await checkIdnits(modelStore[docsStore.activeDocument.id].getValue(), docsStore.activeDocument.fileName, state.idnitsMode, state.idnitsOffline)
504486
state.idnitsTotal = results.length
505487
for (const result of results) {
506-
if (result instanceof ValidationError) {
507-
state.idnitsErrors.push(result)
508-
} else if (result instanceof ValidationWarning) {
488+
if (result instanceof ValidationWarning) {
509489
state.idnitsWarnings.push(result)
510490
} else if (result instanceof ValidationComment) {
511491
state.idnitsComments.push(result)
492+
} else if (result instanceof ValidationError) { // must be last, as other types extend ValidationError
493+
state.idnitsErrors.push(result)
512494
} else {
513495
console.warn('idnits - Invalid result type: ', result)
514496
}
@@ -531,7 +513,7 @@ async function idnitsCheck () {
531513
} catch (err) {
532514
console.warn(err)
533515
$q.notify({
534-
message: 'Unexpected error',
516+
message: 'Fatal error - idnits crashed',
535517
caption: err.message,
536518
color: 'negative',
537519
icon: 'mdi-close-octagon'
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
<template lang="pug">
2+
q-item
3+
q-item-section.text-caption(style='max-width: 280px;')
4+
strong.ellipsis(style='max-width: 280px;', :class='`text-` + props.color + `-4`') {{ props.nit.name }}
5+
q-tooltip {{ props.nit.name }}
6+
.text-blue-grey-2 {{ props.nit.message }}
7+
.text-blue-grey-1.q-mt-xs(v-if='props.nit.text') #[q-icon(name='mdi-transfer-right' color='white')] {{ props.nit.text }}
8+
.text-blue-grey-1.q-mt-xs(v-if='props.nit.path'): strong #[q-icon(name='mdi-transfer-right' color='white')] {{ props.nit.path }}
9+
.text-blue-grey-1.q-mt-xs(v-if='props.nit.lines')
10+
q-icon.q-mr-xs(name='mdi-transfer-right' color='teal-4')
11+
q-badge.text-teal-1(
12+
v-for="(ln, lnIdx) of props.nit.lines"
13+
:key="lnIdx"
14+
color='teal-10'
15+
) Ln {{ ln.line }}, Col {{ ln.pos }}
16+
q-item-section(side)
17+
q-btn(
18+
color='dark-2'
19+
text-color='white'
20+
icon='mdi-book-open-page-variant-outline'
21+
padding='xs xs'
22+
size='sm'
23+
unelevated
24+
@click='viewReference(props.nit.refUrl)'
25+
)
26+
q-tooltip View Reference
27+
</template>
28+
29+
<script setup>
30+
const props = defineProps({
31+
nit: {
32+
type: Object,
33+
required: true
34+
},
35+
color: {
36+
type: String,
37+
default: 'red'
38+
}
39+
})
40+
41+
function viewReference (url) {
42+
window.ipcBridge.emit('launchBrowser', { url })
43+
}
44+
</script>

0 commit comments

Comments
 (0)