Skip to content

Commit

Permalink
feat: integrate element template runtime versions
Browse files Browse the repository at this point in the history
Closes #4530
  • Loading branch information
jarekdanielak authored and nikku committed Dec 13, 2024
1 parent 9ec9ec2 commit e6b9465
Show file tree
Hide file tree
Showing 2 changed files with 69 additions and 3 deletions.
27 changes: 25 additions & 2 deletions client/src/app/tabs/cloud-bpmn/BpmnEditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ export class BpmnEditor extends CachedComponent {
this.ref = React.createRef();
this.propertiesPanelRef = React.createRef();

this.handleEngineProfileChangeDebounced = debounce(this.handleEngineProfileChange);

this.engineProfile = new EngineProfileHelper({
get: () => {
const modeler = this.getModeler();
Expand Down Expand Up @@ -109,7 +111,10 @@ export class BpmnEditor extends CachedComponent {
});
},
getCached: () => this.getCached(),
setCached: (state) => this.setCached(state)
setCached: (state) => {
this.handleEngineProfileChangeDebounced(state);
this.setCached(state);
}
});

this.handleResize = debounce(this.handleResize);
Expand Down Expand Up @@ -202,7 +207,6 @@ export class BpmnEditor extends CachedComponent {

propertiesPanel.setLayout(this.props.layout.propertiesPanel);
}

}

listen(fn) {
Expand Down Expand Up @@ -245,6 +249,20 @@ export class BpmnEditor extends CachedComponent {
});
}

handleEngineProfileChange = ({ engineProfile }) => {
const { executionPlatformVersion: version } = engineProfile;
if (!version) return;

const elementTemplates = this.getModeler().get('elementTemplates');

const engines = {
...elementTemplates.getEngines(),
camunda: version
};

elementTemplates.setEngines(engines);
};

async loadTemplates() {
const { getConfig } = this.props;

Expand Down Expand Up @@ -849,6 +867,11 @@ export class BpmnEditor extends CachedComponent {
elementTemplateChooser: false,
keyboard: {
bind: false
},
elementTemplates: {
engines: {
camundaDesktopModeler: version
}
}
});

Expand Down
45 changes: 44 additions & 1 deletion resources/element-templates/cloud-samples.json
Original file line number Diff line number Diff line change
Expand Up @@ -725,5 +725,48 @@
}
}
]
}
},
{
"$schema": "https://unpkg.com/@camunda/zeebe-element-templates-json-schema/resources/schema.json",
"name": "Compatibility test",
"id": "io.camunda.examples.compatibility",
"version": 1,
"description": "This version is compatible with all Camunda 8 versions.",
"engines": {
"camunda": "^8.0"
},
"appliesTo": [
"bpmn:Task"
],
"properties": []
},
{
"$schema": "https://unpkg.com/@camunda/zeebe-element-templates-json-schema/resources/schema.json",
"name": "Compatibility test",
"id": "io.camunda.examples.compatibility",
"version": 2,
"description": "This version is compatible with Camunda 8.5 and above.",
"engines": {
"camunda": ">=8.5"
},
"appliesTo": [
"bpmn:Task"
],
"properties": []
},
{
"$schema": "https://unpkg.com/@camunda/zeebe-element-templates-json-schema/resources/schema.json",
"name": "Compatibility test - incompatible, no upgrade",
"id": "io.camunda.examples.incompatible",
"version": 2,
"description": "This version is not compatible with Desktop Modeler and Camunda 8",
"engines": {
"camunda": "^9",
"camundaDesktopModeler": "0"
},
"appliesTo": [
"bpmn:Task"
],
"properties": []
}
]

0 comments on commit e6b9465

Please sign in to comment.