From 8d2601eb4c202885abb27ffaa52fc1e03f69c12d Mon Sep 17 00:00:00 2001 From: Mike VanDenburgh Date: Mon, 23 Jan 2023 11:33:34 -0500 Subject: [PATCH 1/2] Remove `loading` variable from store This variable is only used in one component, DandisetLandingView, so move it to a local `ref` in that component instead. --- web/src/stores/dandiset.ts | 14 -------------- .../DandisetLandingView/DandisetLandingView.vue | 6 +++++- 2 files changed, 5 insertions(+), 15 deletions(-) diff --git a/web/src/stores/dandiset.ts b/web/src/stores/dandiset.ts index abaa815ea..ed3e0598c 100644 --- a/web/src/stores/dandiset.ts +++ b/web/src/stores/dandiset.ts @@ -11,7 +11,6 @@ import { draftVersion } from '@/utils/constants'; interface State { dandiset: Version | null; versions: Version[] | null, - loading: boolean, owners: User[] | null, schema: any, } @@ -20,7 +19,6 @@ export const useDandisetStore = defineStore('dandiset', { state: (): State => ({ dandiset: null, versions: null, - loading: false, owners: null, schema: null, }), @@ -47,7 +45,6 @@ export const useDandisetStore = defineStore('dandiset', { this.dandiset = null; this.versions = null; this.owners = null; - this.loading = false; }, async initializeDandisets({ identifier, version }: Record) { this.uninitializeDandisets(); @@ -58,7 +55,6 @@ export const useDandisetStore = defineStore('dandiset', { await this.fetchOwners(identifier); }, async fetchDandisetVersions({ identifier }: Record) { - this.loading = true; let res; try { res = await dandiRest.versions(identifier); @@ -75,16 +71,12 @@ export const useDandisetStore = defineStore('dandiset', { const { results } = res; this.versions = results || []; } - - this.loading = false; }, async fetchDandiset({ identifier, version }: Record) { - this.loading = true; const sanitizedVersion = version || (await dandiRest.mostRecentVersion(identifier))?.version; if (!sanitizedVersion) { this.dandiset = null; - this.loading = false; return; } @@ -98,8 +90,6 @@ export const useDandisetStore = defineStore('dandiset', { throw err; } } - - this.loading = false; }, async fetchSchema() { const { schema_url: schemaUrl } = await dandiRest.info(); @@ -114,12 +104,8 @@ export const useDandisetStore = defineStore('dandiset', { this.schema = schema; }, async fetchOwners(identifier: string) { - this.loading = true; - const { data } = await dandiRest.owners(identifier); this.owners = data; - - this.loading = false; }, }, }); diff --git a/web/src/views/DandisetLandingView/DandisetLandingView.vue b/web/src/views/DandisetLandingView/DandisetLandingView.vue index 29dc63a26..c4f85eac2 100644 --- a/web/src/views/DandisetLandingView/DandisetLandingView.vue +++ b/web/src/views/DandisetLandingView/DandisetLandingView.vue @@ -116,7 +116,7 @@ const router = useRouter(); const store = useDandisetStore(); const currentDandiset = computed(() => store.dandiset); -const loading = computed(() => store.loading); +const loading = ref(false); const schema = computed(() => store.schema); const userCanModifyDandiset = computed(() => store.userCanModifyDandiset); @@ -140,12 +140,15 @@ function navigateToVersion(versionToNavigateTo: string) { watch(() => props.identifier, async () => { const { identifier, version } = props; if (identifier) { + loading.value = true; await store.initializeDandisets({ identifier, version }); + loading.value = false; } }, { immediate: true }); watch([() => props.identifier, () => props.version], async () => { const { identifier, version } = props; + loading.value = true; if (version) { // On version change, fetch the new dandiset (not initial) await store.fetchDandiset({ identifier, version }); @@ -164,6 +167,7 @@ watch([() => props.identifier, () => props.version], async () => { navigateToVersion(draftVersion); } } + loading.value = false; }); const page = ref(Number(route.query.pos) || 1); From 4d898389a6864b074c0bde8734396edb0da4e211 Mon Sep 17 00:00:00 2001 From: Mike VanDenburgh Date: Mon, 23 Jan 2023 13:47:14 -0500 Subject: [PATCH 2/2] Close admin publish warning dialog after publishing --- web/src/views/DandisetLandingView/DandisetPublish.vue | 1 + 1 file changed, 1 insertion(+) diff --git a/web/src/views/DandisetLandingView/DandisetPublish.vue b/web/src/views/DandisetLandingView/DandisetPublish.vue index 8940a8161..fdf8d4d88 100644 --- a/web/src/views/DandisetLandingView/DandisetPublish.vue +++ b/web/src/views/DandisetLandingView/DandisetPublish.vue @@ -632,6 +632,7 @@ async function publish() { } showPublishChecklistDialog.value = false; + showPublishWarningDialog.value = false; publishing.value = true; try {