fix(contextpad): add signal event to end event replace menu
close #211 #218
This commit is contained in:
parent
5604e13468
commit
f527096ac2
|
@ -2,7 +2,9 @@
|
||||||
|
|
||||||
var startEventReplace = [
|
var startEventReplace = [
|
||||||
{
|
{
|
||||||
options: {},
|
options: {
|
||||||
|
eventDefinition: ''
|
||||||
|
},
|
||||||
label: 'Start Event',
|
label: 'Start Event',
|
||||||
actionName: 'replace-with-none-start',
|
actionName: 'replace-with-none-start',
|
||||||
className: 'icon-01-none-start',
|
className: 'icon-01-none-start',
|
||||||
|
@ -120,7 +122,7 @@ var startEventReplace = [
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'Timer Intermediate Catch Event',
|
label: 'Escalation Intermediate Catch Event',
|
||||||
actionName: 'replace-with-escalation-throwing',
|
actionName: 'replace-with-escalation-throwing',
|
||||||
className: 'icon-04-escalation-intermediate-throwing',
|
className: 'icon-04-escalation-intermediate-throwing',
|
||||||
targetType: 'bpmn:IntermediateCatchEvent',
|
targetType: 'bpmn:IntermediateCatchEvent',
|
||||||
|
@ -198,10 +200,12 @@ var endEventReplace = [
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'End Event',
|
label: 'End Event',
|
||||||
actionName: 'replace-with-message-end',
|
actionName: 'replace-with-none-end',
|
||||||
className: 'icon-01-none-end',
|
className: 'icon-01-none-end',
|
||||||
targetType: 'bpmn:EndEvent',
|
targetType: 'bpmn:EndEvent',
|
||||||
options: {},
|
options: {
|
||||||
|
eventDefinition: ''
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'Message End Event',
|
label: 'Message End Event',
|
||||||
|
@ -248,6 +252,15 @@ var endEventReplace = [
|
||||||
eventDefinition: 'bpmn:CompensateEventDefinition'
|
eventDefinition: 'bpmn:CompensateEventDefinition'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
label: 'Signal End Event',
|
||||||
|
actionName: 'replace-with-signal-end',
|
||||||
|
className: 'icon-10-signal-end',
|
||||||
|
targetType: 'bpmn:EndEvent',
|
||||||
|
options: {
|
||||||
|
eventDefinition: 'bpmn:SignalEventDefinition'
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
label: 'Terminate End Event',
|
label: 'Terminate End Event',
|
||||||
actionName: 'replace-with-terminate-end',
|
actionName: 'replace-with-terminate-end',
|
||||||
|
|
|
@ -21,31 +21,14 @@ function getReplacementMenuEntries(element, replaceElement) {
|
||||||
|
|
||||||
if (bo.$instanceOf('bpmn:StartEvent')) {
|
if (bo.$instanceOf('bpmn:StartEvent')) {
|
||||||
|
|
||||||
addEntries(startEventReplace, function(entry) {
|
addEntries(startEventReplace, filterEvents);
|
||||||
var eventDefinition = bo.eventDefinition ? bo.eventDefinition[0].$type : '';
|
|
||||||
|
|
||||||
return entry.options.eventDefinition !== eventDefinition.$type;
|
|
||||||
});
|
|
||||||
} else if (bo.$instanceOf('bpmn:IntermediateCatchEvent') ||
|
} else if (bo.$instanceOf('bpmn:IntermediateCatchEvent') ||
|
||||||
bo.$instanceOf('bpmn:IntermediateThrowEvent')) {
|
bo.$instanceOf('bpmn:IntermediateThrowEvent')) {
|
||||||
|
|
||||||
addEntries(intermediateEventReplace, function(entry) {
|
addEntries(intermediateEventReplace, filterEvents);
|
||||||
|
|
||||||
var eventDefinition = bo.eventDefinitions ? bo.eventDefinitions[0].$type : '';
|
|
||||||
var isEventDefinitionEqual = entry.options.eventDefinition === eventDefinition;
|
|
||||||
var isEventTypeEqual = bo.$type === entry.targetType;
|
|
||||||
|
|
||||||
return ((!isEventDefinitionEqual && isEventTypeEqual) ||
|
|
||||||
!isEventTypeEqual) ||
|
|
||||||
!(isEventDefinitionEqual && isEventTypeEqual);
|
|
||||||
});
|
|
||||||
} else if (bo.$instanceOf('bpmn:EndEvent')) {
|
} else if (bo.$instanceOf('bpmn:EndEvent')) {
|
||||||
|
|
||||||
addEntries(endEventReplace, function(entry) {
|
addEntries(endEventReplace, filterEvents);
|
||||||
var eventDefinition = bo.eventDefinition ? bo.eventDefinition[0].$type : '';
|
|
||||||
|
|
||||||
return entry.options.eventDefinition !== eventDefinition.$type;
|
|
||||||
});
|
|
||||||
} else if (bo.$instanceOf('bpmn:Gateway')) {
|
} else if (bo.$instanceOf('bpmn:Gateway')) {
|
||||||
|
|
||||||
addEntries(gatewayReplace, function(entry) {
|
addEntries(gatewayReplace, function(entry) {
|
||||||
|
@ -60,6 +43,17 @@ function getReplacementMenuEntries(element, replaceElement) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function filterEvents(entry) {
|
||||||
|
|
||||||
|
var eventDefinition = bo.eventDefinitions ? bo.eventDefinitions[0].$type : '';
|
||||||
|
var isEventDefinitionEqual = entry.options.eventDefinition === eventDefinition;
|
||||||
|
var isEventTypeEqual = bo.$type === entry.targetType;
|
||||||
|
|
||||||
|
return ((!isEventDefinitionEqual && isEventTypeEqual) ||
|
||||||
|
!isEventTypeEqual) ||
|
||||||
|
!(isEventDefinitionEqual && isEventTypeEqual);
|
||||||
|
}
|
||||||
|
|
||||||
function addEntries(entries, filterFun) {
|
function addEntries(entries, filterFun) {
|
||||||
// Filter selected type from the array
|
// Filter selected type from the array
|
||||||
var filteredEntries = filter(entries, filterFun);
|
var filteredEntries = filter(entries, filterFun);
|
||||||
|
|
Loading…
Reference in New Issue