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

Properties Panel Header Displays Element Template Icon Found in XML #1012

Closed
wants to merge 9 commits into from
18 changes: 11 additions & 7 deletions src/render/PanelHeaderProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,14 +87,10 @@ export const PanelHeaderProvider = {
getElementIcon: (element) => {
const concreteType = getConcreteType(element);

const elementTemplates = getTemplatesService();
const templateIcon = getModelerTemplateIcon(element);

if (elementTemplates) {
const template = getTemplate(element, elementTemplates);

if (template && template.icon) {
return () => <img class="bio-properties-panel-header-template-icon" width="32" height="32" src={ template.icon.contents } />;
}
if (templateIcon) {
return () => <img class="bio-properties-panel-header-template-icon" width="32" height="32" src={ templateIcon } />;
}

return iconsByType[ concreteType ];
Expand Down Expand Up @@ -191,4 +187,12 @@ function getTemplateDocumentation(element, elementTemplates) {
const template = getTemplate(element, elementTemplates);

return template && template.documentationRef;
}

function getModelerTemplateIcon(element) {
// eslint-disable-next-line react-hooks/rules-of-hooks
const config = useService('config.elementTemplateIconRenderer', false);
const { iconProperty = 'zeebe:modelerTemplateIcon' } = config || {};
philippfromme marked this conversation as resolved.
Show resolved Hide resolved

return getBusinessObject(element).get(iconProperty);
}
Loading