@gudhub/core 1.2.4-beta.28 → 1.2.4-beta.29

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.
@@ -195,6 +195,8 @@ export default class AppsTemplateService {
195
195
 
196
196
  documentInstallerHelper(appId, items, elementId) {
197
197
  const self = this;
198
+ const itemsWithClonedDocument = [];
199
+
198
200
  return new Promise(async (resolve) => {
199
201
  for(const item of items) {
200
202
  const itemId = item.item_id;
@@ -216,10 +218,11 @@ export default class AppsTemplateService {
216
218
 
217
219
  field.field_value = newDocument._id;
218
220
 
221
+ itemsWithClonedDocument.push(item);
219
222
  }
220
223
  }
221
224
  }
222
- resolve();
225
+ resolve(itemsWithClonedDocument);
223
226
  });
224
227
  }
225
228
 
@@ -480,6 +483,39 @@ export default class AppsTemplateService {
480
483
  parent[prop] = `${self.getValueByPath(app.views_list, path, pron_name)}`;
481
484
  }
482
485
 
486
+ if (prop.indexOf("trigger") !== -1 && value.model && value.model.nodes) {
487
+ const nodes = value.model.nodes;
488
+ const nodeProperties = ["inputs", "outputs"];
489
+
490
+ for (const index in nodes) {
491
+ nodeProperties.forEach((property) => {
492
+ const node = nodes[index];
493
+ const numericProperties = Object.keys(node[property]).filter(prop => prop !== '' && !isNaN(prop)); // field_id as keys
494
+
495
+ numericProperties.forEach((old_field_id) => {
496
+ const correspondFieldOfConnectingMap = appsConnectingMap.fields.filter((field) => field.old_field_id == old_field_id);
497
+
498
+ if (correspondFieldOfConnectingMap.length !== 0 && correspondFieldOfConnectingMap[0].new_field_id) {
499
+ const new_field_id = correspondFieldOfConnectingMap[0].new_field_id.toString();
500
+
501
+ const connectionObjectCopy = node[property][old_field_id];
502
+ connectionObjectCopy.connections.forEach((connection) => {
503
+ if (connection.input == old_field_id) {
504
+ connection.input = new_field_id;
505
+ }
506
+ if (connection.output == old_field_id) {
507
+ connection.output = new_field_id;
508
+ }
509
+ });
510
+
511
+ delete node[property][old_field_id];
512
+
513
+ node[property][new_field_id] = connectionObjectCopy;
514
+ }
515
+ });
516
+ });
517
+ };
518
+ }
483
519
  })
484
520
  })
485
521
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gudhub/core",
3
- "version": "1.2.4-beta.28",
3
+ "version": "1.2.4-beta.29",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {