-
Notifications
You must be signed in to change notification settings - Fork 197
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add execution listeners for Zeebe
Related to camunda/camunda-modeler#3951
- Loading branch information
Showing
8 changed files
with
789 additions
and
9 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,140 @@ | ||
import { SelectEntry } from '@bpmn-io/properties-panel'; | ||
|
||
import { | ||
useService | ||
} from '../../../hooks'; | ||
|
||
import { FeelEntryWithVariableContext } from '../../../entries/FeelEntryWithContext'; | ||
|
||
|
||
export default function ExecutionListener(props) { | ||
|
||
const { | ||
idPrefix, | ||
listener | ||
} = props; | ||
|
||
const entries = [ | ||
{ | ||
id: idPrefix + '-eventType', | ||
component: EventType, | ||
idPrefix, | ||
listener | ||
}, | ||
{ | ||
id: idPrefix + '-listenerType', | ||
component: ListenerType, | ||
idPrefix, | ||
listener | ||
}, | ||
{ | ||
id: idPrefix + '-retries', | ||
component: Retries, | ||
idPrefix, | ||
listener | ||
} | ||
]; | ||
|
||
return entries; | ||
} | ||
|
||
function EventType(props) { | ||
const { | ||
idPrefix, | ||
element, | ||
listener | ||
} = props; | ||
|
||
const modeling = useService('modeling'); | ||
const translate = useService('translate'); | ||
|
||
const getOptions = () => { | ||
return [ | ||
{ value: 'start', label: translate('Start') }, | ||
{ value: 'end', label: translate('End') } | ||
]; | ||
}; | ||
|
||
const setValue = (value) => { | ||
modeling.updateModdleProperties(element, listener, { | ||
eventType: value | ||
}); | ||
}; | ||
|
||
const getValue = () => { | ||
return listener.get('eventType'); | ||
}; | ||
|
||
return SelectEntry({ | ||
element, | ||
id: idPrefix + '-eventType', | ||
label: translate('Event type'), | ||
getValue, | ||
setValue, | ||
getOptions | ||
}); | ||
} | ||
|
||
function ListenerType(props) { | ||
const { | ||
idPrefix, | ||
element, | ||
listener | ||
} = props; | ||
|
||
const modeling = useService('modeling'); | ||
const translate = useService('translate'); | ||
const debounce = useService('debounceInput'); | ||
|
||
const setValue = (value) => { | ||
modeling.updateModdleProperties(element, listener, { | ||
type: value | ||
}); | ||
}; | ||
|
||
const getValue = () => { | ||
return listener.get('type'); | ||
}; | ||
|
||
return FeelEntryWithVariableContext({ | ||
element, | ||
id: idPrefix + '-listenerType', | ||
label: translate('Listener type'), | ||
getValue, | ||
setValue, | ||
debounce, | ||
feel: 'optional' | ||
}); | ||
} | ||
|
||
function Retries(props) { | ||
const { | ||
idPrefix, | ||
element, | ||
listener | ||
} = props; | ||
|
||
const modeling = useService('modeling'); | ||
const translate = useService('translate'); | ||
const debounce = useService('debounceInput'); | ||
|
||
const setValue = (value) => { | ||
modeling.updateModdleProperties(element, listener, { | ||
retries: value | ||
}); | ||
}; | ||
|
||
const getValue = () => { | ||
return listener.get('retries'); | ||
}; | ||
|
||
return FeelEntryWithVariableContext({ | ||
element, | ||
id: idPrefix + '-retries', | ||
label: translate('Retries'), | ||
getValue, | ||
setValue, | ||
debounce, | ||
feel: 'optional' | ||
}); | ||
} |
Oops, something went wrong.