Skip to content

Commit

Permalink
feat(camunda-cloud): provide headers & input-output tabs for user tasks
Browse files Browse the repository at this point in the history
  • Loading branch information
Niklas Kiefer committed Feb 22, 2021
1 parent f0deb7a commit 537fe44
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ import elementHelper from 'bpmn-js-properties-panel/lib/helper/ElementHelper';
import cmdHelper from 'bpmn-js-properties-panel/lib/helper/CmdHelper';

import {
is
} from 'bpmn-js/lib/util/ModelUtil';
isAny
} from 'bpmn-js/lib/features/modeling/util/ModelingUtil';

export default function(group, element, bpmnFactory, translate) {

if (!is(element, 'bpmn:ServiceTask')) {
if (!canHaveHeaders(element)) {
return;
}

Expand Down Expand Up @@ -38,3 +38,13 @@ export default function(group, element, bpmnFactory, translate) {
}

}


// helpers ////////////////

function canHaveHeaders(element) {
return isAny(element, [
'bpmn:ServiceTask',
'bpmn:UserTask'
]);
}
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,6 @@ export default function(element, bpmnFactory, translate, options) {

const bo = getBusinessObject(element);

if (!is(element, 'bpmn:ServiceTask')) {
return;
}


assign(options, {
addLabel: translate('Add Header'),
Expand Down
2 changes: 2 additions & 0 deletions lib/camunda-cloud/helper/InputOutputHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ export function isInputOutputSupported(element) {
export function areInputParametersSupported(element) {
return isAny(element, [
'bpmn:ServiceTask',
'bpmn:UserTask',
'bpmn:SubProcess',
'bpmn:CallActivity'
]);
Expand All @@ -118,6 +119,7 @@ export function areInputParametersSupported(element) {
export function areOutputParametersSupported(element) {
return isAny(element, [
'bpmn:ServiceTask',
'bpmn:UserTask',
'bpmn:SubProcess',
'bpmn:ReceiveTask',
'bpmn:CallActivity',
Expand Down
26 changes: 26 additions & 0 deletions test/camunda-cloud/helper/InputOutputHelperSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,19 @@ describe('camunda-cloud/helper - input output helper', function() {
});


it('should support UserTask', function() {

// given
const userTask = createElement('bpmn:UserTask');

// when
const supported = areInputParametersSupported(userTask);

// then
expect(supported).to.be.true;
});


it('should NOT support ReceiveTask', function() {

// given
Expand Down Expand Up @@ -228,6 +241,19 @@ describe('camunda-cloud/helper - input output helper', function() {
expect(!!supported).to.be.true;
});


it('should support UserTask', function() {

// given
const userTask = createElement('bpmn:UserTask');

// when
const supported = areOutputParametersSupported(userTask);

// then
expect(supported).to.be.true;
});

});

});

0 comments on commit 537fe44

Please sign in to comment.