-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(cloud-templates): cast default number and boolean numbers to feel
related to camunda/camunda-modeler#4517
- Loading branch information
Showing
7 changed files
with
155 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 2 additions & 1 deletion
3
src/cloud-element-templates/properties-panel/properties/custom-properties/NumberProperty.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
export const isSpecialFeelProperty = (property) => { | ||
return [ 'optional', 'static' ].includes(property.feel) && [ 'Boolean', 'Number' ].includes(property.type); | ||
}; | ||
|
||
export const toFeelExpression = (value, type) => { | ||
if (typeof value === 'string' && value.startsWith('=')) { | ||
return value; | ||
} | ||
|
||
if (type === 'Boolean') { | ||
value = value === 'false' ? false : value; | ||
return '=' + !!value; | ||
} | ||
|
||
if (typeof value === 'undefined') { | ||
return value; | ||
} | ||
|
||
return '=' + value.toString(); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" id="Definitions_039bbyr" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.4.0"> | ||
<bpmn:process id="Process_1" isExecutable="true"> | ||
<bpmn:serviceTask id="Task_1" /> | ||
<bpmn:intermediateThrowEvent id="Event_1" /> | ||
</bpmn:process> | ||
<bpmndi:BPMNDiagram id="BPMNDiagram_1"> | ||
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Process_1"> | ||
<bpmndi:BPMNShape id="Task_1_di" bpmnElement="Task_1"> | ||
<dc:Bounds x="0" y="0" width="100" height="80" /> | ||
</bpmndi:BPMNShape> | ||
<bpmndi:BPMNShape id="Event_0f371po_di" bpmnElement="Event_1"> | ||
<dc:Bounds x="92" y="172" width="36" height="36" /> | ||
</bpmndi:BPMNShape> | ||
</bpmndi:BPMNPlane> | ||
</bpmndi:BPMNDiagram> | ||
</bpmn:definitions> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
[ | ||
{ | ||
"$schema": "https://unpkg.com/@camunda/zeebe-element-templates-json-schema/resources/schema.json", | ||
"name": "booleanField optional", | ||
"id": "booleanField.feel.optional", | ||
"appliesTo": [ | ||
"bpmn:ServiceTask" | ||
], | ||
"properties": [ | ||
{ | ||
"label": "DefaultStaticBooleanProperty", | ||
"type": "Boolean", | ||
"feel": "optional", | ||
"value": true, | ||
"binding": { | ||
"type": "zeebe:property", | ||
"name": "StaticBooleanProperty" | ||
} | ||
}, | ||
{ | ||
"label": "DefaultOptionalBooleanProperty", | ||
"type": "Boolean", | ||
"feel": "optional", | ||
"value": true, | ||
"binding": { | ||
"type": "zeebe:property", | ||
"name": "OptionalBooleanProperty" | ||
} | ||
} | ||
] | ||
}, | ||
{ | ||
"$schema": "https://unpkg.com/@camunda/zeebe-element-templates-json-schema/resources/schema.json", | ||
"name": "FEEL optional", | ||
"id": "numberField.feel.optional", | ||
"appliesTo": [ | ||
"bpmn:ServiceTask" | ||
], | ||
"properties": [ | ||
{ | ||
"label": "DefaultStaticNumberProperty", | ||
"type": "Number", | ||
"feel": "optional", | ||
"value": 123, | ||
"binding": { | ||
"type": "zeebe:property", | ||
"name": "StaticNumberProperty" | ||
} | ||
}, | ||
{ | ||
"label": "DefaultOptionalNumberProperty", | ||
"type": "Number", | ||
"feel": "optional", | ||
"value": 123, | ||
"binding": { | ||
"type": "zeebe:property", | ||
"name": "OptionalNumberProperty" | ||
} | ||
} | ||
] | ||
} | ||
] |