Add bpmn:Resource in propertiesPanel


#1

is it possible to add bpmn:Resource element in propertiesPanel and edit its attribute???
how to do it???


#2

Hi @Savior1993,

please check our provided rich selection of examples in order to explore bpmn.io’s features and how to implement them.


#3

Hi @FaHinse

Thanks for your response.

I’ve already added some properties to property panel based on the property-panel[link] example.

But I have a challenge in adding ‘bpmn:Resource’ to the properties panel. I don’t want it to be added as an extensionElement.

I’d like it to be inside bpmn:Definitions (beside bpmn:Process). Also I’d like to extend the original bpmn:Resource to add some parameters.

So in MyModdle.json I added:

{
  "name": "Resource",
  "extends": [
    "bpmn:Resource"
  ],
  "properties": [
    {
      "name": "parameters",
      "isMany": true,
      "type": "MyParameter"
    }
  ]
},	{
  "name": "MyParameter",
  "properties": [        
    {
      "name": "myParameterType",
      "isAttr": true,
      "type": "String"
    }
    {
      "name": "myParameterName",
      "isAttr": true,
      "type": "String"
    },        
    {
      "name": "myParameterValue",
      "isAttr": true,
      "type": "String"
    }
  ]
}

now for example in newElement function of MyResource.js

var newElement = function (type, prop, factory) {

        return function (element, extensionElements, value) {

            var commands = [];

            var resource = getResource(element);
            if (!resource) {
                var parent = extensionElements;
                resource = createResource(parent, bpmnFactory);
                console.log('resource', resource);
                commands.push(cmdHelper.addAndRemoveElementsFromList(
                    element,
                    extensionElements,
                    'values',
                    'extensionElements',
                    [resource],
                    []
                ));
            }

            var newElem = createResourceParameter(type, resource, bpmnFactory, {
                resourceId: 'id-' + value
            });
	
	commands.push(cmdHelper.addElementsTolist(element, parameters, prop, [newElem]));
            return commands;
        };
    }

I know this cmdHelper adds ‘bpmn:Resource’ to extensionElements but I don’t know what to use instead!


#4

Have you thought about writing your own command handler that does exactly what you’d expect?