From ebe30a8fc063c0ef51b79304f63714f5fcd73f2b Mon Sep 17 00:00:00 2001 From: Stephan Heunis Date: Sun, 1 Oct 2023 21:41:39 +0200 Subject: [PATCH 1/3] Fix subdataset filtering to filter on name, givenName, and familyName, provided that the property value in each case is not null --- .../catalog/assets/app_component_dataset.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/datalad_catalog/catalog/assets/app_component_dataset.js b/datalad_catalog/catalog/assets/app_component_dataset.js index 572fb49f..e7542893 100644 --- a/datalad_catalog/catalog/assets/app_component_dataset.js +++ b/datalad_catalog/catalog/assets/app_component_dataset.js @@ -218,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 ) ); }); From 11418a1629e5b3a77124a26bdeb8bce749fabf20 Mon Sep 17 00:00:00 2001 From: Stephan Heunis Date: Sun, 1 Oct 2023 23:54:06 +0200 Subject: [PATCH 2/3] only show filtering options when number of subdatasets > 3 This will hide the filtering options otherwise. Additionally, the tags on each subdataset will be deactivated if number of subdatasets < 4. --- datalad_catalog/catalog/templates/dataset-template.html | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/datalad_catalog/catalog/templates/dataset-template.html b/datalad_catalog/catalog/templates/dataset-template.html index c80db10a..930762ee 100644 --- a/datalad_catalog/catalog/templates/dataset-template.html +++ b/datalad_catalog/catalog/templates/dataset-template.html @@ -170,7 +170,7 @@

Cite dataset

There are no subdatasets listed for the current dataset - + @@ -246,7 +246,12 @@
{{ds.dirs_from_path.at - {{keyword}}  + + {{keyword}}  + + + {{keyword}}  + From d8090c66ea67d08887fed685f2fd70ea2c290503 Mon Sep 17 00:00:00 2001 From: Stephan Heunis Date: Sun, 1 Oct 2023 23:59:25 +0200 Subject: [PATCH 3/3] Clear filtering options when navigating to a subdataset This is to prevent the filtering options from remaining and subsequently filtering the subdatasets of the recently selected dataset (after filtering). --- datalad_catalog/catalog/assets/app_component_dataset.js | 8 ++++++++ datalad_catalog/catalog/assets/app_component_item.js | 3 +++ datalad_catalog/catalog/templates/dataset-template.html | 2 +- datalad_catalog/catalog/templates/item-template.html | 2 +- 4 files changed, 13 insertions(+), 2 deletions(-) diff --git a/datalad_catalog/catalog/assets/app_component_dataset.js b/datalad_catalog/catalog/assets/app_component_dataset.js index e7542893..c3073e6e 100644 --- a/datalad_catalog/catalog/assets/app_component_dataset.js +++ b/datalad_catalog/catalog/assets/app_component_dataset.js @@ -333,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'); @@ -345,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; diff --git a/datalad_catalog/catalog/assets/app_component_item.js b/datalad_catalog/catalog/assets/app_component_item.js index bfe0a4c8..dea66b53 100644 --- a/datalad_catalog/catalog/assets/app_component_item.js +++ b/datalad_catalog/catalog/assets/app_component_item.js @@ -89,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'); diff --git a/datalad_catalog/catalog/templates/dataset-template.html b/datalad_catalog/catalog/templates/dataset-template.html index 930762ee..48d43f23 100644 --- a/datalad_catalog/catalog/templates/dataset-template.html +++ b/datalad_catalog/catalog/templates/dataset-template.html @@ -270,7 +270,7 @@
{{ds.dirs_from_path.at
    - +
diff --git a/datalad_catalog/catalog/templates/item-template.html b/datalad_catalog/catalog/templates/item-template.html index 20bea14e..24de4015 100644 --- a/datalad_catalog/catalog/templates/item-template.html +++ b/datalad_catalog/catalog/templates/item-template.html @@ -17,6 +17,6 @@
    - +
\ No newline at end of file