From 3c6a1844083f02796e67fd185306a8d0cdd7da07 Mon Sep 17 00:00:00 2001 From: golabek Date: Thu, 14 Feb 2019 15:13:04 +0100 Subject: Introduced dynamic workflow properties in VID FE VID FE will get workflows from SO API (mocked at this moment),then call SO for the parameters and dynamically render those parameters on the page. (contains PR of @Wojciech Sliwka about mocked parameters API from SO) Change-Id: If2cd156cd96a120e79746a4da44d4926f8d6cbcf Issue-ID: VID-398 Signed-off-by: Tomasz Golabek --- .../new-change-management.controller.js | 41 ++++++++++++++++++---- 1 file changed, 34 insertions(+), 7 deletions(-) (limited to 'vid-app-common/src/main/webapp/app/vid/scripts/modals/new-change-management/new-change-management.controller.js') 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 11f5cd6e5..c85f0fc55 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 @@ -43,6 +43,7 @@ var init = function () { vm.changeManagement = {}; + vm.changeManagement.workflowParameters = new Map(); loadServicesCatalog(); fetchAttUid().then(registerVNFNamesWatcher); @@ -619,11 +620,13 @@ vm.loadWorkFlows = function () { // 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)); - }); + return vm.loadLocalWorkFlows() + .then(vm.loadRemoteWorkFlows) + .then(function () { + vm.workflows = vm.localWorkflows.concat(vm.remoteWorkflows.map(item => item.name)); + }).then(function () { + vm.loadRemoteWorkFlowsParameters(); + }); }; vm.loadLocalWorkFlows = function () { @@ -645,6 +648,30 @@ }); }; + vm.loadRemoteWorkFlowsParameters = function () { + vm.remoteWorkflowsParameters = new Map(); + vm.remoteWorkflows.forEach(function(workflow) { + vm.loadRemoteWorkFlowParameters(workflow); + }); + }; + + vm.loadRemoteWorkFlowParameters = function (workflow) { + changeManagementService.getSOWorkflowParameter(workflow.id) + .then(function (response) { + vm.remoteWorkflowsParameters.set(workflow.name, response.data.parameterDefinitions); + }) + .catch(function (error) { + $log.error(error); + }); + }; + + vm.getRemoteWorkFlowParameters = function (workflow) { + if (workflow && vm.remoteWorkflowsParameters.has(workflow)) { + return vm.remoteWorkflowsParameters.get(workflow) + } + return []; + }; + //Must be $scope because we bind to the onchange of the html (cannot attached to vm variable). $scope.selectFileForVNFName = function (fileInput) { if (fileInput && fileInput.id) { @@ -669,11 +696,11 @@ vm.isConfigUpdate = function () { return vm.changeManagement.workflow === COMPONENT.WORKFLOWS.vnfConfigUpdate; - } + }; vm.isScaleOut = function () { return vm.changeManagement.workflow === COMPONENT.WORKFLOWS.vnfScaleOut; - } + }; vm.shouldShowVnfInPlaceFields = function () { return vm.changeManagement.workflow === COMPONENT.WORKFLOWS.vnfInPlace; -- cgit 1.2.3-korg