Skip to content

Commit

Permalink
Merge branch 'master' into simulation.
Browse files Browse the repository at this point in the history
  • Loading branch information
agarny committed Feb 14, 2024
2 parents 55a5788 + 298db79 commit 04ac3ee
Show file tree
Hide file tree
Showing 215 changed files with 16,731 additions and 6,622 deletions.
83 changes: 83 additions & 0 deletions .github/workflows/cypress.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
name: Cypress Tests
run-name: "Cypress E2E testing for SPARC Portal"

on:
workflow_dispatch:
pull_request_target:
types: [opened, synchronize, reopened]
branches: [master, main]

env:
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
CYPRESS_PROJECT_ID: ${{ secrets.CYPRESS_PROJECT_ID }}
ALGOLIA_API_KEY: ${{ secrets.ALGOLIA_API_KEY }}
ALGOLIA_APP_ID: ${{ secrets.ALGOLIA_APP_ID }}
ALGOLIA_INDEX: ${{ secrets.ALGOLIA_INDEX }}
AWS_USER_POOL_ID: ${{ secrets.AWS_USER_POOL_ID }}
AWS_USER_POOL_WEB_CLIENT_ID: ${{ secrets.AWS_USER_POOL_WEB_CLIENT_ID }}
BIOLUCIDA_PASSWORD: ${{ secrets.BIOLUCIDA_PASSWORD }}
BIOLUCIDA_USERNAME: ${{ secrets.BIOLUCIDA_USERNAME }}
BITLY_ACCESS_TOKEN: ${{ secrets.BITLY_ACCESS_TOKEN }}
BLACKFYNN_API_SECRET: ${{ secrets.BLACKFYNN_API_SECRET }}
BLACKFYNN_API_TOKEN: ${{ secrets.BLACKFYNN_API_TOKEN }}
BLACKFYNN_CONCEPTS_API_HOST: ${{ secrets.BLACKFYNN_CONCEPTS_API_HOST }}
CTF_API_HOST: ${{ secrets.CTF_API_HOST }}
CTF_CDA_ACCESS_TOKEN: ${{ secrets.CTF_CDA_ACCESS_TOKEN }}
CTF_SPACE_ID: ${{ secrets.CTF_SPACE_ID }}
DEPLOY_ENV: ${{ secrets.DEPLOY_ENV }}
DISABLE_REDIRECT_SSL: ${{ secrets.DISABLE_REDIRECT_SSL }}
FLATMAP_API_HOST: ${{ secrets.FLATMAP_API_HOST }}
LOGIN_API_URL: ${{ secrets.LOGIN_API_URL }}
NODE_ENV: ${{ secrets.NODE_ENV }}
NPM_CONFIG_PRODUCTION: ${{ secrets.NPM_CONFIG_PRODUCTION }}
OSPARC_HOST: ${{ secrets.OSPARC_HOST }}
PORTAL_API_HOST: ${{ secrets.PORTAL_API_HOST }}
RECAPTCHA_SECRET_KEY: ${{ secrets.RECAPTCHA_SECRET_KEY }}
RECAPTCHA_SITE_KEY: ${{ secrets.RECAPTCHA_SITE_KEY }}
ROOT_URL: ${{ secrets.ROOT_URL }}
SHOW_FUNDING_FACET: ${{ secrets.SHOW_FUNDING_FACET }}
SHOW_HIERARCHAL_FACETS: ${{ secrets.SHOW_HIERARCHAL_FACETS }}
SHOW_LOGIN_FEATURE: ${{ secrets.SHOW_LOGIN_FEATURE }}
SHOW_METRICS: ${{ secrets.SHOW_METRICS }}
SHOW_OSPARC_TAB: ${{ secrets.SHOW_OSPARC_TAB }}
SHOW_TIMESERIES_VIEWER: ${{ secrets.SHOW_TIMESERIES_VIEWER }}
SPARC_PORTAL_USER_ID: ${{ secrets.SPARC_PORTAL_USER_ID }}
SPARC_PORTAL_USER_SECRET: ${{ secrets.SPARC_PORTAL_USER_SECRET }}

