From f48da5e46c8f1a56525c6651b8a0aed58a7fe0c0 Mon Sep 17 00:00:00 2001 From: Stephan Heunis Date: Wed, 5 Apr 2023 16:20:28 +0200 Subject: [PATCH 1/4] update 404 page layout and info --- datalad_catalog/catalog/assets/app_component_notfound.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/datalad_catalog/catalog/assets/app_component_notfound.js b/datalad_catalog/catalog/assets/app_component_notfound.js index 166babe1..dc87dee9 100644 --- a/datalad_catalog/catalog/assets/app_component_notfound.js +++ b/datalad_catalog/catalog/assets/app_component_notfound.js @@ -1,5 +1,4 @@ // Component definition: 404 view const notFound = { - template: - '404-not-found', + template:'

Oops! Page not found :(

404-not-found

Possible causes of the problem:

Please contact the catalog admin if this should not be the case.

', }; \ No newline at end of file From 662812ab2072a34444550864fd2c891bd1f1ae58 Mon Sep 17 00:00:00 2001 From: Stephan Heunis Date: Wed, 5 Apr 2023 16:24:42 +0200 Subject: [PATCH 2/4] catch 404 and reroute when fetching missing dataset file --- datalad_catalog/catalog/assets/app_component_dataset.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/datalad_catalog/catalog/assets/app_component_dataset.js b/datalad_catalog/catalog/assets/app_component_dataset.js index 499ebe69..8271c3fd 100644 --- a/datalad_catalog/catalog/assets/app_component_dataset.js +++ b/datalad_catalog/catalog/assets/app_component_dataset.js @@ -549,6 +549,13 @@ const datasetView = () => ); var app = this.$root; response = await fetch(file); + // Reroute to 404 if the dataset file is not found + if (response.status == 404) { + router.push({ + name: "404", + }); + return; + } text = await response.text(); app.selectedDataset = JSON.parse(text); this.dataset_ready = true; From f403ccc0d80be82e7c84744c686f666faaea7d77 Mon Sep 17 00:00:00 2001 From: Stephan Heunis Date: Wed, 5 Apr 2023 16:26:11 +0200 Subject: [PATCH 3/4] improve UX of tab display upon dataset navigation - revert to original functioning --- datalad_catalog/catalog/assets/app_component_dataset.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/datalad_catalog/catalog/assets/app_component_dataset.js b/datalad_catalog/catalog/assets/app_component_dataset.js index 8271c3fd..fb0ebddd 100644 --- a/datalad_catalog/catalog/assets/app_component_dataset.js +++ b/datalad_catalog/catalog/assets/app_component_dataset.js @@ -456,9 +456,7 @@ const datasetView = () => }, }, async beforeRouteUpdate(to, from, next) { - if (this.tabIndex != 1) { - this.tabIndex = 0; - } + this.tabIndex = 0; this.subdatasets_ready = false; this.dataset_ready = false; From 3f6b3a5c3c86235d5d3622ded673a865ad5ed322 Mon Sep 17 00:00:00 2001 From: Stephan Heunis Date: Wed, 5 Apr 2023 16:32:08 +0200 Subject: [PATCH 4/4] add spinners to subdtasets, files, and subdirectories when loading --- .../catalog/assets/app_component_dataset.js | 1 + .../catalog/assets/app_component_item.js | 4 ++ .../catalog/templates/dataset-template.html | 55 ++++++++++--------- .../catalog/templates/item-template.html | 8 ++- 4 files changed, 41 insertions(+), 27 deletions(-) diff --git a/datalad_catalog/catalog/assets/app_component_dataset.js b/datalad_catalog/catalog/assets/app_component_dataset.js index fb0ebddd..1e991f06 100644 --- a/datalad_catalog/catalog/assets/app_component_dataset.js +++ b/datalad_catalog/catalog/assets/app_component_dataset.js @@ -421,6 +421,7 @@ const datasetView = () => return this.tag_options_available.indexOf(tag) >= 0; }, getFiles() { + this.files_ready = false; this.$root.selectedDataset.tree = this.$root.selectedDataset["children"]; this.files_ready = true; }, diff --git a/datalad_catalog/catalog/assets/app_component_item.js b/datalad_catalog/catalog/assets/app_component_item.js index d80daede..c86acdc3 100644 --- a/datalad_catalog/catalog/assets/app_component_item.js +++ b/datalad_catalog/catalog/assets/app_component_item.js @@ -16,6 +16,7 @@ Vue.component('tree-item', function (resolve, reject) { return { isOpen: false, files_ready: false, + spinner_on: null, children: [], }; }, @@ -41,6 +42,8 @@ Vue.component('tree-item', function (resolve, reject) { if (this.isFolder) { tempIsOpen = !this.isOpen; if (tempIsOpen && !this.item.hasOwnProperty("children")) { + this.files_ready = false; + this.spinner_on = true; obj = await this.getChildren(this.item); this.item.children = obj["children"]; // go through all children, set state to enabled @@ -58,6 +61,7 @@ Vue.component('tree-item', function (resolve, reject) { }) ); this.files_ready = true; + this.spinner_on = false; } this.isOpen = !this.isOpen; } diff --git a/datalad_catalog/catalog/templates/dataset-template.html b/datalad_catalog/catalog/templates/dataset-template.html index 6939c70e..03259fbb 100644 --- a/datalad_catalog/catalog/templates/dataset-template.html +++ b/datalad_catalog/catalog/templates/dataset-template.html @@ -146,7 +146,12 @@

Cite dataset

- + +
+ +
+
+ There are no subdatasets listed for the current dataset @@ -240,35 +245,35 @@
{{ds.dirs_from_path.at(-1)}} Files - There are no files listed for the current dataset - - - + + There are no files listed for the current dataset + +
-
- -