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

feat(properties-panel): show supported version #106

Merged
merged 1 commit into from
Jun 3, 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
56 changes: 36 additions & 20 deletions lib/utils/properties-panel.js
Original file line number Diff line number Diff line change
Expand Up @@ -325,12 +325,17 @@ export function getErrorMessage(id, report) {
executionPlatformVersion
} = report;

const {
type,
allowedVersion
} = data;

// adjust FEEL message
if (data.type === ERROR_TYPES.FEEL_EXPRESSION_INVALID) {
if (type === ERROR_TYPES.FEEL_EXPRESSION_INVALID) {
return 'Unparsable FEEL expression.';
}

if (data.type === ERROR_TYPES.EXPRESSION_NOT_ALLOWED) {
if (type === ERROR_TYPES.EXPRESSION_NOT_ALLOWED) {
return 'Cannot be an expression.';
}

Expand Down Expand Up @@ -376,11 +381,11 @@ export function getErrorMessage(id, report) {
return 'Result variable must be defined.';
}

if (id === 'errorCode' && data.type === ERROR_TYPES.PROPERTY_REQUIRED) {
if (id === 'errorCode' && type === ERROR_TYPES.PROPERTY_REQUIRED) {
return 'Code must be defined.';
}

if (id === 'escalationCode' && data.type === ERROR_TYPES.PROPERTY_REQUIRED) {
if (id === 'escalationCode' && type === ERROR_TYPES.PROPERTY_REQUIRED) {
return 'Code must be defined.';
}

Expand Down Expand Up @@ -412,15 +417,15 @@ export function getErrorMessage(id, report) {
return 'Type must be defined.';
}

if (id === 'timerEventDefinitionType' && data.type === ERROR_TYPES.PROPERTY_REQUIRED) {
if (id === 'timerEventDefinitionType' && type === ERROR_TYPES.PROPERTY_REQUIRED) {
return 'Type must be defined.';
}

if (id === 'messageSubscriptionCorrelationKey'
&& [
ERROR_TYPES.EXTENSION_ELEMENT_REQUIRED,
ERROR_TYPES.PROPERTY_REQUIRED
].includes(data.type)) {
].includes(type)) {
return 'Subscription correlation key must be defined.';
}

Expand All @@ -429,10 +434,10 @@ export function getErrorMessage(id, report) {
}

if (id === 'formId') {
if (data.type === ERROR_TYPES.PROPERTY_REQUIRED) {
if (type === ERROR_TYPES.PROPERTY_REQUIRED) {
return 'Form ID must be defined.';
} else if (data.type === ERROR_TYPES.PROPERTY_NOT_ALLOWED) {
return 'Form ID not supported.';
} else if (type === ERROR_TYPES.PROPERTY_NOT_ALLOWED) {
return getNotSupportedMessage('Form ID', allowedVersion);
}
}

Expand All @@ -449,7 +454,7 @@ export function getErrorMessage(id, report) {
}

if (/^.+-extensionProperty-[0-9]+-name$/.test(id)) {
return 'Not supported.';
return getNotSupportedMessage('', allowedVersion);
}

if (id === 'userTaskImplementation') {
Expand All @@ -460,12 +465,12 @@ export function getErrorMessage(id, report) {
return 'Condition expression must be defined.';
}

if (id === 'timerEventDefinitionType' && data.type === ERROR_TYPES.PROPERTY_NOT_ALLOWED) {
return 'Type not supported.';
if (id === 'timerEventDefinitionType' && type === ERROR_TYPES.PROPERTY_NOT_ALLOWED) {
return getNotSupportedMessage('Type', allowedVersion);
}

if (id === 'timerEventDefinitionValue') {
if (data.type === ERROR_TYPES.EXPRESSION_REQUIRED) {
if (type === ERROR_TYPES.EXPRESSION_REQUIRED) {
return 'Value must be defined.';
}

Expand All @@ -489,31 +494,31 @@ export function getErrorMessage(id, report) {
}

if (id === 'assignmentDefinitionCandidateUsers') {
return 'Not supported.';
return getNotSupportedMessage('', allowedVersion);
}

if (id === 'taskScheduleDueDate') {
if (data.type === ERROR_TYPES.EXTENSION_ELEMENT_NOT_ALLOWED) {
return 'Not supported.';
if (type === ERROR_TYPES.EXTENSION_ELEMENT_NOT_ALLOWED) {
return getNotSupportedMessage('', allowedVersion);
} else {
return 'Must be an ISO 8601 date.';
}
}

if (id === 'taskScheduleFollowUpDate') {
if (data.type === ERROR_TYPES.EXTENSION_ELEMENT_NOT_ALLOWED) {
return 'Not supported.';
if (type === ERROR_TYPES.EXTENSION_ELEMENT_NOT_ALLOWED) {
return getNotSupportedMessage('', allowedVersion);
} else {
return 'Must be an ISO 8601 date.';
}
}

if (id === 'propagateAllParentVariables') {
return 'Not supported.';
return getNotSupportedMessage('', allowedVersion);
}

if (id === 'linkName') {
if (data.type === ERROR_TYPES.ELEMENT_PROPERTY_VALUE_DUPLICATED) {
if (type === ERROR_TYPES.ELEMENT_PROPERTY_VALUE_DUPLICATED) {
return 'Must be unique.';
} else {
return 'Must be defined.';
Expand Down Expand Up @@ -599,4 +604,15 @@ function getBusinessObject(element) {

function isEmptyString(value) {
return isString(value) && value.trim() === '';
}

function getNotSupportedMessage(property, allowedVersion) {

if (allowedVersion) {
return property ?
`${ property } is only supported by Camunda ${ allowedVersion } or newer.` :
`Only supported by Camunda ${ allowedVersion } or newer.`;
}

return property ? `${ property } is not supported.` : 'Not supported.';
}
14 changes: 7 additions & 7 deletions test/spec/utils/properties-panel.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -869,7 +869,7 @@ describe('utils/properties-panel', function() {
// then
expect(entryIds).to.eql([ 'formId' ]);

expectErrorMessage(entryIds[ 0 ], 'Form ID not supported.', report);
expectErrorMessage(entryIds[ 0 ], 'Form ID is only supported by Camunda 8.4 or newer.', report);
});


Expand Down Expand Up @@ -1060,7 +1060,7 @@ describe('utils/properties-panel', function() {
'ServiceTask_1-extensionProperty-1-name'
]);

expectErrorMessage(entryIds[ 0 ], 'Not supported.', report);
expectErrorMessage(entryIds[ 0 ], 'Only supported by Camunda 8.1 or newer.', report);
});


Expand Down Expand Up @@ -1168,7 +1168,7 @@ describe('utils/properties-panel', function() {
// then
expect(entryIds).to.eql([ 'timerEventDefinitionType' ]);

expectErrorMessage(entryIds[ 0 ], 'Type not supported.', report);
expectErrorMessage(entryIds[ 0 ], 'Type is only supported by Camunda 8.3 or newer.', report);
});


Expand Down Expand Up @@ -1606,7 +1606,7 @@ describe('utils/properties-panel', function() {
// then
expect(entryIds).to.eql([ 'assignmentDefinitionCandidateUsers' ]);

expectErrorMessage(entryIds[ 0 ], 'Not supported.', report);
expectErrorMessage(entryIds[ 0 ], 'Only supported by Camunda 8.2 or newer.', report);
});


Expand Down Expand Up @@ -1689,7 +1689,7 @@ describe('utils/properties-panel', function() {
// then
expect(entryIds).to.eql([ 'taskScheduleDueDate' ]);

expectErrorMessage(entryIds[ 0 ], 'Not supported.', report);
expectErrorMessage(entryIds[ 0 ], 'Only supported by Camunda 8.2 or newer.', report);
});


Expand All @@ -1716,7 +1716,7 @@ describe('utils/properties-panel', function() {
// then
expect(entryIds).to.eql([ 'taskScheduleFollowUpDate' ]);

expectErrorMessage(entryIds[ 0 ], 'Not supported.', report);
expectErrorMessage(entryIds[ 0 ], 'Only supported by Camunda 8.2 or newer.', report);
});

});
Expand Down Expand Up @@ -1745,7 +1745,7 @@ describe('utils/properties-panel', function() {
// then
expect(entryIds).to.eql([ 'propagateAllParentVariables' ]);

expectErrorMessage(entryIds[ 0 ], 'Not supported.', report);
expectErrorMessage(entryIds[ 0 ], 'Only supported by Camunda 8.2 or newer.', report);
});


Expand Down
Loading