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

Add Version tag field #1063

Merged
merged 5 commits into from
Aug 26, 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
28 changes: 14 additions & 14 deletions package-lock.json

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

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
"bpmn-js": "^17.9.1",
"bpmn-js-create-append-anything": "^0.5.2",
"bpmn-moddle": "^9.0.1",
"camunda-bpmn-js-behaviors": "^1.5.0",
"camunda-bpmn-js-behaviors": "^1.6.0",
"camunda-bpmn-moddle": "^7.0.1",
"chai": "^4.4.1",
"cross-env": "^7.0.3",
Expand Down Expand Up @@ -106,7 +106,7 @@
"sinon": "^17.0.1",
"sinon-chai": "^3.7.0",
"webpack": "^5.93.0",
"zeebe-bpmn-moddle": "^1.5.1"
"zeebe-bpmn-moddle": "^1.6.0"
},
"peerDependencies": {
"@bpmn-io/properties-panel": ">= 3.7",
Expand Down
44 changes: 43 additions & 1 deletion src/contextProvider/zeebe/TooltipProvider.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/* eslint-disable react-hooks/rules-of-hooks */
import {
is
is,
isAny
} from 'bpmn-js/lib/util/ModelUtil';

import {
Expand Down Expand Up @@ -293,9 +294,50 @@ const TooltipProvider = {
<h1>{ translate('Deployment binding') }</h1>
{ translate('Uses the resource found in the same deployment.') }
</p>
<p>
<h1>{ translate('Version tag binding') }</h1>
{ translate('Uses the most recent deployed resource with the given version tag.') }
</p>
</div>
);
},
'versionTag': (element) => {
const translate = useService('translate');

if (isAny(element, [ 'bpmn:Process', 'bpmn:Participant' ])) {
return (
<div>
<p>
{ translate('Version tag by which this process can be referenced.') }
</p>
</div>
);
} else if (is(element, 'bpmn:CallActivity')) {
return (
<div>
<p>
{ translate('Version tag by which the called process will be referenced.') }
</p>
</div>
);
} else if (is(element, 'bpmn:BusinessRuleTask')) {
return (
<div>
<p>
{ translate('Version tag by which the called decision will be referenced.') }
</p>
</div>
);
} else if (is(element, 'bpmn:UserTask')) {
return (
<div>
<p>
{ translate('Version tag by which the linked form will be referenced.') }
</p>
</div>
);
}
},
'priorityDefinitionPriority': (element) => {

const translate = useService('translate');
Expand Down
22 changes: 21 additions & 1 deletion src/provider/zeebe/ZeebePropertiesProvider.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { Group, ListGroup } from '@bpmn-io/properties-panel';

import { findIndex } from 'min-dash';

import {
AssignmentDefinitionProps,
BusinessRuleImplementationProps,
Expand All @@ -24,7 +26,8 @@ import {
TaskDefinitionProps,
TaskScheduleProps,
TimerProps,
UserTaskImplementationProps
UserTaskImplementationProps,
VersionTagProps
} from './properties';

import { ExtensionPropertiesProps } from '../shared/ExtensionPropertiesProps';
Expand Down Expand Up @@ -72,6 +75,7 @@ export default class ZeebePropertiesProvider {
groups = groups.concat(this._getGroups(element));

// (2) update existing groups with zeebe specific properties
updateGeneralGroup(groups, element);
updateErrorGroup(groups, element);
updateEscalationGroup(groups, element);
updateMessageGroup(groups, element);
Expand Down Expand Up @@ -335,6 +339,22 @@ function ExtensionPropertiesGroup(element, injector) {
return null;
}

function updateGeneralGroup(groups, element) {

const generalGroup = findGroup(groups, 'general');

if (!generalGroup) {
return;
}

const { entries } = generalGroup;

const executableEntry = findIndex(entries, (entry) => entry.id === 'isExecutable');
const insertIndex = executableEntry >= 0 ? executableEntry : entries.length;

entries.splice(insertIndex, 0, ...VersionTagProps({ element }));
}

function updateErrorGroup(groups, element) {
const errorGroup = findGroup(groups, 'error');

Expand Down
26 changes: 19 additions & 7 deletions src/provider/zeebe/properties/CalledDecisionProps.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ import {
TextFieldEntry
} from '@bpmn-io/properties-panel';

import Binding from './shared/Binding';
import Binding, { getBindingType } from './shared/Binding';
import VersionTag from './shared/VersionTag.js';

import {
getExtensionElementsList
Expand All @@ -36,7 +37,7 @@ export function CalledDecisionProps(props) {
return [];
}

return [
const entries = [
{
id: 'decisionId',
component: DecisionID,
Expand All @@ -46,13 +47,24 @@ export function CalledDecisionProps(props) {
id: 'bindingType',
component: withProps(Binding, { type: 'zeebe:CalledDecision' }),
isEdited: isSelectEntryEdited
},
{
id: 'resultVariable',
component: ResultVariable,
isEdited: isTextFieldEntryEdited
}
];

if (getBindingType(element, 'zeebe:CalledDecision') === 'versionTag') {
entries.push({
id: 'versionTag',
component: withProps(VersionTag, { type: 'zeebe:CalledDecision' }),
isEdited: isTextFieldEntryEdited
});
}

entries.push({
id: 'resultVariable',
component: ResultVariable,
isEdited: isTextFieldEntryEdited
});

return entries;
}

function DecisionID(props) {
Expand Down
11 changes: 10 additions & 1 deletion src/provider/zeebe/properties/FormProps.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ import {
isTextAreaEntryEdited
} from '@bpmn-io/properties-panel';

import Binding from './shared/Binding';
import Binding, { getBindingType } from './shared/Binding';
import VersionTag from './shared/VersionTag';

import { FeelEntryWithVariableContext } from '../../../entries/FeelEntryWithContext';

Expand Down Expand Up @@ -89,6 +90,14 @@ export function FormProps(props) {
component: withProps(Binding, { type: 'zeebe:FormDefinition' }),
isEdited: isSelectEntryEdited
});

if (getBindingType(element, 'zeebe:FormDefinition') === 'versionTag') {
entries.push({
id: 'versionTag',
component: withProps(VersionTag, { type: 'zeebe:FormDefinition' }),
isEdited: isTextFieldEntryEdited
});
}
}

return entries;
Expand Down
18 changes: 15 additions & 3 deletions src/provider/zeebe/properties/TargetProps.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@ import {

import {
isFeelEntryEdited,
isSelectEntryEdited
isSelectEntryEdited,
isTextFieldEntryEdited
} from '@bpmn-io/properties-panel';

import Binding from './shared/Binding';
import Binding, { getBindingType } from './shared/Binding';
import VersionTag from './shared/VersionTag.js';

import {
createElement
Expand All @@ -35,7 +37,7 @@ export function TargetProps(props) {
return [];
}

return [
const entries = [
{
id: 'targetProcessId',
component: TargetProcessId,
Expand All @@ -47,6 +49,16 @@ export function TargetProps(props) {
isEdited: isSelectEntryEdited
}
];

if (getBindingType(element, 'zeebe:CalledElement') === 'versionTag') {
entries.push({
id: 'versionTag',
component: withProps(VersionTag, { type: 'zeebe:CalledElement' }),
isEdited: isTextFieldEntryEdited
});
}

return entries;
}

function TargetProcessId(props) {
Expand Down
Loading