Skip to content

Commit

Permalink
fix CR notes
Browse files Browse the repository at this point in the history
  • Loading branch information
Rodrigo Quelca committed Oct 17, 2023
1 parent f5092ea commit d38c44c
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 24 deletions.
13 changes: 4 additions & 9 deletions src/components/modeler/Modeler.vue
Original file line number Diff line number Diff line change
Expand Up @@ -531,12 +531,7 @@ export default {
},
getElementByNodeId(id) {
const cells = this.paper.model.getCells();
for (const cell of cells) {
if (cell.component && cell.component.id === id) {
return cell;
}
}
return null; // Return null if no matching element is found
return cells.find((cell) => cell.component && cell.component.id === id);
},
async close() {
this.$emit('close');
Expand Down Expand Up @@ -1112,9 +1107,9 @@ export default {
'processmaker-modeler-sequence-flow',
'processmaker-modeler-association',
'processmaker-modeler-data-input-association',
'processmaker-modeler-data-output-association',
'processmaker-modeler-data-input-association',
];
const flowTypes =[
const flowTypes = [
'processmaker-modeler-sequence-flow',
'processmaker-modeler-message-flow',
];
Expand All @@ -1132,7 +1127,7 @@ export default {
id: node.definition.id,
isAddingLaneAbove: true,
};
if (node.pool && node.pool.component) {
if (node?.pool?.component) {
defaultData['poolId'] = node.pool.component.id;
}
window.ProcessMaker.EventBus.$emit('multiplayer-addNode', defaultData);
Expand Down
16 changes: 9 additions & 7 deletions src/components/modeler/Selection.vue
Original file line number Diff line number Diff line change
Expand Up @@ -578,13 +578,12 @@ export default {
this.overPoolStopDrag();
this.updateSelectionBox();
if (this.isMultiplayer) {
const changed = [];
this.getProperties(this.selected, changed);
window.ProcessMaker.EventBus.$emit('multiplayer-updateNodes', changed);
window.ProcessMaker.EventBus.$emit('multiplayer-updateNodes', this.getProperties(this.selected));
}
},
getProperties(shapes, changed) {
getProperties(shapes) {
let changed = [];
const shapesToNotTranslate = [
'PoolLane',
'standard.Link',
Expand All @@ -595,7 +594,7 @@ export default {
.forEach(shape => {
if (shape.model.get('type') === 'processmaker.modeler.bpmn.pool') {
const children = shape.model.component.getElementsUnderArea(shape.model, this.graph);
this.getContainerProperties(children, changed);
changed = [...changed, ...this.getContainerProperties(children, changed)];
} else {
const { node } = shape.model.component;
const defaultData = {
Expand All @@ -607,14 +606,16 @@ export default {
width: shape.model.get('size').width,
},
};
if (node.pool && node.pool.component) {
if (node?.pool?.component) {
defaultData['poolId'] = node.pool.component.id;
}
changed.push(defaultData);
}
});
return changed;
},
getContainerProperties(children, changed) {
getContainerProperties(children) {
const changed = [];
children.forEach(model => {
changed.push({
id: model.component.node.definition.id,
Expand All @@ -626,6 +627,7 @@ export default {
},
});
});
return changed;
},
/**
* Selector will update the waypoints of the related flows
Expand Down
8 changes: 4 additions & 4 deletions src/components/nodes/pool/pool.vue
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ export default {
this.shape.unembed(element);
toPool.component.addToPool(element);
},
async addLane(emitMultiplayer = true) {
async addLane(emitMultiplayer = true) {
/* A Lane element must be contained in a LaneSet element.
* Get the current laneSet element or create a new one. */
Expand All @@ -201,8 +201,8 @@ export default {
lanes.push(this.pushNewLane());
await Promise.all(lanes).
then((val) => {
await Promise.all(lanes)
.then((val) => {
if (emitMultiplayer && this.$parent.isMultiplayer) {
window.ProcessMaker.EventBus.$emit('multiplayer-addLanes', val);
}
Expand All @@ -217,7 +217,7 @@ export default {
const laneSet = this.moddle.create('bpmn:LaneSet');
this.laneSet = laneSet;
const generator = this.nodeIdGenerator;
const [laneSetId] = id ? id : generator.generate();
const [laneSetId] = id ?? generator.generate();
this.laneSet.set('id', laneSetId);
this.containingProcess.get('laneSets').push(laneSet);
},
Expand Down
4 changes: 2 additions & 2 deletions src/components/nodes/sequenceFlow/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ export default {
],
async multiplayerClient(modeler, data) {
const { paper } = modeler;
const sourceElem = modeler.getElementByNodeId( data.sourceRefId);
const targetElem = modeler.getElementByNodeId( data.targetRefId);
const sourceElem = modeler.getElementByNodeId(data.sourceRefId);
const targetElem = modeler.getElementByNodeId(data.targetRefId);
if (sourceElem && targetElem) {
const flow = new SequenceFlow(modeler.nodeRegistry, modeler.moddle, paper);
const actualFlow = flow.makeFlowNode(sourceElem, targetElem, data.waypoint);
Expand Down
4 changes: 2 additions & 2 deletions src/multiplayer/multiplayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ export default class Multiplayer {
break ;
}
}
return found ? index: -1;
return found ? index : -1;
}
getNodeById(nodeId) {
const node = this.modeler.nodes.find((element) => element.definition && element.definition.id === nodeId);
Expand Down Expand Up @@ -312,7 +312,7 @@ export default class Multiplayer {
width: lane.diagram.bounds.width,
height: lane.diagram.bounds.height,
poolId: lane.pool.component.node.definition.id,
laneSetId: lane.pool.component.laneSet.id,
laneSetId: lane.pool.component.laneSet.id,
};
return data;
}
Expand Down

0 comments on commit d38c44c

Please sign in to comment.