-
Notifications
You must be signed in to change notification settings - Fork 24
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
Add element templates to replace menu #204
Comments
My current implementation for this consists in adding a replace menu provider that feeds element templates as menu entries (like "ElementTemplatesProvider"). |
WIP: https://github.com/camunda/camunda-bpmn-js/tree/204-add-replace-anything The end goal of replace with templates: In Example: if default task is selected, only templates that have To consider: allow replace with any templates? In the same context that we can replace a default task with a service task, does it make sense to allow replace of a default task with a service task template (replace element + apply template)? |
@smbea A little summary of our chat (weekly) on this:
|
I have an initial draft for this in #207. Before getting into the nitty gritty, I would like to get some feedback on the high level structure/organisation of the feature. Does the location of the new provider added make sense? Should it be structured different? |
I missed that part indeed, will work on it now. I think it makes sense to follow that structure (like |
I was working on allowing to replace back with plain element (service task backed template -> service task). But I am struggling to make sure the option is added back in the original position when working with the first task. This also appears as a bug on the connectors extension, example: After applying a template to a Task, the Task replace option doesn't appear where it should be: |
From discussions with @marstamm when we fixed that issue I remember that we did the least effort thing to build it. I cannot reproduce #204 (comment) on the connectors extension, unfortunately. What the extension implementation does is to try to insert the element in the original position, taking the next and previous elements as an anchor. The element itself cannot be replaced, as it is filtered out at the core. We could decide to improve this in the core by making it pluggable or element template aware. |
[FYI]: this is the commit that changed the unlink entry position: bpmn-io/bpmn-js-connectors-extension@0ec6a11 EDIT: Nico was faster and already added the relevant code in the original comment 😄 |
It works for middle positions like Service Task. I had an issue in trying to apply a template to Task. I tried with this template: {
"$schema": "https://unpkg.com/@camunda/zeebe-element-templates-json-schema/resources/schema.json",
"name": "AppliesToTask",
"id": "com.camunda.example.AwesomeTask",
"appliesTo": [
"bpmn:Task"
],
"properties": [
{
"label": "Are you awesome?",
"type": "Boolean",
"value": true,
"binding": {
"type": "property",
"name": "customProperty"
}
}
]
} |
@smbea In this case the implementation shall hook the task up in front of the next element in the line. It may be broken, then we need to fix it. My suggestion is: Let's incorporate it, build some basic test coverage around it, and investigate + fix all bugs we find in the process. |
I have looked into the implementation and I understand why it happens. But I was testing out edge cases and it seemed like a bug to me so I wanted to be on the same page. Since it works for most cases, I will do that: incorporate like this and then improve on top. Thanks for the insight! |
What should we do?
Add element templates to replace menu options
Why should we do it?
In the context of support replace anything, see bpmn-io/bpmn-js#1627
The text was updated successfully, but these errors were encountered: