Skip to content

Commit

Permalink
feat(cloud): allow configuration of group open state
Browse files Browse the repository at this point in the history
  • Loading branch information
marstamm committed Oct 4, 2023
1 parent 117f64d commit db49d99
Show file tree
Hide file tree
Showing 4 changed files with 93 additions and 10 deletions.
6 changes: 5 additions & 1 deletion src/cloud-element-templates/properties/CustomProperties.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ export function CustomProperties(props) {
element,
id: `ElementTemplates__CustomProperties-${groupId}`,
label: group.label,
openByDefault: group.openByDefault,
properties: properties,
templateId: `${id}-${groupId}`,
tooltip: PropertyTooltip({ tooltip: group.tooltip })
Expand All @@ -98,17 +99,20 @@ function addCustomGroup(groups, props) {
element,
id,
label,
openByDefault,
properties,
templateId,
tooltip
} = props;

const shouldOpen = typeof openByDefault === 'undefined' ? true : openByDefault;

const customPropertiesGroup = {
id,
label,
component: Group,
entries: [],
shouldOpen: true,
shouldOpen,
tooltip
};

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: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: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.16.0" modeler:executionPlatform="Camunda Cloud" modeler:executionPlatformVersion="1.3.0">
<bpmn:process id="Process_0vvlc66" isExecutable="true">
<bpmn:serviceTask id="ServiceTask_1" name="groups" zeebe:modelerTemplate="example.com.grouping">
<bpmn:extensionElements>
Expand All @@ -18,6 +18,19 @@
<bpmn:serviceTask id="ServiceTask_noGroups" name="no groups" zeebe:modelerTemplate="example.com.grouping-noGroups" />
<bpmn:serviceTask id="ServiceTask_nonExisting" name="non existing group" zeebe:modelerTemplate="example.com.grouping-nonExisting" />
<bpmn:serviceTask id="ServiceTask_noEntries" name="no entries" zeebe:modelerTemplate="example.com.grouping-noEntries" />
<bpmn:serviceTask id="ServiceTask_groupsCollapsed" name="groups - collapsed" zeebe:modelerTemplate="example.com.grouping.collapsed">
<bpmn:extensionElements>
<zeebe:taskDefinition type="http" />
<zeebe:taskHeaders>
<zeebe:header key="method" value="get" />
<zeebe:header key="url" />
</zeebe:taskHeaders>
<zeebe:ioMapping>
<zeebe:input source="= invoiceDetails" target="body" />
<zeebe:output source="= body" target="response" />
</zeebe:ioMapping>
</bpmn:extensionElements>
</bpmn:serviceTask>
</bpmn:process>
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Process_0vvlc66">
Expand All @@ -36,6 +49,10 @@
<bpmndi:BPMNShape id="ServiceTask_noEntries_di" bpmnElement="ServiceTask_noEntries">
<dc:Bounds x="270" y="540" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="BPMNShape_0nnayge" bpmnElement="ServiceTask_groupsCollapsed">
<dc:Bounds x="270" y="650" width="100" height="80" />
<bpmndi:BPMNLabel />
</bpmndi:BPMNShape>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</bpmn:definitions>
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,68 @@
}
]
},
{
"$schema": "https://unpkg.com/@camunda/zeebe-element-templates-json-schema/resources/schema.json",
"name": "Grouping - Collapsed",
"id": "example.com.grouping.collapsed",
"appliesTo": [
"bpmn:ServiceTask"
],
"properties": [
{
"type": "String",
"value": "http",
"binding": {
"type": "zeebe:taskDefinition:type"
}
},
{
"label": "REST Endpoint URL",
"group": "collapsed",
"type": "String",
"binding": {
"type": "zeebe:taskHeader",
"key": "url"
}
},
{
"label": "Request Body",
"value": "",
"group": "open",
"type": "String",
"binding": {
"type": "zeebe:input",
"name": "body"
}
},
{
"label": "Result Variable",
"group": "unspecified",
"value": "response",
"type": "String",
"binding": {
"type": "zeebe:output",
"source": "= body"
}
}
],
"groups": [
{
"id": "collapsed",
"label": "Collapsed Group",
"openByDefault": false
},
{
"id": "open",
"label": "Opened Group",
"openByDefault": true
},
{
"id": "unspecified",
"label": "Open State Undefined"
}
]
},
{
"$schema": "https://unpkg.com/@camunda/zeebe-element-templates-json-schema/resources/schema.json",
"name": "no default",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1795,22 +1795,22 @@ describe('provider/cloud-element-templates - CustomProperties', function() {
});


it('should open custom groups', async function() {
it('should open custom groups by default', async function() {

// given
await expectSelected('ServiceTask_1');
await expectSelected('ServiceTask_groupsCollapsed');

// when
var customGroups = [
getGroupById('ElementTemplates__CustomProperties-headers', container),
getGroupById('ElementTemplates__CustomProperties-payload', container),
getGroupById('ElementTemplates__CustomProperties-mapping', container),
getGroupById('ElementTemplates__CustomProperties', container)
[ getGroupById('ElementTemplates__CustomProperties-collapsed', container), false ],
[ getGroupById('ElementTemplates__CustomProperties-open', container), true ],
[ getGroupById('ElementTemplates__CustomProperties-unspecified', container), true ],
[ getGroupById('ElementTemplates__CustomProperties', container),true ]
];

// then
customGroups.forEach(function(group) {
expectGroupOpen(group, true);
customGroups.forEach(function([ group, open ]) {
expectGroupOpen(group, open);
});

});
Expand Down

0 comments on commit db49d99

Please sign in to comment.