Skip to content

Commit

Permalink
Allow trs_version to refer to name or id field
Browse files Browse the repository at this point in the history
This has diverged between workflowhub.eu and dockstore implementations.
  • Loading branch information
mvdbeek committed May 20, 2021
1 parent cf8e972 commit 9736d53
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
15 changes: 13 additions & 2 deletions client/src/components/Workflow/TrsImport.vue
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,20 @@ export default {
this.trsTool = tool;
this.errorMessage = null;
if (this.isAutoImport) {
const version = this.trsTool.versions.find((version) => version.id === this.queryTrsVersionId);
/* Resolve discrepancy between workflowhub, which sends an id as query parameter,
and dockstore, which uses the version name as the query parameter.
Should just be one of them eventually. */
let versionField = "name";
const version = this.trsTool.versions.find((version) => {
if (version.name == this.queryTrsVersionId) {
return true;
} else if (version.id == this.queryTrsVersionId) {
versionField = "id";
return true;
}
});
if (version) {
this.importVersion(this.trsTool.id, version, this.isRun);
this.importVersion(this.trsTool.id, version[versionField], this.isRun);
} else {
Toast.warning(`Specified version: ${this.queryTrsVersionId} doesn't exist`);
this.isAutoImport = false;
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/Workflow/trsMixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export default {
methods: {
importVersion(toolId, version, isRunFormRedirect = false) {
this.services
.importTrsTool(this.trsSelection.id, toolId, version.name)
.importTrsTool(this.trsSelection.id, toolId, version)
.then((response_data) => {
redirectOnImport(getAppRoot(), response_data, isRunFormRedirect);
})
Expand Down

0 comments on commit 9736d53

Please sign in to comment.