diff --git a/client/src/app/tabs/cloud-bpmn/BpmnEditor.js b/client/src/app/tabs/cloud-bpmn/BpmnEditor.js index 193393b6c7..39066e6728 100644 --- a/client/src/app/tabs/cloud-bpmn/BpmnEditor.js +++ b/client/src/app/tabs/cloud-bpmn/BpmnEditor.js @@ -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(); @@ -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); @@ -202,7 +207,6 @@ export class BpmnEditor extends CachedComponent { propertiesPanel.setLayout(this.props.layout.propertiesPanel); } - } listen(fn) { @@ -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; @@ -849,6 +867,11 @@ export class BpmnEditor extends CachedComponent { elementTemplateChooser: false, keyboard: { bind: false + }, + elementTemplates: { + engines: { + camundaDesktopModeler: version + } } }); diff --git a/resources/element-templates/cloud-samples.json b/resources/element-templates/cloud-samples.json index 0803500694..8292309721 100644 --- a/resources/element-templates/cloud-samples.json +++ b/resources/element-templates/cloud-samples.json @@ -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": [] +} ]