@@ -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'
241221import { modelStore } from ' src/stores/models'
242222import { MODES , ValidationError , ValidationComment , ValidationWarning } from ' @ietf-tools/idnits'
243223
224+ import IdnitsResultItem from ' ./IdnitsResultItem.vue'
225+
244226const $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'
0 commit comments