question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Applied Element Template is not unlinked, when changing to not supported element type

See original GitHub issue

Describe the Enhancement

When applying an task-specific element template to a task of a specific type (e.g., ServiceTask) and then changing the type of the respective task (e.g., to UserTask), the element template is still present. This is IMO an inconsistent state, since the element template configuration would not allow that template to be applied to a task other than ServiceTask.

Steps to Reproduce

  1. Setup the following example element template
{
    "name": "Mail Task",
    "id": "com.camunda.example.MailTask",
    "appliesTo": [
      "bpmn:ServiceTask"
    ],
    "properties": [
      {
        "label": "Implementation Type",
        "type": "String",
        "value": "com.mycompany.MailTaskImpl",
        "editable": false,
        "binding": {
          "type": "property",
          "name": "camunda:class"
        }
      },
      {
        "label": "Sender",
        "type": "String",
        "binding": {
          "type": "camunda:inputParameter",
          "name": "sender"
        },
        "constraints": {
          "notEmpty": true,
          "pattern": {
            "value": "^[A-z0-9._%+-]+@[A-z0-9.-]+\\.[A-z]{2,}$",
            "message": "Must be a valid email."
          }
        }
      },
      {
        "label": "Receivers",
        "type": "String",
        "binding": {
          "type": "camunda:inputParameter",
          "name": "receivers"
        },
        "constraints": {
          "notEmpty": true
        }
      },
      {
        "label": "Template",
        "description": "By the way, you can use <a href=\"https://freemarker.apache.org/\">freemarker templates</a> here",
        "value": "Hello ${firstName}!",
        "type": "Text",
        "binding": {
          "type": "camunda:inputParameter",
          "name": "messageBody",
          "scriptFormat": "freemarker"
        },
        "constraints": {
          "notEmpty": true
        }
      },
      {
        "label": "Result Status",
        "description": "The process variable to which to assign the send result to",
        "type": "String",
        "value": "mailSendResult",
        "binding": {
          "type": "camunda:outputParameter",
          "source": "${ resultStatus }"
        }
      },
      {
        "label": "Send Async?",
        "type": "Boolean",
        "value": true,
        "binding": {
          "type": "property",
          "name": "camunda:asyncBefore"
        }
      }
    ]
  }
  1. Apply the template to a serviceTask
  2. Change the task type to userTask
  3. => The element template is still applied

Expected Behavior

The element template shall be unlinked, if not supporting the respective new task type.

Why

If we don’t have this, the user would get to an inconsistent state of the diagram (according to the element template configuration)

Environment

  • OS: Arch Linux Manjaro
  • Camunda Modeler Version: develop branch + develop branch bpmn-js-properties-panel on 6th October

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

3reactions
philippfrommecommented, Oct 30, 2020

The solution I’ve discussed with @azeghers is:

  • when the template cannot be found it will be unlinked
  • when the template can be found it will be unlinked if it can’t be applied to the new element

CodeSandbox example: https://codesandbox.io/s/restricting-camundamodelertemplate-nyrtp?file=/src/index.js

Read more comments on GitHub >

github_iconTop Results From Across the Web

Global Elements | Use containers + unlink global
This way, the template gets inserted directly as individual elements. So changing the template (in Bricks > Templates) will not affect it.
Read more >
2 Linking/unlinking - Zabbix
To link a template to the host, do the following: Go to Configuration → Hosts; Click on the required host; Start typing the...
Read more >
Components | Webflow University
Components allow you to maintain a consistent, efficient, and scalable design workflow by creating customizable blocks from elements and child elements.
Read more >
dom-repeat – API Reference - Polymer Project
The <dom-repeat> element will automatically stamp and binds one instance of ... on properties not contained in items , the user should observe...
Read more >
Cover Creator - Amazon Kindle Direct Publishing
Note: Cover Creator does not support Japanese, Hebrew, and Yiddish. ... click anywhere on the cover, except where other elements (e.g., text boxes)...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found