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

[21.05] Allow trs_version to refer to name or id field #12021

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
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