Skip to content

Conversation

@caleeli
Copy link
Contributor

@caleeli caleeli commented Apr 9, 2020

Resolves #1182

This PR includes:

  • Add a crown button for sequence flow to set it as default. This button is enabled only for outgoing flows of gateways (exclusive and inclusive)
  • The default assignment can be removed clicking in the same button
  • Add a marker for the sequence flow assigned as default
  • One gateway can have only one default flow
    image
    image

@lisa-fehr lisa-fehr self-requested a review April 9, 2020 18:06
Comment on lines 92 to 94
this.defaultFlow = this.node.definition.sourceRef
&& this.node.definition.sourceRef.default
&& this.node.definition.sourceRef.default.id === this.node.definition.id;
Copy link
Contributor

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;
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

caleeli and others added 2 commits April 9, 2020 17:43
Co-Authored-By: Lisa Fehr <lisa-fehr@users.noreply.github.com>
Copy link
Contributor

@johnblackspear johnblackspear left a 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 :)

},
},
methods: {
defaultFlow(flow) {
Copy link
Contributor

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 :)

Copy link
Contributor Author

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;
Copy link
Contributor

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?

Copy link
Contributor Author

@caleeli caleeli Apr 13, 2020

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

Comment on lines 72 to 74
get() {
return this.shape.attr('line').sourceMarker['stroke-width'] > 0;
},
Copy link
Contributor

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed

Comment on lines 75 to 82
set(value) {
this.shape.attr('line', {
sourceMarker: {
'stroke-width': value ? 2 : 0,
},
});
},
},
Copy link
Contributor

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.

Copy link
Contributor Author

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();
Copy link
Contributor

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

Comment on lines 165 to 171
const isDefault = this.isDefaultFlow();
this.shape.attr('line', {
sourceMarker: {
'type': 'polyline',
'stroke-width': isDefault ? 2 : 0,
points: '2,6 6,-6',
},
Copy link
Contributor

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.

Copy link
Contributor Author

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
Comment on lines 55 to 58
setDefaultFlow(state, { source, flow }) {
source.set('default', flow);
makeDefinitionPropertyReactive(source, 'default', flow);
},
Copy link
Contributor

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 });)

Copy link
Contributor Author

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

@caleeli caleeli requested a review from johnblackspear April 13, 2020 15:45
@caleeli
Copy link
Contributor Author

caleeli commented Apr 13, 2020

@johnblackspear thanks for your comments, I updated the PR with the fixes

Copy link
Contributor

@johnblackspear johnblackspear left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks David :)

@johnblackspear johnblackspear merged commit 6e2308e into develop Apr 14, 2020
@johnblackspear johnblackspear deleted the feature/1182 branch April 14, 2020 13:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Default geteway flow

5 participants