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

Fix publishing UI bug #1442

Merged
merged 2 commits into from
Jan 23, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
14 changes: 0 additions & 14 deletions web/src/stores/dandiset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import { draftVersion } from '@/utils/constants';
interface State {
dandiset: Version | null;
versions: Version[] | null,
loading: boolean,
owners: User[] | null,
schema: any,
}
Expand All @@ -20,7 +19,6 @@ export const useDandisetStore = defineStore('dandiset', {
state: (): State => ({
dandiset: null,
versions: null,
loading: false,
owners: null,
schema: null,
}),
Expand All @@ -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<string, string>) {
this.uninitializeDandisets();
Expand All @@ -58,7 +55,6 @@ export const useDandisetStore = defineStore('dandiset', {
await this.fetchOwners(identifier);
},
async fetchDandisetVersions({ identifier }: Record<string, string>) {
this.loading = true;
let res;
try {
res = await dandiRest.versions(identifier);
Expand All @@ -75,16 +71,12 @@ export const useDandisetStore = defineStore('dandiset', {
const { results } = res;
this.versions = results || [];
}

this.loading = false;
},
async fetchDandiset({ identifier, version }: Record<string, string>) {
this.loading = true;
const sanitizedVersion = version || (await dandiRest.mostRecentVersion(identifier))?.version;

if (!sanitizedVersion) {
this.dandiset = null;
this.loading = false;
return;
}

Expand All @@ -98,8 +90,6 @@ export const useDandisetStore = defineStore('dandiset', {
throw err;
}
}

this.loading = false;
},
async fetchSchema() {
const { schema_url: schemaUrl } = await dandiRest.info();
Expand All @@ -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;
},
},
});
6 changes: 5 additions & 1 deletion web/src/views/DandisetLandingView/DandisetLandingView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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 });
Expand All @@ -164,6 +167,7 @@ watch([() => props.identifier, () => props.version], async () => {
navigateToVersion(draftVersion);
}
}
loading.value = false;
});

const page = ref(Number(route.query.pos) || 1);
Expand Down