jobs:
e2e-testing:
runs-on: ubuntu-latest
steps:
- run: echo "event name is:" ${{ github.event_name }}
- uses: actions-cool/check-user-permission@main
if: github.event_name == 'pull_request_target'
id: checkUser
with:
require: 'write'
username: ${{ github.event.pull_request.user.name }}
- name: Checkout
if: github.event_name == 'pull_request_target' && steps.checkUser.outputs.require-result == 'true'
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Checkout
if: github.event_name == 'workflow_dispatch'
uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 14.17.6
- name: Run e2e tests
if: github.event_name == 'workflow_dispatch' || steps.checkUser.outputs.require-result == 'true'
uses: cypress-io/github-action@v6
with:
build: yarn build
start: yarn start
wait-on: ${{ secrets.ROOT_URL }}
command: yarn test-run-e2e
- name: Skip tests
if: github.event_name == 'pull_request_target' && steps.checkUser.outputs.require-result == 'false'
uses: actions/github-script@v3
with:
script: |
core.setFailed('Pull request is opened by an user without write permission, tests are skipped for security reason')
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -109,3 +109,6 @@ sw.*

# Certifact files
.certs/

test/cypress/videos
test/cypress/downloads
Binary file added assets/3d-map.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 0 additions & 4 deletions assets/_layout.scss
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,4 @@
border: 1px solid #dcdfe6;
margin: 1em 0;
padding: 1em;
@media (min-width: 48em) {
margin: 2.5em 0;
padding: 2em;
}
}
1 change: 1 addition & 0 deletions assets/_viewer.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
border-bottom: 1px solid #dbdfe6;
flex-direction: column;
font-size: 0.875em;
line-height: 1.5rem;
display: flex;
padding: 1rem 0.625rem;
@media (min-width: 48em) {
Expand Down
Binary file added assets/ac-map.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/fc-map.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/sparcLogoFast.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
123 changes: 123 additions & 0 deletions components/AlternativeSearchResults/AlternativeSearchResultsNews.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
<template>
<!-- Alternative search suggestions NNOTE that this is currently just copy and pasted from /data/index.vue -->
<div v-if="searchHasAltResults && this.$route.query.search" class="mt-24">
<br />
<template v-if="!searchHadResults">
No results were found for <strong><i>{{ this.$route.query.search }}</i></strong>.
</template>
The following results were discovered for the other categories:
<br />
<br />
<template v-for="dataType in dataTypes">
<dd v-if="resultCounts[dataType] > 0" :key="dataType">
<nuxt-link
:to="{
name: `news-and-events-${dataType}`,
query: {
...$route.query
}
}"
>
{{ resultCounts[dataType] }} result{{
resultCounts[dataType] > 1 ? 's' : ''
}}
</nuxt-link>
- {{ humanReadableDataTypesLookup[dataType] }}
</dd>
</template>
</div>
</template>

<script>
import {
fetchNews,
fetchEvents,
fetchCommunitySpotlightItems
} from '@/pages/news-and-events/model.ts'
import createClient from '@/plugins/contentful.js'
const client = createClient()
function getLastUrlSegment(path) {
return path
.split('/')
.filter(Boolean)
.pop()
}
export default {
name: 'AlternativeSearchResultsNews',
props: {
searchHadResults: {
type: Boolean,
default: true
}
},
data: function() {
return {
searchHasAltResults: false,
dataTypes: ['news', 'events', 'community-spotlight'],
humanReadableDataTypesLookup: {
news: 'News',
events: 'Events',
'community-spotlight': 'Community Spotlight'
},
functionLookup: {
news: fetchNews,
events: fetchEvents,
'community-spotlight': fetchCommunitySpotlightItems
},
resultCounts: {
news: 0,
events: 0,
'community-spotlight': 0
},
fetchNews: fetchNews,
fetchEvents: fetchEvents,
fetchCommunitySpotlightItems: fetchCommunitySpotlightItems
}
},
computed: {
dataTypeSeleced: function() {
return getLastUrlSegment(this.$route.path)
}
},
methods: {
retrieveAltTotals: function() {
this.searchHasAltResults = false
for (let key in this.resultCounts) {
// reset reults list
this.resultCounts[key] = 0
}
let altSearchTypes = this.dataTypes.filter(
e => e !== this.dataTypeSeleced
) // Remove from list of data types
altSearchTypes.forEach(type => {
// Search on each data type remaining
this.retrieveAltTotal(type)
})
},
retrieveAltTotal: function(category) {
this.functionLookup[category]( // dynamically call the function
client,
this.$route.query.search,
undefined,
undefined,
undefined
)
.then(resp => {
this.resultCounts[category] = resp.total
resp.total > 0 ? (this.searchHasAltResults = true) : null
})
.catch(err => {
console.log('Error in alternative Search results call:', err)
this.resultCounts[category] = 0
})
}
}
}
</script>

