Created
August 1, 2019 13:52
-
-
Save nikku/01330530c67e6b66084c563f443c0e83 to your computer and use it in GitHub Desktop.
For Linus USE ONLY
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { React, ReactDOM, Fill, registerBpmnJSPlugin } from 'camunda-modeler-plugin-helpers'; | |
function BpmnModelerPlugin(eventBus, tabContext) { | |
class AppPlugin extends React.Component { | |
constructor(props) { | |
super(props); | |
this.tabContext = props.tabContext; | |
} | |
showDialog() { | |
} | |
doOtherTHings() { | |
} | |
triggerSave() { | |
} | |
render() { | |
<div> | |
<Fill name="toolbar" group="save"> | |
<button className="some-button" onClick={ this.triggerSave } > | |
</button> | |
</Fill> | |
</div> | |
} | |
} | |
let el, appPlugin; | |
function mountApp() { | |
el = document.createElement('div'); | |
document.body.appendChild(el); | |
// one extension per diagram, reacts to tabContext.on(...) to either show buttons (or not) | |
appPlugin = ReactDOM.render(<AppPlugin tabContext={ tabContext } />, el); | |
} | |
function unmountApp() { | |
if (!el) { | |
return; | |
} | |
// unmount app | |
ReactDOM.render(null, el); | |
document.body.removeChild(el); | |
el = null; | |
appPlugin = null; | |
} | |
eventBus.on('diagram.destroy', function() { | |
}); | |
tabContext.on('tab.shown', mountApp()); | |
tabContext.on('tab.hide', unmountApp()); | |
const saveContext = 'USER_TRIGGERD_AWAAAAA'; | |
await tabContext.save(saveContext); | |
const workspace = tabContext.get('workspace'); | |
tabContext.getConfig('cawemo:CAWEMO_USER', ''); | |
const value = await workspace.getConfig('cawemo:CAWEMO_USER', ''); | |
await workspace.setConfig('cawemo:CAWEMO_USER', 'asddsa'); | |
tabContext.on('tab.save', function(definitions, saveContext) { | |
// add cawemo related meta-data to BPMN 2.0 XML | |
}); | |
tabContext.on('tab.saved', async function(xml, saveContext) { | |
return appPlugin.upload(); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
😍