-
Notifications
You must be signed in to change notification settings - Fork 3
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
Element Templates Runtime Versions support #132
Conversation
Architecture sketch done in the session with @niku: |
This ensures the tests clearly layout expectations.
@jarekdanielak I updated the PR as per today morning s discussions. All test cases are green, and a few stub cases remain that I'd ask you to implement. |
@nikku filled the tests and fixed small things on the way. I moved |
Turns out we did not add validation for Via 07b580e I made sure that we have both in there, and tests are available for both I find d66afd3 interesting @jarekdanielak. You add this to the manual test bed, but don't add it as an integration test? What would be the expected behavior if only incompatible templates are provided? We don't test cover this (yet). |
It's covered here. Or do you mean engine version zero?
First version (first provided in |
Exactly, cf. f37ae0e. |
2ab8f11 marks only compatible templates as latest. |
I suggest you @jarekdanielak and @lmbateman checkin and fine-tune the UI of the update buttons. You can find my proposal here, which includes a "yellow", "warning" state that signals "you may better do something about this (but don't have to). I'm resistant to show incompatibility as 🔴, cf. this conversation and following: |
@jarekdanielak What do you think of the following: We add Why? Because this allows environments to specify: "compatible with element templates >= xyz", so older Desktop Modeler versions would be able to safely ignore templates that are tagged for incompatible element template run-times. |
* | ||
* @return {Object} - incompatible engines along with their template and local versions | ||
*/ | ||
getIncompatibleEngines(template) { |
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 we expose another public API then we need to test this.
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.
Added with 54da72d
Updated with linting and UI changes discussed in the Slack thread. Since we want compatibility to lint with warning level, I extracted it to a new rule and reorganized linting code to make it easier to navigate and extend (36cf7a5). I consider this now ready for review: @barmac, @philippfromme @lmbateman you can run it and check all the element templates states we now have with:
Please give me your thumbs up or comments on the final design.
@nikku let's discuss tomorrow. |
Summary of discussion with @nikku about adding current version of Providing Let's build it. 👍 In the example below, it's clear that Template Version 2 relies on some new |
7414cbe
to
f8e4026
Compare
@nikku ready for review. ✅ |
feat: support <engines> field in schema validation See https://github.com/camunda/element-templates-json-schema/blob/main/packages/zeebe-element-templates-json-schema/CHANGELOG.md#0210 Related to camunda/element-templates-json-schema#152
Config for current runtime platform and version can now be passed to elementTemplates. If template has information about supported engines, compatibility will be verified. Related to camunda/camunda-modeler#4530 feat: emit <changed> as part of <set> This allows us to safely use <set> to reflect internal changes.
This now looks good to me. Performed another minor cleanup, with minor changes:
Please double-check, consider to squash 6e04e56 and ad8897e, and we're good to merge. |
To fix: the template removal does not update the UI and allows to delete the model o.O Screen.Recording.2024-12-12.at.10.49.23.mov |
Wondering if this is related to the identified dependency of the properties panel on element templates (https://github.com/bpmn-io/hour-of-code/pull/8) |
6e04e56
to
8b9a078
Compare
The problem only happened in the Example test and is now fixed. Good catch. 👍 |
The example test bed is broken now, after the fixes for #132 (comment): We can follow-up with the fix after merging this PR, but my question would be: What is our stable pattern to hook up engine changes (in XML) and const ChangeEnginesModule = {
__init__: [ function(bpmnjs, eventBus, elementTemplates) {
eventBus.on([
'import.done',
'elements.changed'
], function() {
const executionPlatformVersion = bpmnjs.getDefinitions().get('executionPlatformVersion');
elementTemplates.setEngines({
camunda: executionPlatformVersion
});
});
} ]
}; |
Fixed "everything" at last, via 7f81766 and ensure the integration pattern works. |
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 works as expected, let's go forth and merge and release.
test: simplify example testbed
Can be used to test an element template for compatibility, returning current and expected engine versions.
Clean up linting and add a new rule for element template compatibility.
`elementTemplates` engine is by default set to `bpmn-js-elements-template` version. This allows templates authors to indicate compatibility with specific library versions.
7f81766
to
0f33d20
Compare
Related to camunda/camunda-modeler#4530
Related to https://github.com/camunda/product-hub/issues/2368 (epic)
Proposed Changes
The goal of this pull request is to ensure that served element templates are compatible (best to our knowledge) with current runtime environment.
Modelers will be able to pass their
engines
configuration toelementTemplates
. If templates have information about compatible engines in their schema (introduced with camunda/element-templates-json-schema#146), compatibility will be verified and relevant templates will be provided.If runtime environment changes dynamically, it can be adjusted with
elementTemplates#setEngines
API.Bunch of enhancements to support element templates runtime versions:
engines
configuration to ElementTemplates module.engines
config.Test locally
npx @bpmn-io/sr bpmn-io/bpmn-js-element-templates#engines
Checklist
To ensure you provided everything we need to look at your PR:
@bpmn-io/sr
toolCloses {LINK_TO_ISSUE}
orRelated to {LINK_TO_ISSUE}