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}` : ""}` +);