From a3a2c6a3f7b04d76c3ce8ab810dfbdf7207a41e6 Mon Sep 17 00:00:00 2001 From: Remi PLANEL <rplanel@pasteur.fr> Date: Wed, 3 Apr 2024 15:43:44 +0200 Subject: [PATCH] handle case when title do not correspond to system name --- components/content/ArticleStructure.vue | 9 ++++--- .../content/ArticleSystemDistributionPlot.vue | 11 ++++++--- components/content/pdockqMatrix.vue | 24 ++++++++++--------- 3 files changed, 27 insertions(+), 17 deletions(-) diff --git a/components/content/ArticleStructure.vue b/components/content/ArticleStructure.vue index b1fe5ec3..76dabe6d 100644 --- a/components/content/ArticleStructure.vue +++ b/components/content/ArticleStructure.vue @@ -32,7 +32,10 @@ const groupBy = ref([ }, ]) - +const computedSystem = computed(() => { + const toValPage = toValue(page) + return toValPage?.system ?? toValPage?.title ?? undefined +}) onMounted(() => { fetchStructures() }) @@ -82,11 +85,11 @@ async function fetchStructures() { try { const d = await client.index(toValue(msIndexName)).search("", { facets: ["*"], - filter: [`System='${toValue(page).title}'`, "completed='true'"], + filter: [`System='${toValue(computedSystem)}'`, "completed='true'"], }) structures.value = d } catch (error) { - throw createError(`Cannot get structure for system: ${page.title}`) + throw createError(`Cannot get structure for system: ${toValue(computedSystem)}`) } } diff --git a/components/content/ArticleSystemDistributionPlot.vue b/components/content/ArticleSystemDistributionPlot.vue index 6bf20a3b..5ad27815 100644 --- a/components/content/ArticleSystemDistributionPlot.vue +++ b/components/content/ArticleSystemDistributionPlot.vue @@ -109,6 +109,11 @@ const distributionOptions = computed(() => { }) +const systemName = computed(() => { + const toValPage = toValue(page) + return toValPage?.system ?? toValPage?.title ?? undefined +}) + // ================================================= // ASYNC PART // ================================================= @@ -118,13 +123,13 @@ async function fetchSystemHits() { query: "", params: { facets: ["*"], - filter: [`type='${toValue(page).title}'`], + filter: [`type='${toValue(systemName)}'`], limit: 500000, } }) systemHits.value = data.value if (error.value) { - throw createError(`Cannot get hits on refseq for system: ${page.title}`) + throw createError(`Cannot get hits on refseq for system: ${toValue(systemName)}`) } } @@ -140,7 +145,7 @@ async function fetchRefSeqTaxo() { }) refseqTaxo.value = data.value if (error.value) { - throw createError(`Cannot get refseq taxo: ${page.title}`) + throw createError(`Cannot get refseq taxo: ${toValue(systemName)}`) } } diff --git a/components/content/pdockqMatrix.vue b/components/content/pdockqMatrix.vue index 34f680ed..fe082810 100644 --- a/components/content/pdockqMatrix.vue +++ b/components/content/pdockqMatrix.vue @@ -8,13 +8,10 @@ import { useRefinedUrl } from "@/composables/useRefinedUrl" import { useDisplay } from "vuetify"; -export interface Props { - system?: MaybeRef<string | null> -} + const { mobile } = useDisplay(); const { page } = useContent(); -const { system } = withDefaults(defineProps<Props>(), { system: null }) const dbName = "structure" const filterBase = ref<string[]>([ "prediction_type='multimer(dimer)'", @@ -58,17 +55,22 @@ onMounted(async () => { }) + const computedSystem = computed(() => { const toValPage = toValue(page) - const toValSystem = toValue(system) - if (toValSystem === null) { - return toValPage?.title?.toLowerCase() ?? null - } - else { - return toValSystem - } + return toValPage?.system ?? toValPage?.title ?? undefined }) +// const computedSystem = computed(() => { +// const toValSystem = toValue(system) +// if (toValSystem === null) { +// return toValue(systemName).toLowerCase() ?? null +// } +// else { +// return toValSystem +// } +// }) + const groupedPdocks = computed(() => { const toValData = toValue(data) -- GitLab