-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #405 from datalad/linked-rendering
ENH: Linked data rendering in `additional_display` tab
- Loading branch information
Showing
8 changed files
with
542 additions
and
6 deletions.
There are no files selected for viewing
33 changes: 33 additions & 0 deletions
33
datalad_catalog/catalog/assets/app_component_contexttab.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// Component definition: an "additional tab" with context | ||
Vue.component('context-tab-body', function (resolve, reject) { | ||
url = template_dir + "/context-tab-template.html" | ||
fetch(url). | ||
then(response => { | ||
return response.text(); | ||
}). | ||
then(text => { | ||
resolve( | ||
{ | ||
template: text, | ||
props: { | ||
tabby: Object, | ||
}, | ||
data: function () { | ||
return { | ||
context_tab_ready: false, | ||
}; | ||
}, | ||
computed: {}, | ||
methods: { | ||
toUpperString(str_in) { | ||
return str_in.charAt(0).toUpperCase() + str_in.slice(1) | ||
} | ||
}, | ||
async created() { | ||
this.context_tab_ready = true; | ||
// console.log(new_tab) | ||
} | ||
} | ||
) | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
...etadata/c475969b-2919-57b1-a3e6-71770acaa222/0.1.0/aa1/11b599c3a81615b29b99b1d87a7db.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"type": "directory", "dataset_id": "c475969b-2919-57b1-a3e6-71770acaa222", "dataset_version": "0.1.0", "children": [{"type": "file", "dataset_id": "c475969b-2919-57b1-a3e6-71770acaa222", "dataset_version": "0.1.0", "metadata_sources": {"key_source_map": {}, "sources": [{"source_name": "tabby", "source_version": "0.1.0", "source_parameter": {}, "source_time": 1702323824.80198, "agent_name": "Stephan Heunis", "agent_email": "s.heunis@fz-juelich.de"}]}, "path": "raw/adelie.csv", "contentbytesize": 23755, "url": "https://portal.edirepository.org/nis/dataviewer?packageid=knb-lter-pal.219.3&entityid=002f3893385f710df69eeebe893144ff", "name": "adelie.csv"}, {"type": "file", "dataset_id": "c475969b-2919-57b1-a3e6-71770acaa222", "dataset_version": "0.1.0", "metadata_sources": {"key_source_map": {}, "sources": [{"source_name": "tabby", "source_version": "0.1.0", "source_parameter": {}, "source_time": 1702323824.80198, "agent_name": "Stephan Heunis", "agent_email": "s.heunis@fz-juelich.de"}]}, "path": "raw/gentoo.csv", "contentbytesize": 11263, "url": "https://portal.edirepository.org/nis/dataviewer?packageid=knb-lter-pal.220.3&entityid=e03b43c924f226486f2f0ab6709d2381", "name": "gentoo.csv"}, {"type": "file", "dataset_id": "c475969b-2919-57b1-a3e6-71770acaa222", "dataset_version": "0.1.0", "metadata_sources": {"key_source_map": {}, "sources": [{"source_name": "tabby", "source_version": "0.1.0", "source_parameter": {}, "source_time": 1702323824.80198, "agent_name": "Stephan Heunis", "agent_email": "s.heunis@fz-juelich.de"}]}, "path": "raw/chinstrap.csv", "contentbytesize": 18872, "url": "https://portal.edirepository.org/nis/dataviewer?packageid=knb-lter-pal.221.2&entityid=fe853aa8f7a59aa84cdd3197619ef462", "name": "chinstrap.csv"}], "path": "raw", "name": "raw"} |
196 changes: 196 additions & 0 deletions
196
...etadata/c475969b-2919-57b1-a3e6-71770acaa222/0.1.0/cad/486b905182ab9d7cee7d80ea1173d.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,196 @@ | ||
{ | ||
"type": "dataset", | ||
"dataset_id": "c475969b-2919-57b1-a3e6-71770acaa222", | ||
"dataset_version": "0.1.0", | ||
"children": [ | ||
{ | ||
"type": "directory", | ||
"name": "raw", | ||
"path": "raw", | ||
"dataset_id": "c475969b-2919-57b1-a3e6-71770acaa222", | ||
"dataset_version": "0.1.0" | ||
} | ||
], | ||
"metadata_sources": { | ||
"key_source_map": { | ||
"license": [ | ||
"tabby" | ||
], | ||
"doi": [ | ||
"tabby" | ||
], | ||
"authors": [ | ||
"tabby" | ||
], | ||
"keywords": [ | ||
"tabby" | ||
], | ||
"funding": [ | ||
"tabby" | ||
], | ||
"publications": [ | ||
"tabby" | ||
], | ||
"access_request_contact": [ | ||
"tabby" | ||
], | ||
"additional_display": [ | ||
"tabby" | ||
] | ||
}, | ||
"sources": [ | ||
{ | ||
"source_name": "tabby", | ||
"source_version": "0.1.0", | ||
"source_parameter": {}, | ||
"source_time": 1702323824.737152, | ||
"agent_name": "Stephan Heunis", | ||
"agent_email": "s.heunis@fz-juelich.de" | ||
} | ||
] | ||
}, | ||
"name": null, | ||
"license": { | ||
"name": "https://creativecommons.org/publicdomain/zero/1.0/", | ||
"url": "https://creativecommons.org/publicdomain/zero/1.0/" | ||
}, | ||
"description": null, | ||
"doi": "https://doi.org/10.5281/zenodo.3960218", | ||
"authors": [ | ||
{ | ||
"email": "a@example.com", | ||
"name": "Allison Horst", | ||
"identifiers": [ | ||
{ | ||
"name": "ORCID", | ||
"identifier": "0000-0002-6047-5564" | ||
} | ||
] | ||
}, | ||
{ | ||
"email": "b@example.com", | ||
"name": "Alison Hill", | ||
"identifiers": [ | ||
{ | ||
"name": "ORCID", | ||
"identifier": "0000-0002-8082-1890" | ||
} | ||
] | ||
}, | ||
{ | ||
"email": "c@example.com", | ||
"name": "Kristen Gorman", | ||
"identifiers": [ | ||
{ | ||
"name": "ORCID", | ||
"identifier": "0000-0002-0258-9264" | ||
} | ||
] | ||
} | ||
], | ||
"keywords": [ | ||
"penguins", | ||
"sea ice", | ||
"foraging", | ||
"ecological niches", | ||
"islands", | ||
"antarctica", | ||
"animal sexual behavior", | ||
"isotopes" | ||
], | ||
"funding": [ | ||
{ | ||
"@type": "schema:Grant", | ||
"name": "DFG", | ||
"identifier": "431549029-INF", | ||
"schema:url": "https://gepris.dfg.de/gepris/projekt/431549029?context=projekt&task=showDetail&id=431549029&" | ||
}, | ||
{ | ||
"@type": "schema:Grant", | ||
"name": "NSF-OPP", | ||
"identifier": "#0217282", | ||
"schema:url": "https://www.nsf.gov/awardsearch/showAward?AWD_ID=0217282&HistoricalAwards=false" | ||
}, | ||
{ | ||
"@type": "schema:Grant", | ||
"name": "NSF-OPP", | ||
"identifier": "#0823101", | ||
"schema:url": "https://www.nsf.gov/awardsearch/showAward?AWD_ID=0823101&HistoricalAwards=false" | ||
}, | ||
{ | ||
"@type": "schema:Grant", | ||
"name": "NSF-OPP", | ||
"identifier": "#0741351", | ||
"schema:url": "https://www.nsf.gov/awardsearch/showAward?AWD_ID=0741351&HistoricalAwards=false" | ||
} | ||
], | ||
"publications": [ | ||
{ | ||
"@type": "schema:CreativeWork", | ||
"datePublished": "2014", | ||
"doi": "https://doi.org/10.1371/journal.pone.0090081", | ||
"title": "Gorman KB, Williams TD, Fraser WR (2014) Ecological Sexual Dimorphism and Environmental Variability within a Community of Antarctic Penguins (Genus Pygoscelis). PLoS ONE 9(3): e90081.", | ||
"authors": [] | ||
} | ||
], | ||
"access_request_contact": { | ||
"givenName": "Allison", | ||
"familyName": "Horst", | ||
"email": "ahorst@ucsb.edu" | ||
}, | ||
"additional_display": [ | ||
{ | ||
"name": "ABCD-J", | ||
"icon": "fa-solid fa-graduation-cap", | ||
"content": { | ||
"@context": { | ||
"homepage": "https://schema.org/mainEntityOfPage", | ||
"data controller": "https://w3id.org/dpv#hasDataController", | ||
"sample (organism)": "https://openminds.ebrains.eu/controlledTerms/Species", | ||
"sample (organism part)": "https://openminds.ebrains.eu/controlledTerms/UBERONParcellation", | ||
"used for": "http://www.w3.org/ns/prov#hadUsage" | ||
}, | ||
"sample (organism)": [ | ||
{ | ||
"@type": "https://openminds.ebrains.eu/controlledTerms/Species", | ||
"name": "Pygoscelis adeliae", | ||
"preferredOntologyIdentifier": "http://purl.obolibrary.org/obo/NCBITaxon_9238", | ||
"synonym": "Adelie penguin" | ||
}, | ||
{ | ||
"@type": "https://openminds.ebrains.eu/controlledTerms/Species", | ||
"name": "Pygoscelis papua", | ||
"preferredOntologyIdentifier": "http://purl.obolibrary.org/obo/NCBITaxon_30457", | ||
"synonym": "Gentoo penguin" | ||
}, | ||
{ | ||
"@type": "https://openminds.ebrains.eu/controlledTerms/Species", | ||
"name": "Pygoscelis antarcticus", | ||
"preferredOntologyIdentifier": "http://purl.obolibrary.org/obo/NCBITaxon_79643", | ||
"synonym": "chinstrap penguin" | ||
} | ||
], | ||
"sample (organism part)": { | ||
"@type": "https://openminds.ebrains.eu/controlledTerms/UBERONParcellation", | ||
"name": "body proper", | ||
"preferredOntologyIdentifier": "http://purl.obolibrary.org/obo/UBERON_0013702" | ||
}, | ||
"homepage": { | ||
"@type": "https://schema.org/URL", | ||
"@value": "https://github.com/allisonhorst/palmerpenguins" | ||
}, | ||
"data controller": { | ||
"@type": "https://schema.org/Person", | ||
"email": "ahorst@ucsb.edu", | ||
"name": "Allison Horst" | ||
}, | ||
"used for": { | ||
"@type": "https://schema.org/Thing", | ||
"name": "Testing effort for DBI backends", | ||
"url": "https://dbitest.r-dbi.org/", | ||
"description": "The dataset is used as example data for testing data base backend features in automated tests" | ||
} | ||
} | ||
} | ||
] | ||
} |
70 changes: 70 additions & 0 deletions
70
datalad_catalog/catalog/templates/context-tab-template.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
<tbody v-if="context_tab_ready"> | ||
<tr v-for="content_key in Object.keys(tabby.content).filter((k) => !k.startsWith('@'))"> | ||
<!-- PROPERTY NAME --> | ||
<td width="30%"> | ||
<strong> | ||
<!-- name --> | ||
<span :id="tabby.name + '_' + content_key">{{ toUpperString(content_key) }}</span> | ||
<!-- popover --> | ||
<span v-if="tabby.content?.['@context']?.[content_key]"> | ||
<sup><i :id="tabby.name + '_' + content_key + '_info'" class="fas fa-circle-info"></i></sup> | ||
<b-popover triggers="hover" :target="tabby.name + '_' + content_key + '_info'" placement="topleft"> | ||
<a :href="tabby.content?.['@context']?.[content_key]">{{ tabby.content?.['@context']?.[content_key] }}</a> | ||
</b-popover> | ||
</span> | ||
</strong> | ||
</td> | ||
<!-- PROPERTY VALUE --> | ||
<td> | ||
<!-- Always work with an array; if single value given create a one-element array out of it --> | ||
<span v-for="(val, idx) in Array.isArray(tabby.content[content_key]) ? tabby.content[content_key] : Array.of(tabby.content[content_key])"> | ||
<template v-if="typeof val === 'object'"> | ||
<!-- URL --> | ||
<template v-if="val?.['@type'] == 'https://schema.org/URL'"> | ||
<a :href="val['@value']"> {{val['@value']}}</a><br> | ||
</template> | ||
<!-- Person --> | ||
<template v-else-if="val?.['@type'] == 'https://schema.org/Person'"> | ||
<template v-if="Object.hasOwn(val, 'email')"> | ||
<!-- with e-mail --> | ||
<a :href="'mailto:' + val.email"> {{val.name}}</a><br> | ||
</template> | ||
<template v-else> | ||
<!-- without e-mail --> | ||
{{val.name}} | ||
</template> | ||
</template> | ||
<!-- Thing (name, url, description) --> | ||
<template v-else-if="val?.['@type'] == 'https://schema.org/Thing'"> | ||
<template v-if="Object.hasOwn(val, 'name') && Object.hasOwn(val, 'url')"> | ||
<!-- with url --> | ||
<a :href="val.url">{{val.name}}</a> {{val?.description}} | ||
</template> | ||
<template v-else> | ||
<!-- without url --> | ||
{{val?.name}} {{val?.description}} | ||
</template> | ||
</template> | ||
<!-- OpenMINDS Species --> | ||
<template v-else-if="val?.['@type'] == 'https://openminds.ebrains.eu/controlledTerms/Species'"> | ||
<a :href="val.preferredOntologyIdentifier">{{val.name}} ({{val?.synonym}})</a><br> | ||
</template> | ||
<!-- OpenMINDS UBERONParcellation --> | ||
<template v-else-if="val?.['@type'] == 'https://openminds.ebrains.eu/controlledTerms/UBERONParcellation'"> | ||
<a :href="val.preferredOntologyIdentifier">{{val.name}}</a><br> | ||
</template> | ||
<!-- Anything else - type unknown or not declared --> | ||
<template v-else> | ||
{{val}} | ||
</template> | ||
</template> | ||
|
||
<template v-else> | ||
<!-- Primitive value, presumably text or number but we take any --> | ||
{{val}} | ||
</template> | ||
|
||
</span> | ||
</td> | ||
</tr> | ||
</tbody> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.