diff options
author | Wojciech Sliwka <wojciech.sliwka@nokia.com> | 2019-05-29 11:05:35 +0200 |
---|---|---|
committer | Wojciech Sliwka <wojciech.sliwka@nokia.com> | 2019-05-30 11:50:56 +0000 |
commit | e51b28b3ac10919efc02328c70e5e5898fca0bb8 (patch) | |
tree | aecaa641172e5cddc9d4ec35ab9219b495c8f817 /vid-app-common/src/main/webapp | |
parent | e3c3ba0dc33afe638cd1cade06331b1c5d379295 (diff) |
Initialize parameters maps before reading params
Change-Id: Ie4845c5afc647cae96869609fc665cc4fe854eb8
Issue-ID: VID-484
Signed-off-by: Wojciech Sliwka <wojciech.sliwka@nokia.com>
(cherry picked from commit ac142979f8499af24390290f7800d3fe266583d1)
Diffstat (limited to 'vid-app-common/src/main/webapp')
2 files changed, 5 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 9709e8f32..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,12 +740,10 @@ }; vm.loadRemoteWorkFlowsParameters = function () { - vm.remoteWorkflowsParameters = new Map(); vm.remoteWorkflows.forEach(function(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 709e8ca00..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()); }); }); |