8787
8888 <template #column-type =" { row } " >
8989 <!-- eslint-disable-next-line vue/no-v-html -->
90- <span v-html =" highlight(row.type, row.id, 'type')" />
90+ <span v-if =" row.typeName" v-html =" highlight(row.typeName, row.id, 'typeName')" />
91+ <span v-else class =" secret-list__empty-cell" >—</span >
9192 </template >
9293
9394 <template #column-createdAt =" { row } " >
@@ -116,6 +117,7 @@ import PencilIcon from 'vue-material-design-icons/Pencil.vue'
116117import CreateSecretDialog from ' ../dialog/CreateSecretDialog.vue'
117118import { useFolderStore } from ' ../store/modules/folder.js'
118119import { useSecretStore } from ' ../store/modules/secret.js'
120+ import { useSecretTypeStore } from ' ../store/modules/secretType.js'
119121import { useSettingsStore } from ' ../store/modules/settings.js'
120122import { getFaviconUrl } from ' ../utils/favicon.js'
121123
@@ -154,9 +156,19 @@ export default {
154156 secretStore () {
155157 return useSecretStore ()
156158 },
159+ secretTypeStore () {
160+ return useSecretTypeStore ()
161+ },
157162 settingsStore () {
158163 return useSettingsStore ()
159164 },
165+ typesById () {
166+ const map = {}
167+ for (const t of this .secretTypeStore .types ) {
168+ map[t .id ] = t .label
169+ }
170+ return map
171+ },
160172 pageTitle () {
161173 if (this .folderId ) {
162174 const folder = this .folderStore .folders .find (f => f .id === this .folderId )
@@ -172,9 +184,15 @@ export default {
172184 { key: ' createdAt' , label: t (' doriath' , ' Created' ), sortable: true },
173185 ]
174186 },
187+ enrichedSecrets () {
188+ return this .secretStore .secrets .map (s => ({
189+ ... s,
190+ typeName: this .typesById [s .typeId ] || ' ' ,
191+ }))
192+ },
175193 fuse () {
176- return new Fuse (this .secretStore . secrets , {
177- keys: [' name' , ' url' , ' type ' ],
194+ return new Fuse (this .enrichedSecrets , {
195+ keys: [' name' , ' url' , ' typeName ' ],
178196 threshold: 0.4 ,
179197 includeMatches: true ,
180198 })
@@ -185,7 +203,7 @@ export default {
185203 return this .fuse .search (query)
186204 },
187205 filteredSecrets () {
188- if (! this .fuseResults ) return this .secretStore . secrets
206+ if (! this .fuseResults ) return this .enrichedSecrets
189207 return this .fuseResults .map (r => r .item )
190208 },
191209 matchesById () {
@@ -231,7 +249,10 @@ export default {
231249 },
232250 },
233251 async created () {
234- await this .loadSecrets ()
252+ await Promise .all ([
253+ this .loadSecrets (),
254+ this .secretTypeStore .fetchTypes (),
255+ ])
235256 },
236257 methods: {
237258 async loadSecrets () {
0 commit comments