aboutsummaryrefslogtreecommitdiffstats
path: root/sdc-workflow-designer-ui/src/main/frontend/src/features/version/composition/custom-properties-provider/provider/camunda/parts/createInputOutputTabGroups.js
blob: 3dede1a948ea39212623512168c726c88b8d4a1d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
import inputOutputParameter from './InputOutputParameterProps';
import inputOutput from './InputOutputProps';
const is = require('bpmn-js/lib/util/ModelUtil').is;

var getInputOutputParameterLabel = function(param, translate) {
    if (is(param, 'camunda:InputParameter')) {
        return translate('Input Parameter');
    }

    if (is(param, 'camunda:OutputParameter')) {
        return translate('Output Parameter');
    }

    return '';
};

export default function createInputOutputTabGroups(
    element,
    bpmnFactory,
    elementRegistry,
    translate,
    config
) {
    var inputOutputGroup = {
        id: 'input-output',
        label: translate('Parameters'),
        entries: []
    };

    var options = inputOutput(
        inputOutputGroup,
        element,
        bpmnFactory,
        translate
    );
    var inputOutputParameterGroup = {
        id: 'input-output-parameter',
        entries: [],
        enabled: function(element, node) {
            return options.getSelectedParameter(element, node);
        },
        label: function(element, node) {
            var param = options.getSelectedParameter(element, node);
            return getInputOutputParameterLabel(param, translate);
        }
    };

    inputOutputParameter(
        inputOutputParameterGroup,
        element,
        bpmnFactory,
        options,
        translate,
        config
    );

    return [inputOutputGroup, inputOutputParameterGroup];
}