Skip to content
Open
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
1 change: 1 addition & 0 deletions assets/element-templates.css
Original file line number Diff line number Diff line change
Expand Up @@ -114,4 +114,5 @@
.bio-properties-panel-deprecated-template-text,
.bio-properties-panel-template-incompatible-text {
width: 216px;
overflow-wrap: break-word;
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export default function({ templates = [] }) {
if (templateId && !template) {
reporter.report(
node.id,
'Linked element template not found',
`Linked element template '${templateId}' not found`,
{
name: node.name
}
Expand Down
15 changes: 8 additions & 7 deletions src/components/ElementTemplatesGroup.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ function TemplateGroupButtons({ element, getTemplateId }) {
} else if (templateState.type === 'KNOWN_TEMPLATE') {
return <AppliedTemplate element={ element } />;
} else if (templateState.type === 'UNKNOWN_TEMPLATE') {
return <UnknownTemplate element={ element } />;
return <UnknownTemplate element={ element } templateState={ templateState } />;
} else if (templateState.type === 'DEPRECATED_TEMPLATE') {
return <DeprecatedTemplate element={ element } templateState={ templateState } />;
} else if (templateState.type === 'INCOMPATIBLE_TEMPLATE') {
Expand Down Expand Up @@ -203,12 +203,12 @@ function RemoveTemplate() {
return <span class="bio-properties-panel-remove-template">{ translate('Remove') }</span>;
}

function UnknownTemplate({ element }) {
function UnknownTemplate({ element, templateState }) {
const translate = useService('translate'),
elementTemplates = useService('elementTemplates');

const menuItems = [
{ entry: <NotFoundText /> },
{ entry: <NotFoundText templateState={ templateState } /> },
{ separator: true },
{ entry: translate('Unlink'), action: () => elementTemplates.unlinkTemplate(element) },
{ entry: <RemoveTemplate />, action: () => elementTemplates.removeTemplate(element) }
Expand All @@ -224,14 +224,15 @@ function UnknownTemplate({ element }) {
);
}

function NotFoundText() {
function NotFoundText({ templateState }) {
const translate = useService('translate');
const { templateId } = templateState;

return (
<div class="bio-properties-panel-template-not-found-text">
{ translate(
'The template applied was not found. Therefore, its properties cannot be shown. Unlink to access the data.'
) }
{ (translate(
'The applied template with id \'{templateId}\' was not found. Its properties cannot be shown. Unlink to access the data.'
)).replace('{templateId}', `${templateId}`) }
</div>
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ const invalid = [
},
report: {
id: 'Task_1',
message: 'Linked element template not found'
message: 'Linked element template \'missing-template\' not found'
}
},
{
Expand Down Expand Up @@ -307,7 +307,7 @@ describe('cloud-element-templates/linting', function() {
// then
const report = secondResult['element-templates/validate'][0];
expect(report).to.have.property('id', 'Task_1');
expect(report).to.have.property('message', 'Linked element template not found');
expect(report).to.have.property('message', 'Linked element template \'constraints.empty\' not found');
});
});

Expand Down