Skip to content

Commit

Permalink
🚸 Find unused assets (#1324)
Browse files Browse the repository at this point in the history
  • Loading branch information
padms committed Jan 2, 2023
1 parent 7f4ba6a commit 79726f7
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions studio/src/lib/structure/items/AssetLibrary.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,16 @@ const assetLibraryItems = [
.title('Show all asset files')
.icon(FileIcon)
.child(S.documentTypeList('assetFile').id('allFiles').title('All files')),
Flags.IS_DEV &&
S.listItem()
.title('Show all unused asset files')
.icon(FileIcon)
.child(
S.documentTypeList('assetFile')
.filter(`_type in ["assetFile"] && count(*[ references(^._id) ]) == 0 && !(_id in path("drafts.**"))`)
.id('allFiles')
.title('All unused files'),
),
S.divider(),
AssetExtensionFilters(),
AssetTagFilters(),
Expand All @@ -24,6 +34,17 @@ const assetLibraryItems = [
.title('Video Assets')
.icon(() => EdsIcon(play_circle_outlined))
.child(S.documentTypeList('videoFile').id('videoFiles').title('Video Files')),
Flags.IS_DEV &&
S.listItem()
.title('Unused Video Assets')
.icon(() => EdsIcon(play_circle_outlined))
.child(
S.documentTypeList('videoFile')
.filter(`_type in ["assetFile"] && count(*[ references(^._id) ]) == 0 && !(_id in path("drafts.**"))`)
.filter(`_type in ["assetFile"] && count(*[ references(^._id) ]) == 0 && !(_id in path("drafts.**"))`)
.id('videoFiles')
.title('Video Files'),
),
].filter((e) => e)

export const AssetLibrary = S.listItem()
Expand Down

0 comments on commit 79726f7

Please sign in to comment.