Skip to content

Commit

Permalink
Improves workflow module insertion and error handling
Browse files Browse the repository at this point in the history
Adds state overwrites parameter to module insertion
Enhances error handling for workflow import
Ensures unique UUID generation on step cloning
  • Loading branch information
itisAliRH committed Jan 13, 2025
1 parent a4f9022 commit 4c78a92
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions client/src/components/Workflow/Editor/Index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import {
useSpecialWorkflowActivities,
workflowEditorActivities,
} from "@/components/Workflow/Editor/modules/activities";
import type { WorkflowInput } from "@/components/Workflow/Editor/modules/inputs";
import { fromSimple } from "@/components/Workflow/Editor/modules/model";
import { getUntypedWorkflowParameters, type UntypedParameters } from "@/components/Workflow/Editor/modules/parameters";
import { getModule, getVersions, loadWorkflow, saveWorkflow } from "@/components/Workflow/Editor/modules/services";
Expand Down Expand Up @@ -338,19 +339,18 @@ function onInsertTool(toolId: string, toolName: string) {
insertStep(toolId, toolName, "tool");
}
function onInsertModule(moduleId: Step["type"], moduleName: string) {
insertStep(moduleName, moduleName, moduleId);
function onInsertModule(moduleId: Step["type"], moduleName: string, state: WorkflowInput["stateOverwrites"]) {
insertStep(moduleName, moduleName, moduleId, state);
}
async function onInsertWorkflow(workflowId: string, workflowName: string, state: any) {
insertStep(workflowId, workflowName, "subworkflow", state);
}
function copyIntoWorkflow(workflowId: string) {
// Load workflow definition
setModalMessage("Importing workflow", "progress");
async function copyIntoWorkflow(workflowId: string) {
try {
const data = await loadWorkflow({ id: workflowId });
loadWorkflow({ id: workflowId }).then((data) => {
const action = new CopyIntoWorkflowAction(
workflowId,
data,
Expand All @@ -364,7 +364,9 @@ function copyIntoWorkflow(workflowId: string) {
const insertedStateMessages = getStateUpgradeMessages(data);
onInsertedStateMessages(insertedStateMessages);
});
} catch (e) {
setModalMessage("Importing workflow failed", errorMessageAsString(e));
}
}
function onDownload() {
Expand Down Expand Up @@ -623,6 +625,7 @@ async function onClone(stepId: string) {
if (sourceStep) {
const newStep = {
...sourceStep,
uuid: undefined,
position: defaultPosition(graphOffset.value, transform.value),
};
Expand Down

0 comments on commit 4c78a92

Please sign in to comment.