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

Integrate new context pad #4321

Merged
merged 2 commits into from
Jun 3, 2024
Merged
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
1 change: 1 addition & 0 deletions client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"@camunda/execution-platform": "^0.3.2",
"@camunda/form-linting": "^0.16.0",
"@camunda/form-playground": "^0.14.0",
"@camunda/improved-canvas": "^1.7.0",
"@camunda/linting": "^3.20.0",
"@codemirror/commands": "^6.1.3",
"@codemirror/lang-json": "^6.0.1",
Expand Down
9 changes: 9 additions & 0 deletions client/src/app/tabs/bpmn/BpmnEditor.less
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,15 @@
--bjs-font-family: var(--font-family);
}

/* @camunda/improved-canvas restets */
.djs-container.bio-improved-canvas {
background-color: var(--color-white);
}

.bio-improved-canvas defs pattern circle {
fill: #ccc !important;
}

.djs-minimap {

.toggle {
Expand Down
39 changes: 39 additions & 0 deletions client/src/app/tabs/bpmn/__tests__/BpmnEditorSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ import {

import { SlotFillRoot } from '../../../slot-fill';

import Flags, { ENABLE_NEW_CONTEXT_PAD } from '../../../../util/Flags';

const { spy } = sinon;


Expand Down Expand Up @@ -2091,6 +2093,43 @@ describe('<BpmnEditor>', function() {

});


describe('new context pad', function() {

beforeEach(function() {
Flags.reset();
});


it('should disable new context pad by default', async function() {

// when
const { instance } = await renderEditor(diagramXML);

// then
expect(instance).to.exist;
expect(instance.getModeler().additionalModules).to.exist;
expect(instance.getModeler().additionalModules).to.have.length(0);
});


it('should enable new context pad if enabled through flag', async function() {

// when
Flags.init({
[ ENABLE_NEW_CONTEXT_PAD ]: true
});

const { instance } = await renderEditor(diagramXML);

// then
expect(instance).to.exist;
expect(instance.getModeler().additionalModules).to.exist;
expect(instance.getModeler().additionalModules).to.have.length(1);
});

});

});


Expand Down
32 changes: 24 additions & 8 deletions client/src/app/tabs/bpmn/modeler/BpmnModeler.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ import handToolOnSpaceModule from './features/hand-tool-on-space';
import propertiesPanelKeyboardBindingsModule from './features/properties-panel-keyboard-bindings';
import lintingAnnotationsModule from '@camunda/linting/modeler';

import Flags, { DISABLE_ADJUST_ORIGIN } from '../../../../util/Flags';

import { BpmnJSTracking as bpmnJSTracking } from 'bpmn-js-tracking';

import contextPadTracking from 'bpmn-js-tracking/lib/features/context-pad';
Expand All @@ -28,22 +26,40 @@ import modelingTracking from 'bpmn-js-tracking/lib/features/modeling';
import popupMenuTracking from 'bpmn-js-tracking/lib/features/popup-menu';
import paletteTracking from 'bpmn-js-tracking/lib/features/palette';

import { BpmnImprovedCanvasModule } from '@camunda/improved-canvas';

import Flags, {
DISABLE_ADJUST_ORIGIN,
ENABLE_NEW_CONTEXT_PAD
} from '../../../../util/Flags';

export default class PlatformBpmnModeler extends BpmnModeler {

constructor(options = {}) {

const {
moddleExtensions,
let {
additionalModules = [],
moddleExtensions = {},
...otherOptions
} = options;

if (Flags.get(ENABLE_NEW_CONTEXT_PAD, false)) {
additionalModules = [
...additionalModules,
{
__depends__: [ BpmnImprovedCanvasModule ],
resourceLinkingContextPadProvider: [ 'value', null ],
resourceLinkingRules: [ 'value', null ],
showComments: [ 'value', null ]
}
];
}

super({
...otherOptions,
disableAdjustOrigin: Flags.get(DISABLE_ADJUST_ORIGIN),
moddleExtensions: {
...(moddleExtensions || {})
}
additionalModules,
moddleExtensions,
disableAdjustOrigin: Flags.get(DISABLE_ADJUST_ORIGIN)
});
}
}
Expand Down
10 changes: 9 additions & 1 deletion client/src/app/tabs/cloud-bpmn/BpmnEditor.less
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,19 @@
}
}


