diff options
author | Stanislav Vishnevetskiy <shlomo-stanisla.vishnevetskiy@amdocs.com> | 2018-09-05 16:57:32 +0300 |
---|---|---|
committer | Stanislav Vishnevetskiy <shlomo-stanisla.vishnevetskiy@amdocs.com> | 2018-09-05 16:59:42 +0300 |
commit | 6a81388cf93207c6317a3f6b68d0a9d7aeeca41a (patch) | |
tree | 293f49e269e0e7173374497f4f129a8662627011 /workflow-designer-ui/src | |
parent | 7f88989e73c66e3c50ad75575c4b42e8e17a2326 (diff) |
composition issues fix
Issue-ID: SDC-1591
Change-Id: I1cf9fc840d42c3d84c0f71ddcce0a9749f802c05
Signed-off-by: Stanislav Vishnevetskiy <shlomo-stanisla.vishnevetskiy@amdocs.com>
Diffstat (limited to 'workflow-designer-ui/src')
17 files changed, 186 insertions, 53 deletions
diff --git a/workflow-designer-ui/src/main/frontend/src/features/version/composition/CompositionView.js b/workflow-designer-ui/src/main/frontend/src/features/version/composition/CompositionView.js index d5b06d3e..41c6db0b 100644 --- a/workflow-designer-ui/src/main/frontend/src/features/version/composition/CompositionView.js +++ b/workflow-designer-ui/src/main/frontend/src/features/version/composition/CompositionView.js @@ -46,7 +46,7 @@ class CompositionView extends Component { } componentDidMount() { - const { composition, activities } = this.props; + const { composition, activities, inputOutput } = this.props; this.modeler = new CustomModeler({ propertiesPanel: { @@ -61,7 +61,8 @@ class CompositionView extends Component { }, workflow: { activities: activities, - onChange: this.onActivityChanged + onChange: this.onActivityChanged, + workflowInputOutput: inputOutput } }); @@ -79,16 +80,20 @@ class CompositionView extends Component { const selectedActivity = this.props.activities.find( el => el.name === selectedValue ); + const config = this.modeler.get('config'); if (selectedActivity) { const inputsOutputs = { inputs: selectedActivity.inputs, outputs: selectedActivity.outputs }; + config.workflow.selectedActivityInputs = inputsOutputs; + this.modeler.config = config; setElementInputsOutputs( bo, inputsOutputs, - this.modeler.get('moddle') + this.modeler.get('moddle'), + true ); } }; diff --git a/workflow-designer-ui/src/main/frontend/src/features/version/composition/bpmnUtils.js b/workflow-designer-ui/src/main/frontend/src/features/version/composition/bpmnUtils.js index adc42868..d5916f1c 100644 --- a/workflow-designer-ui/src/main/frontend/src/features/version/composition/bpmnUtils.js +++ b/workflow-designer-ui/src/main/frontend/src/features/version/composition/bpmnUtils.js @@ -34,7 +34,12 @@ export function updatedData(moddle, inputData, existingArray, type) { }); } -export function setElementInputsOutputs(businessObject, inputOutput, moddle) { +export function setElementInputsOutputs( + businessObject, + inputOutput, + moddle, + cleanInputsOutpus +) { const { inputs = [], outputs = [] } = inputOutput; if (!businessObject.extensionElements) { @@ -51,14 +56,20 @@ export function setElementInputsOutputs(businessObject, inputOutput, moddle) { const processInputs = updatedData( moddle, inputs, - (existingInputOutput && existingInputOutput.inputParameters) || [], + cleanInputsOutpus + ? [] + : (existingInputOutput && existingInputOutput.inputParameters) || + [], bpmnElementsTypes.INPUT_PARAMETER ); const processOutputs = updatedData( moddle, outputs, - (existingInputOutput && existingInputOutput.outputParameters) || [], + cleanInputsOutpus + ? [] + : (existingInputOutput && existingInputOutput.outputParameters) || + [], bpmnElementsTypes.OUTPUT_PARAMETER ); diff --git a/workflow-designer-ui/src/main/frontend/src/features/version/composition/custom-properties-provider/descriptors/camunda.json b/workflow-designer-ui/src/main/frontend/src/features/version/composition/custom-properties-provider/descriptors/camunda.json index b671c432..6613c4bf 100644 --- a/workflow-designer-ui/src/main/frontend/src/features/version/composition/custom-properties-provider/descriptors/camunda.json +++ b/workflow-designer-ui/src/main/frontend/src/features/version/composition/custom-properties-provider/descriptors/camunda.json @@ -563,6 +563,16 @@ "type": "String" }, { + "name": "workflowSource", + "isAttr": true, + "type": "String" + }, + { + "name": "workflowTarget", + "isAttr": true, + "type": "String" + }, + { "name": "value", "isBody": true, "type": "String" diff --git a/workflow-designer-ui/src/main/frontend/src/features/version/composition/custom-properties-provider/provider/camunda/WorkflowPropertiesProvider.js b/workflow-designer-ui/src/main/frontend/src/features/version/composition/custom-properties-provider/provider/camunda/WorkflowPropertiesProvider.js index 98a5797d..34130d01 100644 --- a/workflow-designer-ui/src/main/frontend/src/features/version/composition/custom-properties-provider/provider/camunda/WorkflowPropertiesProvider.js +++ b/workflow-designer-ui/src/main/frontend/src/features/version/composition/custom-properties-provider/provider/camunda/WorkflowPropertiesProvider.js @@ -278,7 +278,8 @@ function WorkflowPropertiesProvider( element, bpmnFactory, elementRegistry, - translate + translate, + config ) }; tabs.unshift(inputOutputTab); diff --git a/workflow-designer-ui/src/main/frontend/src/features/version/composition/custom-properties-provider/provider/camunda/parts/InputOutputParameterProps.js b/workflow-designer-ui/src/main/frontend/src/features/version/composition/custom-properties-provider/provider/camunda/parts/InputOutputParameterProps.js index a1f1efb0..d221c6e3 100644 --- a/workflow-designer-ui/src/main/frontend/src/features/version/composition/custom-properties-provider/provider/camunda/parts/InputOutputParameterProps.js +++ b/workflow-designer-ui/src/main/frontend/src/features/version/composition/custom-properties-provider/provider/camunda/parts/InputOutputParameterProps.js @@ -1,15 +1,21 @@ -'use strict'; - import inputOutputParameter from './implementation/InputOutputParameter'; import assign from 'lodash.assign'; -module.exports = function(group, element, bpmnFactory, options, translate) { +export default function( + group, + element, + bpmnFactory, + options, + translate, + config +) { group.entries = group.entries.concat( inputOutputParameter( element, bpmnFactory, assign({}, options), - translate + translate, + config ) ); -}; +} diff --git a/workflow-designer-ui/src/main/frontend/src/features/version/composition/custom-properties-provider/provider/camunda/parts/InputOutputProps.js b/workflow-designer-ui/src/main/frontend/src/features/version/composition/custom-properties-provider/provider/camunda/parts/InputOutputProps.js index df1e5432..bdcbab46 100644 --- a/workflow-designer-ui/src/main/frontend/src/features/version/composition/custom-properties-provider/provider/camunda/parts/InputOutputProps.js +++ b/workflow-designer-ui/src/main/frontend/src/features/version/composition/custom-properties-provider/provider/camunda/parts/InputOutputProps.js @@ -1,13 +1,13 @@ 'use strict'; -var inputOutput = require('./implementation/InputOutput'); +import inputOutput from './implementation/InputOutput'; -module.exports = function(group, element, bpmnFactory, translate) { - var inputOutputEntry = inputOutput(element, bpmnFactory, {}, translate); +export default function(group, element, bpmnFactory, translate) { + const inputOutputEntry = inputOutput(element, bpmnFactory, {}, translate); group.entries = group.entries.concat(inputOutputEntry.entries); return { getSelectedParameter: inputOutputEntry.getSelectedParameter }; -}; +} diff --git a/workflow-designer-ui/src/main/frontend/src/features/version/composition/custom-properties-provider/provider/camunda/parts/createInputOutputTabGroups.js b/workflow-designer-ui/src/main/frontend/src/features/version/composition/custom-properties-provider/provider/camunda/parts/createInputOutputTabGroups.js index f14e359f..3dede1a9 100644 --- a/workflow-designer-ui/src/main/frontend/src/features/version/composition/custom-properties-provider/provider/camunda/parts/createInputOutputTabGroups.js +++ b/workflow-designer-ui/src/main/frontend/src/features/version/composition/custom-properties-provider/provider/camunda/parts/createInputOutputTabGroups.js @@ -1,6 +1,6 @@ -let inputOutputParameter = require('./InputOutputParameterProps'); -let inputOutput = require('./InputOutputProps'); -var is = require('bpmn-js/lib/util/ModelUtil').is; +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')) { @@ -18,7 +18,8 @@ export default function createInputOutputTabGroups( element, bpmnFactory, elementRegistry, - translate + translate, + config ) { var inputOutputGroup = { id: 'input-output', @@ -32,7 +33,6 @@ export default function createInputOutputTabGroups( bpmnFactory, translate ); - var inputOutputParameterGroup = { id: 'input-output-parameter', entries: [], @@ -50,7 +50,8 @@ export default function createInputOutputTabGroups( element, bpmnFactory, options, - translate + translate, + config ); return [inputOutputGroup, inputOutputParameterGroup]; diff --git a/workflow-designer-ui/src/main/frontend/src/features/version/composition/custom-properties-provider/provider/camunda/parts/implementation/InputOutput.js b/workflow-designer-ui/src/main/frontend/src/features/version/composition/custom-properties-provider/provider/camunda/parts/implementation/InputOutput.js index 2adf7f7b..8962a309 100644 --- a/workflow-designer-ui/src/main/frontend/src/features/version/composition/custom-properties-provider/provider/camunda/parts/implementation/InputOutput.js +++ b/workflow-designer-ui/src/main/frontend/src/features/version/composition/custom-properties-provider/provider/camunda/parts/implementation/InputOutput.js @@ -1,9 +1,8 @@ -'use strict'; +import inputOutputHelper from './InputOutputHelper'; var getBusinessObject = require('bpmn-js/lib/util/ModelUtil').getBusinessObject; var elementHelper = require('bpmn-js-properties-panel/lib/helper/ElementHelper'), extensionElementsHelper = require('bpmn-js-properties-panel/lib/helper/ExtensionElementsHelper'), - inputOutputHelper = require('./InputOutputHelper'), cmdHelper = require('bpmn-js-properties-panel/lib/helper/CmdHelper'); var extensionElementsEntry = require('bpmn-js-properties-panel/lib/provider/camunda/parts/implementation//ExtensionElements'); @@ -61,7 +60,7 @@ function ensureOutparameterSupported(element, insideConnector) { ); } -module.exports = function(element, bpmnFactory, options, translate) { +export default function(element, bpmnFactory, options, translate) { var TYPE_LABEL = { 'camunda:Map': translate('Map'), 'camunda:List': translate('List'), @@ -144,8 +143,6 @@ module.exports = function(element, bpmnFactory, options, translate) { name: value }); - console.log(newElem); - commands.push( cmdHelper.addElementsTolist(element, inputOutput, prop, [ newElem @@ -289,4 +286,4 @@ module.exports = function(element, bpmnFactory, options, translate) { } return result; -}; +} diff --git a/workflow-designer-ui/src/main/frontend/src/features/version/composition/custom-properties-provider/provider/camunda/parts/implementation/InputOutputHelper.js b/workflow-designer-ui/src/main/frontend/src/features/version/composition/custom-properties-provider/provider/camunda/parts/implementation/InputOutputHelper.js index 13bc50aa..e3a79d4c 100644 --- a/workflow-designer-ui/src/main/frontend/src/features/version/composition/custom-properties-provider/provider/camunda/parts/implementation/InputOutputHelper.js +++ b/workflow-designer-ui/src/main/frontend/src/features/version/composition/custom-properties-provider/provider/camunda/parts/implementation/InputOutputHelper.js @@ -1,5 +1,3 @@ -'use strict'; - var ModelUtil = require('bpmn-js/lib/util/ModelUtil'), is = ModelUtil.is, getBusinessObject = ModelUtil.getBusinessObject; @@ -13,8 +11,6 @@ import { var InputOutputHelper = {}; -module.exports = InputOutputHelper; - function getElements(bo, type, prop) { var elems = extensionElementsHelper.getExtensionElements(bo, type) || []; return !prop ? elems : (elems[0] || {})[prop] || []; @@ -164,3 +160,5 @@ InputOutputHelper.isCreateDeleteSupported = function(element) { element.type !== 'bpmn:Process' ); }; + +export default InputOutputHelper; diff --git a/workflow-designer-ui/src/main/frontend/src/features/version/composition/custom-properties-provider/provider/camunda/parts/implementation/InputOutputParameter.js b/workflow-designer-ui/src/main/frontend/src/features/version/composition/custom-properties-provider/provider/camunda/parts/implementation/InputOutputParameter.js index 628874fc..faa20fb0 100644 --- a/workflow-designer-ui/src/main/frontend/src/features/version/composition/custom-properties-provider/provider/camunda/parts/implementation/InputOutputParameter.js +++ b/workflow-designer-ui/src/main/frontend/src/features/version/composition/custom-properties-provider/provider/camunda/parts/implementation/InputOutputParameter.js @@ -1,9 +1,8 @@ -'use strict'; +import inputOutputHelper from './InputOutputHelper'; var is = require('bpmn-js/lib/util/ModelUtil').is; var elementHelper = require('bpmn-js-properties-panel/lib/helper/ElementHelper'), - inputOutputHelper = require('./InputOutputHelper'), cmdHelper = require('bpmn-js-properties-panel/lib/helper/CmdHelper'), utils = require('bpmn-js-properties-panel/lib/Utils'); @@ -34,7 +33,7 @@ function ensureInputOutputSupported(element, insideConnector) { return inputOutputHelper.isInputOutputSupported(element, insideConnector); } -module.exports = function(element, bpmnFactory, options, translate) { +export default function(element, bpmnFactory, options, translate, config) { var typeInfo = { 'camunda:Map': { value: 'map', @@ -421,5 +420,97 @@ module.exports = function(element, bpmnFactory, options, translate) { }) ); + //workflow source parameter (type = text) /////////////////////////////////////////////////////// + const workflowInputs = config.workflowInputOutput.inputs.map(item => ({ + name: item.name, + value: item.name + })); + + const workflowOutputs = config.workflowInputOutput.outputs.map(item => ({ + name: item.name, + value: item.name + })); + + const workflowSources = [ + { name: '', value: '' }, + ...workflowInputs, + ...workflowOutputs + ]; + + entries.push( + entryFactory.selectBox({ + id: 'parameter-workflowSource', + label: 'Workflow Source Parameter', + selectOptions: workflowSources, + modelProperty: 'workflowSource', + + get: function(element, node) { + return { + workflowSource: (getSelected(element, node) || {}) + .workflowSource + }; + }, + + set: function(element, values, node) { + var properties = { + workflowSource: undefined + }; + + properties.workflowSource = values.workflowSource; + var param = getSelected(element, node); + values.workflowSource = values.workflowSource || undefined; + + return cmdHelper.updateBusinessObject(element, param, values); + }, + + hidden: function(element, node) { + var bo = getSelected(element, node); + return !( + bo && + bo.$type && + bo.$type === 'camunda:InputParameter' + ); + } + }) + ); + + //workflow target parameter (type = text) /////////////////////////////////////////////////////// + entries.push( + entryFactory.selectBox({ + id: 'parameter-workflowTarget', + label: 'Workflow Target Parameter', + selectOptions: workflowSources, + modelProperty: 'workflowTarget', + + get: function(element, node) { + return { + workflowTarget: (getSelected(element, node) || {}) + .workflowTarget + }; + }, + + set: function(element, values, node) { + var properties = { + workflowTarget: undefined + }; + + properties.workflowTarget = values.workflowTarget; + var param = getSelected(element, node); + values.workflowTarget = values.workflowTarget || undefined; + + return cmdHelper.updateBusinessObject(element, param, values); + }, + + hidden: function(element, node) { + var bo = getSelected(element, node); + return !( + bo && + bo.$type && + bo.$type === 'camunda:OutputParameter' + ); + } + }) + ); + return entries; -}; +} diff --git a/workflow-designer-ui/src/main/frontend/src/features/version/composition/custom-properties-provider/provider/camunda/parts/implementation/WorkflowImplementationType.js b/workflow-designer-ui/src/main/frontend/src/features/version/composition/custom-properties-provider/provider/camunda/parts/implementation/WorkflowImplementationType.js index 11e8fcba..eac00fdd 100644 --- a/workflow-designer-ui/src/main/frontend/src/features/version/composition/custom-properties-provider/provider/camunda/parts/implementation/WorkflowImplementationType.js +++ b/workflow-designer-ui/src/main/frontend/src/features/version/composition/custom-properties-provider/provider/camunda/parts/implementation/WorkflowImplementationType.js @@ -33,7 +33,7 @@ const ACTIVITY_PROPS = {}; ACTIVITY_PROPS[implementationType] = undefined; -module.exports = function(element, bpmnFactory, options, translate) { +export default function(element, bpmnFactory, options, translate) { var DEFAULT_OPTIONS = [ { value: 'class', name: translate('Java Class') }, { value: 'expression', name: translate('Expression') }, @@ -224,4 +224,4 @@ module.exports = function(element, bpmnFactory, options, translate) { ); return entries; -}; +} diff --git a/workflow-designer-ui/src/main/frontend/src/features/version/composition/newDiagram.bpmn b/workflow-designer-ui/src/main/frontend/src/features/version/composition/newDiagram.bpmn index 7ed9b6e1..1e2ca7a9 100644 --- a/workflow-designer-ui/src/main/frontend/src/features/version/composition/newDiagram.bpmn +++ b/workflow-designer-ui/src/main/frontend/src/features/version/composition/newDiagram.bpmn @@ -1,4 +1,4 @@ -<?xml version="1.0" encoding="UTF-8"?> +export default `<?xml version="1.0" encoding="UTF-8"?> <bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd" id="sample-diagram" targetNamespace="http://bpmn.io/schema/bpmn"> <bpmn2:process id="Process_1" isExecutable="false"> </bpmn2:process> @@ -6,4 +6,5 @@ <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Process_1"> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> -</bpmn2:definitions> +</bpmn2:definitions>`; + diff --git a/workflow-designer-ui/src/main/frontend/src/features/version/inputOutput/InputOutputView.jsx b/workflow-designer-ui/src/main/frontend/src/features/version/inputOutput/InputOutputView.jsx index 6b76933e..4dea49d4 100644 --- a/workflow-designer-ui/src/main/frontend/src/features/version/inputOutput/InputOutputView.jsx +++ b/workflow-designer-ui/src/main/frontend/src/features/version/inputOutput/InputOutputView.jsx @@ -67,13 +67,7 @@ class InputOutputView extends React.Component { this.props.handleSearch(value); }; - handleNameChange = (key, isBlur = false) => value => { - let name = isBlur ? value.target.value : value; - name = name.replace(/\s+/g, ' '); - name = isBlur - ? name.replace(/^\s+|\s+$/g, '') - : name.replace(/^\s+/g, ''); - + handleNameChange = key => name => { this.props.handleNameChange(name, key); }; @@ -144,7 +138,6 @@ class InputOutputView extends React.Component { nameErrorMessage={errorMessage} dataTestId="wf-input-output-row" handleNameChange={this.handleNameChange(i)} - handleNameBlur={this.handleNameChange(i, true)} handleTypeChange={this.handleTypeChange(i)} handleMandatoryChange={this.handleMandatoryChange(i)} handleRemoveClick={this.handleRemoveClick(i)} diff --git a/workflow-designer-ui/src/main/frontend/src/features/version/inputOutput/inputOutputValidations.js b/workflow-designer-ui/src/main/frontend/src/features/version/inputOutput/inputOutputValidations.js index 50a64211..d4057879 100644 --- a/workflow-designer-ui/src/main/frontend/src/features/version/inputOutput/inputOutputValidations.js +++ b/workflow-designer-ui/src/main/frontend/src/features/version/inputOutput/inputOutputValidations.js @@ -52,7 +52,7 @@ export const getValidationsError = dataRows => { const groupKey = value.name; if (groupKey) { - if (!/^[\w\s\d]+$/.test(groupKey)) { + if (!/^[\w\d]+$/.test(groupKey)) { result.push(key); } } diff --git a/workflow-designer-ui/src/main/frontend/src/features/version/versionApi.js b/workflow-designer-ui/src/main/frontend/src/features/version/versionApi.js index 4e591c9b..ab9394cb 100644 --- a/workflow-designer-ui/src/main/frontend/src/features/version/versionApi.js +++ b/workflow-designer-ui/src/main/frontend/src/features/version/versionApi.js @@ -46,10 +46,20 @@ const Api = { `${baseUrl(workflowId)}/${versionId}/artifact` ); }, - updateVersionArtifact: ({ workflowId, versionId, payload }) => { + updateVersionArtifact: ({ + workflowId, + versionId, + workflowName, + versionName, + payload + }) => { let formData = new FormData(); var blob = new Blob([payload], { type: 'text/xml' }); - formData.append('fileToUpload', blob); + formData.append( + 'fileToUpload', + blob, + `${workflowName}-${versionName}.bpmn` + ); return RestfulAPIUtil.put( `${baseUrl(workflowId)}/${versionId}/artifact`, diff --git a/workflow-designer-ui/src/main/frontend/src/features/version/versionController/VersionControllerView.jsx b/workflow-designer-ui/src/main/frontend/src/features/version/versionController/VersionControllerView.jsx index d0188875..20a14c62 100644 --- a/workflow-designer-ui/src/main/frontend/src/features/version/versionController/VersionControllerView.jsx +++ b/workflow-designer-ui/src/main/frontend/src/features/version/versionController/VersionControllerView.jsx @@ -51,8 +51,13 @@ export default class VersionControllerView extends Component { }; sendSaveParamsToServer = () => { - const { savedParams, saveParamsToServer, workflowId } = this.props; - saveParamsToServer({ params: savedParams, workflowId }); + const { + savedParams, + saveParamsToServer, + workflowId, + workflowName + } = this.props; + saveParamsToServer({ params: savedParams, workflowId, workflowName }); }; certifyVersion = () => { diff --git a/workflow-designer-ui/src/main/frontend/src/features/version/versionSaga.js b/workflow-designer-ui/src/main/frontend/src/features/version/versionSaga.js index c8fdaaf0..a7dabed8 100644 --- a/workflow-designer-ui/src/main/frontend/src/features/version/versionSaga.js +++ b/workflow-designer-ui/src/main/frontend/src/features/version/versionSaga.js @@ -78,8 +78,10 @@ function* watchUpdateVersion(action) { try { const { workflowId, + workflowName, params: { composition, ...versionData } } = action.payload; + yield call(versionApi.updateVersion, { workflowId, params: versionData @@ -87,6 +89,8 @@ function* watchUpdateVersion(action) { if (composition) { yield call(versionApi.updateVersionArtifact, { workflowId, + workflowName, + versionName: versionData.name.split('.').join('_'), versionId: versionData.id, payload: composition }); |