Skip to content

Commit

Permalink
Merge pull request #18574 from ElectronicBlueberry/fix-history-change…
Browse files Browse the repository at this point in the history
…s-workflow-run-form-reset

[24.1] Fix history changes switch to simple form
  • Loading branch information
mvdbeek authored Jul 19, 2024
2 parents 5c43d00 + 314e20c commit 3be3672
Showing 1 changed file with 52 additions and 41 deletions.
93 changes: 52 additions & 41 deletions client/src/components/Workflow/Run/WorkflowRun.vue
Original file line number Diff line number Diff line change
Expand Up @@ -77,55 +77,66 @@ function handleSubmissionError(error: string) {
submissionError.value = errorMessageAsString(error);
}
function loadRun() {
getRunData(props.workflowId, props.version || undefined)
.then((runData) => {
const incomingModel = new WorkflowRunModel(runData);
simpleForm.value = props.preferSimpleForm;
if (simpleForm.value) {
// These only work with PJA - the API doesn't evaluate them at
// all outside that context currently. The main workflow form renders
// these dynamically and takes care of all the validation and setup details
// on the frontend. If these are implemented on the backend at some
// point this restriction can be lifted.
if (incomingModel.hasReplacementParametersInToolForm) {
console.log("cannot render simple workflow form - has ${} values in tool steps");
simpleForm.value = false;
}
// If there are required parameters in a tool form (a disconnected runtime
// input), we have to render the tool form steps and cannot use the
// simplified tool form.
if (incomingModel.hasOpenToolSteps) {
console.log(
"cannot render simple workflow form - one or more tools have disconnected runtime inputs"
);
simpleForm.value = false;
}
// Just render the whole form for resource request parameters (kind of
// niche - I'm not sure anyone is using these currently anyway).
if (incomingModel.hasWorkflowResourceParameters) {
console.log(`Cannot render simple workflow form - workflow resource parameters are configured`);
simpleForm.value = false;
}
async function loadRun() {
try {
const runData = await getRunData(props.workflowId, props.version || undefined);
const incomingModel = new WorkflowRunModel(runData);
simpleForm.value = props.preferSimpleForm;
if (simpleForm.value) {
// These only work with PJA - the API doesn't evaluate them at
// all outside that context currently. The main workflow form renders
// these dynamically and takes care of all the validation and setup details
// on the frontend. If these are implemented on the backend at some
// point this restriction can be lifted.
if (incomingModel.hasReplacementParametersInToolForm) {
console.log("cannot render simple workflow form - has ${} values in tool steps");
simpleForm.value = false;
}
hasUpgradeMessages.value = incomingModel.hasUpgradeMessages;
hasStepVersionChanges.value = incomingModel.hasStepVersionChanges;
workflowName.value = incomingModel.name;
workflowModel.value = incomingModel;
loading.value = false;
})
.catch((response) => {
workflowError.value = errorMessageAsString(response);
});
// If there are required parameters in a tool form (a disconnected runtime
// input), we have to render the tool form steps and cannot use the
// simplified tool form.
if (incomingModel.hasOpenToolSteps) {
console.log("cannot render simple workflow form - one or more tools have disconnected runtime inputs");
simpleForm.value = false;
}
// Just render the whole form for resource request parameters (kind of
// niche - I'm not sure anyone is using these currently anyway).
if (incomingModel.hasWorkflowResourceParameters) {
console.log(`Cannot render simple workflow form - workflow resource parameters are configured`);
simpleForm.value = false;
}
}
hasUpgradeMessages.value = incomingModel.hasUpgradeMessages;
hasStepVersionChanges.value = incomingModel.hasStepVersionChanges;
workflowName.value = incomingModel.name;
workflowModel.value = incomingModel;
loading.value = false;
} catch (e) {
workflowError.value = errorMessageAsString(e);
}
}
async function onImport() {
const response = await copyWorkflow(props.workflowId, workflowModel.value.runData.owner, props.version);
router.push(`/workflows/edit?id=${response.id}`);
}
const advancedForm = ref(false);
const fromVariant = computed<"simple" | "advanced">(() => {
if (advancedForm.value) {
return "advanced";
} else if (simpleForm.value) {
return "simple";
} else {
return "advanced";
}
});
function showAdvanced() {
simpleForm.value = false;
advancedForm.value = true;
}
onMounted(() => {
Expand Down Expand Up @@ -185,7 +196,7 @@ defineExpose({
Workflow submission failed: {{ submissionError }}
</BAlert>
<WorkflowRunFormSimple
v-else-if="simpleForm"
v-else-if="fromVariant === 'simple'"
:model="workflowModel"
:target-history="simpleFormTargetHistory"
:use-job-cache="simpleFormUseJobCache"
Expand Down

0 comments on commit 3be3672

Please sign in to comment.