-
Notifications
You must be signed in to change notification settings - Fork 50
Implements default gateway flow #1184
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| this.defaultFlow = this.node.definition.sourceRef | ||
| && this.node.definition.sourceRef.default | ||
| && this.node.definition.sourceRef.default.id === this.node.definition.id; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Used 3 times. Could become a method.
isDefaultFlow() {
return this.node.definition.sourceRef
&& this.node.definition.sourceRef.default
&& this.node.definition.sourceRef.default.id === this.node.definition.id;
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
Co-Authored-By: Lisa Fehr <lisa-fehr@users.noreply.github.com>
johnblackspear
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left a few comments :)
src/components/modeler/Modeler.vue
Outdated
| }, | ||
| }, | ||
| methods: { | ||
| defaultFlow(flow) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you rename this to toggleDefaultFlow or similar?
Or at least extract source.default && source.default.id === flow.id into a labeled expression that communicate the toggling intent :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Renamed to "toggleDefaultFlow"
| mixins: [highlightConfig, portsConfig, hideLabelOnDrag], | ||
| created() { | ||
| const flow = this.node.definition.default || null; | ||
| delete this.node.definition.default; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm a little confused why you're deleting and re-adding it - could you give some overview why this needs to be done this way?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is to fix a weird issue when loading a process with a gateway with a defined "default" property, it is not reactive, then the user can not change the default flow. This could caused by way moddle loads this reference property
| get() { | ||
| return this.shape.attr('line').sourceMarker['stroke-width'] > 0; | ||
| }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This getter doesn't seem to be called anywhere - and I think that we may be confused in future about whether we should use the defaultFlow computed property or the isDefaultFlow() method to determine whether a flow is the default. Could this be removed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed
| set(value) { | ||
| this.shape.attr('line', { | ||
| sourceMarker: { | ||
| 'stroke-width': value ? 2 : 0, | ||
| }, | ||
| }); | ||
| }, | ||
| }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you get rid of the getter then this can be its own method, removing the need for the computed property.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Computed removed, changed to a setDefaultMarker method
| if (newNameLabel !== this.nameLabel) { | ||
| this.nameLabel = newNameLabel; | ||
| } | ||
| this.defaultFlow = this.isDefaultFlow(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See comments above regarding the computed property, this could be a call to whatever method handles the stroke at the flow origin
| const isDefault = this.isDefaultFlow(); | ||
| this.shape.attr('line', { | ||
| sourceMarker: { | ||
| 'type': 'polyline', | ||
| 'stroke-width': isDefault ? 2 : 0, | ||
| points: '2,6 6,-6', | ||
| }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could be at the heart of the method that you have instead of the computed property. I'd also suggest inlining the isDefault const.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
src/store.js
Outdated
| setDefaultFlow(state, { source, flow }) { | ||
| source.set('default', flow); | ||
| makeDefinitionPropertyReactive(source, 'default', flow); | ||
| }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't need to be on the store - since it doesn't read or set any state in the store. You can basically inline the source.set in Modeler.vue where you commit (i.e. store.commit('setDefaultFlow', { source, flow });)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed from store, moved to Modeler.vue
|
@johnblackspear thanks for your comments, I updated the PR with the fixes |
johnblackspear
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks David :)
Resolves #1182
This PR includes: