diff options
Diffstat (limited to 'vid-app-common/src/main')
2 files changed, 57 insertions, 7 deletions
diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/modals/new-change-management/new-change-management.controller.js b/vid-app-common/src/main/webapp/app/vid/scripts/modals/new-change-management/new-change-management.controller.js index c6a5b31af..02242cb37 100644 --- a/vid-app-common/src/main/webapp/app/vid/scripts/modals/new-change-management/new-change-management.controller.js +++ b/vid-app-common/src/main/webapp/app/vid/scripts/modals/new-change-management/new-change-management.controller.js @@ -433,7 +433,6 @@ } else { let source = vm.getRemoteWorkflowSource(vm.changeManagement.workflow); if( source === "NATIVE"){ - vm.localWorkflowsParameters = vm.remoteWorkflowsParameters; vm.triggerLocalWorkflow(); }else { vm.triggerRemoteWorkflow(); @@ -687,7 +686,9 @@ }; vm.loadWorkFlows = function () { - if (featureFlags.isOn(COMPONENT.FEATURE_FLAGS.FLAG_HANDLE_SO_WORKFLOWS)) { + vm.localWorkflowsParameters = new Map(); + vm.remoteWorkflowsParameters = new Map(); + if (featureFlags.isOn(COMPONENT.FEATURE_FLAGS.FLAG_HANDLE_SO_WORKFLOWS)) { return vm.loadRemoteWorkFlows() .then(function () { vm.workflows = vm.remoteWorkflows.map(item => item.name); @@ -723,7 +724,6 @@ }; vm.loadLocalWorkFlowsParameters = function () { - vm.localWorkflowsParameters = new Map(); vm.localWorkflows.forEach(function(workflow) { vm.loadLocalWorkFlowParameters(workflow); }); @@ -740,9 +740,12 @@ }; vm.loadRemoteWorkFlowsParameters = function () { - vm.remoteWorkflowsParameters = new Map(); vm.remoteWorkflows.forEach(function(workflow) { - vm.loadRemoteWorkFlowParameters(workflow); + if (workflow.source ==='SDC' || workflow.source === 'sdc' ){ + vm.loadRemoteWorkFlowParameters(workflow); + } else { + vm.loadLocalWorkFlowParameters(workflow.name); + } }); }; diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/modals/new-change-management/new-change-management.controller.test.js b/vid-app-common/src/main/webapp/app/vid/scripts/modals/new-change-management/new-change-management.controller.test.js index afc643993..b11070a9f 100644 --- a/vid-app-common/src/main/webapp/app/vid/scripts/modals/new-change-management/new-change-management.controller.test.js +++ b/vid-app-common/src/main/webapp/app/vid/scripts/modals/new-change-management/new-change-management.controller.test.js @@ -127,7 +127,7 @@ describe('Testing workFlows from SO', () => { // when return $controller.loadWorkFlows().then(() => { expect($controller.workflows).toContain('inPlaceSoftwareUpdate'); - expect($controller.localWorkflowsParameters).toBeUndefined(); + expect($controller.localWorkflowsParameters).toEqual(new Map()); }); }); @@ -196,7 +196,7 @@ describe('Testing workFlows from SO', () => { return $controller.loadWorkFlows() .then(() => { expect($controller.workflows).toEqual(["workflow 0"]); - expect($controller.remoteWorkflowsParameters).toEqual(undefined); + expect($controller.remoteWorkflowsParameters).toEqual(new Map()); }); }); @@ -357,4 +357,51 @@ describe('Testing workFlows from SO', () => { expect(internalWorkFlowParameters).toEqual(result); }); }); + + test('Verify get remote workflow should call internal service for params when workflow is native', () =>{ + let getWorkflowsStub = Promise.resolve({"data": {"workflows": ["workflow 0"]}}) + let getLocalWorkflowsParametersStub = Promise.resolve({"data":{ + "parameterDefinitions": [ + { + "id": 1, + "name": "Configuration Parameters", + "required": true, + "type": "text", + "pattern": ".*", + "msgOnPatternError": null, + "msgOnContentError": null, + "acceptableFileType": null + } + ], + }}); + let getSOWorkflowsPromiseStub = Promise.resolve({"data":[{ + + "id": "ab6478e4-ea33-3346-ac12-ab121484a333", + "workflowName": "inPlaceSoftwareUpdate", + "name": "inPlaceSoftwareUpdate", + "source": "native", + "workflowInputParameters": [ + ] + }] + }); + + $controller.changeManagement.vnfNames = [{modelVersionId: 'test1', name:'test'}]; + $changeManagementService.getWorkflows = () => getWorkflowsStub; + $changeManagementService.getLocalWorkflowParameter = () => getLocalWorkflowsParametersStub; + $changeManagementService.getSOWorkflows = () => getSOWorkflowsPromiseStub; + + return $controller.loadWorkFlows().then(() => { + expect($controller.workflows).toContain('inPlaceSoftwareUpdate'); + expect($controller.localWorkflowsParameters.get('inPlaceSoftwareUpdate')).toEqual([{ + "id": 1, + "name": "Configuration Parameters", + "required": true, + "type": "text", + "pattern": ".*", + "msgOnPatternError": null, + "msgOnContentError": null, + "acceptableFileType": null + }]); + }); +}); }); |