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

dynamic title for structure

parent 7982e1c5
No related branches found
No related tags found
3 merge requests!229Draft: Modify all articles with article struct,!228Uniq molstar plugin per page,!226Resolve "Design of the structure section in a system's page"
Pipeline #127253 waiting for manual action with stages
in 6 minutes and 38 seconds
...@@ -6,6 +6,7 @@ import MolstarPdbePlugin from './MolstarPdbePlugin.vue'; ...@@ -6,6 +6,7 @@ import MolstarPdbePlugin from './MolstarPdbePlugin.vue';
const { page } = useContent(); const { page } = useContent();
// get the structures // get the structures
const structures = ref() const structures = ref()
const structureTitle = ref("Structure")
const msIndexName = ref<string>("structure") const msIndexName = ref<string>("structure")
const stuctureUrls = ref<string[] | undefined>(undefined) const stuctureUrls = ref<string[] | undefined>(undefined)
const headers = ref<Record<string, any>[]>([ const headers = ref<Record<string, any>[]>([
...@@ -51,6 +52,8 @@ function pdbNameToCif(pdbPath: string) { ...@@ -51,6 +52,8 @@ function pdbNameToCif(pdbPath: string) {
} }
function displayStructure(item) { function displayStructure(item) {
stuctureUrls.value = item.structuresUrls stuctureUrls.value = item.structuresUrls
console.log(item)
structureTitle.value = `${item.subtype} - ${item.gene_name}`
} }
...@@ -145,6 +148,6 @@ console.log(structures) ...@@ -145,6 +148,6 @@ console.log(structures)
</v-row> </v-row>
</template> </template>
</v-data-table> </v-data-table>
<PdbeMolstarPlugin v-model="stuctureUrls" /> <PdbeMolstarPlugin v-model="stuctureUrls" v-model:title="structureTitle" />
</v-card> </v-card>
</template> </template>
\ No newline at end of file
...@@ -45,6 +45,7 @@ const props = withDefaults(defineProps<Props>(), { ...@@ -45,6 +45,7 @@ const props = withDefaults(defineProps<Props>(), {
}) })
const dataUrls = defineModel() const dataUrls = defineModel()
const title = defineModel('title')
const pdbeMolstarComponent = ref(null) const pdbeMolstarComponent = ref(null)
const dialog = ref(false) const dialog = ref(false)
...@@ -62,15 +63,7 @@ const computedHeight = computed(() => { ...@@ -62,15 +63,7 @@ const computedHeight = computed(() => {
return height.value - 250 return height.value - 250
}) })
function refinedUrl(url: string) {
if (url?.startsWith('/') && !url.startsWith('//')) {
const _base = withLeadingSlash(withTrailingSlash(useRuntimeConfig().app.baseURL))
if (_base !== '/' && !url.startsWith(_base)) {
return joinURL(_base, url)
}
}
return url
}
function viewPdb(pdbPath: string | null) { function viewPdb(pdbPath: string | null) {
if (pdbPath !== null) { if (pdbPath !== null) {
dialog.value = true dialog.value = true
...@@ -85,20 +78,10 @@ function viewPdb(pdbPath: string | null) { ...@@ -85,20 +78,10 @@ function viewPdb(pdbPath: string | null) {
} }
} }
const refinedDataUrls = computed(() => {
const toValDataUrls = toValue(dataUrls)
if (toValDataUrls !== undefined && toValDataUrls.length > 0) {
return toValDataUrls.map((dataUrl) => {
return refinedUrl(dataUrl)
// return dataUrl
})
}
return toValDataUrls
})
function closeStructure() { function closeStructure() {
selectedPdb.value = null selectedPdb.value = null
dataUrls.value = undefined
dialog.value = false dialog.value = false
} }
watch(selectedPdb, (newSelectedPdb, prevSelectPdb) => { watch(selectedPdb, (newSelectedPdb, prevSelectPdb) => {
...@@ -107,9 +90,10 @@ watch(selectedPdb, (newSelectedPdb, prevSelectPdb) => { ...@@ -107,9 +90,10 @@ watch(selectedPdb, (newSelectedPdb, prevSelectPdb) => {
}) })
watchEffect(() => { watchEffect(() => {
const toValUrl = toValue(refinedDataUrls) const toValUrl = toValue(dataUrls)
if (toValUrl?.length > 0) { if (toValUrl?.length > 0) {
dialog.value = true dialog.value = true
selectedPdb.value = dataUrls.value[0]
} }
else { else {
dialog.value = false dialog.value = false
...@@ -121,9 +105,8 @@ watchEffect(() => { ...@@ -121,9 +105,8 @@ watchEffect(() => {
<v-dialog v-model="dialog" transition="dialog-bottom-transition" fullscreen :scrim="false"> <v-dialog v-model="dialog" transition="dialog-bottom-transition" fullscreen :scrim="false">
<v-card flat :rounded="false"> <v-card flat :rounded="false">
<v-toolbar> <v-toolbar>
<v-toolbar-title>Structures</v-toolbar-title> <v-toolbar-title>{{ title }}</v-toolbar-title>
<v-select v-model="selectedPdb" label="Select PDB" :items="refinedDataUrls" <v-select v-model="selectedPdb" label="Select PDB" :items="dataUrls" hide-details="auto"></v-select>
hide-details="auto"></v-select>
<v-spacer></v-spacer> <v-spacer></v-spacer>
<v-btn :disabled="!selectedPdb" icon="md:download" :href="structureToDownload"></v-btn> <v-btn :disabled="!selectedPdb" icon="md:download" :href="structureToDownload"></v-btn>
......
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