1
1
import Vue from 'vue'
2
2
import 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'
4
4
import type { RootState } from '../types'
5
5
import type { HistoryItem } from '../history/types'
6
6
import { SupportedImageFormats , SupportedMarkdownFormats , SupportedVideoFormats } from '@/globals'
@@ -16,9 +16,9 @@ export const getters: GetterTree<FilesState, RootState> = {
16
16
const items : FileBrowserEntry [ ] = [ ]
17
17
18
18
const [ root , ...restOfPath ] = path . split ( '/' )
19
- const pathNoRoot = restOfPath . join ( '/' )
19
+ const pathFilename = restOfPath . join ( '/' )
20
20
21
- if ( pathNoRoot !== '' ) {
21
+ if ( pathFilename !== '' ) {
22
22
const item : AppDirectory = {
23
23
type : 'directory' ,
24
24
name : '..' ,
@@ -91,7 +91,7 @@ export const getters: GetterTree<FilesState, RootState> = {
91
91
type : 'file' ,
92
92
name : file . filename ,
93
93
extension,
94
- path : pathNoRoot ,
94
+ path : pathFilename ,
95
95
modified : new Date ( file . modified ) . getTime ( )
96
96
}
97
97
@@ -192,16 +192,24 @@ export const getters: GetterTree<FilesState, RootState> = {
192
192
const file = pathContent ?. files . find ( file => file . filename === filename )
193
193
194
194
if ( file ) {
195
- const metadata : Partial < MoonrakerFileMeta > & Pick < AppFileWithMeta , 'history' > = { }
195
+ const metadata : Partial < AppFileMeta > & Pick < AppFileWithMeta , 'history' > = { }
196
196
197
197
if ( 'job_id' in file && file . job_id ) {
198
198
const history : HistoryItem | undefined = rootGetters [ 'history/getHistoryById' ] ( file . job_id )
199
199
200
200
metadata . history = history
201
201
}
202
202
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
+
203
211
const [ , ...restOfPath ] = path . split ( '/' )
204
- const pathNoRoot = restOfPath . join ( '/' )
212
+ const pathFilename = restOfPath . join ( '/' )
205
213
206
214
const extensionIndex = filename . lastIndexOf ( '.' )
207
215
const extension = extensionIndex > - 1 ? filename . substring ( extensionIndex ) : ''
@@ -212,7 +220,7 @@ export const getters: GetterTree<FilesState, RootState> = {
212
220
type : 'file' ,
213
221
name : file . filename ,
214
222
extension,
215
- path : pathNoRoot ,
223
+ path : pathFilename ,
216
224
modified : new Date ( file . modified ) . getDate ( )
217
225
}
218
226
0 commit comments