Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add RPA editor to Camunda Modeler #4807

Draft
wants to merge 4 commits into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions app/lib/zeebe-api/zeebe-api.js
Original file line number Diff line number Diff line change
Expand Up @@ -667,6 +667,12 @@ function getResource(parameters, contents, resourceName) {
} else if (resourceType === RESOURCE_TYPES.DMN) {
resource.decision = contents;
} else if (resourceType === RESOURCE_TYPES.FORM) {
resource.form = contents;
} else {

// Fallback for unknown resource, cf.
// https://github.com/camunda-community-hub/zeebe-client-node-js/blob/7969ce1808c96a87519cb1a3f279287f30637c4b/src/zb/ZBClient.ts#L873-L886

resource.form = contents;
}

Expand Down
2 changes: 1 addition & 1 deletion client/karma.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ module.exports = function(karma) {
use: 'react-svg-loader'
},
{
test: /\.(css|bpmn|cmmn|dmn|less|xml|png|svg|form)$/,
test: /\.(css|bpmn|cmmn|dmn|less|xml|png|svg|form|rpa)$/,
type: 'asset/source'
}
]
Expand Down
4 changes: 4 additions & 0 deletions client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
"@camunda/form-playground": "^0.19.1",
"@camunda/improved-canvas": "^1.7.5",
"@camunda/linting": "^3.30.0",
"@camunda/rpa-integration": "0.0.1-alpha.3",
"@carbon/icons-react": "^11.53.0",
"@codemirror/commands": "^6.6.2",
"@codemirror/lang-json": "^6.0.1",
"@codemirror/lang-xml": "^6.1.0",
Expand Down Expand Up @@ -55,11 +57,13 @@
"formik": "2.0.4",
"ids": "^1.0.0",
"inherits-browser": "^0.1.0",
"install": "^0.13.0",
"min-dash": "^4.1.1",
"min-dom": "^4.2.1",
"mitt": "^3.0.0",
"mixpanel-browser": "^2.55.1",
"modeler-moddle": "^0.2.0",
"npm": "^10.9.2",
"p-defer": "^4.0.1",
"p-series": "^3.0.0",
"react": "^16.14.0",
Expand Down
51 changes: 50 additions & 1 deletion client/src/app/TabsProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@

import replaceIds from '@bpmn-io/replace-ids';

import { Bot } from '@carbon/icons-react';

import { Linter as BpmnLinter } from '@camunda/linting';
import { FormLinter } from '@camunda/form-linting/lib/FormLinter';

Expand All @@ -28,6 +30,7 @@
import cloudDmnDiagram from './tabs/cloud-dmn/diagram.dmn';
import form from './tabs/form/initial.form';
import cloudForm from './tabs/form/initial-cloud.form';
import rpaScript from './tabs/rpa/resources/initial.rpa';

import {
ENGINES
Expand Down Expand Up @@ -56,7 +59,8 @@
DISABLE_PLATFORM,
DISABLE_CMMN,
DISABLE_HTTL_HINT,
DEFAULT_HTTL
DEFAULT_HTTL,
DISABLE_RPA
} from '../util/Flags';

import BPMNIcon from '../../resources/icons/file-types/BPMN.svg';
Expand Down Expand Up @@ -490,6 +494,43 @@
getLinter() {
return formLinter;
}
},
'rpa': {
name: 'RPA',
encoding: 'utf8',
exports: {},
extensions: [ 'rpa' ],
canOpen(file) {
return file.name.endsWith('.rpa');

Check warning on line 504 in client/src/app/TabsProvider.js

View check run for this annotation

Codecov / codecov/patch

client/src/app/TabsProvider.js#L504

Added line #L504 was not covered by tests
},
getComponent(options) {
return import('./tabs/rpa');

Check warning on line 507 in client/src/app/TabsProvider.js

View check run for this annotation

Codecov / codecov/patch

client/src/app/TabsProvider.js#L507

Added line #L507 was not covered by tests
},
getIcon() {
return Bot;
},
getInitialContents() {
return rpaScript;
},
getInitialFilename(suffix) {
return `script_${suffix}.rpa`;
},
getHelpMenu() {
return [];

Check warning on line 519 in client/src/app/TabsProvider.js

View check run for this annotation

Codecov / codecov/patch

client/src/app/TabsProvider.js#L519

Added line #L519 was not covered by tests
},
getNewFileMenu() {
return [ {
label: 'RPA script',
group: 'Camunda 8',
action: 'create-diagram',
options: {
type: 'rpa'
}
} ];
},
getLinter() {
return null;

Check warning on line 532 in client/src/app/TabsProvider.js

View check run for this annotation

Codecov / codecov/patch

client/src/app/TabsProvider.js#L532

Added line #L532 was not covered by tests
}
}
};

