Skip to content

Commit

Permalink
feat(cloud-element-templates): add feel guidance
Browse files Browse the repository at this point in the history
closes #606
  • Loading branch information
marstamm committed Mar 17, 2022
1 parent 670ae2d commit 662cac3
Show file tree
Hide file tree
Showing 8 changed files with 318 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,8 @@ function StringProperty(props) {
const {
description,
editable,
label
label,
feel
} = property;

const bpmnFactory = useService('bpmnFactory'),
Expand All @@ -288,6 +289,7 @@ function StringProperty(props) {
getValue: propertyGetter(element, property),
id,
label,
feel,
description: PropertyDescription({ description }),
setValue: propertySetter(bpmnFactory, commandStack, element, property),
validate: propertyValidator(translate, property),
Expand All @@ -305,7 +307,8 @@ function TextAreaProperty(props) {
const {
description,
editable,
label
label,
feel
} = property;

const bpmnFactory = useService('bpmnFactory'),
Expand All @@ -317,6 +320,7 @@ function TextAreaProperty(props) {
element,
id,
label,
feel,
description: PropertyDescription({ description }),
getValue: propertyGetter(element, property),
setValue: propertySetter(bpmnFactory, commandStack, element, property),
Expand Down
17 changes: 17 additions & 0 deletions test/spec/provider/cloud-element-templates/Validator.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,23 @@ describe('provider/cloud-element-templates - Validator', function() {
});


it('should reject feel on invalid type', function() {

// given
const templates = new Validator();

const templateDescriptor = require('./fixtures/error-feel-invalid-type');

// when
templates.addAll(templateDescriptor);

// then
expect(errors(templates)).to.contain('template(id: <invalid>, name: <Invalid>): feel is only supported for "String" and "Text" type');

expect(valid(templates)).to.be.empty;
});


describe('grouping', function() {

it('should accept groups', function() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?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" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:zeebe="http://camunda.org/schema/zeebe/1.0" xmlns:modeler="http://camunda.org/schema/modeler/1.0" id="Definitions_165ah7c" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.13.0-nightly.20220113" modeler:executionPlatform="Camunda Cloud" modeler:executionPlatformVersion="1.3.0">
<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" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:zeebe="http://camunda.org/schema/zeebe/1.0" xmlns:modeler="http://camunda.org/schema/modeler/1.0" id="Definitions_165ah7c" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="5.0.0-alpha.1" modeler:executionPlatform="Camunda Cloud" modeler:executionPlatformVersion="1.3.0">
<bpmn:process id="Process_0vvlc66" isExecutable="true">
<bpmn:startEvent id="StartEvent_1">
<bpmn:outgoing>Flow_0gw5hlt</bpmn:outgoing>
Expand Down Expand Up @@ -53,6 +53,7 @@
</zeebe:ioMapping>
</bpmn:extensionElements>
</bpmn:serviceTask>
<bpmn:serviceTask id="Activity_1k5y89v" name="feel" zeebe:modelerTemplate="io.camunda.connectors.RestConnector-feel" />
</bpmn:process>
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Process_0vvlc66">
Expand Down Expand Up @@ -88,6 +89,9 @@
<bpmndi:BPMNShape id="Activity_042oqko_di" bpmnElement="Activity_042oqko">
<dc:Bounds x="410" y="360" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="BPMNShape_0dk5at4" bpmnElement="Activity_1k5y89v">
<dc:Bounds x="270" y="470" width="100" height="80" />
</bpmndi:BPMNShape>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</bpmn:definitions>
74 changes: 74 additions & 0 deletions test/spec/provider/cloud-element-templates/fixtures/complex.json
Original file line number Diff line number Diff line change
Expand Up @@ -451,5 +451,79 @@
}
}
]
},
{
"$schema": "https://unpkg.com/@camunda/zeebe-element-templates-json-schema/resources/schema.json",
"name": "REST Connector (FEEL enabled)",
"id": "io.camunda.connectors.RestConnector-feel",
"description": "A generic REST service.",
"appliesTo": [
"bpmn:ServiceTask"
],
"properties": [
{
"type": "Hidden",
"value": "http",
"binding": {
"type": "zeebe:taskDefinition:type"
}
},
{
"label": "REST Endpoint URL",
"description": "Specify the url of the REST API to talk to.",
"type": "String",
"binding": {
"type": "zeebe:taskHeader",
"key": "url"
},
"constraints": {
"notEmpty": true,
"pattern": {
"value": "^https?://.*",
"message": "Must be http(s) URL."
}
}
},
{
"label": "REST Method",
"description": "Specify the HTTP method to use.",
"type": "Dropdown",
"value": "get",
"choices": [
{ "name": "GET", "value": "get" },
{ "name": "POST", "value": "post" },
{ "name": "PATCH", "value": "patch" },
{ "name": "DELETE", "value": "delete" }
],
"binding": {
"type": "zeebe:taskHeader",
"key": "method"
}
},
{
"label": "Request Body",
"description": "Data to send to the endpoint.",
"value": "",
"optional": true,
"type": "Text",
"binding": {
"type": "zeebe:input",
"name": "body"
},
"feel": "optional"
},
{
"label": "Result Variable",
"description": "Name of variable to store the response data in.",
"value": "response",
"optional": true,
"type": "String",
"binding": {
"type": "zeebe:output",
"source": "= body"
},
"feel": "required"
}
]
}
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
[
{
"$schema": "https://unpkg.com/@camunda/zeebe-element-templates-json-schema/resources/schema.json",
"name": "Invalid",
"id": "invalid",
"appliesTo": [
"bpmn:ServiceTask"
],
"properties": [
{
"type": "Hidden",
"binding": {
"type": "zeebe:input",
"name": "input1"
},
"feel": "required"
}
]
}
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?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" xmlns:zeebe="http://camunda.org/schema/zeebe/1.0" xmlns:modeler="http://camunda.org/schema/modeler/1.0" id="Definitions_165ah7c" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.13.0-nightly.20220113" modeler:executionPlatform="Camunda Cloud" modeler:executionPlatformVersion="1.3.0">
<bpmn:process id="Process_1" isExecutable="false">
<bpmn:userTask id="stringTask" name="Feel Task" zeebe:modelerTemplate="my.custom.FeelTask.String">
</bpmn:userTask>
<bpmn:userTask id="textTask" name="Text Feel Task" zeebe:modelerTemplate="my.custom.FeelTask.Text">
</bpmn:userTask>
</bpmn:process>
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Process_1">
<bpmndi:BPMNShape id="Task_0zadlfo_di" bpmnElement="stringTask">
<dc:Bounds x="79" y="53" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Task_2_di" bpmnElement="textTask">
<dc:Bounds x="250" y="53" width="100" height="80" />
</bpmndi:BPMNShape>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</bpmn:definitions>
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
[
{
"name": "Custom FeelTask with Strings",
"$schema": "https://unpkg.com/@camunda/zeebe-element-templates-json-schema/resources/schema.json",
"id": "my.custom.FeelTask.String",
"appliesTo": [
"bpmn:ServiceTask"
],
"properties": [
{
"label": "A FEEL expression",
"type": "String",
"feel": "optional",
"editable": true,
"binding": {
"type": "property",
"name": "optionalFeelProp"
}
},
{
"label": "A required FEEL expression",
"type": "String",
"feel": "required",
"editable": true,
"binding": {
"type": "property",
"name": "feelProp"
}
},
{
"label": "A Normal Input",
"type": "String",
"editable": true,
"binding": {
"type": "property",
"name": "myCustomProp"
}
}
],
"entriesVisible": false
},
{
"name": "Custom FeelTask with TextFields",
"$schema": "https://unpkg.com/@camunda/zeebe-element-templates-json-schema/resources/schema.json",
"id": "my.custom.FeelTask.Text",
"appliesTo": [
"bpmn:ServiceTask"
],
"properties": [
{
"label": "A FEEL expression",
"type": "Text",
"feel": "optional",
"editable": true,
"binding": {
"type": "property",
"name": "optionalFeelProp"
}
},
{
"label": "A required FEEL expression",
"type": "Text",
"feel": "required",
"editable": true,
"binding": {
"type": "property",
"name": "feelProp"
}
},
{
"label": "A Normal Input",
"type": "Text",
"editable": true,
"binding": {
"type": "property",
"name": "myCustomProp"
}
}
],
"entriesVisible": false
}
]
Loading

0 comments on commit 662cac3

Please sign in to comment.