Skip to content
Snippets Groups Projects
Commit a3a2c6a3 authored by Remi  PLANEL's avatar Remi PLANEL
Browse files

handle case when title do not correspond to system name

parent 506cafe7
No related branches found
No related tags found
No related merge requests found
Pipeline #127638 waiting for manual action with stages
in 2 minutes and 46 seconds
...@@ -32,7 +32,10 @@ const groupBy = ref([ ...@@ -32,7 +32,10 @@ const groupBy = ref([
}, },
]) ])
const computedSystem = computed(() => {
const toValPage = toValue(page)
return toValPage?.system ?? toValPage?.title ?? undefined
})
onMounted(() => { onMounted(() => {
fetchStructures() fetchStructures()
}) })
...@@ -82,11 +85,11 @@ async function fetchStructures() { ...@@ -82,11 +85,11 @@ async function fetchStructures() {
try { try {
const d = await client.index(toValue(msIndexName)).search("", { const d = await client.index(toValue(msIndexName)).search("", {
facets: ["*"], facets: ["*"],
filter: [`System='${toValue(page).title}'`, "completed='true'"], filter: [`System='${toValue(computedSystem)}'`, "completed='true'"],
}) })
structures.value = d structures.value = d
} catch (error) { } catch (error) {
throw createError(`Cannot get structure for system: ${page.title}`) throw createError(`Cannot get structure for system: ${toValue(computedSystem)}`)
} }
} }
......
...@@ -109,6 +109,11 @@ const distributionOptions = computed(() => { ...@@ -109,6 +109,11 @@ const distributionOptions = computed(() => {
}) })
const systemName = computed(() => {
const toValPage = toValue(page)
return toValPage?.system ?? toValPage?.title ?? undefined
})
// ================================================= // =================================================
// ASYNC PART // ASYNC PART
// ================================================= // =================================================
...@@ -118,13 +123,13 @@ async function fetchSystemHits() { ...@@ -118,13 +123,13 @@ async function fetchSystemHits() {
query: "", query: "",
params: { params: {
facets: ["*"], facets: ["*"],
filter: [`type='${toValue(page).title}'`], filter: [`type='${toValue(systemName)}'`],
limit: 500000, limit: 500000,
} }
}) })
systemHits.value = data.value systemHits.value = data.value
if (error.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() { ...@@ -140,7 +145,7 @@ async function fetchRefSeqTaxo() {
}) })
refseqTaxo.value = data.value refseqTaxo.value = data.value
if (error.value) { if (error.value) {
throw createError(`Cannot get refseq taxo: ${page.title}`) throw createError(`Cannot get refseq taxo: ${toValue(systemName)}`)
} }
} }
......
...@@ -8,13 +8,10 @@ import { useRefinedUrl } from "@/composables/useRefinedUrl" ...@@ -8,13 +8,10 @@ import { useRefinedUrl } from "@/composables/useRefinedUrl"
import { useDisplay } from "vuetify"; import { useDisplay } from "vuetify";
export interface Props {
system?: MaybeRef<string | null>
}
const { mobile } = useDisplay(); const { mobile } = useDisplay();
const { page } = useContent(); const { page } = useContent();
const { system } = withDefaults(defineProps<Props>(), { system: null })
const dbName = "structure" const dbName = "structure"
const filterBase = ref<string[]>([ const filterBase = ref<string[]>([
"prediction_type='multimer(dimer)'", "prediction_type='multimer(dimer)'",
...@@ -58,17 +55,22 @@ onMounted(async () => { ...@@ -58,17 +55,22 @@ onMounted(async () => {
}) })
const computedSystem = computed(() => { const computedSystem = computed(() => {
const toValPage = toValue(page) const toValPage = toValue(page)
const toValSystem = toValue(system) return toValPage?.system ?? toValPage?.title ?? undefined
if (toValSystem === null) {
return toValPage?.title?.toLowerCase() ?? null
}
else {
return toValSystem
}
}) })
// const computedSystem = computed(() => {
// const toValSystem = toValue(system)
// if (toValSystem === null) {
// return toValue(systemName).toLowerCase() ?? null
// }
// else {
// return toValSystem
// }
// })
const groupedPdocks = computed(() => { const groupedPdocks = computed(() => {
const toValData = toValue(data) const toValData = toValue(data)
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment