Skip to content

Commit

Permalink
Merge pull request #721 from egauzens/Add-sds-viewer-flag
Browse files Browse the repository at this point in the history
Added Env Var Flag for SDS Viewer
  • Loading branch information
egauzens authored Aug 23, 2023
2 parents 9eafe52 + 2ead783 commit 20eafd2
Show file tree
Hide file tree
Showing 3 changed files with 77 additions and 74 deletions.
146 changes: 74 additions & 72 deletions components/DatasetDetails/DatasetActionBox.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,87 +4,89 @@
<sparc-pill class="sparc-pill" v-if="embargoed">
Embargoed
</sparc-pill>
<div class="button-container" v-if="datasetTypeName === 'scaffold' && !datasetInfo.study">
<div v-if="hasFiles" class="button-container">
<div class="button-container">
<template v-if="datasetTypeName === 'scaffold' && !datasetInfo.study">
<div v-if="hasFiles" class="button-container">
<el-button
class="dataset-button"
@click="actionButtonClicked('images')"
>
View Scaffold
</el-button>
<el-button
class="dataset-button"
@click="actionButtonClicked('files')"
>
Get Scaffold
</el-button>
</div>
<el-button class="secondary" @click="actionButtonClicked('cite')">
Cite Scaffold
</el-button>
</template>
<template v-else-if="datasetTypeName === 'computational model'">
<el-button v-if="canViewSimulation" @click="openSimulationViewer()">
View Simulation
</el-button>
<a
v-if="canRunSimulation"
:href="`https://osparc.io/study/${simulationId}`"
target="_blank"
>
<el-button>
Run Simulation
</el-button>
</a>
<el-button
class="dataset-button"
@click="actionButtonClicked('images')"
v-if="hasFiles"
@click="actionButtonClicked('files')"
>
View Scaffold
Get Model
</el-button>
<el-button class="secondary" @click="actionButtonClicked('cite')">
Cite Model
</el-button>
<a
v-if="canViewSimulation || canRunSimulation"
href="https://osparc.io/"
target="_blank"
>
<sparc-tooltip
placement="left-center"
>
<div slot="data">
oSPARC simulations may offer<br />additional functionality, such as<br />more parameters, if you create<br />an account at
<a class="ospac-tooltip" href="https://osparc.io/">
osparc.io
</a>
</div>
<el-button slot="item" style="width: 100%;" class="secondary">
Go to oSPARC
</el-button>
</sparc-tooltip>
</a>
</template>
<template>
<el-button
class="dataset-button"
v-if="hasFiles"
@click="actionButtonClicked('files')"
>
Get Scaffold
Get Dataset
</el-button>
</div>
<el-button class="secondary" @click="actionButtonClicked('cite')">
Cite Scaffold
</el-button>
</div>
<div class="button-container" v-else-if="datasetTypeName === 'computational model'">
<el-button v-if="canViewSimulation" @click="openSimulationViewer()">
View Simulation
</el-button>
<a
v-if="canRunSimulation"
:href="`https://osparc.io/study/${simulationId}`"
target="_blank"
>
<el-button>
Run Simulation
<el-button class="secondary" @click="actionButtonClicked('cite')">
Cite Dataset
</el-button>
</a>
<el-button
v-if="hasFiles"
@click="actionButtonClicked('files')"
>
Get Model
</el-button>
<el-button class="secondary" @click="actionButtonClicked('cite')">
Cite Model
</el-button>
<a
v-if="canViewSimulation || canRunSimulation"
href="https://osparc.io/"
target="_blank"
>
<sparc-tooltip
placement="left-center"
</template>
<template v-if="sdsViewer">
<a
:href="sdsViewer"
target="_blank"
>
<div slot="data">
oSPARC simulations may offer<br />additional functionality, such as<br />more parameters, if you create<br />an account at
<a class="ospac-tooltip" href="https://osparc.io/">
osparc.io
</a>
</div>
<el-button slot="item" style="width: 100%;" class="secondary">
Go to oSPARC
<el-button class="secondary">
SDS Viewer
</el-button>
</sparc-tooltip>
</a>
</div>
<div class="button-container" v-else>
<el-button
v-if="hasFiles"
@click="actionButtonClicked('files')"
>
Get Dataset
</el-button>
<el-button class="secondary" @click="actionButtonClicked('cite')">
Cite Dataset
</el-button>
</div>
<div class="button-container" v-show="sdsViewer">
<a
:href="sdsViewer"
target="_blank"
>
<el-button class="secondary">
SDS Viewer
</el-button>
</a>
</a>
</template>
</div>
</div>
</template>
Expand Down Expand Up @@ -149,7 +151,7 @@ export default {
return propOr(false, 'embargo', this.datasetInfo)
},
sdsViewer: function() {
if (this.datasetInfo.doi) {
if (this.datasetInfo.doi && process.env.SHOW_SDS_VIEWER === 'true') {
const metacellUrl = new URL(process.env.METACELL_SDS_VIEWER_URL)
metacellUrl.searchParams.append('doi', this.datasetInfo.doi)
return metacellUrl.toString()
Expand Down
2 changes: 1 addition & 1 deletion components/DatasetDetails/DatasetFilesInfo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ export default {
return url
},
sdsViewer: function() {
if (this.datasetInfo.doi) {
if (this.datasetInfo.doi && process.env.SHOW_SDS_VIEWER === 'true') {
const metacellUrl = new URL(process.env.METACELL_SDS_VIEWER_URL)
metacellUrl.searchParams.append('doi', this.datasetInfo.doi)
return metacellUrl.toString()
Expand Down
3 changes: 2 additions & 1 deletion nuxt.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,8 @@ export default {
RECAPTCHA_SECRET_KEY: process.env.RECAPTCHA_SECRET_KEY,
METRICS_URL: process.env.METRICS_URL || 'https://metrics.sparc.science',
METACELL_SDS_VIEWER_URL: process.env.METACELL_SDS_VIEWER_URL || 'https://metacell.github.io/sds-viewer',
SHOW_HIERARCHAL_FACETS: process.env.SHOW_HIERARCHAL_FACETS || 'false'
SHOW_HIERARCHAL_FACETS: process.env.SHOW_HIERARCHAL_FACETS || 'false',
SHOW_SDS_VIEWER: process.env.SHOW_SDS_VIEWER || 'false'
},

serverMiddleware: [
Expand Down

0 comments on commit 20eafd2

Please sign in to comment.