Unverified Commit c60f03cc authored by Marius van den Beek's avatar Marius van den Beek Committed by GitHub
Browse files

Merge pull request #18378 from ahmedhamidawan/workflow_run_edit_for_version

[24.1] Allow running and editing workflows for specific versions
parents 070c6a25 2994a0f4
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -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
+3 −1
Original line number Diff line number Diff line
@@ -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) {
+7 −3
Original line number Diff line number Diff line
@@ -27,12 +27,14 @@ const router = useRouter();

interface Props {
    workflowId: string;
    version?: string;
    preferSimpleForm?: boolean;
    simpleFormTargetHistory?: string;
    simpleFormUseJobCache?: boolean;
}

const props = withDefaults(defineProps<Props>(), {
    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}`);
}

+2 −1
Original line number Diff line number Diff line
@@ -7,7 +7,7 @@
            </span>
        </BAlert>
        <div class="h4 clearfix mb-3">
            <b>Workflow: {{ model.name }}</b>
            <b>Workflow: {{ model.name }}</b> <i>(version: {{ model.runData.version + 1 }})</i>
            <ButtonSpinner
                id="run-workflow"
                class="float-right"
@@ -231,6 +231,7 @@ export default {
                // the user is already warned if tool versions are wrong,
                // they can still choose to invoke the workflow anyway.
                require_exact_tool_versions: false,
                version: this.model.runData.version,
            };

            console.debug("WorkflowRunForm::onExecute()", "Ready for submission.", jobDef);
+2 −1
Original line number Diff line number Diff line
@@ -7,7 +7,7 @@
                    or send the results to a new one using the run settings ⚙️
                </span>
            </BAlert>
            <b>Workflow: {{ model.name }}</b>
            <b>Workflow: {{ model.name }}</b> <i>(version: {{ model.runData.version + 1 }})</i>
            <ButtonSpinner
                id="run-workflow"
                :wait="waitingForRequest"
@@ -200,6 +200,7 @@ export default {
                batch: true,
                use_cached_job: this.useCachedJobs,
                require_exact_tool_versions: false,
                version: this.model.runData.version,
            };
            if (this.sendToNewHistory) {
                data.new_history_name = this.model.name;
Loading