From d5879dc22d9de441864026aae4b046f389f44b9a Mon Sep 17 00:00:00 2001 From: "David J. Yu" <87633683+ddjnw1yu@users.noreply.github.com> Date: Fri, 12 Apr 2024 10:42:54 +1200 Subject: [PATCH 1/4] Remove image title from isReady() Failed request and incorrect name structure will cause forever loading --- components/Gallery/GalleryItems/FileViewerCard.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/Gallery/GalleryItems/FileViewerCard.vue b/components/Gallery/GalleryItems/FileViewerCard.vue index 2e3e7fb8..944f2b4d 100644 --- a/components/Gallery/GalleryItems/FileViewerCard.vue +++ b/components/Gallery/GalleryItems/FileViewerCard.vue @@ -104,7 +104,7 @@ export default { }, computed: { isReady() { - return this.data.title && (this.thumbnail || this.useDefaultImg) && (this.data.link || this.data.userData) + return (this.thumbnail || this.useDefaultImg) && (this.data.link || this.data.userData) }, imageHeight() { return this.showCardDetails ? this.height * 0.525 : this.height From 7654466147d08d8713a0a99c7241aadaccbf8c3b Mon Sep 17 00:00:00 2001 From: "David J. Yu" <87633683+ddjnw1yu@users.noreply.github.com> Date: Fri, 12 Apr 2024 10:44:32 +1200 Subject: [PATCH 2/4] Use original name if no file suffix If no file suffix, the name will be undefined --- components/ImagesGallery/ImagesGallery.vue | 3 +++ 1 file changed, 3 insertions(+) diff --git a/components/ImagesGallery/ImagesGallery.vue b/components/ImagesGallery/ImagesGallery.vue index 4a78878e..ae67a748 100644 --- a/components/ImagesGallery/ImagesGallery.vue +++ b/components/ImagesGallery/ImagesGallery.vue @@ -808,6 +808,9 @@ export default { const name = response.name if (name) { this.$set(item, 'title', name.substring(0, name.lastIndexOf('.'))) + if (name.lastIndexOf('.') === -1) { + this.$set(item, 'title', name) + } } }, reason => { From abd46a158e3abd07e682039b7a80ab48b4ae0fa0 Mon Sep 17 00:00:00 2001 From: "David J. Yu" <87633683+ddjnw1yu@users.noreply.github.com> Date: Fri, 12 Apr 2024 10:46:41 +1200 Subject: [PATCH 3/4] Add thumbnail prefix if response exist The thumbnail response can be empty string. When this happens, the default thumbnail will not be used. --- components/ImagesGallery/ImagesGallery.vue | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/components/ImagesGallery/ImagesGallery.vue b/components/ImagesGallery/ImagesGallery.vue index ae67a748..7c54f1dc 100644 --- a/components/ImagesGallery/ImagesGallery.vue +++ b/components/ImagesGallery/ImagesGallery.vue @@ -782,8 +782,9 @@ export default { biolucida.getThumbnail(info.id).then( response => { let item = items.find(x => x.id === info.id) - - this.$set(item, 'thumbnail', 'data:image/png;base64,' + response.data) + if (response.data) { + this.$set(item, 'thumbnail', 'data:image/png;base64,' + response.data) + } }, reason => { if ( From a5aabc9a64e0668435a5f47f1ca55a9904678168 Mon Sep 17 00:00:00 2001 From: "David J. Yu" <87633683+ddjnw1yu@users.noreply.github.com> Date: Fri, 12 Apr 2024 10:49:08 +1200 Subject: [PATCH 4/4] Remove duplicate images from biolucida dataset When duplicate images exist, except the first image request, all others will have no responses. --- components/ImagesGallery/ImagesGallery.vue | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/components/ImagesGallery/ImagesGallery.vue b/components/ImagesGallery/ImagesGallery.vue index 7c54f1dc..0d3f28d6 100644 --- a/components/ImagesGallery/ImagesGallery.vue +++ b/components/ImagesGallery/ImagesGallery.vue @@ -526,7 +526,9 @@ export default { const baseRoute = this.$router.options.base || '/' if ('dataset_images' in biolucidaData) { items.push( - ...Array.from(biolucidaData.dataset_images, dataset_image => { + ...Array.from(biolucidaData.dataset_images.filter((obj, index) => { + return index === biolucidaData.dataset_images.findIndex(o => obj.image_id === o.image_id); + }), dataset_image => { let filePath = "" biolucida2DItems.forEach(biolucida2DItem => { if (pathOr("", ['biolucida','identifier'], biolucida2DItem) == dataset_image.image_id) {