Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apply latest changes from datalad-catalog #50

Merged
merged 3 commits into from
Oct 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
143 changes: 98 additions & 45 deletions docs/assets/app_component_dataset.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ const datasetView = () =>
citation_busy: false,
citation_text: "",
invalid_doi: false,
show_backbutton: false,
};
},
watch: {
Expand Down Expand Up @@ -91,7 +92,7 @@ const datasetView = () =>
disp_dataset["short_name"] = dataset["short_name"];
}
}
disp_dataset["display_name"] = " - " + disp_dataset["short_name"];
disp_dataset["display_name"] = disp_dataset["short_name"];
// DOI
if (!dataset.hasOwnProperty("doi") || !dataset["doi"]) {
disp_dataset["doi"] = "not available";
Expand All @@ -108,9 +109,12 @@ const datasetView = () =>
sorted_metadata_sources = dataset.metadata_sources.sources.sort(
(a, b) => b.source_time - a.source_time
);
disp_dataset.last_updated = this.getDateFromUTCseconds(
sorted_metadata_sources[0].source_time
);
disp_dataset.last_updated = sorted_metadata_sources[0].source_time
if (disp_dataset.last_updated) {
disp_dataset.last_updated = this.getDateFromUTCseconds(
disp_dataset.last_updated
);
}
// ID, version and location
disp_dataset.file_path =
"metadata/" +
Expand Down Expand Up @@ -214,10 +218,17 @@ const datasetView = () =>
c.dirs_from_path[c.dirs_from_path.length - 1]
.toLowerCase()
.indexOf(this.search_text.toLowerCase()) >= 0 ||
// || (c.authors.some(e => e.givenName.toLowerCase().indexOf(this.search_text.toLowerCase()) >= 0))
c.authors.some(
(f) =>
f.name.toLowerCase().indexOf(this.search_text.toLowerCase()) >= 0
f.givenName && f.givenName.toLowerCase().indexOf(this.search_text.toLowerCase()) >= 0
) ||
c.authors.some(
(f) =>
f.familyName && f.familyName.toLowerCase().indexOf(this.search_text.toLowerCase()) >= 0
) ||
c.authors.some(
(f) =>
f.name && f.name.toLowerCase().indexOf(this.search_text.toLowerCase()) >= 0
)
);
});
Expand Down Expand Up @@ -322,6 +333,9 @@ const datasetView = () =>
dataset_version: objVersion,
},
}
// before navigation, clear filtering options
this.clearFilters()
// now navigate
if (newBrowserTab) {
const routeData = router.resolve(route_info);
window.open(routeData.href, '_blank');
Expand All @@ -334,6 +348,11 @@ const datasetView = () =>
this.$root.$emit("bv::show::modal", "modal-3", "#btnShow");
}
},
clearFilters() {
this.search_text = ""
this.search_tags = []
this.clearSearchTagText()
},
selectDescription(desc) {
if (desc.content.startsWith("path:")) {
this.description_ready = false;
Expand Down Expand Up @@ -380,7 +399,7 @@ const datasetView = () =>
},
openWithBinder(dataset_url) {
const environment_url =
"https://mybinder.org/v2/gh/datalad/datalad-binder/parameter-test";
"https://mybinder.org/v2/gh/datalad/datalad-binder/main";
const content_url = "/~https://github.com/jsheunis/datalad-notebooks";
const content_repo_name = "datalad-notebooks";
const notebook_name = "download_data_with_datalad_python.ipynb";
Expand Down Expand Up @@ -481,37 +500,18 @@ const datasetView = () =>
}
}
},
tabsChanged(currentTabs, previousTabs) {
this.setCorrectTab(
this.$root.selectedDataset.has_subdatasets,
this.$root.selectedDataset.has_files
)
},
setCorrectTab(has_subdatasets, has_files) {
// now set the correct tab:
var tabs = this.$refs['alltabs'].$children.filter(
child => typeof child.$vnode.key === 'string' || child.$vnode.key instanceof String
).map(child => child.$vnode.key)
var tab_param = this.$route.params.tab_name;
setCorrectTab(tab_param) {
// the set of available tabs have been updated in component
// data in either created() or beforeRouteUpdate()
var tabs = this.$root.selectedDataset.available_tabs.map(v => v.toLowerCase());
// If no tab parameter is supplied via the router, set to first tab
if (!tab_param) {
if (has_subdatasets) {
this.tabIndex = 0;
}
else {
if (has_files) {
this.tabIndex = 1;
}
else {
if (tabs.length > 2) {
this.tabIndex = 2;
} else {
this.tabIndex = 0;
}
}
}
this.tabIndex = 0
}
// If a tab parameter is supplied via the router, navigate to that tab if
// part of available tabs, otherwise first tab
else {
selectTab = tabs.indexOf(tab_param)
selectTab = tabs.indexOf(tab_param.toLowerCase())
if (selectTab >= 0) {
this.tabIndex = selectTab;
} else {
Expand Down Expand Up @@ -629,14 +629,50 @@ const datasetView = () =>
else {
this.$root.selectedDataset.has_files = false;
}
// // now set the correct tab:
// this.setCorrectTab(
// this.$root.selectedDataset.has_subdatasets,
// this.$root.selectedDataset.has_files
// )
// Now list all tabs and set the correct one
// order in DOM: subdatasets, content, publications, funding, provenance,
sDs = this.$root.selectedDataset
available_tabs = ['subdatasets', 'content']
standard_tabs = ['publications', 'funding', 'provenance']
// add available standard tabs
for (var t=0; t<standard_tabs.length; t++) {
if (sDs[standard_tabs[t]] && sDs[standard_tabs[t]].length) {
available_tabs.push(standard_tabs[t])
}
}
// add available additional_display tabs
if (sDs.additional_display && sDs.additional_display.length) {
for (var t=0; t<sDs.additional_display.length; t++) {
available_tabs.push(sDs.additional_display[t].name)
}
}
// finally set the root data and then set the correct tab
this.$root.selectedDataset.available_tabs = available_tabs
this.setCorrectTab(
to.params.tab_name,
)
// if navigated to using vue router (i.e. internal to the app), show the back button
if ((this.$root.home_dataset_id == this.$root.selectedDataset.dataset_id) &&
(this.$root.home_dataset_version == this.$root.selectedDataset.dataset_version)) {
this.$root.selectedDataset.show_backbutton = false
} else {
this.$root.selectedDataset.show_backbutton = true
}
next();
},
async created() {
// fetch superfile in order to set id and version on $root
homefile = metadata_dir + "/super.json";
homeresponse = await fetch(homefile);
if (homeresponse.status == 404) {
this.$root.home_dataset_id = null;
this.$root.home_dataset_version = null;
} else {
hometext = await homeresponse.text();
homedataset = JSON.parse(hometext);
this.$root.home_dataset_id = homedataset.dataset_id;
this.$root.home_dataset_version = homedataset.dataset_version;
}
file = getFilePath(
this.$route.params.dataset_id,
this.$route.params.dataset_version,
Expand Down Expand Up @@ -717,15 +753,32 @@ const datasetView = () =>
else {
this.$root.selectedDataset.has_files = false;
}
// this.setCorrectTab(
// this.$root.selectedDataset.has_subdatasets,
// this.$root.selectedDataset.has_files
// )
// Now list all tabs and set the correct one
// order in DOM: subdatasets, content, publications, funding, provenance,
sDs = this.$root.selectedDataset
available_tabs = ['subdatasets', 'content']
standard_tabs = ['publications', 'funding', 'provenance']
// add available standard tabs
for (var t=0; t<standard_tabs.length; t++) {
if (sDs[standard_tabs[t]] && sDs[standard_tabs[t]].length) {
available_tabs.push(standard_tabs[t])
}
}
// add available additional_display tabs
if (sDs.additional_display && sDs.additional_display.length) {
for (var t=0; t<sDs.additional_display.length; t++) {
available_tabs.push(sDs.additional_display[t].name)
}
}
// finally set the root data and then set the correct tab
this.$root.selectedDataset.available_tabs = available_tabs
this.setCorrectTab(
this.$route.params.tab_name,
)
},
mounted() {
this.tag_options_filtered = this.tag_options;
this.tag_options_available = this.tag_options;
this.tabIndex = 0;
}
}
})
9 changes: 8 additions & 1 deletion docs/assets/app_component_item.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,11 @@ Vue.component('tree-item', function (resolve, reject) {
return this.item["name"];
},
byteText: function () {
return this.formatBytes(this.item["contentbytesize"]);
if (this.item["contentbytesize"]) {
return this.formatBytes(this.item["contentbytesize"]);
} else {
return ""
}
},
downloadURL: function () {
return this.getDownloadURL(this.item["url"]);
Expand Down Expand Up @@ -85,6 +89,9 @@ Vue.component('tree-item', function (resolve, reject) {
dataset_version: objVersion,
},
}
// before navigation, clear filter options
this.$emit('clear-filters')
// now navigate
if (newBrowserTab) {
const routeData = router.resolve(route_info);
window.open(routeData.href, '_blank');
Expand Down
3 changes: 2 additions & 1 deletion docs/assets/app_globals.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ const default_config = {
about: null,
documentation: null,
github: null,
twitter: null,
mastodon: null,
x: null
},
dataset_options: {
include_metadata_export: true,
Expand Down
6 changes: 3 additions & 3 deletions docs/assets/brands.min.css

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion docs/assets/display_schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,8 @@ var form_app = new Vue({
github:
"/~https://github.com/datalad/datalad-catalog",
docs: "https://docs.datalad.org/projects/catalog/en/latest/",
twitter: "https://twitter.com/datalad",
mastodon: "https://fosstodon.org/@datalad",
x: "https://x.com/datalad"
};
if (dest in destinations) {
window.open(destinations[dest]);
Expand Down
Binary file modified docs/assets/fa-brands-400.woff2
Binary file not shown.
Binary file modified docs/assets/fa-regular-400.woff2
Binary file not shown.
Binary file modified docs/assets/fa-solid-900.woff2
Binary file not shown.
Binary file modified docs/assets/favicon/favicon.ico
Binary file not shown.
9 changes: 6 additions & 3 deletions docs/assets/fontawesome.min.css

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion docs/assets/meta_entry.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ var demo = new Vue({
github:
"/~https://github.com/datalad/datalad-catalog",
docs: "https://docs.datalad.org/projects/catalog/en/latest/",
twitter: "https://twitter.com/datalad",
mastodon: "https://fosstodon.org/@datalad",
x: "https://x.com/datalad"
};
if (dest in destinations) {
window.open(destinations[dest]);
Expand Down
21 changes: 20 additions & 1 deletion docs/assets/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,13 @@ a:hover {
}

.item {
cursor: pointer;
font-family: Menlo, Consolas, monospace;
}

.showpointer {
cursor: pointer;
}

.bold {
font-weight: bold;
}
Expand Down Expand Up @@ -230,4 +233,20 @@ li[class="item"]:last-child {
.reflink:hover {
color: #75787b;
cursor: pointer;
}

.dataset-title {
margin-top: 0.5em;
}

.dataset-nav {
box-shadow: 0px 0px 4px 2px rgba(0,0,0,0.1);
border-radius: 4px;
padding: 1px 5px;
padding-bottom: 2px;
}

.dataset-nav-item {
padding-left: 5px;
border-left: 2px solid #a9afb440;
}
2 changes: 1 addition & 1 deletion docs/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"about": "https://www.crc1451.uni-koeln.de/",
"documentation": "https://rdm.sfb1451.de/publication-catalog/",
"github": null,
"twitter": "https://twitter.com/crc1451"
"x": "https://twitter.com/crc1451"
},
"dataset_options": {
"include_metadata_export": false
Expand Down
14 changes: 4 additions & 10 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,12 @@
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />

<title>CRC1451 Catalog</title>
<meta name="description" content="The CRC1451 data catalog for the Collaborative Research Center (CRC/SFB 1451) investigating key mechanisms of motor control in health and disease"/>
<meta property="og:url" content="https://psychoinformatics-de.github.io/sfb1451-projects-catalog"/>
<meta property="og:title" content="CRC1451 Catalog"/>
<meta property="og:locale" content="en-US"/>
<meta property="og:description" content="The CRC1451 data catalog for the Collaborative Research Center (CRC/SFB 1451) investigating key mechanisms of motor control in health and disease"/>
<meta property="og:image" content="https://www.crc1451.uni-koeln.de/wp-content/uploads/2022/02/P2110058_CRC1451_Logo.png"/>
<meta property="twitter:card" content="summary_large_image"/>

<link rel="icon" href="assets/favicon/favicon.ico" type="image/x-icon">
<link rel="icon" type="image/png" sizes="32x32" href="assets/favicon/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="assets/favicon/favicon-16x16.png">

<title>DataLad Catalog</title>

<!-- Required Stylesheets -->
<link rel="stylesheet" type="text/css" href="assets/style.css"/>
<link rel="stylesheet" type="text/css" href="assets/fontawesome.min.css"/>
Expand Down Expand Up @@ -55,7 +48,8 @@
<b-nav-item v-if="social_links['about']" v-b-tooltip.hover title="About" @click="gotoExternal(social_links['about'])"><i class="fas fa-info-circle"></i></b-nav-item>
<b-nav-item v-if="social_links['documentation']" v-b-tooltip.hover title="Read documentation" @click="gotoExternal(social_links['documentation'])"><i class="fas fa-file-alt"></i></b-nav-item>
<b-nav-item v-if="social_links['github']" v-b-tooltip.hover title="View code base" @click="gotoExternal(social_links['github'])"><i class="fab fa-github"></i></b-nav-item>
<b-nav-item v-if="social_links['twitter']" v-b-tooltip.hover title="Follow on Twitter!" @click="gotoExternal(social_links['twitter'])"><i class="fab fa-twitter"></i></b-nav-item>
<b-nav-item v-if="social_links['mastodon']" v-b-tooltip.hover title="Follow on Mastodon" @click="gotoExternal(social_links['mastodon'])"><i class="fab fa-mastodon"></i></b-nav-item>
<b-nav-item v-if="social_links['x']" v-b-tooltip.hover title="Follow on X (Twitter)" @click="gotoExternal(social_links['x'])"><i class="fab fa-x-twitter"></i></b-nav-item>
</b-navbar-nav>
</b-collapse>
</b-navbar>
Expand Down
Loading