diff --git a/lib/utils/properties-panel.js b/lib/utils/properties-panel.js index 2358c55..44da82b 100644 --- a/lib/utils/properties-panel.js +++ b/lib/utils/properties-panel.js @@ -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.'; } @@ -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.'; } @@ -412,7 +417,7 @@ 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.'; } @@ -420,7 +425,7 @@ export function getErrorMessage(id, report) { && [ ERROR_TYPES.EXTENSION_ELEMENT_REQUIRED, ERROR_TYPES.PROPERTY_REQUIRED - ].includes(data.type)) { + ].includes(type)) { return 'Subscription correlation key must be defined.'; } @@ -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); } } @@ -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') { @@ -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.'; } @@ -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.'; @@ -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.'; } \ No newline at end of file diff --git a/test/spec/utils/properties-panel.spec.js b/test/spec/utils/properties-panel.spec.js index 457dc5c..e163654 100644 --- a/test/spec/utils/properties-panel.spec.js +++ b/test/spec/utils/properties-panel.spec.js @@ -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); }); @@ -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); }); @@ -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); }); @@ -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); }); @@ -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); }); @@ -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); }); }); @@ -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); });