<style></style>
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
<template>
<!-- Alternative search suggestions NNOTE that this is currently just copy and pasted from /data/index.vue -->
<div v-if="searchHasAltResults && this.$route.query.search" class="mt-24">
<br />
<template v-if="!searchHadResults">
No results were found for <strong><i>{{ this.$route.query.search }}</i></strong>.
</template>
The following results were discovered for the other categories:
<br />
<br />
<template v-for="dataType in dataTypes">
<dd v-if="resultCounts[dataType] > 0" :key="dataType">
<nuxt-link
:to="{
name: `resources-${dataType}`,
query: {
...$route.query
}
}"
>
{{ resultCounts[dataType] }} result{{
resultCounts[dataType] > 1 ? 's' : ''
}}
</nuxt-link>
- {{ humanReadableDataTypesLookup[dataType] }}
</dd>
</template>
</div>
</template>

<script>
import { fetchResources } from '@/pages/resources/utils.ts'
function getLastUrlSegment(path) {
return path
.split('/')
.filter(Boolean)
.pop()
}
export default {
name: 'AlternativeSearchResults',
props: {
searchHadResults: {
type: Boolean,
default: true
}
},
data: function() {
return {
searchHasAltResults: false,
dataTypes: [
'biological',
'databases',
'devices',
'information-services',
'software'
],
humanReadableDataTypesLookup: {
biological: 'Biologicals',
databases: 'Data and Models',
devices: 'Devices',
'information-services': 'Information Services',
software: 'Software'
},
resultCounts: {
biological: 0,
databases: 0,
devices: 0,
'information-services': 0,
software: 0
}
}
},
computed: {
dataTypeSeleced: function() {
return getLastUrlSegment(this.$route.path)
}
},
methods: {
retrieveAltTotals: function() {
this.searchHasAltResults = false
for (let key in this.resultCounts) {
// reset reults list
this.resultCounts[key] = 0
}
let altSearchTypes = this.dataTypes.filter(
e => e !== this.dataTypeSeleced
) // Remove from list of data types
altSearchTypes.forEach(type => {
// Search on each data type remaining
this.retrieveAltTotal(type)
})
},
retrieveAltTotal: function(category) {
fetchResources(
this.humanReadableDataTypesLookup[category], // needed as human readable is used for contentful
this.$route.query.search,
undefined,
undefined,
10,
0
)
.then(resp => {
this.resultCounts[category] = resp.total
resp.total > 0 ? (this.searchHasAltResults = true) : null
})
.catch(err => {
console.log('Error in alternative Search results call:', err)
this.resultCounts[category] = 0
})
}
}
}
</script>

<style></style>
15 changes: 15 additions & 0 deletions components/BfDownloadFile/BfDownloadFile.vue
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
</template>

<script>
import { propOr } from 'ramda'
import StorageMetrics from '@/mixins/bf-storage-metrics'
const DEFAULT_ARCHIVE_NAME = 'sparc-portal-data'
Expand Down Expand Up @@ -189,6 +190,20 @@ export default {
this.$nextTick(() => {
this.$refs.zipForm.submit() // eslint-disable-line no-undef
})
this.$gtm.push({
event: 'interaction_event',
event_name: 'download_dataset_files',
files: propOr('', 'paths', payload),
file_name: "",
file_path: "",
file_type: "",
category: "",
dataset_id: this.dataset.id,
version_id: this.dataset.version,
doi: this.dataset.doi,
citation_type: "",
location: ""
})
this.closeConfirmDownload()
},
Expand Down
Loading

0 comments on commit 04ac3ee

Please sign in to comment.