From 570aa627ebf08967bcb35520d55da14b96cff362 Mon Sep 17 00:00:00 2001 From: Mike VanDenburgh Date: Mon, 30 Jan 2023 14:19:37 -0500 Subject: [PATCH 1/5] Display error message if dandiset doesn't exist --- web/src/stores/dandiset.ts | 5 +++- .../DandisetLandingView.vue | 24 +++++++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/web/src/stores/dandiset.ts b/web/src/stores/dandiset.ts index ed3e0598c..b44a314f6 100644 --- a/web/src/stores/dandiset.ts +++ b/web/src/stores/dandiset.ts @@ -52,7 +52,10 @@ export const useDandisetStore = defineStore('dandiset', { // this can be done concurrently, don't await this.fetchDandisetVersions({ identifier }); await this.fetchDandiset({ identifier, version }); - await this.fetchOwners(identifier); + + if (this.dandiset) { + await this.fetchOwners(identifier); + } }, async fetchDandisetVersions({ identifier }: Record) { let res; diff --git a/web/src/views/DandisetLandingView/DandisetLandingView.vue b/web/src/views/DandisetLandingView/DandisetLandingView.vue index c4f85eac2..289f7a36b 100644 --- a/web/src/views/DandisetLandingView/DandisetLandingView.vue +++ b/web/src/views/DandisetLandingView/DandisetLandingView.vue @@ -10,6 +10,24 @@ /> +
+ + mdi-alert + Error: Dandiset does not exist. + +

+ + Proceed back to the Public Dandisets page + or use the search bar to find a valid Dandiset. + +
+
+ @@ -117,6 +135,7 @@ const store = useDandisetStore(); const currentDandiset = computed(() => store.dandiset); const loading = ref(false); +const dandisetDoesNotExist = ref(false); const schema = computed(() => store.schema); const userCanModifyDandiset = computed(() => store.userCanModifyDandiset); @@ -143,6 +162,11 @@ watch(() => props.identifier, async () => { loading.value = true; await store.initializeDandisets({ identifier, version }); loading.value = false; + + // Render an error message if currentDandiset is still null after fetching + if (!currentDandiset.value) { + dandisetDoesNotExist.value = true; + } } }, { immediate: true }); From 0bab37b7413fec09ceaf9c160af83669eaecc8d9 Mon Sep 17 00:00:00 2001 From: Mike VanDenburgh Date: Mon, 30 Jan 2023 14:44:03 -0500 Subject: [PATCH 2/5] Add test for invalid dandiset URL --- web/test/src/tests/dandisetLandingPage.test.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/web/test/src/tests/dandisetLandingPage.test.js b/web/test/src/tests/dandisetLandingPage.test.js index d9bdda587..c93b17a9e 100644 --- a/web/test/src/tests/dandisetLandingPage.test.js +++ b/web/test/src/tests/dandisetLandingPage.test.js @@ -6,6 +6,7 @@ import { logout, waitForRequestsToFinish, clearCookiesAndCache, + CLIENT_URL, } from '../util'; describe('dandiset landing page', () => { @@ -60,4 +61,10 @@ describe('dandiset landing page', () => { await expect(page).toContainXPath(vChip(otherUserName)); await expect(page).toContainXPath(vChip(ownerName)); }); + + it('navigate to an invalid dandiset URL', async () => { + await page.goto(new URL('/dandiset/1', CLIENT_URL).href); + await waitForRequestsToFinish(); + await expect(page).toMatch('Error: Dandiset does not exist.'); + }); }); From e74a1d9c5b025eec8fc84f97a79f1081ce62c1fb Mon Sep 17 00:00:00 2001 From: Mike VanDenburgh <37340715+mvandenburgh@users.noreply.github.com> Date: Mon, 30 Jan 2023 16:51:09 -0500 Subject: [PATCH 3/5] Clean up wording Co-authored-by: Roni Choudhury <2903332+waxlamp@users.noreply.github.com> --- web/src/views/DandisetLandingView/DandisetLandingView.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/web/src/views/DandisetLandingView/DandisetLandingView.vue b/web/src/views/DandisetLandingView/DandisetLandingView.vue index 289f7a36b..3ebd5e65a 100644 --- a/web/src/views/DandisetLandingView/DandisetLandingView.vue +++ b/web/src/views/DandisetLandingView/DandisetLandingView.vue @@ -17,11 +17,11 @@
mdi-alert - Error: Dandiset does not exist. + Error: Dandiset does not exist

- Proceed back to the Public Dandisets page + Proceed to the Public Dandisets page or use the search bar to find a valid Dandiset.
From 741f301aee847aabae75ddb282f0a5979effb6f7 Mon Sep 17 00:00:00 2001 From: Mike VanDenburgh Date: Mon, 30 Jan 2023 16:54:46 -0500 Subject: [PATCH 4/5] RF ref into a computed property --- .../views/DandisetLandingView/DandisetLandingView.vue | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/web/src/views/DandisetLandingView/DandisetLandingView.vue b/web/src/views/DandisetLandingView/DandisetLandingView.vue index 3ebd5e65a..622b9be17 100644 --- a/web/src/views/DandisetLandingView/DandisetLandingView.vue +++ b/web/src/views/DandisetLandingView/DandisetLandingView.vue @@ -135,7 +135,10 @@ const store = useDandisetStore(); const currentDandiset = computed(() => store.dandiset); const loading = ref(false); -const dandisetDoesNotExist = ref(false); + +// If loading is finished and currentDandiset is still null, the dandiset doesn't exist. +const dandisetDoesNotExist = computed(() => !loading.value && !currentDandiset.value); + const schema = computed(() => store.schema); const userCanModifyDandiset = computed(() => store.userCanModifyDandiset); @@ -162,11 +165,6 @@ watch(() => props.identifier, async () => { loading.value = true; await store.initializeDandisets({ identifier, version }); loading.value = false; - - // Render an error message if currentDandiset is still null after fetching - if (!currentDandiset.value) { - dandisetDoesNotExist.value = true; - } } }, { immediate: true }); From 676e3e039dfd03acb3327f18a1071ca4049e526a Mon Sep 17 00:00:00 2001 From: Mike VanDenburgh Date: Mon, 30 Jan 2023 17:13:58 -0500 Subject: [PATCH 5/5] Update test --- web/test/src/tests/dandisetLandingPage.test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/test/src/tests/dandisetLandingPage.test.js b/web/test/src/tests/dandisetLandingPage.test.js index c93b17a9e..0b2eecaf6 100644 --- a/web/test/src/tests/dandisetLandingPage.test.js +++ b/web/test/src/tests/dandisetLandingPage.test.js @@ -65,6 +65,6 @@ describe('dandiset landing page', () => { it('navigate to an invalid dandiset URL', async () => { await page.goto(new URL('/dandiset/1', CLIENT_URL).href); await waitForRequestsToFinish(); - await expect(page).toMatch('Error: Dandiset does not exist.'); + await expect(page).toMatch('Error: Dandiset does not exist'); }); });