diff --git a/components/BiolucidaViewer/BiolucidaViewer.vue b/components/BiolucidaViewer/BiolucidaViewer.vue index ea012dd8..872d272d 100644 --- a/components/BiolucidaViewer/BiolucidaViewer.vue +++ b/components/BiolucidaViewer/BiolucidaViewer.vue @@ -86,13 +86,43 @@ export default { default: () => {} }, }, - + data() { + return { + webNeurolucidaLink: '', + } + }, + async fetch() { + try { + const image_identifier = this.data.biolucida_image_id + const [ + view_info, + image_info, + ] = await Promise.all([ + biolucida.decodeViewParameter(this.viewId), + biolucida.getImageInfo(image_identifier), + ]) + const BASE_URL = `blv:${process.env.BL_SERVER_URL}` + const queryParameters = `image_id=${image_identifier}&type=${view_info[1]}${view_info[2]}&filename=${image_info.name}` + const webNeurolucidaLink = BASE_URL + '/image_view?' + queryParameters + this.webNeurolucidaLink = webNeurolucidaLink + } catch (e) { + console.log(e) + } + }, mounted() { window.addEventListener('message', this.receiveMessage) }, beforeDestroy() { window.removeEventListener('message', this.receiveMessage) }, + computed: { + viewId() { + return this.data.share_link.replace( + process.env.BL_SHARE_LINK_PREFIX, + '' + ) + }, + }, methods: { launchViewer() { window.open(this.data.blv_link, '_blank') @@ -102,7 +132,7 @@ export default { .fetchNeurolucida360Url({ applicationRequest: 'NL360', userID: 'SPARCPortal', - sessionContext: this.data.web_neurolucida_link + sessionContext: this.webNeurolucidaLink }) .then(response => { if (response.data.url) { diff --git a/components/ViewersMetadata/BiolucidaViewerMetadata.vue b/components/ViewersMetadata/BiolucidaViewerMetadata.vue index bf87c798..6a9d9c18 100644 --- a/components/ViewersMetadata/BiolucidaViewerMetadata.vue +++ b/components/ViewersMetadata/BiolucidaViewerMetadata.vue @@ -103,7 +103,6 @@ export default { share_link: '', status: '', location: '', - web_neurolucida_link: '' } } }, @@ -119,9 +118,6 @@ export default { data() { return { data_collection: '', - blv_link: '', - web_neurolucida_link: '', - image_info: '', xmp_metadata: '', } }, @@ -130,29 +126,17 @@ export default { try { const image_identifier = this.biolucidaData.biolucida_image_id const [ - blv_info, - view_info, - image_info, xmp_metadata, readme_markdown ] = await Promise.all([ - biolucida.getBLVLink(image_identifier), - biolucida.decodeViewParameter(this.viewId), - biolucida.getImageInfo(image_identifier), biolucida.getXMPInfo(image_identifier), fetch(this.datasetInfo.readme).then((response) => { return response.text() }) ]) - const BASE_URL = `blv:${process.env.BL_SERVER_URL}` - const queryParameters = `image_id=${image_identifier}&type=${view_info[1]}${view_info[2]}&filename=${image_info.name}` - const webNeurolucidaLink = BASE_URL + '/image_view?' + queryParameters const html = this.parseMarkdown(readme_markdown) this.data_collection = extractSection(/data collect[^:]+:/i, html) - this.blv_link = blv_info['link'] - this.web_neurolucida_link = webNeurolucidaLink - this.image_info = image_info this.xmp_metadata = xmp_metadata } catch (e) { console.log(e)