From 982faeeeb46dc06661250bf504b83c1423015b3f Mon Sep 17 00:00:00 2001
From: Remi  PLANEL <rplanel@pasteur.fr>
Date: Mon, 24 Jun 2024 19:06:28 +0200
Subject: [PATCH] fix bug structure

---
 components/content/StructureDb.vue | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/components/content/StructureDb.vue b/components/content/StructureDb.vue
index 19e480fe..10fe4461 100644
--- a/components/content/StructureDb.vue
+++ b/components/content/StructureDb.vue
@@ -130,8 +130,7 @@ const dataTableServerProps = computed(() => {
 
 
 function toFolseekUrl(item: Item) {
-    const url = joinURL("/" + item.system, item.pdb.replace(/\.pdb$/i, ".html"))
-    console.log(url)
+    const url = joinURL("/" + item.system.toLocaleLowerCase(), item.pdb.replace(/\.pdb$/i, ".html"))
     const { refinedUrl } = useRefinedUrl(url)
     return toValue(refinedUrl)
 }
@@ -162,11 +161,14 @@ function pdbNameToCif(pdbPath: string) {
 
 function buildStructureUrl(item: StructureItem) {
     const lowercaseSystem = item.system.toLocaleLowerCase()
-    return [
-        `/${lowercaseSystem}/${pdbNameToCif(item.pdb)}`,
-        `/${lowercaseSystem}/${item.pdb}`].map(url => {
-            return toValue(useRefinedUrl(url).refinedUrl)
-        })
+
+    if (item?.pdb && item?.pdb !== 'na') {
+        return [
+            `/${lowercaseSystem}/${pdbNameToCif(item.pdb)}`,
+            `/${lowercaseSystem}/${item.pdb}`].map(url => {
+                return toValue(useRefinedUrl(url).refinedUrl)
+            })
+    }
 }
 
 function displayStructure(item: StructureItem) {
@@ -258,7 +260,7 @@ const { refinedUrl: downloadAllCifUrl } = useRefinedUrl("/df-all-cifs.tar.gz")
                 </CollapsibleChips>
             </template>
             <template #[`item.structure`]="{ item }">
-                <v-row justify="space-between" dense no-gutters align="center">
+                <v-row v-if="item?.pdb !== 'na'" justify="space-between" dense no-gutters align="center">
                     <v-col>
                         <v-btn size="x-small" variant="text" icon="md:visibility"
                             @click="displayStructure(item)"></v-btn>
-- 
GitLab