Skip to content

Commit

Permalink
Merge pull request #800 from nih-sparc/add-repository-panels-to-profi…
Browse files Browse the repository at this point in the history
…le-page

Add repository panels to profile page
  • Loading branch information
egauzens authored Mar 5, 2024
2 parents d5a4ed5 + f912e43 commit 1cb0318
Show file tree
Hide file tree
Showing 9 changed files with 135 additions and 17 deletions.
Binary file added assets/rejoin.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion components/FilesTable/FilesTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -531,7 +531,7 @@ export default {
isTimeseriesViewFile(file) {
const type = propOr('', 'packageType', file)
return type === 'TimeSeries' && process.env.SHOW_TIMESERIES_VIEWER
return type == 'TimeSeries' && process.env.SHOW_TIMESERIES_VIEWER == 'true'
},
/**
Expand Down
2 changes: 1 addition & 1 deletion components/ImagesGallery/ImagesGallery.vue
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ export default {
this.$store.dispatch('pages/datasets/datasetId/setDatasetInfo', newDatasetInfo)
// Get all timeseries files (those with an '.edf' extension)
const timeseriesData = process.env.SHOW_TIMESERIES_VIEWER
const timeseriesData = process.env.SHOW_TIMESERIES_VIEWER == 'true'
? await this.$axios.$get(`${process.env.discover_api_host}/search/files?fileType=edf&datasetId=${this.datasetId}`)
.then(({ files }) => {
let data = []
Expand Down
57 changes: 57 additions & 0 deletions components/RepositoryCard/RepositoryCard.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
<template>
<el-card :style="{ border: 'none', maxWidth: width + 'rem' }" class="card centered">
<div class="image-container">
<img class="thumbnail" :src="thumbnailUrl" alt="thumbnail loading ..." />
</div>
<div class="body1 mb-16">
{{description}}
</div>
<div class="body1 mb-16">
Status: <b>{{ status }}</b>
</div>
<a :href="buttonLink" target="_blank">
<el-button class='secondary'>
Launch Pennsieve <svg-icon icon="icon-open" height="16" width="16" />
</el-button>
</a>
</el-card>
</template>
<script>
export default {
name: 'RespositoryCard',
props: {
width: {
type: Number,
default: 13.8
},
description: {
type: String,
default: null
},
status: {
type: String,
default: null
},
buttonLink: {
type: String,
default: null
},
thumbnailUrl: {
type: String,
default: null
},
}
}
</script>
<style lang="scss" scoped>
.centered {
text-align: center;
}
.image-container {
max-width: 75%;
margin: auto;
img {
width: 100%;
}
}
</style>
6 changes: 4 additions & 2 deletions nuxt.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,15 +118,17 @@ const config = {
PENNSIEVE_API_VERSION_2: process.env.PENNSIEVE_API_VERSION_2 || 'https://api2.pennsieve.net',
ORCID_API_URL: process.env.ORCID_API_URL || 'https://pub.orcid.org/v2.1',
GOOGLE_ANALYTICS_UA: process.env.GOOGLE_ANALYTICS_UA,
SHOW_TIMESERIES_VIEWER: process.env.SHOW_TIMESERIES_VIEWER || false,
SHOW_TIMESERIES_VIEWER: process.env.SHOW_TIMESERIES_VIEWER || 'false',
RECAPTCHA_SITE_KEY: process.env.RECAPTCHA_SITE_KEY,
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_SDS_VIEWER: process.env.SHOW_SDS_VIEWER || 'false',
SHOW_DATASET_SUBMISSION_FEATURE: process.env.SHOW_DATASET_SUBMISSION_FEATURE || 'false',
GOOGLE_TAG_MANAGER_ID: process.env.GOOGLE_TAG_MANAGER_ID || 'GTM-TPT2CVCS'
GOOGLE_TAG_MANAGER_ID: process.env.GOOGLE_TAG_MANAGER_ID || 'GTM-TPT2CVCS',
SPARC_ORG_ID: process.env.SPARC_ORG_ID || 'N:organization:618e8dd9-f8d2-4dc4-9abb-c6aaab2e78a0',
REJOIN_ORG_ID: process.env.REJOIN_ORG_ID || 'N:organization:f08e188e-2316-4668-ae2c-8a20dc88502f'
},

serverMiddleware: [
Expand Down
2 changes: 1 addition & 1 deletion pages/datasets/file/_datasetId/_datasetVersion/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ export default {
packageType = file.packageType
}
const hasTimeseriesViewer = packageType === 'TimeSeries'
if (hasTimeseriesViewer && process.env.SHOW_TIMESERIES_VIEWER) {
if (hasTimeseriesViewer && process.env.SHOW_TIMESERIES_VIEWER == 'true') {
redirect(`/datasets/timeseriesviewer?dataset_id=${route.params.datasetId}&dataset_version=${route.params.datasetVersion}&file_path=${filePath}`)
}
Expand Down
2 changes: 1 addition & 1 deletion pages/datasets/timeseriesviewer/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ export default {
if (sourcePackageId !== 'details') {
packageType = file.packageType
}
const hasTimeseriesViewer = packageType === 'TimeSeries' && process.env.SHOW_TIMESERIES_VIEWER
const hasTimeseriesViewer = packageType == 'TimeSeries' && process.env.SHOW_TIMESERIES_VIEWER == 'true'
return {
datasetInfo,
Expand Down
50 changes: 39 additions & 11 deletions pages/user/profile/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -54,19 +54,20 @@
<div class="resource-container body1">
Pennsieve:
<span class="label4"><b>You are registered.</b></span>
<div class="body4">
<div class="body4 mb-8">
The Pennsieve Data Management Platform provides a scalable cloud-based solution for managing, analyzing, and sharing scientific datasets.
</div>
<div class="mt-8">
<a href="https://app.pennsieve.io/#" target="_blank">
<el-button class='secondary'>
Launch Pennsieve <svg-icon icon="icon-open" height="16" width="16" />
</el-button>
</a>
</div>
<template v-for="organization in organizations">
<repository-card
:key="organization.id"
:thumbnailUrl="organization.logo"
:description="getOrganizationDescription(organization)"
:status="organization.status"
buttonLink="https://pennsieve.io"
/>
</template>
</div>
</div>
<div class="section heading2 p-16 mt-16">
<div class="datasets-container-title">
<span class="heading2 mb-16">Published Datasets ({{ datasets.length }})</span>
Expand Down Expand Up @@ -202,6 +203,8 @@ import AuthenticatedMixin from '@/mixins/authenticated/index'
import DatasetSubmissionModal from '@/components/DatasetSubmissionModal/DatasetSubmissionModal.vue'
import createAlgoliaClient from '@/plugins/algolia.js'
import ConfirmationModal from '@/components/ConfirmationModal/ConfirmationModal.vue'
import RepositoryCard from '@/components/RepositoryCard/RepositoryCard.vue'
import { getOrganizationInfo, getOrganizationStatus } from '@/static/js/organizations'
const algoliaClient = createAlgoliaClient()
const algoliaIndex = algoliaClient.initIndex(process.env.ALGOLIA_INDEX)
Expand All @@ -214,7 +217,8 @@ export default {
ConfirmationModal,
DatasetSubmissionModal,
Gallery,
PageHero
PageHero,
RepositoryCard
},
async asyncData({env, $axios}) {
Expand Down Expand Up @@ -259,6 +263,7 @@ export default {
showDeleteConfirmationModal: false,
submissionToRetract: '',
showRetractConfirmationModal: false,
organizations: [],
}
},
Expand Down Expand Up @@ -311,11 +316,12 @@ export default {
immediate: true
},
orcid: {
handler: async function(newValue) {
handler: function(newValue) {
if (newValue && newValue !== '') {
this.fetchPublishedDatasets(newValue)
this.fetchDatasetSubmissions()
this.fetchQuestions()
this.fetchOrganizations()
}
},
immediate: true
Expand Down Expand Up @@ -386,6 +392,28 @@ export default {
return 0
}
},
async fetchOrganizations() {
const headers = { 'Authorization': `Bearer ${this.userToken}` }
const url = `${process.env.LOGIN_API_URL}/organizations?includeAdmins=false`
this.organizations = await this.$axios.$get(url, { headers }).then(response => {
const orgsResponse = propOr([], 'organizations', response)
let orgs = []
orgsResponse.forEach(org => {
const organization = propOr({}, 'organization', org)
const organizationInfo = getOrganizationInfo(organization.id)
if (organizationInfo != null) {
orgs.push({ ...organizationInfo, status: getOrganizationStatus(org) })
}
})
return orgs
}).catch(() => {
this.hasError = true
return []
})
},
getOrganizationDescription(org) {
return `Open the ${org.name} workspace in Pennsieve`
},
getDownloadsCount(id) {
let numDownloads = 0
this.downloadsSummary.filter(download => download.datasetId == id).forEach(item => {
Expand Down
31 changes: 31 additions & 0 deletions static/js/organizations.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import sparcLogo from '@/assets/logo-sparc-wave-primary.svg'
import rejoinLogo from '@/assets/rejoin.jpg'

const organizationsData = [
{
name: 'SPARC',
id: process.env.SPARC_ORG_ID,
logo: sparcLogo
},
{
name: 'RE-JOIN',
id: process.env.REJOIN_ORG_ID,
logo: rejoinLogo
}
]

export const getOrganizationInfo = id => {
const org = organizationsData.find(org => org.id == id)
return org ? org : null
}

export const getOrganizationStatus = org => {
if (org.isOwner)
return 'Owner Access'
else if (org.isAdmin)
return 'Admin Access'
else if (org.isGuest)
return 'Guest Access'
else
return 'Read Access'
}

0 comments on commit 1cb0318

Please sign in to comment.