aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgolabek <tomasz.golabek@nokia.com>2019-02-14 15:13:04 +0100
committergolabek <tomasz.golabek@nokia.com>2019-02-22 12:30:24 +0100
commit3c6a1844083f02796e67fd185306a8d0cdd7da07 (patch)
tree4ce0ecaaf6e2c513f88e384d42dc0ce5aa824d22
parentf5f3e8ee869ab0359dd4768f4b6bf554b5cc1371 (diff)
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 <tomasz.golabek@nokia.com>
-rwxr-xr-xdeliveries/src/main/docker/docker-files/docker-compose.yml74
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/controller/WebConfig.java3
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/model/SOWorkflows.kt19
-rwxr-xr-xvid-app-common/src/main/webapp/app/vid/scripts/constants/componentConstants.js1
-rw-r--r--vid-app-common/src/main/webapp/app/vid/scripts/modals/new-change-management/new-change-management.controller.js41
-rw-r--r--vid-app-common/src/main/webapp/app/vid/scripts/modals/new-change-management/new-change-management.controller.test.js27
-rw-r--r--vid-app-common/src/main/webapp/app/vid/scripts/modals/new-change-management/new-change-management.html5
-rw-r--r--vid-app-common/src/main/webapp/app/vid/scripts/services/change-management.service.js7
8 files changed, 123 insertions, 54 deletions
diff --git a/deliveries/src/main/docker/docker-files/docker-compose.yml b/deliveries/src/main/docker/docker-files/docker-compose.yml
index e4bab263b..8d321cfb5 100755
--- a/deliveries/src/main/docker/docker-files/docker-compose.yml
+++ b/deliveries/src/main/docker/docker-files/docker-compose.yml
@@ -1,37 +1,37 @@
-version: '3.2'
-
-# Please note this configuration is provided for local development. Do not use it on production.
-
-services:
- vid-server:
- image: onap/vid:latest
- ports:
- - "8080:8080"
- environment:
- VID_MYSQL_DBNAME: vid_openecomp_epsdk
- VID_MYSQL_PASS: YOUR_PASSWORD
- VID_MYSQL_HOST: vid-mariadb
- ASDC_CLIENT_REST_PROTOCOL: http
- ASDC_CLIENT_REST_HOST: vid-simulator
- ASDC_CLIENT_REST_PORT: 1080
- VID_AAI_URL: http://vid-simulator:1080
- VID_MSO_SERVER_URL: http://vid-simulator:1080
-
- vid-mariadb:
- image: mariadb:10
- ports:
- - "3306:3306"
- volumes:
- - ../../../../../lf_config/vid-my.cnf:/etc/mysql/my.cnf
- - /var/lib/mysql
- environment:
- MYSQL_DATABASE: vid_openecomp_epsdk
- MYSQL_USER: vidadmin
- MYSQL_PASSWORD: YOUR_PASSWORD
- MYSQL_ROOT_PASSWORD: ROOT_PASSWORD
-
- vid-simulator:
- image: onap/vid-simulator:latest
- ports:
- - "9080:8080"
- - "1080:1080"
+version: '3.2'
+
+# Please note this configuration is provided for local development. Do not use it on production.
+
+services:
+ vid-server:
+ image: onap/vid:latest
+ ports:
+ - "8080:8080"
+ environment:
+ VID_MYSQL_DBNAME: vid_openecomp_epsdk
+ VID_MYSQL_PASS: YOUR_PASSWORD
+ VID_MYSQL_HOST: vid-mariadb
+ ASDC_CLIENT_REST_PROTOCOL: http
+ ASDC_CLIENT_REST_HOST: vid-simulator
+ ASDC_CLIENT_REST_PORT: 1080
+ VID_AAI_URL: http://vid-simulator:1080
+ VID_MSO_SERVER_URL: http://vid-simulator:1080
+
+ vid-mariadb:
+ image: mariadb:10
+ ports:
+ - "3306:3306"
+ volumes:
+ - ../../../../../lf_config/vid-my.cnf:/etc/mysql/my.cnf
+ - /var/lib/mysql
+ environment:
+ MYSQL_DATABASE: vid_openecomp_epsdk
+ MYSQL_USER: vidadmin
+ MYSQL_PASSWORD: YOUR_PASSWORD
+ MYSQL_ROOT_PASSWORD: ROOT_PASSWORD
+
+ vid-simulator:
+ image: onap/vid-simulator:latest
+ ports:
+ - "9080:8080"
+ - "1080:1080"
diff --git a/vid-app-common/src/main/java/org/onap/vid/controller/WebConfig.java b/vid-app-common/src/main/java/org/onap/vid/controller/WebConfig.java
index 8fe7c1fa1..2456ebd0f 100644
--- a/vid-app-common/src/main/java/org/onap/vid/controller/WebConfig.java
+++ b/vid-app-common/src/main/java/org/onap/vid/controller/WebConfig.java
@@ -22,6 +22,7 @@
package org.onap.vid.controller;
import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.module.kotlin.KotlinModule;
import io.joshworks.restclient.http.mapper.ObjectMapper;
import org.onap.vid.aai.*;
import org.onap.vid.aai.model.PortDetailsTranslator;
@@ -55,7 +56,7 @@ public class WebConfig {
*/
@Bean
public com.fasterxml.jackson.databind.ObjectMapper getObjectMapper() {
- return new com.fasterxml.jackson.databind.ObjectMapper();
+ return new com.fasterxml.jackson.databind.ObjectMapper().registerModule(new KotlinModule());
}
diff --git a/vid-app-common/src/main/java/org/onap/vid/model/SOWorkflows.kt b/vid-app-common/src/main/java/org/onap/vid/model/SOWorkflows.kt
index 25125cea6..82c720eed 100644
--- a/vid-app-common/src/main/java/org/onap/vid/model/SOWorkflows.kt
+++ b/vid-app-common/src/main/java/org/onap/vid/model/SOWorkflows.kt
@@ -1,21 +1,26 @@
package org.onap.vid.model
-data class SOWorkflow @JvmOverloads constructor(var id: Long? = null, var name: String? = null) {
+data class SOWorkflow constructor(val id: Long, val name: String) {
fun clone(): SOWorkflow {
return copy()
}
}
-data class SOWorkflows @JvmOverloads constructor(var workflows: List<SOWorkflow>? = emptyList()) {
+data class SOWorkflows @JvmOverloads constructor(val workflows: List<SOWorkflow> = emptyList()) {
fun clone(): SOWorkflows {
- return copy(workflows?.toMutableList())
+ return copy(workflows.toMutableList())
}
}
-
-enum class SOWorkflowType(var type: String? = "STRING") {
+enum class SOWorkflowType(val type: String) {
STRING("STRING")
}
-data class SOWorkflowParameterDefinition(var id: Long? = null, var name: String? = null, var pattern: String? = null, var type: SOWorkflowType? = null, val required: Boolean? = null)
-data class SOWorkflowParameterDefinitions(var parameterDefinitions: List<SOWorkflowParameterDefinition>? = null) \ No newline at end of file
+data class SOWorkflowParameterDefinition constructor(val id: Long, val name: String, val pattern: String,
+ val type: SOWorkflowType, val required: Boolean)
+
+data class SOWorkflowParameterDefinitions constructor(val parameterDefinitions: List<SOWorkflowParameterDefinition> = emptyList()) {
+ fun clone(): SOWorkflowParameterDefinitions {
+ return copy(parameterDefinitions.toMutableList())
+ }
+} \ No newline at end of file
diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/constants/componentConstants.js b/vid-app-common/src/main/webapp/app/vid/scripts/constants/componentConstants.js
index 8ee2d062c..dff51ee2b 100755
--- a/vid-app-common/src/main/webapp/app/vid/scripts/constants/componentConstants.js
+++ b/vid-app-common/src/main/webapp/app/vid/scripts/constants/componentConstants.js
@@ -116,6 +116,7 @@ appDS2
CHANGE_MANAGEMENT_OPERATION_NO_SCHEDULER: "change-management/workflow/@vnfName",
GET_WORKFLOW: "change-management/get_vnf_workflow_relation",
GET_SO_WORKFLOWS: "workflows-management/workflows",
+ GET_SO_WORKFLOW_PARAMETER: "workflows-management/workflow-parameters/@workflowID",
GET_MSO_WORKFLOWS: "change-management/mso",
GET_SCHEDULER_CHANGE_MANAGEMENTS: "change-management/scheduler",
CANCEL_SCHEDULE_REQUEST: "change-management/scheduler/schedules",
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;
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 c4b940641..7f21ddaf5 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
@@ -50,7 +50,7 @@ describe('Testing workFlows from SO', () => {
// when
return $controller.loadRemoteWorkFlows()
.then(() => {
- remoteWorkflows = $controller.remoteWorkflows.map(item => item.name)
+ remoteWorkflows = $controller.remoteWorkflows.map(item => item.name);
expect(remoteWorkflows).toContain('workflow 1');
expect(remoteWorkflows).toContain('workflow 2');
}
@@ -61,10 +61,12 @@ describe('Testing workFlows from SO', () => {
// given
let getWorkflowsStub = Promise.resolve({"data": {"workflows": ["workflow 0"]}});
let getSOWorkflowsPromiseStub = Promise.resolve({"data": [{"id": "1", "name": "workflow 1"}, {"id": "2", "name": "workflow 2"}]});
+ let getSOWorkflowsParametersPromiseStub = Promise.resolve({"data":{"parameterDefinitions": []}});
$controller.changeManagement.vnfNames = [{name: 'test1'}, {name: "test2"}];
$changeManagementService.getWorkflows = () => getWorkflowsStub;
$changeManagementService.getSOWorkflows = () => getSOWorkflowsPromiseStub;
+ $changeManagementService.getSOWorkflowParameter = () => getSOWorkflowsParametersPromiseStub;
// when
return $controller.loadWorkFlows().then(() => {
expect($controller.workflows).toContain('workflow 0');
@@ -73,6 +75,29 @@ describe('Testing workFlows from SO', () => {
});
});
+ test('Verify load workflows will call load workflows parameters from SO', () => {
+ // given
+ let getWorkflowsStub = Promise.resolve({"data": {"workflows": ["workflow 0"]}});
+ let getSOWorkflowsPromiseStub = Promise.resolve({"data": [{"id": "1", "name": "workflow 0"}]});
+ let getSOWorkflowsParametersPromiseStub = Promise.resolve({"data":{"parameterDefinitions": [
+ {"id": 1, "name": "parameter 1", "required": true, "type": "STRING", "pattern": "[0-9]*"},
+ {"id": 2, "name": "parameter 2", "required": true, "type": "STRING", "pattern": ".*"},
+ {"id": 3, "name": "parameter 3", "required": false, "type": "STRING", "pattern": "[0-9]*"}]}});
+
+ $controller.changeManagement.vnfNames = [{name: 'test1'}, {name: "test2"}];
+ $changeManagementService.getWorkflows = () => getWorkflowsStub;
+ $changeManagementService.getSOWorkflows = () => getSOWorkflowsPromiseStub;
+ $changeManagementService.getSOWorkflowParameter = () => getSOWorkflowsParametersPromiseStub;
+ // when
+ return $controller.loadWorkFlows()
+ .then(() => {
+ expect($controller.remoteWorkflowsParameters).toEqual(new Map([["workflow 0",
+ [{"id": 1, "name": "parameter 1", "pattern": "[0-9]*", "required": true, "type": "STRING"},
+ {"id": 2, "name": "parameter 2", "pattern": ".*", "required": true, "type": "STRING"},
+ {"id": 3, "name": "parameter 3", "pattern": "[0-9]*", "required": false, "type": "STRING"}]]]));
+ });
+ });
+
test('Verify broken SO workflows wont change content of local workflows', () => {
// given
let getWorkflowsStub = Promise.resolve({"data": {"workflows": ["workflow 0"]}});
diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/modals/new-change-management/new-change-management.html b/vid-app-common/src/main/webapp/app/vid/scripts/modals/new-change-management/new-change-management.html
index 21f9c5d3f..f83a267dc 100644
--- a/vid-app-common/src/main/webapp/app/vid/scripts/modals/new-change-management/new-change-management.html
+++ b/vid-app-common/src/main/webapp/app/vid/scripts/modals/new-change-management/new-change-management.html
@@ -86,7 +86,10 @@
<label class="control-label">New software version</label>
<input class="form-control" ng-model="vm.changeManagement.newSoftwareVersion" name="newSoftwareVersion" type="text" id="new-software-version" pattern="{{vm.softwareVersionRegex}}" required>
</div>
-
+ </div>
+ <div class="form-group" ng-if="vm.changeManagement.workflow" ng-repeat="item in vm.getRemoteWorkFlowParameters(vm.changeManagement.workflow)">
+ <label for="so-workflow-parameter-{{item.id}}" class="control-label">{{item.name}}</label>
+ <input class="form-control" ng-model="item.value" type="text" id="so-workflow-parameter-{{item.id}}" pattern="{{item.pattern}}" ng-required="{{item.required}}">
</div>
</div>
diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/services/change-management.service.js b/vid-app-common/src/main/webapp/app/vid/scripts/services/change-management.service.js
index 699868477..38b85f973 100644
--- a/vid-app-common/src/main/webapp/app/vid/scripts/services/change-management.service.js
+++ b/vid-app-common/src/main/webapp/app/vid/scripts/services/change-management.service.js
@@ -30,6 +30,13 @@
});
};
+ this.getSOWorkflowParameter = function (workflowID){
+ return $http.get(COMPONENT.GET_SO_WORKFLOW_PARAMETER.replace('@workflowID', workflowID))
+ .success(function (response) {
+ return {data: response.parameterDefinitions}
+ });
+ };
+
this.getMSOChangeManagements = function() {
var deferred = $q.defer();