Skip to content

Commit

Permalink
Merge branch 'nih-sparc:master' into d&m-core-function-qc
Browse files Browse the repository at this point in the history
  • Loading branch information
ddjnw1yu authored Nov 26, 2023
2 parents 7669ac4 + 8b70e34 commit dfa4d9a
Show file tree
Hide file tree
Showing 12 changed files with 167 additions and 53 deletions.
11 changes: 10 additions & 1 deletion components/BfDownloadFile/BfDownloadFile.vue
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,16 @@ export default {
this.$gtm.push({
event: 'interaction_event',
event_name: 'dataset_file_download',
files: propOr('', 'paths', payload)
files: propOr('', 'paths', payload),
file_name: "",
file_path: "",
file_type: "",
category: "",
dataset_id: "",
version_id: "",
doi: "",
citation_type: "",
location: ""
})
this.closeConfirmDownload()
},
Expand Down
10 changes: 9 additions & 1 deletion components/CitationDetails/CitationDetails.vue
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,15 @@ export default {
event: 'interaction_event',
event_name: 'copy_citation_button_click',
dataset_id: this.$route.params.datasetId,
citation_type: citationType.label
citation_type: citationType.label,
category: "",
version_id: "",
doi: "",
location: "",
files: "",
file_name: "",
file_path: "",
file_type: "",
})
this.$message(
successMessage(
Expand Down
11 changes: 10 additions & 1 deletion components/DatasetDetails/DatasetActionBox.vue
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,16 @@ export default {
this.$gtm.push({
event: 'interaction_event',
event_name: 'sds_viewer_button_click',
button_location: 'dataset_action_box'
location: 'dataset_action_box',
category: "",
dataset_id: propOr('', 'id', this.datasetInfo),
version_id: propOr('', 'version', this.datasetInfo),
doi: propOr('', 'doi', this.datasetInfo),
citation_type: "",
files: "",
file_name: "",
file_path: "",
file_type: "",
})
},
/**
Expand Down
22 changes: 19 additions & 3 deletions components/DatasetDetails/DatasetFilesInfo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,16 @@ export default {
this.$gtm.push({
event: 'interaction_event',
event_name: 'sds_viewer_button_click',
button_location: 'files_tab'
location: 'files_tab',
category: "",
dataset_id: propOr('', 'id', this.datasetInfo),
version_id: propOr('', 'version', this.datasetInfo),
doi: propOr('', 'doi', this.datasetInfo),
citation_type: "",
files: "",
file_name: "",
file_path: "",
file_type: "",
})
},
agreementLoaded(id) {
Expand Down Expand Up @@ -346,8 +355,15 @@ export default {
event: 'interaction_event',
event_name: 'download_full_dataset',
dataset_id: this.datasetId,
version_id: propOr('undefined', 'version', this.datasetInfo),
doi: propOr('undefined', 'doi', this.datasetInfo)
version_id: propOr('', 'version', this.datasetInfo),
doi: propOr('', 'doi', this.datasetInfo),
location: "",
category: "",
citation_type: "",
files: "",
file_name: "",
file_path: "",
file_type: "",
})
}
}
Expand Down
18 changes: 17 additions & 1 deletion components/FilesTable/FilesTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -628,6 +628,13 @@ export default {
file_name: pathOr('', ['row','name'], scope),
file_path: pathOr('', ['row','path'], scope),
file_type: pathOr('', ['row','fileType'], scope),
location: "",
category: "",
dataset_id: "",
version_id: "",
doi: "",
citation_type: "",
files: ""
})
this.getViewFileUrl(scope).then(response => {
window.open(response, '_blank')
Expand All @@ -654,7 +661,16 @@ export default {
this.$gtm.push({
event: 'interaction_event',
event_name: 'dataset_file_download',
files: propOr('', 'paths', payload)
files: propOr('', 'paths', payload),
file_name: "",
file_path: "",
file_type: "",
location: "",
category: "",
dataset_id: "",
version_id: "",
doi: "",
citation_type: ""
})
},
Expand Down
2 changes: 1 addition & 1 deletion components/ImagesGallery/ImagesGallery.vue
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ export default {
title = `View ${f.organ}`
}
let linkUrl = `${baseRoute}maps?type=flatmap&dataset_version=${datasetVersion}&dataset_id=${datasetId}&taxo=${f.taxo}&uberonid=${f.uberonid}`
let linkUrl = `${baseRoute}maps?type=ac&dataset_version=${datasetVersion}&dataset_id=${datasetId}&taxon=${f.taxo}&anatomy=${f.uberonid}`
if (f.species) linkUrl = linkUrl + `&for_species=${f.species}`
const item = {
id: f.uberonid,
Expand Down
2 changes: 1 addition & 1 deletion components/header/Header.vue
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
>
<nuxt-link
:to="link.href"
:class="{ active: activeLink(link.title) }"
:class="{ active: activeLink(link.href) }"
exact-active-class="active"
>
{{ link.displayTitle }}
Expand Down
18 changes: 18 additions & 0 deletions middleware/clearDatalayer.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
export default function ({ app }) {
if (app != undefined && app.$gtm != undefined) {
app.$gtm.push({
event: '',
event_name: '',
category: "",
files: "",
file_name: "",
file_path: "",
file_type: "",
location: "",
dataset_id: "",
version_id: "",
doi: "",
citation_type: ""
})
}
}
2 changes: 1 addition & 1 deletion nuxt.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ const config = {
component: '@/pages/datasets/_datasetId.vue'
})
},
middleware: ['documentationHubRedirects', 'signOutRedirect']
middleware: ['documentationHubRedirects', 'signOutRedirect', 'clearDatalayer']
},
/*
** Global CSS
Expand Down
15 changes: 12 additions & 3 deletions pages/data/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -467,9 +467,18 @@ export default {
}
const category = searchTypes.find(searchType => searchType.type == this.$route.query.type)
this.$gtm.push({
event: 'interaction_event',
event_name: 'data_page_view',
category: propOr('Datasets', 'label', category)
event: "",
event_name: '',
category: propOr('Datasets', 'label', category),
files: "",
file_name: "",
file_path: "",
file_type: "",
location: "",
dataset_id: "",
version_id: "",
doi: "",
citation_type: ""
})
},
immediate: true
Expand Down
13 changes: 11 additions & 2 deletions pages/datasets/_datasetId.vue
Original file line number Diff line number Diff line change
Expand Up @@ -369,9 +369,18 @@ export default {
mounted() {
this.$gtm.push({
event: "",
category: "",
dataset_id: propOr(this.$route.params.datasetId, 'id', this.datasetInfo),
version_id: propOr('undefined', 'version', this.datasetInfo),
doi: propOr('undefined', 'doi', this.datasetInfo)
version_id: propOr('', 'version', this.datasetInfo),
doi: propOr('', 'doi', this.datasetInfo),
event_name: "",
citation_type: "",
location: "",
files: "",
file_name: "",
file_path: "",
file_type: "",
})
},
Expand Down
96 changes: 58 additions & 38 deletions pages/maps/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -64,35 +64,6 @@ const formatLabel = (text) => {
return text
}
const getFlatmapEntry = async (route) => {
const uberonid = route.query.uberonid
//Specify the gender of human
let organ_name = uberonid
let biologicalSex = route.query.biologicalSex
if (route.query.taxo && route.query.taxo === 'NCBITaxon:9606') {
if (!biologicalSex) {
biologicalSex = 'PATO:0000384'
}
}
try {
let name = await scicrunch.getOrganFromUberonId(uberonid)
//We do not want to display the body proper
if (name && name.toLowerCase() === 'body proper') {
organ_name = undefined
}
} catch (e) {
// Error caught return empty data.
}
return {
type: 'MultiFlatmap',
taxo: route.query.taxo,
biologicalSex: biologicalSex,
uuid: route.query.fid,
organ: organ_name,
}
}
const getScaffoldState = async (uuid, $axios) => {
if (uuid) {
let url = `${process.env.portal_api}/scaffold/getstate`
Expand Down Expand Up @@ -193,6 +164,7 @@ export default {
},
],
currentEntry: undefined,
organ_name: undefined,
facets: [],
uuid: undefined,
startingMap: "AC",
Expand Down Expand Up @@ -358,7 +330,7 @@ export default {
) {
this.$message(
failMessage(
`Sorry! A flatmap for a ${this.forSpecies} does not yet exist. The ${this.organ} of a rat has been shown instead.`
`Sorry! A flatmap for a ${this.forSpecies} does not yet exist. The ${this.organ_name} of a rat has been shown instead.`
)
)
}
Expand Down Expand Up @@ -397,6 +369,58 @@ export default {
}
});
},
//Process any taxon or anatomy parameters if they are available
processEntry: async function(route) {
//uberionid and taxo are now deprecated and replaced by Anatomy and taxon
const anatomy = route.query.anatomy ? route.query.anatomy : route.query.uberonid
const taxon = route.query.taxon ? route.query.taxon : route.query.taxo
if (anatomy || taxon) {
//Specify the gender of human
let biologicalSex = route.query.biologicalSex
if (taxon && taxon === 'NCBITaxon:9606') {
if (!biologicalSex) {
biologicalSex = 'PATO:0000384'
}
}
try {
this.organ_name = await scicrunch.getOrganFromUberonId(anatomy)
//We do not want to display the body proper
if (this.organ_name && this.organ_name.toLowerCase() === 'body proper') {
anatomy = undefined
}
} catch (e) {
// Error caught return empty data.
}
if (this.$route.query.type === 'ac' || this.$route.query.type === 'flatmap') {
this.currentEntry = {
type: 'MultiFlatmap',
taxo: taxon,
biologicalSex: biologicalSex,
uuid: route.query.fid,
organ: anatomy,
}
this.checkSpecies()
return
}
if (this.$route.query.type === 'fc' && anatomy) {
this.currentEntry = {
type: 'Flatmap',
resource: 'FunctionalConnectivity',
label: 'Functional',
state: {searchTerm: anatomy}
}
return
}
}
if (this.$route.query.type === 'ac' || this.$route.query.type === 'flatmap') {
this.startingType = "AC"
return
}
if (this.$route.query.type === 'fc') {
this.startingMap = "FC"
return
}
},
openViewWithQuery: async function () {
//Open the map with specific view defined by the query.
//First get the bucket and facets information if available
Expand Down Expand Up @@ -429,14 +453,10 @@ export default {
)
)
}
} else if (this.$route.query.type === 'flatmap') {
this.currentEntry = await getFlatmapEntry(this.$route)
//Check species information
this.checkSpecies()
} else if (this.$route.query.type === 'fc') {
this.startingMap = "FC"
} else if (this.$route.query.type === 'ac') {
this.startingMap = "AC"
} else if (this.$route.query.type === 'fc' ||
this.$route.query.type === 'ac' ||
this.$route.query.type === 'flatmap') {
await this.processEntry(this.$route)
} else if (this.$route.query.type === 'wholebody') {
this.startingMap = "WholeBody"
}
Expand Down

0 comments on commit dfa4d9a

Please sign in to comment.