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

Fixed call to download file mixin to include version #790

Merged
merged 2 commits into from
Dec 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
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
3 changes: 1 addition & 2 deletions components/FilesTable/FilesTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -647,7 +647,6 @@ export default {
},

executeDownload(downloadInfo) {
const version = propOr('', 'version', downloadInfo)
const datasetVersionRegexp = /(?<datasetId>\d*)\/(?<filePath>.*)/
let params = downloadInfo.uri.replace("s3://", "")
let firstIndex = params.indexOf("/") + 1
Expand All @@ -657,7 +656,7 @@ export default {
const payload = {
paths: [matches.groups.filePath],
datasetId: matches.groups.datasetId,
version: version
version: this.datasetVersion
}

this.zipData = JSON.stringify(payload, undefined)
Expand Down
7 changes: 5 additions & 2 deletions components/ViewersMetadata/BiolucidaViewerMetadata.vue
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
</div>
</div>
<div v-if="filePath" class="pt-16">
<el-button @click="requestDownloadFile(file)">
<el-button @click="requestDownloadFile({...file, version: versionId})">
Download file
</el-button>
</div>
Expand Down Expand Up @@ -170,7 +170,10 @@ export default {
},
datasetId() {
return propOr(undefined, "id", this.datasetInfo)
}
},
versionId() {
return propOr(undefined, "version", this.datasetInfo)
},
}
}
</script>
Expand Down
5 changes: 4 additions & 1 deletion components/ViewersMetadata/PlotViewerMetadata.vue
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
</div>
</div>
<div class="pt-16">
<bf-button @click="requestDownloadFile(file)">
<bf-button @click="requestDownloadFile({...file, version: versionId})">
Download file
</bf-button>
</div>
Expand Down Expand Up @@ -86,6 +86,9 @@ export default {
datasetId() {
return propOr(undefined, "id", this.datasetInfo)
},
versionId() {
return propOr(undefined, "version", this.datasetInfo)
},
},
}
</script>
Expand Down
2 changes: 1 addition & 1 deletion components/ViewersMetadata/SegmentationViewerMetadata.vue
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
</div>
</div>
<div class="pt-16">
<el-button @click="requestDownloadFile(file)">
<el-button @click="requestDownloadFile({...file, version: versionId})">
Download file
</el-button>
</div>
Expand Down
5 changes: 4 additions & 1 deletion components/ViewersMetadata/VideoViewerMetadata.vue
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
</div>
</div>
<div class="pt-16">
<bf-button @click="requestDownloadFile(file)">
<bf-button @click="requestDownloadFile({...file, version: versionId})">
Download file
</bf-button>
</div>
Expand Down Expand Up @@ -82,6 +82,9 @@ export default {
datasetId() {
return propOr(undefined, "id", this.datasetInfo)
},
versionId() {
return propOr(undefined, "version", this.datasetInfo)
},
fileType: function() {
return this.file.fileType
},
Expand Down
3 changes: 2 additions & 1 deletion mixins/dataset-info/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { isEmpty } from 'ramda'
export default {
methods: {
/**
Expand All @@ -6,7 +7,7 @@ export default {
getDatasetInfo: async function(axios, datasetId, datasetVersion, userToken) {
const url = `${process.env.discover_api_host}/datasets/${datasetId}`
var datasetUrl = datasetVersion ? `${url}/versions/${datasetVersion}` : url
if (userToken) {
if (!isEmpty(userToken)) {
datasetUrl += `?api_key=${userToken}`
}
return await axios.$get(datasetUrl).catch(error => {
Expand Down