Skip to content

Commit

Permalink
feat(camunda-cloud): support Zeebe 1.1
Browse files Browse the repository at this point in the history
Adds support for:

* bpmn:SendTask
* bpmn:ScriptTask
* bpmn:BusinessRuleTask

Related to camunda/camunda-modeler#2296
Related to camunda/camunda-modeler#2297
Related to camunda/camunda-modeler#2298
  • Loading branch information
barmac authored and nikku committed Jun 16, 2021
1 parent aba1b4e commit ddfde49
Show file tree
Hide file tree
Showing 10 changed files with 420 additions and 113 deletions.
3 changes: 3 additions & 0 deletions lib/camunda-cloud/features/popup-menu/ReplaceOptions.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
export const REPLACE_OPTIONS = [
'replace-with-service-task',
'replace-with-script-task',
'replace-with-send-task',
'replace-with-rule-task',
'replace-with-message-intermediate-catch',
'replace-with-timer-intermediate-catch',
'replace-with-none-start',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export default function(group, element, bpmnFactory, translate) {

function canHaveHeaders(element) {
return isAny(element, [
'bpmn:ServiceTask',
'zeebe:ZeebeServiceTask',
'bpmn:UserTask'
]);
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import extensionElementsHelper from 'bpmn-js-properties-panel/lib/helper/Extensi

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

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

Expand Down Expand Up @@ -76,7 +76,7 @@ export default function(group, element, bpmnFactory, translate) {

if (!type) {
validation = {
type: translate('ServiceTask must have a type')
type: translate('Must have a type')
};
}

Expand Down
4 changes: 2 additions & 2 deletions lib/camunda-cloud/helper/InputOutputHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ export function isInputOutputSupported(element) {
*/
export function areInputParametersSupported(element) {
return isAny(element, [
'bpmn:ServiceTask',
'zeebe:ZeebeServiceTask',
'bpmn:UserTask',
'bpmn:SubProcess',
'bpmn:CallActivity'
Expand All @@ -118,7 +118,7 @@ export function areInputParametersSupported(element) {
*/
export function areOutputParametersSupported(element) {
return isAny(element, [
'bpmn:ServiceTask',
'zeebe:ZeebeServiceTask',
'bpmn:UserTask',
'bpmn:SubProcess',
'bpmn:ReceiveTask',
Expand Down
271 changes: 172 additions & 99 deletions test/camunda-cloud/features/popup-menu/ReplaceMenuProviderSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,26 +152,23 @@ describe('camunda-cloud/features - PopupMenu', function() {
// given
const task = elementRegistry.get('Task_1');

// when
openPopup(task);

const messageTaskEntry = queryEntry(popupMenu, 'replace-with-receive-task'),
serviceTaskEntry = queryEntry(popupMenu, 'replace-with-service-task'),
callActivityEntry = queryEntry(popupMenu, 'replace-with-call-activity'),
collapsedSubProcessEntry = queryEntry(popupMenu, 'replace-with-collapsed-subprocess'),
expandedSubProcessEntry = queryEntry(popupMenu, 'replace-with-expanded-subprocess'),
sequentialMultiInstanceEntry = queryEntry(popupMenu, 'toggle-parallel-mi'),
parallelMultiInstanceEntry = queryEntry(popupMenu, 'toggle-sequential-mi'),
userTaskEntry = queryEntry(popupMenu, 'replace-with-user-task');

// then
expect(messageTaskEntry).to.exist;
expect(serviceTaskEntry).to.exist;
expect(callActivityEntry).to.exist;
expect(collapsedSubProcessEntry).to.exist;
expect(expandedSubProcessEntry).to.exist;
expect(sequentialMultiInstanceEntry).to.exist;
expect(parallelMultiInstanceEntry).to.exist;
expect(userTaskEntry).to.exist;
expectEntries(popupMenu, [
'replace-with-receive-task',
'replace-with-service-task',
'replace-with-call-activity',
'replace-with-collapsed-subprocess',
'replace-with-expanded-subprocess',
'toggle-parallel-mi',
'toggle-sequential-mi',
'replace-with-user-task',
'replace-with-script-task',
'replace-with-send-task',
'replace-with-rule-task'
]);
}));


Expand All @@ -183,24 +180,20 @@ describe('camunda-cloud/features - PopupMenu', function() {

openPopup(messageTask);

const taskEntry = queryEntry(popupMenu, 'replace-with-task'),
serviceTaskEntry = queryEntry(popupMenu, 'replace-with-service-task'),
callActivityEntry = queryEntry(popupMenu, 'replace-with-call-activity'),
collapsedSubProcessEntry = queryEntry(popupMenu, 'replace-with-collapsed-subprocess'),
expandedSubProcessEntry = queryEntry(popupMenu, 'replace-with-expanded-subprocess'),
sequentialMultiInstanceEntry = queryEntry(popupMenu, 'toggle-parallel-mi'),
parallelMultiInstanceEntry = queryEntry(popupMenu, 'toggle-sequential-mi'),
userTaskEntry = queryEntry(popupMenu, 'replace-with-user-task');

// then
expect(taskEntry).to.exist;
expect(serviceTaskEntry).to.exist;
expect(callActivityEntry).to.exist;
expect(collapsedSubProcessEntry).to.exist;
expect(expandedSubProcessEntry).to.exist;
expect(sequentialMultiInstanceEntry).to.exist;
expect(parallelMultiInstanceEntry).to.exist;
expect(userTaskEntry).to.exist;
expectEntries(popupMenu, [
'replace-with-task',
'replace-with-service-task',
'replace-with-call-activity',
'replace-with-collapsed-subprocess',
'replace-with-expanded-subprocess',
'toggle-parallel-mi',
'toggle-sequential-mi',
'replace-with-user-task',
'replace-with-script-task',
'replace-with-send-task',
'replace-with-rule-task'
]);
}));


Expand All @@ -210,26 +203,101 @@ describe('camunda-cloud/features - PopupMenu', function() {
// given
const serviceTask = elementRegistry.get('ServiceTask_1');

// when
openPopup(serviceTask);

const taskEntry = queryEntry(popupMenu, 'replace-with-task'),
receiveTaskEntry = queryEntry(popupMenu, 'replace-with-receive-task'),
callActivityEntry = queryEntry(popupMenu, 'replace-with-call-activity'),
collapsedSubProcessEntry = queryEntry(popupMenu, 'replace-with-collapsed-subprocess'),
expandedSubProcessEntry = queryEntry(popupMenu, 'replace-with-expanded-subprocess'),
sequentialMultiInstanceEntry = queryEntry(popupMenu, 'toggle-parallel-mi'),
parallelMultiInstanceEntry = queryEntry(popupMenu, 'toggle-sequential-mi'),
userTaskEntry = queryEntry(popupMenu, 'replace-with-user-task');
// then
expectEntries(popupMenu, [
'replace-with-task',
'replace-with-receive-task',
'replace-with-call-activity',
'replace-with-collapsed-subprocess',
'replace-with-expanded-subprocess',
'toggle-parallel-mi',
'toggle-sequential-mi',
'replace-with-user-task',
'replace-with-script-task',
'replace-with-send-task',
'replace-with-rule-task'
]);
}));


it('should contain options for SendTask', inject(function(
popupMenu, elementRegistry) {

// given
const serviceTask = elementRegistry.get('SendTask_1');

// when
openPopup(serviceTask);

// then
expect(taskEntry).to.exist;
expect(receiveTaskEntry).to.exist;
expect(callActivityEntry).to.exist;
expect(collapsedSubProcessEntry).to.exist;
expect(expandedSubProcessEntry).to.exist;
expect(sequentialMultiInstanceEntry).to.exist;
expect(parallelMultiInstanceEntry).to.exist;
expect(userTaskEntry).to.exist;
expectEntries(popupMenu, [
'replace-with-task',
'replace-with-receive-task',
'replace-with-service-task',
'replace-with-call-activity',
'replace-with-collapsed-subprocess',
'replace-with-expanded-subprocess',
'toggle-parallel-mi',
'toggle-sequential-mi',
'replace-with-user-task',
'replace-with-script-task',
'replace-with-rule-task'
]);
}));


it('should contain options for ScriptTask', inject(function(
popupMenu, elementRegistry) {

// given
const serviceTask = elementRegistry.get('ScriptTask_1');

// when
openPopup(serviceTask);

// then
expectEntries(popupMenu, [
'replace-with-task',
'replace-with-receive-task',
'replace-with-service-task',
'replace-with-call-activity',
'replace-with-collapsed-subprocess',
'replace-with-expanded-subprocess',
'toggle-parallel-mi',
'toggle-sequential-mi',
'replace-with-user-task',
'replace-with-send-task',
'replace-with-rule-task'
]);
}));


it('should contain options for BusinessRuleTask', inject(function(
popupMenu, elementRegistry) {

// given
const serviceTask = elementRegistry.get('BusinessRuleTask_1');

// when
openPopup(serviceTask);

// then
expectEntries(popupMenu, [
'replace-with-task',
'replace-with-receive-task',
'replace-with-service-task',
'replace-with-call-activity',
'replace-with-collapsed-subprocess',
'replace-with-expanded-subprocess',
'toggle-parallel-mi',
'toggle-sequential-mi',
'replace-with-user-task',
'replace-with-script-task',
'replace-with-send-task'
]);
}));


Expand All @@ -239,24 +307,22 @@ describe('camunda-cloud/features - PopupMenu', function() {
// given
const callActivity = elementRegistry.get('CallActivity_1');

// when
openPopup(callActivity);

const taskEntry = queryEntry(popupMenu, 'replace-with-task'),
receiveTaskEntry = queryEntry(popupMenu, 'replace-with-receive-task'),
serviceTaskEntry = queryEntry(popupMenu, 'replace-with-service-task'),
collapsedSubProcessEntry = queryEntry(popupMenu, 'replace-with-collapsed-subprocess'),
expandedSubProcessEntry = queryEntry(popupMenu, 'replace-with-expanded-subprocess'),
sequentialMultiInstanceEntry = queryEntry(popupMenu, 'toggle-parallel-mi'),
parallelMultiInstanceEntry = queryEntry(popupMenu, 'toggle-sequential-mi');

// then
expect(taskEntry).to.exist;
expect(receiveTaskEntry).to.exist;
expect(serviceTaskEntry).to.exist;
expect(collapsedSubProcessEntry).to.exist;
expect(expandedSubProcessEntry).to.exist;
expect(sequentialMultiInstanceEntry).to.exist;
expect(parallelMultiInstanceEntry).to.exist;
expectEntries(popupMenu, [
'replace-with-task',
'replace-with-receive-task',
'replace-with-service-task',
'replace-with-collapsed-subprocess',
'replace-with-expanded-subprocess',
'toggle-parallel-mi',
'toggle-sequential-mi',
'replace-with-script-task',
'replace-with-send-task',
'replace-with-rule-task'
]);
}));


Expand All @@ -266,26 +332,23 @@ describe('camunda-cloud/features - PopupMenu', function() {
// given
const userTask = elementRegistry.get('UserTask_1');

// when
openPopup(userTask);

const taskEntry = queryEntry(popupMenu, 'replace-with-task'),
serviceTaskEntry = queryEntry(popupMenu, 'replace-with-service-task'),
receiveTaskEntry = queryEntry(popupMenu, 'replace-with-receive-task'),
callActivityEntry = queryEntry(popupMenu, 'replace-with-call-activity'),
collapsedSubProcessEntry = queryEntry(popupMenu, 'replace-with-collapsed-subprocess'),
expandedSubProcessEntry = queryEntry(popupMenu, 'replace-with-expanded-subprocess'),
sequentialMultiInstanceEntry = queryEntry(popupMenu, 'toggle-parallel-mi'),
parallelMultiInstanceEntry = queryEntry(popupMenu, 'toggle-sequential-mi');

// then
expect(taskEntry).to.exist;
expect(serviceTaskEntry).to.exist;
expect(receiveTaskEntry).to.exist;
expect(callActivityEntry).to.exist;
expect(collapsedSubProcessEntry).to.exist;
expect(expandedSubProcessEntry).to.exist;
expect(sequentialMultiInstanceEntry).to.exist;
expect(parallelMultiInstanceEntry).to.exist;
expectEntries(popupMenu, [
'replace-with-task',
'replace-with-service-task',
'replace-with-receive-task',
'replace-with-call-activity',
'replace-with-collapsed-subprocess',
'replace-with-expanded-subprocess',
'toggle-parallel-mi',
'toggle-sequential-mi',
'replace-with-script-task',
'replace-with-send-task',
'replace-with-rule-task'
]);
}));

});
Expand Down Expand Up @@ -354,26 +417,23 @@ describe('camunda-cloud/features - PopupMenu', function() {
// given
const subProcess = elementRegistry.get('SubProcess_1');

// when
openPopup(subProcess);

const taskEntry = queryEntry(popupMenu, 'replace-with-task'),
receiveTaskEntry = queryEntry(popupMenu, 'replace-with-receive-task'),
serviceTaskEntry = queryEntry(popupMenu, 'replace-with-service-task'),
callActivityEntry = queryEntry(popupMenu, 'replace-with-call-activity'),
expandedSubProcessEntry = queryEntry(popupMenu, 'replace-with-expanded-subprocess'),
sequentialMultiInstanceEntry = queryEntry(popupMenu, 'toggle-parallel-mi'),
parallelMultiInstanceEntry = queryEntry(popupMenu, 'toggle-sequential-mi'),
userTaskEntry = queryEntry(popupMenu, 'replace-with-user-task');

// then
expect(taskEntry).to.exist;
expect(receiveTaskEntry).to.exist;
expect(serviceTaskEntry).to.exist;
expect(callActivityEntry).to.exist;
expect(expandedSubProcessEntry).to.exist;
expect(sequentialMultiInstanceEntry).to.exist;
expect(parallelMultiInstanceEntry).to.exist;
expect(userTaskEntry).to.exist;
expectEntries(popupMenu, [
'replace-with-task',
'replace-with-receive-task',
'replace-with-service-task',
'replace-with-call-activity',
'replace-with-expanded-subprocess',
'toggle-parallel-mi',
'toggle-sequential-mi',
'replace-with-user-task',
'replace-with-script-task',
'replace-with-send-task',
'replace-with-rule-task'
]);
}));


Expand Down Expand Up @@ -483,6 +543,19 @@ describe('camunda-cloud/features - PopupMenu', function() {

// helper //////////

/**
* Query popup menu to check if queries exist.
*
* @param {string[]} entries - ids of the expected entries
*/
function expectEntries(popupMenu, entries) {
for (const entryId of entries) {
const entry = queryEntry(popupMenu, entryId);

expect(entry, `Entry ${entryId} not found`).to.exist;
}
}

const queryEntry = (popupMenu, id) => {
return domQuery('[data-id="' + id + '"]', popupMenu._current.container);
};
Expand Down
Loading

0 comments on commit ddfde49

Please sign in to comment.