Skip to content

Commit 135d324

Browse files
committed
refactor: use divaservices-utils function in saveWorkflow
1 parent 875943a commit 135d324

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

src/js/workflows/saveWorkflow.js

+12-4
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import xml2js from "xml2js";
66
import { getWebserviceByName } from "../constants/globals";
77
import { app } from "../app";
88
import { CATEGORY_DATATEST, CATEGORY_SERVICE } from "../constants/constants";
9-
import { Validation, XMLBuilders } from "divaservices-utils";
9+
import { Validation, XMLBuilders, DivaServices } from "divaservices-utils";
1010
import { sendWorkflowSteps } from "../api/requests";
1111
import { getOrderedElements } from "../elements/orderElement";
1212

@@ -29,7 +29,7 @@ export const saveWorkflow = async (jsonGraph, installation = false) => {
2929
// .filter(({ category }) => category != CATEGORY_DATATEST)
3030
// .forEach((box, i) => {
3131
const { type, boxId } = box;
32-
const Name = type.replace(/\s/g, "");
32+
const Name = DivaServices.buildNameForRequest(type);
3333
const No = i;
3434
const Inputs = { Parameter: [], Data: [] };
3535

@@ -120,7 +120,10 @@ export const saveWorkflow = async (jsonGraph, installation = false) => {
120120
targetWebservice.Inputs.Data.push(p);
121121

122122
_targetWebservice.inputs.data.push({
123-
[link.target.portName]: `$${name}/$${link.source.portName}`
123+
[link.target.portName]: DivaServices.buildInputReferenceName(
124+
name,
125+
link.source.portName
126+
)
124127
});
125128
} else {
126129
const sourceDataBox = app.currentDataElements.find(
@@ -133,7 +136,12 @@ export const saveWorkflow = async (jsonGraph, installation = false) => {
133136
const file = sourceDataBox.data[0]; // suppose one file
134137
allFiles.push(file);
135138
const dataName =
136-
targetWebservice.Name + "_" + link.target.portName + "_" + i++;
139+
DivaServices.buildInputNameForService(
140+
targetWebservice.Name,
141+
link.target.portName
142+
) +
143+
"_" +
144+
i++;
137145
const fileData = {
138146
[dataName]: file.identifier
139147
};

0 commit comments

Comments
 (0)