Expand Down Expand Up @@ -518,9 +559,12 @@
this.providersByFileType.bpmn = this.providersByFileType.bpmn.filter(p => p !== this.providers['cloud-bpmn']);
this.providersByFileType.dmn = this.providersByFileType.dmn.filter(p => p !== this.providers['cloud-dmn']);
this.providersByFileType.form = this.providersByFileType.form.filter(p => p !== this.providers['cloud-form']);
this.providersByFileType.rpa = [];

delete this.providers['cloud-bpmn'];
delete this.providers['cloud-dmn'];
delete this.providers['cloud-form'];
delete this.providers['rpa'];
}

if (Flags.get(DISABLE_PLATFORM)) {
Expand Down Expand Up @@ -552,6 +596,11 @@
delete this.providers['cloud-form'];
delete this.providersByFileType.form;
}

if (Flags.get(DISABLE_RPA)) {
delete this.providers.rpa;
delete this.providersByFileType.rpa;
}
}

getProviderNames() {
Expand Down
3 changes: 2 additions & 1 deletion client/src/app/__tests__/EmptyTabSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,12 @@ describe('<EmptyTab>', function() {
buttons.forEach(wrapper => wrapper.simulate('click'));

// then
expect(onAction).to.have.callCount(6);
expect(onAction).to.have.callCount(7);
expect(onAction.args).to.eql([
[ 'create-cloud-bpmn-diagram', undefined ],
[ 'create-cloud-dmn-diagram', undefined ],
[ 'create-cloud-form', undefined ],
[ 'create-diagram', { type: 'rpa' } ],
[ 'create-bpmn-diagram', undefined ],
[ 'create-dmn-diagram', undefined ],
[ 'create-form', undefined ]
Expand Down
44 changes: 39 additions & 5 deletions client/src/app/__tests__/TabsProviderSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ import Flags, {
CLOUD_ENGINE_VERSION,
PLATFORM_ENGINE_VERSION,
DISABLE_HTTL_HINT,
DEFAULT_HTTL
DEFAULT_HTTL,
DISABLE_RPA
} from '../../util/Flags';

import {
Expand Down Expand Up @@ -473,6 +474,21 @@ describe('TabsProvider', function() {
// then
expect(contents).to.include(`"executionPlatformVersion": "${ expectedPlatformVersion }"`);
});


it('should replace version placeholder with actual latest version (RPA)', function() {

// given
const tabsProvider = new TabsProvider();

const expectedPlatformVersion = getLatestStablePlatformVersion(ENGINES.CLOUD);

// when
const { file: { contents } } = tabsProvider.createTab('rpa');

// then
expect(contents).to.include(`"executionPlatformVersion": "${ expectedPlatformVersion }"`);
});
});
});

Expand Down Expand Up @@ -556,6 +572,7 @@ describe('TabsProvider', function() {
expect(tabsProvider.createTab('dmn')).to.exist;
expect(tabsProvider.createTab('cloud-dmn')).to.exist;
expect(tabsProvider.createTab('form')).to.exist;
expect(tabsProvider.createTab('rpa')).to.exist;
});


Expand Down Expand Up @@ -870,6 +887,7 @@ describe('TabsProvider', function() {
expect(providers['cmmn']).to.exist;
expect(providers['dmn']).to.exist;
expect(providers['cloud-dmn']).to.exist;
expect(providers['rpa']).to.exist;
expect(providers['empty']).to.exist;
});

Expand All @@ -886,7 +904,7 @@ describe('TabsProvider', function() {
const providerNames = tabsProvider.getProviderNames();

// then
expect(providerNames).to.eql([ 'BPMN', 'DMN', 'FORM' ]);
expect(providerNames).to.eql([ 'BPMN', 'DMN', 'FORM', 'RPA' ]);

});

Expand All @@ -903,7 +921,7 @@ describe('TabsProvider', function() {
const providerNames = tabsProvider.getProviderNames();

// then
expect(providerNames).to.eql([ 'BPMN', 'CMMN', 'DMN', 'FORM' ]);
expect(providerNames).to.eql([ 'BPMN', 'CMMN', 'DMN', 'FORM', 'RPA' ]);

});

Expand All @@ -920,7 +938,7 @@ describe('TabsProvider', function() {
const providerNames = tabsProvider.getProviderNames();

// then
expect(providerNames).to.eql([ 'BPMN', 'DMN', 'FORM' ]);
expect(providerNames).to.eql([ 'BPMN', 'DMN', 'FORM', 'RPA' ]);

});

Expand Down Expand Up @@ -1165,6 +1183,21 @@ describe('TabsProvider', function() {
});


it('should disable RPA', function() {

// given
Flags.init({
[DISABLE_RPA]: true
});

// when
const tabsProvider = new TabsProvider();

// then
expect(tabsProvider.hasProvider('rpa')).to.be.false;
});


it('should disable HTTL hint', async function() {

// given
Expand Down Expand Up @@ -1242,7 +1275,8 @@ describe('TabsProvider', function() {
'dmn',
'cloud-dmn',
'form',
'cloud-form'
'cloud-form',
'rpa'
].forEach((type) => {

it(`should have icon <${type}>`, function() {
Expand Down
Loading
Loading