@pxp-nd/flow 1.0.41 → 1.0.42
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/controllers/Flow.js +49 -40
- package/package.json +1 -1
package/dist/controllers/Flow.js
CHANGED
|
@@ -146,7 +146,7 @@ let Flow = class Flow extends core_1.Controller {
|
|
|
146
146
|
createdAt: undefined
|
|
147
147
|
};
|
|
148
148
|
const flowDataClone = await manager.save(Flow_1.default, { ...flowToClone, name: `${flowData.name} Copy` });
|
|
149
|
-
const nodesToDuplicate = await manager.find(Node_1.default, { flowId: flowData === null || flowData === void 0 ? void 0 : flowData.flowId });
|
|
149
|
+
const nodesToDuplicate = await manager.find(Node_1.default, { flowId: flowData === null || flowData === void 0 ? void 0 : flowData.flowId, isActive: true });
|
|
150
150
|
if (nodesToDuplicate) {
|
|
151
151
|
const originalNodeIds = nodesToDuplicate.map((node) => node.nodeId);
|
|
152
152
|
const duplicatedNodes = nodesToDuplicate.map((node) => {
|
|
@@ -284,23 +284,28 @@ let Flow = class Flow extends core_1.Controller {
|
|
|
284
284
|
let id = null;
|
|
285
285
|
let flowId = null;
|
|
286
286
|
let taskIds = [];
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
287
|
+
if (nodeRefIds.length === 0) {
|
|
288
|
+
flowId = params.board.columns['2-column-nodes-configured'].flowId;
|
|
289
|
+
}
|
|
290
|
+
else {
|
|
291
|
+
for (const nodeId of nodeRefIds) {
|
|
292
|
+
// console.log ('node:',nodes[`${nodeId}`]);
|
|
293
|
+
if (nodes[`${nodeId}`]) {
|
|
294
|
+
flowId = nodes[`${nodeId}`].flowId;
|
|
295
|
+
if (nodeId != 'new') {
|
|
296
|
+
id = parseInt(nodeId.split("-")[1]);
|
|
297
|
+
taskIds.push(id);
|
|
298
|
+
const connectionsToDel = await manager.find(NodeConnection_1.default, {
|
|
299
|
+
where: { nodeIdChild: id }
|
|
300
|
+
});
|
|
301
|
+
if (connectionsToDel) {
|
|
302
|
+
//console.log("hay para eliminar---->", connectionsToDel);
|
|
303
|
+
const originalNodeCIds = connectionsToDel.map((node) => node.nodeConnectionId);
|
|
304
|
+
//console.log("eliminando: ", originalNodeCIds);
|
|
305
|
+
let flowNodeC = await typeorm_1.getManager().query(`DELETE
|
|
302
306
|
from twf_node_connection
|
|
303
307
|
WHERE node_connection_id = ${originalNodeCIds}`);
|
|
308
|
+
}
|
|
304
309
|
}
|
|
305
310
|
}
|
|
306
311
|
}
|
|
@@ -322,32 +327,36 @@ let Flow = class Flow extends core_1.Controller {
|
|
|
322
327
|
await manager.query(dNode);
|
|
323
328
|
}
|
|
324
329
|
}
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
330
|
+
if (nodeRefIds.length === 0) {
|
|
331
|
+
}
|
|
332
|
+
else {
|
|
333
|
+
for (const nodeId of nodeRefIds) {
|
|
334
|
+
if (nodes[`${nodeId}`]) {
|
|
335
|
+
if (nodeId === 'new') {
|
|
336
|
+
//get information about Action
|
|
337
|
+
const newAction = await Action_1.default.findOne({ code: nodes[`${nodeId}`].action.code });
|
|
338
|
+
const newNode = manager.create(Node_1.default, {
|
|
339
|
+
nodeId: undefined,
|
|
340
|
+
flowId: nodes[`${nodeId}`].flowId,
|
|
341
|
+
isInit: 'N',
|
|
342
|
+
actionId: newAction.actionId
|
|
343
|
+
});
|
|
344
|
+
const saveNode = await manager.save(newNode);
|
|
345
|
+
id = saveNode.nodeId;
|
|
346
|
+
}
|
|
347
|
+
else {
|
|
348
|
+
id = parseInt(nodeId.split("-")[1]);
|
|
349
|
+
}
|
|
350
|
+
//save in node and node_connection
|
|
351
|
+
const newConnection = manager.create(NodeConnection_1.default, {
|
|
352
|
+
nodeConnectionId: undefined,
|
|
353
|
+
nodeIdMaster: masterId,
|
|
354
|
+
nodeIdChild: id,
|
|
335
355
|
});
|
|
336
|
-
|
|
337
|
-
|
|
356
|
+
masterId = id;
|
|
357
|
+
const savedNodes = await manager.save(newConnection);
|
|
358
|
+
// }
|
|
338
359
|
}
|
|
339
|
-
else {
|
|
340
|
-
id = parseInt(nodeId.split("-")[1]);
|
|
341
|
-
}
|
|
342
|
-
//save in node and node_connection
|
|
343
|
-
const newConnection = manager.create(NodeConnection_1.default, {
|
|
344
|
-
nodeConnectionId: undefined,
|
|
345
|
-
nodeIdMaster: masterId,
|
|
346
|
-
nodeIdChild: id,
|
|
347
|
-
});
|
|
348
|
-
masterId = id;
|
|
349
|
-
const savedNodes = await manager.save(newConnection);
|
|
350
|
-
// }
|
|
351
360
|
}
|
|
352
361
|
}
|
|
353
362
|
return { success: true };
|