@processmaker/modeler 1.39.32 → 1.40.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@processmaker/modeler",
3
- "version": "1.39.32",
3
+ "version": "1.40.0",
4
4
  "scripts": {
5
5
  "serve": "vue-cli-service serve --mode development",
6
6
  "test:unit": "vue-cli-service test:unit",
@@ -32,6 +32,14 @@ export default class Multiplayer {
32
32
  // Connect to websocket server
33
33
  this.clientIO = io(window.ProcessMaker.multiplayer.host, { transports: ['websocket', 'polling']});
34
34
 
35
+ if (window.ProcessMaker.multiplayer.enabled) {
36
+ this.webSocketEvents();
37
+ this.multiplayerEvents();
38
+ } else {
39
+ this.clientIO.disconnect();
40
+ }
41
+ }
42
+ webSocketEvents() {
35
43
  this.clientIO.on('connect', () => {
36
44
  // Join the room
37
45
  this.clientIO.emit('joinRoom', {
@@ -133,6 +141,7 @@ export default class Multiplayer {
133
141
  // Update the element in the shared array
134
142
  Y.applyUpdate(this.yDoc, new Uint8Array(updateDoc));
135
143
  });
144
+
136
145
  this.clientIO.on('updateFlows', (payload) => {
137
146
  const { updateDoc, updatedNodes } = payload;
138
147
  // Update the elements in the process
@@ -142,10 +151,13 @@ export default class Multiplayer {
142
151
  // Update the element in the shared array
143
152
  Y.applyUpdate(this.yDoc, new Uint8Array(updateDoc));
144
153
  });
154
+ }
145
155
 
156
+ multiplayerEvents() {
146
157
  window.ProcessMaker.EventBus.$on('multiplayer-addNode', ( data ) => {
147
158
  this.addNode(data);
148
159
  });
160
+
149
161
  window.ProcessMaker.EventBus.$on('multiplayer-removeNode', ( data ) => {
150
162
  this.removeNode(data);
151
163
  });
@@ -169,6 +181,7 @@ export default class Multiplayer {
169
181
  window.ProcessMaker.EventBus.$on('multiplayer-addLanes', ( lanes ) => {
170
182
  this.addLaneNodes(lanes);
171
183
  });
184
+
172
185
  window.ProcessMaker.EventBus.$on('multiplayer-updateInspectorProperty', ( data ) => {
173
186
  if (this.modeler.isMultiplayer) {
174
187
  this.updateInspectorProperty(data);
@@ -36,6 +36,7 @@ window.ProcessMaker = {
36
36
  },
37
37
  multiplayer:{
38
38
  host: process.env.VUE_APP_WEBSOCKET_PROVIDER,
39
+ enabled: /^true$/i.test(process.env.VUE_APP_COLLABORATIVE_ENABLED),
39
40
  },
40
41
  EventBus: new Vue(),
41
42
  apiClient: axios,
@@ -63,5 +64,4 @@ window.ProcessMaker = {
63
64
  fullName: faker.person.fullName(),
64
65
  avatar: null,
65
66
  },
66
-
67
67
  };