Skip to content

Commit

Permalink
Merge pull request #531 from dandi/django-create-dandiset
Browse files Browse the repository at this point in the history
Django create dandiset
  • Loading branch information
dchiquito committed Dec 28, 2020
2 parents 337c8a8 + 6f53280 commit b38764d
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 18 deletions.
4 changes: 4 additions & 0 deletions web/src/rest/publish.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,10 @@ const publishRest = new Vue({
async dandisets(params) {
return client.get('dandisets/', { params });
},
async createDandiset(name, description) {
const metadata = { name, description };
return client.post('dandisets/', { name, metadata });
},
async owners(identifier) {
return client.get(`dandisets/${identifier}/users/`);
},
Expand Down
34 changes: 22 additions & 12 deletions web/src/views/CreateDandisetView/CreateDandisetView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@
</template>

<script>
import { girderRest, loggedIn } from '@/rest';
import { girderRest, publishRest, loggedIn } from '@/rest';
import toggles from '@/featureToggle';
export default {
name: 'CreateDandisetView',
Expand All @@ -63,18 +64,27 @@ export default {
methods: {
async registerDandiset() {
const { name, description } = this;
const { data } = await girderRest.post('dandi', null, {
params: {
name,
description,
},
});
if (toggles.DJANGO_API) {
const { data } = await publishRest.createDandiset(name, description);
const { identifier } = data;
this.$router.push({
name: 'dandisetLanding',
params: { identifier },
});
} else {
const { data } = await girderRest.post('dandi', null, {
params: {
name,
description,
},
});
const { identifier } = data.meta.dandiset;
this.$router.push({
name: 'dandisetLanding',
params: { identifier },
});
const { identifier } = data.meta.dandiset;
this.$router.push({
name: 'dandisetLanding',
params: { identifier },
});
}
},
},
};
Expand Down
10 changes: 4 additions & 6 deletions web/src/views/FileBrowserView/FileBrowser.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
<script>
import { mapState, mapActions } from 'vuex';
import { draftVersion } from '@/utils';
import toggles from '@/featureToggle';
import GirderFileBrowser from './GirderFileBrowser.vue';
import PublishFileBrowser from './PublishFileBrowser.vue';
import toggles from '@/featureToggle';
export default {
name: 'FileBrowser',
Expand Down Expand Up @@ -54,11 +54,9 @@ export default {
if (!this.publishDandiset) {
this.fetchPublishDandiset({ identifier, version });
}
} else {
if (!this.girderDandiset) {
// Await so we can use this value afterwards
await this.fetchGirderDandiset({ identifier });
}
} else if (!this.girderDandiset) {
// Await so we can use this value afterwards
await this.fetchGirderDandiset({ identifier });
}
},
methods: {
Expand Down

0 comments on commit b38764d

Please sign in to comment.