From e3ee4a99e3d420f24063eb80dfaa0fd9c118efad Mon Sep 17 00:00:00 2001 From: Ahmed Awan Date: Tue, 11 Jun 2024 17:48:55 -0500 Subject: [PATCH] [24.1] Allow running and editing workflows for specific versions This passes the version prop to the routes for editing and running workflows also and to the `InvokeWorkflowPayload`, so that users can run specific versions of workflows. Fixes https://github.com/galaxyproject/galaxy/issues/18367 --- client/src/api/schema/schema.ts | 5 +++++ client/src/components/Workflow/Editor/Index.vue | 4 +++- client/src/components/Workflow/Run/WorkflowRun.vue | 10 +++++++--- client/src/components/Workflow/Run/WorkflowRunForm.vue | 3 ++- .../components/Workflow/Run/WorkflowRunFormSimple.vue | 3 ++- client/src/components/Workflow/Run/services.js | 8 ++++++-- client/src/components/Workflow/WorkflowRunButton.vue | 10 ++++++++-- client/src/components/Workflow/workflows.services.ts | 8 ++++++-- .../WorkflowInvocationState.vue | 5 +++-- client/src/entry/analysis/modules/Home.vue | 2 ++ client/src/entry/analysis/modules/WorkflowEditor.vue | 5 +++++ client/src/entry/analysis/router.js | 5 ++++- lib/galaxy/schema/workflows.py | 5 +++++ lib/galaxy/webapps/galaxy/services/workflows.py | 7 ++++++- 14 files changed, 64 insertions(+), 16 deletions(-) diff --git a/client/src/api/schema/schema.ts b/client/src/api/schema/schema.ts index 60b12c0d2827..530f4e438291 100644 --- a/client/src/api/schema/schema.ts +++ b/client/src/api/schema/schema.ts @@ -8555,6 +8555,11 @@ export interface components { * @default false */ use_cached_job?: boolean | null; + /** + * Version + * @description The version of the workflow to invoke. + */ + version?: number | null; }; /** * ItemTagsCreatePayload diff --git a/client/src/components/Workflow/Editor/Index.vue b/client/src/components/Workflow/Editor/Index.vue index a3ffdf9873a0..ffb07080dc1f 100644 --- a/client/src/components/Workflow/Editor/Index.vue +++ b/client/src/components/Workflow/Editor/Index.vue @@ -774,7 +774,9 @@ export default { this.report.markdown = markdown; }, onRun() { - const runUrl = `/workflows/run?id=${this.id}`; + const runUrl = `/workflows/run?id=${this.id}${ + this.version !== undefined ? `&version=${this.version}` : "" + }`; this.onNavigate(runUrl); }, async onNavigate(url, forceSave = false, ignoreChanges = false) { diff --git a/client/src/components/Workflow/Run/WorkflowRun.vue b/client/src/components/Workflow/Run/WorkflowRun.vue index 91b338323ad9..fbf47ec93a9d 100644 --- a/client/src/components/Workflow/Run/WorkflowRun.vue +++ b/client/src/components/Workflow/Run/WorkflowRun.vue @@ -27,12 +27,14 @@ const router = useRouter(); interface Props { workflowId: string; + version?: string; preferSimpleForm?: boolean; simpleFormTargetHistory?: string; simpleFormUseJobCache?: boolean; } const props = withDefaults(defineProps(), { + version: undefined, preferSimpleForm: false, simpleFormTargetHistory: "current", simpleFormUseJobCache: false, @@ -49,7 +51,9 @@ const workflowName = ref(""); const workflowModel: any = ref(null); const currentHistoryId = computed(() => historyStore.currentHistoryId); -const editorLink = computed(() => `/workflows/edit?id=${props.workflowId}`); +const editorLink = computed( + () => `/workflows/edit?id=${props.workflowId}${props.version ? `&version=${props.version}` : ""}` +); const historyStatusKey = computed(() => `${currentHistoryId.value}_${lastUpdateTime.value}`); const isOwner = computed(() => currentUser.value?.username === workflowModel.value.runData.owner); const lastUpdateTime = computed(() => historyItemsStore.lastUpdateTime); @@ -74,7 +78,7 @@ function handleSubmissionError(error: string) { } function loadRun() { - getRunData(props.workflowId) + getRunData(props.workflowId, props.version || undefined) .then((runData) => { const incomingModel = new WorkflowRunModel(runData); simpleForm.value = props.preferSimpleForm; @@ -116,7 +120,7 @@ function loadRun() { } async function onImport() { - const response = await copyWorkflow(props.workflowId, workflowModel.value.runData.owner); + const response = await copyWorkflow(props.workflowId, workflowModel.value.runData.owner, props.version); router.push(`/workflows/edit?id=${response.id}`); } diff --git a/client/src/components/Workflow/Run/WorkflowRunForm.vue b/client/src/components/Workflow/Run/WorkflowRunForm.vue index 2627554e526f..6b23e8895ea0 100644 --- a/client/src/components/Workflow/Run/WorkflowRunForm.vue +++ b/client/src/components/Workflow/Run/WorkflowRunForm.vue @@ -7,7 +7,7 @@
- Workflow: {{ model.name }} + Workflow: {{ model.name }} (version: {{ model.runData.version + 1 }}) - Workflow: {{ model.name }} + Workflow: {{ model.name }} (version: {{ model.runData.version + 1 }}) (); +const props = defineProps(); + +const runPath = computed( + () => `/workflows/run?id=${props.id}${props.version !== undefined ? `&version=${props.version}` : ""}` +);