1
0
Fork 0
mirror of https://gitlab.com/bramw/baserow.git synced 2025-05-05 17:30:11 +00:00

Resolve "Error message when creating a gallery view with an image from a lookup field"

This commit is contained in:
Davide Silvestri 2024-10-04 10:39:30 +00:00
parent 71ef458c47
commit ce2df040e1
12 changed files with 150 additions and 35 deletions
web-frontend/modules/database/components/card

View file

@ -55,7 +55,6 @@
</template>
<script>
import { FileFieldType } from '@baserow/modules/database/fieldTypes'
import RecursiveWrapper from '@baserow/modules/database/components/RecursiveWrapper'
export default {
@ -93,17 +92,20 @@ export default {
},
computed: {
coverImageUrl() {
if (
this.coverImageField === null ||
this.coverImageField.type !== FileFieldType.getType()
) {
const field = this.coverImageField
if (field === null) {
return null
}
const fieldType = this.$registry.get('field', field.type)
if (!fieldType.canRepresentFiles(field)) {
return null
}
const value = this.row[`field_${this.coverImageField.id}`]
const value = this.row[`field_${field.id}`]
if (!Array.isArray(value)) {
return null
// might be a single file
return value?.is_image ? value.thumbnails.card_cover.url : null
}
const image = value.find((file) => file.is_image)