aboutsummaryrefslogtreecommitdiffstats
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-28 07:53:17 +0000
commit8140332ee31a1cde9cd60d7ffe6ddb01af8f6037 (patch)
tree72d7a4d4201928cc3cc66b145dbcc21ad87cc255
parent065ca8e7d4851dc30683aed9dfc7771cb9e14d6e (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>
-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
+ }]);
+ });
+});
});