mirror of
https://github.com/directus/directus.git
synced 2026-04-25 03:00:53 -04:00
Fix Files interface with custom junction field (#22241)
This commit is contained in:
5
.changeset/six-bags-play.md
Normal file
5
.changeset/six-bags-play.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'@directus/app': patch
|
||||
---
|
||||
|
||||
Fixed Files interface when used with custom junction field
|
||||
@@ -219,8 +219,9 @@ const downloadName = computed(() => {
|
||||
const junctionField = relationInfo.value.junctionField.field;
|
||||
const relationPkField = relationInfo.value.relatedPrimaryKeyField.field;
|
||||
|
||||
return displayItems.value.find((item) => get(item, [junctionField, relationPkField]))?.directus_files_id
|
||||
?.filename_download;
|
||||
return displayItems.value.find((item) => get(item, [junctionField, relationPkField]) === relatedPrimaryKey.value)?.[
|
||||
junctionField
|
||||
]?.filename_download;
|
||||
});
|
||||
|
||||
const downloadUrl = computed(() => {
|
||||
@@ -238,6 +239,13 @@ function getFilename(junctionRow: Record<string, any>) {
|
||||
return key;
|
||||
}
|
||||
|
||||
function getDownloadName(junctionRow: Record<string, any>) {
|
||||
const junctionField = relationInfo.value?.junctionField.field;
|
||||
if (!junctionField) return;
|
||||
|
||||
return junctionRow[junctionField]?.filename_download;
|
||||
}
|
||||
|
||||
const customFilter = computed(() => {
|
||||
if (!relationInfo.value) return;
|
||||
|
||||
@@ -335,7 +343,7 @@ const allowDrag = computed(
|
||||
</v-list-item>
|
||||
<v-list-item
|
||||
clickable
|
||||
:download="element.directus_files_id.filename_download"
|
||||
:download="getDownloadName(element)"
|
||||
:href="getAssetUrl(getFilename(element), true)"
|
||||
>
|
||||
<v-list-item-icon><v-icon name="download" /></v-list-item-icon>
|
||||
|
||||
Reference in New Issue
Block a user