11import Vue from 'vue'
22import type { GetterTree } from 'vuex'
3- import type { AppDirectory , AppFile , AppFileMeta , AppFileWithMeta , FileBrowserEntry , FilesState , MoonrakerFileMeta , RootProperties } from './types'
3+ import type { AppDirectory , AppFile , AppFileMeta , AppFileWithMeta , FileBrowserEntry , FilesState , RootProperties } from './types'
44import type { RootState } from '../types'
55import type { HistoryItem } from '../history/types'
66import { SupportedImageFormats , SupportedMarkdownFormats , SupportedVideoFormats } from '@/globals'
@@ -16,9 +16,9 @@ export const getters: GetterTree<FilesState, RootState> = {
1616 const items : FileBrowserEntry [ ] = [ ]
1717
1818 const [ root , ...restOfPath ] = path . split ( '/' )
19- const pathNoRoot = restOfPath . join ( '/' )
19+ const pathFilename = restOfPath . join ( '/' )
2020
21- if ( pathNoRoot !== '' ) {
21+ if ( pathFilename !== '' ) {
2222 const item : AppDirectory = {
2323 type : 'directory' ,
2424 name : '..' ,
@@ -91,7 +91,7 @@ export const getters: GetterTree<FilesState, RootState> = {
9191 type : 'file' ,
9292 name : file . filename ,
9393 extension,
94- path : pathNoRoot ,
94+ path : pathFilename ,
9595 modified : new Date ( file . modified ) . getTime ( )
9696 }
9797
@@ -192,16 +192,24 @@ export const getters: GetterTree<FilesState, RootState> = {
192192 const file = pathContent ?. files . find ( file => file . filename === filename )
193193
194194 if ( file ) {
195- const metadata : Partial < MoonrakerFileMeta > & Pick < AppFileWithMeta , 'history' > = { }
195+ const metadata : Partial < AppFileMeta > & Pick < AppFileWithMeta , 'history' > = { }
196196
197197 if ( 'job_id' in file && file . job_id ) {
198198 const history : HistoryItem | undefined = rootGetters [ 'history/getHistoryById' ] ( file . job_id )
199199
200200 metadata . history = history
201201 }
202202
203+ if ( 'filament_name' in file && file . filament_name ) {
204+ metadata . filament_name = Vue . $filters . getStringArray ( file . filament_name )
205+ }
206+
207+ if ( 'filament_type' in file && file . filament_type ) {
208+ metadata . filament_type = Vue . $filters . getStringArray ( file . filament_type )
209+ }
210+
203211 const [ , ...restOfPath ] = path . split ( '/' )
204- const pathNoRoot = restOfPath . join ( '/' )
212+ const pathFilename = restOfPath . join ( '/' )
205213
206214 const extensionIndex = filename . lastIndexOf ( '.' )
207215 const extension = extensionIndex > - 1 ? filename . substring ( extensionIndex ) : ''
@@ -212,7 +220,7 @@ export const getters: GetterTree<FilesState, RootState> = {
212220 type : 'file' ,
213221 name : file . filename ,
214222 extension,
215- path : pathNoRoot ,
223+ path : pathFilename ,
216224 modified : new Date ( file . modified ) . getDate ( )
217225 }
218226
0 commit comments