Skip to content

Commit

Permalink
feat(dmn-editor): migrate DMN diagrams to DMN 1.3
Browse files Browse the repository at this point in the history
  • Loading branch information
philippfromme committed Mar 18, 2020
1 parent e087fc7 commit 0ec40ba
Show file tree
Hide file tree
Showing 27 changed files with 524 additions and 126 deletions.
2 changes: 1 addition & 1 deletion app/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

132 changes: 103 additions & 29 deletions client/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"dependencies": {
"@bpmn-io/add-exporter": "^0.2.0",
"@bpmn-io/align-to-origin": "^0.6.0",
"@bpmn-io/dmn-migrate": "^0.4.3",
"@bpmn-io/replace-ids": "^0.2.0",
"bpmn-js": "^6.3.4",
"bpmn-js-disable-collapsed-subprocess": "^0.1.1",
Expand All @@ -27,7 +28,7 @@
"diagram-js-direct-editing": "^1.6.1",
"diagram-js-minimap": "^2.0.3",
"diagram-js-origin": "^1.3.1",
"dmn-js": "^7.5.0",
"dmn-js": "^8.0.0-alpha.1",
"dmn-js-properties-panel": "^0.3.5",
"drag-tabs": "^2.2.0",
"events": "^3.0.0",
Expand Down
7 changes: 7 additions & 0 deletions client/src/app/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -1725,6 +1725,12 @@ export class App extends PureComponent {
return config.get(key, file, ...args);
}

setConfig = (key, ...args) => {
const config = this.getGlobal('config');

return config.set(key, ...args);
}

getPlugins = type => {
return this.getGlobal('plugins').get(type);
}
Expand Down Expand Up @@ -1917,6 +1923,7 @@ export class App extends PureComponent {
onAction={ this.triggerAction }
onModal={ this.openModal }
getConfig={ this.getConfig }
setConfig={ this.setConfig }
getPlugins={ this.getPlugins }
ref={ this.tabRef }
/>
Expand Down
30 changes: 30 additions & 0 deletions client/src/app/__tests__/AppSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2392,6 +2392,36 @@ describe('<App>', function() {
});


describe('#setConfig', function() {

afterEach(sinon.restore);


it('should set config', async function() {

// given
const setConfigSpy = spy();

const config = new Config({
set: setConfigSpy
});

const { app } = createApp({
globals: {
config
}
});

// when
app.setConfig('foo');

// then
expect(setConfigSpy).to.be.calledOnceWith('foo');
});

});


describe('#loadPlugins', function() {

it('should load plugins', function() {
Expand Down
17 changes: 15 additions & 2 deletions client/src/app/tabs/MultiSheetTab.js
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,19 @@ export class MultiSheetTab extends CachedComponent {
return file && !file.path;
}

onAction = (action, options) => {
const {
onAction,
tab
} = this.props;

if (action === 'close-tab') {
return onAction('close-tab', { tabId: tab.id });
}

return onAction(action, options);
}

render() {
let {
activeSheet,
Expand All @@ -348,7 +361,6 @@ export class MultiSheetTab extends CachedComponent {
id,
xml,
layout,
onAction,
tab
} = this.props;

Expand Down Expand Up @@ -376,14 +388,15 @@ export class MultiSheetTab extends CachedComponent {
activeSheet={ activeSheet }
onSheetsChanged={ this.sheetsChanged }
onContextMenu={ this.handleContextMenu }
onAction={ onAction }
onAction={ this.onAction }
onChanged={ this.handleChanged }
onContentUpdated={ this.handleContentUpdated }
onError={ this.handleError }
onImport={ this.handleImport }
onLayoutChanged={ this.handleLayoutChanged }
onModal={ this.props.onModal }
getConfig={ this.props.getConfig }
setConfig={ this.props.setConfig }
getPlugins={ this.props.getPlugins }
/>
</TabContainer>
Expand Down
41 changes: 41 additions & 0 deletions client/src/app/tabs/__tests__/MultiSheetTabSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -455,6 +455,47 @@ describe('<MultiSheetTab>', function() {

});


describe('#onAction', function() {

it('should propagate action', async function() {

// given
const onAction = sinon.spy();

const {
instance
} = renderTab({
onAction
});

// when
await instance.onAction('foo');

// then
expect(onAction).to.have.been.calledWith('foo');
});


it('should handle close-tab action', async function() {

// given
const onAction = sinon.spy();

const {
instance
} = renderTab({
onAction
});

// when
await instance.onAction('close-tab');

// then
expect(onAction).to.have.been.calledWith('close-tab', { tabId: instance.props.tab.id });
});
});

});


Expand Down
2 changes: 1 addition & 1 deletion client/src/app/tabs/bpmn/BpmnEditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ import applyDefaultTemplates from './modeler/features/apply-default-templates/ap
import {
findUsages as findNamespaceUsages,
replaceUsages as replaceNamespaceUsages
} from './util/namespace';
} from '../util/namespace';

import configureModeler from './util/configure';

Expand Down
Loading

0 comments on commit 0ec40ba

Please sign in to comment.