summaryrefslogtreecommitdiffstats
path: root/vid-app-common/src/main
diff options
context:
space:
mode:
authorWojciech Sliwka <wojciech.sliwka@nokia.com>2019-05-27 17:39:44 +0200
committerWojciech Sliwka <wojciech.sliwka@nokia.com>2019-05-29 06:09:11 +0000
commite3c3ba0dc33afe638cd1cade06331b1c5d379295 (patch)
treefa9ca34fb6997e2a2ba738b16b7b868924b62b03 /vid-app-common/src/main
parentbd42250f5046225cfb155d004c839eb9e1de1899 (diff)
fetch parameters for native workflows
SO api for retrieving workflows won't return parameters for workflow marked as native due to high impact on existing code. In that case VID will fetch parameters from internal API Issue-ID: VID-484 Change-Id: I7577afa3832c96b523daae01895a249d6ea86e65 Signed-off-by: Wojciech Sliwka <wojciech.sliwka@nokia.com> (cherry picked from commit 8140332ee31a1cde9cd60d7ffe6ddb01af8f6037)
Diffstat (limited to 'vid-app-common/src/main')
-rw-r--r--vid-app-common/src/main/webapp/app/vid/scripts/modals/new-change-management/new-change-management.controller.js7
-rw-r--r--vid-app-common/src/main/webapp/app/vid/scripts/modals/new-change-management/new-change-management.controller.test.js47
2 files changed, 53 insertions, 1 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..9709e8f32 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
@@ -742,7 +742,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.localWorkflowsParameters = new Map();
+ 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..709e8ca00 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
@@ -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
+ }]);
+ });
+});
});