camunda / camunda-modeler

An integrated modeling solution for BPMN, DMN and Forms based on bpmn.io.
https://camunda.com/products/modeler
MIT License
1.47k stars 473 forks source link

Updating the element templates with camunda:Connector leads to duplicated <camunda:connector> element in XML #3154

Open CatalinaMoisuc opened 1 year ago

CatalinaMoisuc commented 1 year ago

Describe the bug

Given one template on my local machine

When I make a change to it i.e. increase the version number The upgrade is correctly suggested in the UI. ✔️

When upgrade to the newer version Then the one element in the XML is not replaced, but it is duplicated. ❌

Steps to reproduce

  1. Create a new template in your element-template folder in your Camunda Desktop Modeler installation with the following content:

This is the same template example provided here that uses the Camunda 7 Connectors. See docs here and here

{
  "$schema": "https://unpkg.com/@camunda/element-templates-json-schema/resources/schema.json",
  "name": "ConnectorGetTask-LOCAL",
  "id": "9a158cf8-c500-40d8-90a5-c4a62727684110",
  "appliesTo": [
    "bpmn:Task"
  ],
  "version": 1,
  "properties": [],
  "scopes": [
    {
      "type": "camunda:Connector",
      "properties": [
        {
          "label": "ConnectorId",
          "type": "String",
          "value": "My Connector HTTP - GET",
          "binding": {
            "type": "property",
            "name": "connectorId"
          }
        },
        {
          "label": "Method",
          "type": "String",
          "value": "GET",
          "binding": {
            "type": "camunda:inputParameter",
            "name": "method"
          }
        },
        {
          "label": "URL",
          "type": "String",
          "value": "https://bpmn.io",
          "binding": {
            "type": "camunda:inputParameter",
            "name": "url"
          }
        },
        {
          "label": "Response",
          "type": "String",
          "value": "wsResponse",
          "binding": {
            "type": "camunda:outputParameter",
            "source": "${S(response)}",
            "scriptFormat": "freemarker"
          }
        }
      ]
    }
  ]
}
  1. Create a new C7 BPMN diagram and add a task to it

  2. Apply the template to the task and save

  3. Increase the version number in the template from 1 to 2

  4. Go to your diagram from (3.) and Upgrade the template

  5. Open the XML view and see two entries of in the XML

See screen recording:

https://user-images.githubusercontent.com/25924333/192004921-64472a7e-0147-4a23-82f9-e49a746341ff.mov

And the only difference between the two templates is the version:

Screenshot 2022-09-23 at 18 01 28

Expected behavior

The upgrade of the template should replace my cammunda:Connector, not duplicate it.

Environment

Additional context

The issue has been reported by a customer via SUPPORT-14645

nikku commented 1 year ago

Thanks for reporting. Moving to backlog for the moment.

CC @christian-konrad.

christian-konrad commented 1 year ago

In case we fix this, this would require a patch release of 4.12 since the customer is not able to migrate their plugins to 5.x for now. @nikku I assume it's been a while since the last patch release was built (I think it was v4.8.1). What's the effort to provide one (in case we already have this fixed in 5.x)?

nikku commented 1 year ago

Low effort to patch release this. We have an existing process + branching strategy in place.

CatalinaMoisuc commented 1 year ago

@christian-konrad

I just checked in 5.4.2. and I can still reproduce the issue with only the Cloud Connect plugin installed:

https://user-images.githubusercontent.com/25924333/197817905-595245b2-b21a-4300-95ae-29776372bead.mov

Regarding the plugins, I removed all plugins from my plugins folder, restarted the Desktop Modeler, and I have the same issue with the templates taken from my local resources folder with no plugin installed:

https://user-images.githubusercontent.com/25924333/197820747-71d43163-4505-483d-9925-852559d1f623.mov

sghidiu commented 1 year ago

Hi Team, customer has migrated their plugins to V5.x now. Is it possible to get a timeline for a fix on V5?

knobik commented 1 month ago

Hello, any news on fixing this issue?