diff options
author | Ittay Stern <ittay.stern@att.com> | 2019-02-18 13:05:06 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2019-02-18 13:05:06 +0000 |
commit | 36baada47134d2e6915baad5627d14d26e4c35ef (patch) | |
tree | f9175c70a9be28ddfc589dcfabc66ab00b9554b4 /vid-app-common/src/main/webapp/app/vid/scripts/modals/new-change-management/new-change-management.controller.js | |
parent | 2cfbe3407713a48fb81783ae2a560c5fe6face5e (diff) | |
parent | e3f8c6d9b3ff4b9c9b82c795a791ea9b5a014c98 (diff) |
Merge "Introduced mocked SO workflows in VID FE"
Diffstat (limited to 'vid-app-common/src/main/webapp/app/vid/scripts/modals/new-change-management/new-change-management.controller.js')
-rw-r--r-- | vid-app-common/src/main/webapp/app/vid/scripts/modals/new-change-management/new-change-management.controller.js | 33 |
1 files changed, 26 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 9a758cc73..11f5cd6e5 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 @@ -617,13 +617,32 @@ }; vm.loadWorkFlows = function () { - changeManagementService.getWorkflows(vm.changeManagement.vnfNames) - .then(function(response) { - vm.workflows = response.data.workflows; - }) - .catch(function(error) { - $log.error(error); - }); + // Should be corrected when VID-397 will be closed. At the moment there is a need + // to merge local and remote workflows not to broke current functionality. + return vm.loadLocalWorkFlows() + .then(vm.loadRemoteWorkFlows) + .then(function () { + vm.workflows = vm.localWorkflows.concat(vm.remoteWorkflows.map(item => item.name)); + }); + }; + + vm.loadLocalWorkFlows = function () { + return changeManagementService.getWorkflows(vm.changeManagement.vnfNames) + .then(function (response) { + vm.localWorkflows = response.data.workflows || []; + }).catch(function (error) { + $log.error(error); + }); + }; + + vm.loadRemoteWorkFlows = function () { + let vnfNames = vm.changeManagement.vnfNames.map(vnfName => vnfName.name); + return changeManagementService.getSOWorkflows(vnfNames) + .then(function (response) { + vm.remoteWorkflows = response.data || []; + }).catch(function (error) { + $log.error(error); + }); }; //Must be $scope because we bind to the onchange of the html (cannot attached to vm variable). |