[Appc-1806] Removing INSTAR from CDT for ONAP. 01/36201/1
authorMohamed Asgar Samiulla(ma926a) <ma926a@us.att.com>
Fri, 16 Mar 2018 10:40:26 +0000 (16:10 +0530)
committerMohamed Asgar Samiulla(ma926a) <ma926a@us.att.com>
Fri, 16 Mar 2018 10:57:17 +0000 (16:27 +0530)
The source name for INSTAR made configurable through a property file.

Issue-ID: APPC-750
Change-Id: I7e0d2ae657d4469f6fae54b5358ddb6f5476b211
Signed-off-by: Mohamed Asgar Samiulla(ma926a) <ma926a@us.att.com>
src/app/CDTProperties.json [new file with mode: 0644]
src/app/vnfs/build-artifacts/parameter-definitions/parameter-definition.service.ts
src/app/vnfs/build-artifacts/parameter-definitions/parameter.component.html
src/app/vnfs/build-artifacts/parameter-definitions/parameter.component.ts

diff --git a/src/app/CDTProperties.json b/src/app/CDTProperties.json
new file mode 100644 (file)
index 0000000..b395923
--- /dev/null
@@ -0,0 +1,3 @@
+{
+    "source": "INSTAR"
+}
index 89eeec2..cfcab03 100644 (file)
@@ -63,13 +63,12 @@ export class ParameterDefinitionService {
     private selectedActionReference: any;
     private apiToken = localStorage['apiToken'];
     private userId = localStorage['userId'];
-
+    public configurable_source = require('../../../CDTProperties.json').source;
     constructor(private mappingEditorService: MappingEditorService,
                 private paramShareService: ParamShareService,
                 private nService: NotificationsService,
                 private httpService: HttpUtilService,
                 private utilService: UtilityService) {
-
     }
 
     public initialize() {
@@ -313,7 +312,7 @@ export class ParameterDefinitionService {
         let isValid = true;
         if (undefined != objs || null != objs) {
             for (var i = 0; i < objs.length; i++) {
-                if (objs[i].source == 'INSTAR' && (null == objs[i]['response-keys'] || undefined == objs[i]['response-keys'])) {
+                if (objs[i].source == this.configurable_source && (null == objs[i]['response-keys'] || undefined == objs[i]['response-keys'])) {
                     isValid = false;
                     return isValid;
                 }
@@ -355,7 +354,6 @@ export class ParameterDefinitionService {
             jsonString = jsonString.replace(/"null"/g, 'null');
             let saveModel = JSON.parse(jsonString);
             let pdFileObject = this.processResponseKeys(saveModel);
-            //Validate for Source =INSTAR and responsekeys present
             if (this.isValidateSourceAndResponseKeys(pdFileObject)) {
                 let yamlObject = {
                     'kind': 'Property Definition',
@@ -386,7 +384,7 @@ export class ParameterDefinitionService {
                 for (var i = 0; i < this.modelParamDefinitionObjects.length; i++) {
                     this.formatKeys(this.modelParamDefinitionObjects[i]);
                 }
-                this.nService.error('Error', 'Response Keys cannot be empty if source is INSTAR');
+                this.nService.error('Error', 'Response Keys cannot be empty if source is '+this.configurable_source);
                 return;
             }
             //Restore Keys for display
@@ -437,7 +435,7 @@ export class ParameterDefinitionService {
                 parameterDefinitionObject['source'] = fields[0];
                 parameterDefinitionObject['rule-type'] = fields[1];
             } else {
-                if (parameterDefinitionObject['source'] === 'INSTAR') {
+                if (parameterDefinitionObject['source'] === this.configurable_source) {
                     parameterDefinitionObject['source'] = 'Manual';
                     parameterDefinitionObject['ruleTypeValues'] = [null];
                     parameterDefinitionObject['rule-type'] = null;
index cb02db9..1130c94 100644 (file)
@@ -135,7 +135,7 @@ ECOMP is a trademark and service mark of AT&T Intellectual Property.
                                 <option *ngFor="let src of sourceValues"
                                         [value]="src"
                                         [selected]="src === obj.source"
-                                        [disabled]="src === 'INSTAR'">
+                                        [disabled]="src === configurable_source">
                                     {{src}}
                                 </option>
 
index 2732473..ea22634 100644 (file)
@@ -122,8 +122,9 @@ export class ParameterComponent implements OnInit {
             }
         ]
     };
+    public configurable_source = require('../../../CDTProperties.json').source;
     public requiredValues: boolean[] = [null, true, false];
-    public sourceValues = ['Manual', 'INSTAR', 'A&AI'];
+    public sourceValues = ['Manual', this.configurable_source, 'A&AI'];
     public ruleTypeValues = [null, 'vnf-name', 'vm-name-list', 'vnfc-name-list', 'vnf-oam-ipv4-address', 'vnfc-oam-ipv4-address-list'];
     public typeValues = [null, 'ipv4-address', 'ipv6-address', 'ipv4-prefix', 'ipv6-prefix'];
     public responseKeyNameValues = ['', 'unique-key-name', 'unique-key-value', 'field-key-name'];
@@ -190,8 +191,6 @@ export class ParameterComponent implements OnInit {
     identifier: any;
     private selectedActionReference: any;
 
-    //this.mappingeditorservice.referenceNameObjects = object;PLEASE USE THIS OBJECT TO GET TEMPALLDATA
-
     constructor (private httpService: HttpUtilService,
         private parameterDefinitionService: ParameterDefinitionService,
         private paramShareService: ParamShareService,
@@ -234,11 +233,6 @@ export class ParameterComponent implements OnInit {
             };
         }
 
-        //let path = this.location.path
-        /* this.activeRoutes.url.subscribe(UrlSegment => {
-             this.actionType = UrlSegment[0].path
-         })
-         */
         this.identifier = this.mappingEditorService.identifier;
     }
 
@@ -353,7 +347,6 @@ export class ParameterComponent implements OnInit {
             // callback with the results
             callback(reader.result);
         };
-        //this.notificationService.notifySuccessMessage('Uploading File ' + file.name + ':' + file.type + ':' + file.size);
         // Read the file
         reader.readAsText(file, 'UTF-8');
     }