@processmaker/modeler 1.39.30 → 1.39.32
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/modeler.common.js +311 -112
- package/dist/modeler.common.js.map +1 -1
- package/dist/modeler.umd.js +311 -112
- package/dist/modeler.umd.js.map +1 -1
- package/dist/modeler.umd.min.js +4 -4
- package/dist/modeler.umd.min.js.map +1 -1
- package/package.json +1 -1
- package/src/components/inspectors/MessageSelect.vue +1 -1
- package/src/components/inspectors/PreviewPanel.vue +67 -63
- package/src/components/inspectors/preview_panel.scss +22 -25
- package/src/components/modeler/Modeler.vue +45 -6
- package/src/components/modeler/NodeMigrator.js +10 -2
- package/src/components/nodes/errorEndEvent/index.js +3 -1
- package/src/components/nodes/messageEventDefinition/index.js +13 -1
- package/src/components/nodes/sequenceFlow/index.js +15 -0
- package/src/multiplayer/multiplayer.js +113 -16
|
@@ -56,7 +56,6 @@ export default class Multiplayer {
|
|
|
56
56
|
};
|
|
57
57
|
this.modeler.addPlayer(newPlayer);
|
|
58
58
|
});
|
|
59
|
-
this.syncLocalNodes(this.clientIO.id);
|
|
60
59
|
}
|
|
61
60
|
});
|
|
62
61
|
|
|
@@ -68,10 +67,9 @@ export default class Multiplayer {
|
|
|
68
67
|
});
|
|
69
68
|
|
|
70
69
|
this.clientIO.on('requestProcess', (payload) => {
|
|
71
|
-
const {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
if (firstClient.id === this.clientIO.id) {
|
|
70
|
+
const { clientId } = payload;
|
|
71
|
+
// Sync the local Nodes
|
|
72
|
+
if (clientId) {
|
|
75
73
|
this.syncLocalNodes(clientId);
|
|
76
74
|
}
|
|
77
75
|
});
|
|
@@ -135,7 +133,15 @@ export default class Multiplayer {
|
|
|
135
133
|
// Update the element in the shared array
|
|
136
134
|
Y.applyUpdate(this.yDoc, new Uint8Array(updateDoc));
|
|
137
135
|
});
|
|
138
|
-
|
|
136
|
+
this.clientIO.on('updateFlows', (payload) => {
|
|
137
|
+
const { updateDoc, updatedNodes } = payload;
|
|
138
|
+
// Update the elements in the process
|
|
139
|
+
updatedNodes.forEach((data) => {
|
|
140
|
+
this.updateFlowClient(data);
|
|
141
|
+
});
|
|
142
|
+
// Update the element in the shared array
|
|
143
|
+
Y.applyUpdate(this.yDoc, new Uint8Array(updateDoc));
|
|
144
|
+
});
|
|
139
145
|
|
|
140
146
|
window.ProcessMaker.EventBus.$on('multiplayer-addNode', ( data ) => {
|
|
141
147
|
this.addNode(data);
|
|
@@ -168,10 +174,15 @@ export default class Multiplayer {
|
|
|
168
174
|
this.updateInspectorProperty(data);
|
|
169
175
|
}
|
|
170
176
|
});
|
|
177
|
+
window.ProcessMaker.EventBus.$on('multiplayer-updateFlows', ( data ) => {
|
|
178
|
+
if (this.modeler.isMultiplayer) {
|
|
179
|
+
this.updateFlows(data);
|
|
180
|
+
}
|
|
181
|
+
});
|
|
171
182
|
}
|
|
172
183
|
/**
|
|
173
184
|
* Sync the modeler nodes with the microservice
|
|
174
|
-
* @param {String} clientId
|
|
185
|
+
* @param {String} clientId
|
|
175
186
|
*/
|
|
176
187
|
syncLocalNodes(clientId){
|
|
177
188
|
// Get the process definition
|
|
@@ -247,7 +258,7 @@ export default class Multiplayer {
|
|
|
247
258
|
return node;
|
|
248
259
|
}
|
|
249
260
|
removeShape(node) {
|
|
250
|
-
this.modeler.removeNodeProcedure(node,
|
|
261
|
+
this.modeler.removeNodeProcedure(node, { removeRelationships: false });
|
|
251
262
|
}
|
|
252
263
|
getRemovedNodes(array1, array2) {
|
|
253
264
|
return array1.filter(object1 => {
|
|
@@ -481,6 +492,10 @@ export default class Multiplayer {
|
|
|
481
492
|
}
|
|
482
493
|
nodeToUpdate.set(data.key, newValue);
|
|
483
494
|
|
|
495
|
+
if (data.extras && Object.keys(data.extras).length > 0) {
|
|
496
|
+
nodeToUpdate.set('extras', data.extras);
|
|
497
|
+
}
|
|
498
|
+
|
|
484
499
|
const stateUpdate = Y.encodeStateAsUpdate(this.yDoc);
|
|
485
500
|
// Send the update to the web socket server
|
|
486
501
|
this.clientIO.emit('updateFromInspector', { updateDoc: stateUpdate, isReplaced: false });
|
|
@@ -503,6 +518,11 @@ export default class Multiplayer {
|
|
|
503
518
|
node = this.getNodeById(data.id);
|
|
504
519
|
|
|
505
520
|
if (node) {
|
|
521
|
+
let extras = {};
|
|
522
|
+
// extras property section
|
|
523
|
+
if (data.extras && Object.keys(data.extras).length > 0) {
|
|
524
|
+
extras = data.extras;
|
|
525
|
+
}
|
|
506
526
|
// loopCharacteristics property section
|
|
507
527
|
if (data.loopCharacteristics) {
|
|
508
528
|
const loopCharacteristics = JSON.parse(data.loopCharacteristics);
|
|
@@ -515,22 +535,99 @@ export default class Multiplayer {
|
|
|
515
535
|
}, node, this.setNodeProp, this.modeler.moddle, this.modeler.definitions, false);
|
|
516
536
|
return;
|
|
517
537
|
}
|
|
518
|
-
if (this.modeler.nodeRegistry[node.type]
|
|
519
|
-
this.modeler.nodeRegistry[node.type].multiplayerInspectorHandler(node, data);
|
|
538
|
+
if (this.modeler.nodeRegistry[node.type]?.multiplayerInspectorHandler) {
|
|
539
|
+
this.modeler.nodeRegistry[node.type].multiplayerInspectorHandler(node, data,this.setNodeProp, this.modeler.moddle);
|
|
520
540
|
return;
|
|
521
541
|
}
|
|
522
542
|
const keys = Object.keys(data).filter((key) => key !== 'id');
|
|
543
|
+
const key = keys[0];
|
|
544
|
+
const value = data[key];
|
|
523
545
|
|
|
524
|
-
if (
|
|
525
|
-
node.definition.get('eventDefinitions')[0].get('condition').body =
|
|
546
|
+
if (key === 'condition') {
|
|
547
|
+
node.definition.get('eventDefinitions')[0].get('condition').body = value;
|
|
526
548
|
}
|
|
527
549
|
|
|
528
|
-
if (
|
|
529
|
-
node.definition.set('gatewayDirection',
|
|
550
|
+
if (key === 'gatewayDirection') {
|
|
551
|
+
node.definition.set('gatewayDirection', value);
|
|
530
552
|
}
|
|
531
553
|
|
|
532
|
-
|
|
533
|
-
|
|
554
|
+
if (key === 'messageRef') {
|
|
555
|
+
let message = this.modeler.definitions.rootElements.find(element => element.id === value);
|
|
556
|
+
|
|
557
|
+
if (!message) {
|
|
558
|
+
message = this.modeler.moddle.create('bpmn:Message', {
|
|
559
|
+
id: value,
|
|
560
|
+
name: extras?.messageName || value,
|
|
561
|
+
});
|
|
562
|
+
this.modeler.definitions.rootElements.push(message);
|
|
563
|
+
}
|
|
534
564
|
|
|
565
|
+
node.definition.get('eventDefinitions')[0].messageRef = message;
|
|
566
|
+
|
|
567
|
+
if (extras?.allowedUsers) {
|
|
568
|
+
node.definition.set('allowedUsers', extras.allowedUsers);
|
|
569
|
+
}
|
|
570
|
+
|
|
571
|
+
if (extras?.allowedGroups) {
|
|
572
|
+
node.definition.set('allowedGroups', extras.allowedGroups);
|
|
573
|
+
}
|
|
574
|
+
}
|
|
575
|
+
|
|
576
|
+
if (!['messageRef', 'gatewayDirection', 'condition', 'allowedUsers', 'allowedGroups'].includes(key)) {
|
|
577
|
+
store.commit('updateNodeProp', { node, key, value });
|
|
578
|
+
}
|
|
579
|
+
}
|
|
580
|
+
}
|
|
581
|
+
/**
|
|
582
|
+
* Update the shared document and emit socket sign to update the flows
|
|
583
|
+
* @param {Object} data
|
|
584
|
+
*/
|
|
585
|
+
updateFlows(data){
|
|
586
|
+
data.forEach((value) => {
|
|
587
|
+
const index = this.getIndex(value.id);
|
|
588
|
+
const nodeToUpdate = this.yArray.get(index);
|
|
589
|
+
this.yDoc.transact(() => {
|
|
590
|
+
for (const key in value) {
|
|
591
|
+
if (Object.hasOwn(value, key)) {
|
|
592
|
+
nodeToUpdate.set(key, value[key]);
|
|
593
|
+
}
|
|
594
|
+
}
|
|
595
|
+
});
|
|
596
|
+
});
|
|
597
|
+
// Encode the state as an update and send it to the server
|
|
598
|
+
const stateUpdate = Y.encodeStateAsUpdate(this.yDoc);
|
|
599
|
+
this.clientIO.emit('updateFlows', { updateDoc: stateUpdate, isReplaced: false });
|
|
600
|
+
}
|
|
601
|
+
/**
|
|
602
|
+
* Update the flow client, All node refs will be updated and forced to remount
|
|
603
|
+
* @param {Object} data
|
|
604
|
+
*/
|
|
605
|
+
updateFlowClient(data) {
|
|
606
|
+
let remount = false;
|
|
607
|
+
const flow = this.getNodeById(data.id);
|
|
608
|
+
if (flow && data.sourceRefId) {
|
|
609
|
+
const sourceRef = this.getNodeById(data.sourceRefId);
|
|
610
|
+
flow.definition.set('sourceRef', sourceRef.definition);
|
|
611
|
+
const outgoing = sourceRef.definition.get('outgoing')
|
|
612
|
+
.find((element) => element.id === flow.definition.id);
|
|
613
|
+
if (!outgoing) {
|
|
614
|
+
sourceRef.definition.get('outgoing').push(...[flow.definition]);
|
|
615
|
+
}
|
|
616
|
+
remount = true;
|
|
617
|
+
}
|
|
618
|
+
if (flow && data.targetRefId) {
|
|
619
|
+
const targetRef = this.getNodeById(data.targetRefId);
|
|
620
|
+
flow.definition.set('targetRef', targetRef.definition);
|
|
621
|
+
const incoming = targetRef.definition.get('incoming')
|
|
622
|
+
.find((element) => element.id === flow.definition.id);
|
|
623
|
+
if (!incoming) {
|
|
624
|
+
targetRef.definition.get('incoming').push(...[flow.definition]);
|
|
625
|
+
}
|
|
626
|
+
remount = true;
|
|
627
|
+
}
|
|
628
|
+
if (remount) {
|
|
629
|
+
// Force Remount Flow
|
|
630
|
+
flow._modelerId += '_replaced';
|
|
631
|
+
}
|
|
535
632
|
}
|
|
536
633
|
}
|