.bjs-container {
--bjs-font-family: var(--font-family);
}

/* @camunda/improved-canvas restets */
.djs-container.bio-improved-canvas {
background-color: var(--color-white);
}

.bio-improved-canvas defs pattern circle {
fill: #ccc !important;
}

.djs-minimap {

.toggle {
Expand Down
39 changes: 39 additions & 0 deletions client/src/app/tabs/cloud-bpmn/__tests__/BpmnEditorSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ import {

import { SlotFillRoot } from '../../../slot-fill';

import Flags, { ENABLE_NEW_CONTEXT_PAD } from '../../../../util/Flags';

const { spy } = sinon;


Expand Down Expand Up @@ -2012,6 +2014,43 @@ describe('cloud-bpmn - <BpmnEditor>', function() {

});


describe('new context pad', function() {

beforeEach(function() {
Flags.reset();
});


it('should disable new context pad by default', async function() {

// when
const { instance } = await renderEditor(diagramXML);

// then
expect(instance).to.exist;
expect(instance.getModeler().additionalModules).to.exist;
expect(instance.getModeler().additionalModules).to.have.length(0);
});


it('should enable new context pad if enabled through flag', async function() {

// when
Flags.init({
[ ENABLE_NEW_CONTEXT_PAD ]: true
});

const { instance } = await renderEditor(diagramXML);

// then
expect(instance).to.exist;
expect(instance.getModeler().additionalModules).to.exist;
expect(instance.getModeler().additionalModules).to.have.length(1);
});

});

});


Expand Down
25 changes: 21 additions & 4 deletions client/src/app/tabs/cloud-bpmn/modeler/BpmnModeler.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,23 +27,40 @@ import modelingTracking from 'bpmn-js-tracking/lib/features/modeling';
import popupMenuTracking from 'bpmn-js-tracking/lib/features/popup-menu';
import paletteTracking from 'bpmn-js-tracking/lib/features/palette';

import { BpmnImprovedCanvasModule } from '@camunda/improved-canvas';

import Flags, {
DISABLE_ADJUST_ORIGIN
DISABLE_ADJUST_ORIGIN,
ENABLE_NEW_CONTEXT_PAD
} from '../../../../util/Flags';


export default class CloudBpmnModeler extends BpmnModeler {

constructor(options = {}) {

const {
moddleExtensions,
let {
additionalModules = [],
moddleExtensions = {},
...otherOptions
} = options;

if (Flags.get(ENABLE_NEW_CONTEXT_PAD, false)) {
additionalModules = [
...additionalModules,
{
__depends__: [ BpmnImprovedCanvasModule ],
resourceLinkingContextPadProvider: [ 'value', null ],
resourceLinkingRules: [ 'value', null ],
showComments: [ 'value', null ]
}
];
}

super({
...otherOptions,
moddleExtensions: moddleExtensions || {},
additionalModules,
moddleExtensions,
disableAdjustOrigin: Flags.get(DISABLE_ADJUST_ORIGIN)
});
}
Expand Down
29 changes: 21 additions & 8 deletions client/src/app/tabs/cloud-dmn/modeler/DmnModeler.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,19 @@
import propertiesPanelKeyboardBindingsModule from '../../bpmn/modeler/features/properties-panel-keyboard-bindings';
import decisionTableKeyboardModule from '../../dmn/modeler/features/decision-table-keyboard';

import Flags, { DISABLE_ADJUST_ORIGIN } from '../../../../util/Flags';
import Flags, {
DISABLE_ADJUST_ORIGIN,
ENABLE_NEW_CONTEXT_PAD
} from '../../../../util/Flags';

import openDrgElementModule from '../../dmn/modeler/features/overview/open-drg-element';
import overviewRendererModule from '../../dmn/modeler/features/overview/overview-renderer';

import executionPlatformModule from '@camunda/execution-platform';
import modelerModdle from 'modeler-moddle/resources/dmn-modeler.json';

import { DmnImprovedCanvasModule } from '@camunda/improved-canvas';

const NOOP_MODULE = [ 'value', null ];

const poweredByModule = {
Expand All @@ -44,18 +49,22 @@

const {
moddleExtensions = {},
drd: drdConfig,
drd,
decisionTable,
literalExpression,
exporter,
overview,
...otherOptions
} = options;

const drd = {
...drdConfig,
disableAdjustOrigin: Flags.get(DISABLE_ADJUST_ORIGIN)
};
let additionalModules = [];

if (Flags.get(ENABLE_NEW_CONTEXT_PAD, false)) {
additionalModules = [

Check warning on line 63 in client/src/app/tabs/cloud-dmn/modeler/DmnModeler.js

View check run for this annotation

Codecov / codecov/patch

client/src/app/tabs/cloud-dmn/modeler/DmnModeler.js#L63

Added line #L63 was not covered by tests
...additionalModules,
DmnImprovedCanvasModule
];
}

super({
...otherOptions,
Expand All @@ -66,9 +75,13 @@
viewDrd: NOOP_MODULE
}
]),
drd: mergeModules(drd, [
drd: mergeModules({
...drd,
disableAdjustOrigin: Flags.get(DISABLE_ADJUST_ORIGIN)
}, [
propertiesPanelKeyboardBindingsModule,
executionPlatformModule
executionPlatformModule,
...additionalModules
]),
decisionTable: mergeModules(decisionTable, [
decisionTableKeyboardModule,
Expand Down
9 changes: 9 additions & 0 deletions client/src/app/tabs/dmn/DmnEditor.less
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,15 @@
--drd-font-family-monospace: var(--font-family-monospace);
}

/* @camunda/improved-canvas restets */
.djs-container.bio-improved-canvas {
background-color: var(--color-white);
}

.bio-improved-canvas defs pattern circle {
fill: #ccc !important;
}

.dmn-decision-table-container {
--decision-table-font-family: var(--font-family);
}
Expand Down
29 changes: 21 additions & 8 deletions client/src/app/tabs/dmn/modeler/DmnModeler.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,19 @@ import completeDirectEditingModule from '../../bpmn/modeler/features/complete-di
import propertiesPanelKeyboardBindingsModule from '../../bpmn/modeler/features/properties-panel-keyboard-bindings';
import decisionTableKeyboardModule from './features/decision-table-keyboard';

import Flags, { DISABLE_ADJUST_ORIGIN } from '../../../../util/Flags';
import Flags, {
DISABLE_ADJUST_ORIGIN,
ENABLE_NEW_CONTEXT_PAD
} from '../../../../util/Flags';

import openDrgElementModule from './features/overview/open-drg-element';
import overviewRendererModule from './features/overview/overview-renderer';

import executionPlatformModule from '@camunda/execution-platform';
import modelerModdle from 'modeler-moddle/resources/dmn-modeler.json';

import { DmnImprovedCanvasModule } from '@camunda/improved-canvas';

const NOOP_MODULE = [ 'value', null ];

const poweredByModule = {
Expand All @@ -44,18 +49,22 @@ export default class CamundaDmnModeler extends DmnModeler {

const {
moddleExtensions = {},
drd: drdConfig,
drd,
decisionTable,
literalExpression,
exporter,
overview,
...otherOptions
} = options;

const drd = {
...drdConfig,
disableAdjustOrigin: Flags.get(DISABLE_ADJUST_ORIGIN)
};
let additionalModules = [];

if (Flags.get(ENABLE_NEW_CONTEXT_PAD, false)) {
additionalModules = [
...additionalModules,
DmnImprovedCanvasModule
];
}

super({
...otherOptions,
Expand All @@ -66,9 +75,13 @@ export default class CamundaDmnModeler extends DmnModeler {
viewDrd: NOOP_MODULE
}
]),
drd: mergeModules(drd, [
drd: mergeModules({
...drd,
disableAdjustOrigin: Flags.get(DISABLE_ADJUST_ORIGIN)
}, [
propertiesPanelKeyboardBindingsModule,
executionPlatformModule
executionPlatformModule,
...additionalModules
]),
decisionTable: mergeModules(decisionTable, [
decisionTableKeyboardModule,
Expand Down
Loading