@pxp-nd/flow 1.0.38 → 1.0.40
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 +48 -39
- package/package.json +1 -1
package/dist/controllers/Flow.js
CHANGED
|
@@ -277,23 +277,28 @@ let Flow = class Flow extends core_1.Controller {
|
|
|
277
277
|
let id = null;
|
|
278
278
|
let flowId = null;
|
|
279
279
|
let taskIds = [];
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
280
|
+
if (nodeRefIds.length === 0) {
|
|
281
|
+
flowId = params.board.columns['2-column-nodes-configured'].flowId;
|
|
282
|
+
}
|
|
283
|
+
else {
|
|
284
|
+
for (const nodeId of nodeRefIds) {
|
|
285
|
+
// console.log ('node:',nodes[`${nodeId}`]);
|
|
286
|
+
if (nodes[`${nodeId}`]) {
|
|
287
|
+
flowId = nodes[`${nodeId}`].flowId;
|
|
288
|
+
if (nodeId != 'new') {
|
|
289
|
+
id = parseInt(nodeId.split("-")[1]);
|
|
290
|
+
taskIds.push(id);
|
|
291
|
+
const connectionsToDel = await manager.find(NodeConnection_1.default, {
|
|
292
|
+
where: { nodeIdChild: id }
|
|
293
|
+
});
|
|
294
|
+
if (connectionsToDel) {
|
|
295
|
+
//console.log("hay para eliminar---->", connectionsToDel);
|
|
296
|
+
const originalNodeCIds = connectionsToDel.map((node) => node.nodeConnectionId);
|
|
297
|
+
//console.log("eliminando: ", originalNodeCIds);
|
|
298
|
+
let flowNodeC = await typeorm_1.getManager().query(`DELETE
|
|
295
299
|
from twf_node_connection
|
|
296
300
|
WHERE node_connection_id = ${originalNodeCIds}`);
|
|
301
|
+
}
|
|
297
302
|
}
|
|
298
303
|
}
|
|
299
304
|
}
|
|
@@ -315,32 +320,36 @@ let Flow = class Flow extends core_1.Controller {
|
|
|
315
320
|
await manager.query(dNode);
|
|
316
321
|
}
|
|
317
322
|
}
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
323
|
+
if (nodeRefIds.length === 0) {
|
|
324
|
+
}
|
|
325
|
+
else {
|
|
326
|
+
for (const nodeId of nodeRefIds) {
|
|
327
|
+
if (nodes[`${nodeId}`]) {
|
|
328
|
+
if (nodeId === 'new') {
|
|
329
|
+
//get information about Action
|
|
330
|
+
const newAction = await Action_1.default.findOne({ code: nodes[`${nodeId}`].action.code });
|
|
331
|
+
const newNode = manager.create(Node_1.default, {
|
|
332
|
+
nodeId: undefined,
|
|
333
|
+
flowId: nodes[`${nodeId}`].flowId,
|
|
334
|
+
isInit: 'N',
|
|
335
|
+
actionId: newAction.actionId
|
|
336
|
+
});
|
|
337
|
+
const saveNode = await manager.save(newNode);
|
|
338
|
+
id = saveNode.nodeId;
|
|
339
|
+
}
|
|
340
|
+
else {
|
|
341
|
+
id = parseInt(nodeId.split("-")[1]);
|
|
342
|
+
}
|
|
343
|
+
//save in node and node_connection
|
|
344
|
+
const newConnection = manager.create(NodeConnection_1.default, {
|
|
345
|
+
nodeConnectionId: undefined,
|
|
346
|
+
nodeIdMaster: masterId,
|
|
347
|
+
nodeIdChild: id,
|
|
328
348
|
});
|
|
329
|
-
|
|
330
|
-
|
|
349
|
+
masterId = id;
|
|
350
|
+
const savedNodes = await manager.save(newConnection);
|
|
351
|
+
// }
|
|
331
352
|
}
|
|
332
|
-
else {
|
|
333
|
-
id = parseInt(nodeId.split("-")[1]);
|
|
334
|
-
}
|
|
335
|
-
//save in node and node_connection
|
|
336
|
-
const newConnection = manager.create(NodeConnection_1.default, {
|
|
337
|
-
nodeConnectionId: undefined,
|
|
338
|
-
nodeIdMaster: masterId,
|
|
339
|
-
nodeIdChild: id,
|
|
340
|
-
});
|
|
341
|
-
masterId = id;
|
|
342
|
-
const savedNodes = await manager.save(newConnection);
|
|
343
|
-
// }
|
|
344
353
|
}
|
|
345
354
|
}
|
|
346
355
|
return { success: true };
|