From 9d5e8e703674224e87f972dea22900b20db9df49 Mon Sep 17 00:00:00 2001 From: Arundathi Patil Date: Tue, 17 Jul 2018 15:46:17 +0530 Subject: Removed hard coded values Moved all the constant values in parameter component to app-Constants file. Issue-ID: APPC-1054 Change-Id: I507cc0a4aa8ddc8d6d42e97129b21a235b96b225 Signed-off-by: Arundathi Patil --- .../parameter-definitions/parameter.component.ts | 152 +++++---------------- 1 file changed, 35 insertions(+), 117 deletions(-) (limited to 'src/app/vnfs/build-artifacts/parameter-definitions/parameter.component.ts') diff --git a/src/app/vnfs/build-artifacts/parameter-definitions/parameter.component.ts b/src/app/vnfs/build-artifacts/parameter-definitions/parameter.component.ts index 6c8be91..20204fd 100644 --- a/src/app/vnfs/build-artifacts/parameter-definitions/parameter.component.ts +++ b/src/app/vnfs/build-artifacts/parameter-definitions/parameter.component.ts @@ -2,6 +2,8 @@ ============LICENSE_START========================================== =================================================================== Copyright (C) 2018 AT&T Intellectual Property. All rights reserved. + +Copyright (C) 2018 IBM Intellectual Property. All rights reserved. =================================================================== Copyright (C) 2018 IBM. =================================================================== @@ -35,6 +37,7 @@ import { ParameterDefinitionService } from './parameter-definition.service'; import 'rxjs/add/operator/map'; import { NgProgress } from 'ngx-progressbar'; import { NgxSpinnerService } from 'ngx-spinner'; +import { appConstants } from '../../../../constants/app-constants'; let YAML = require('yamljs'); @@ -50,87 +53,16 @@ export class ParameterComponent implements OnInit { public paramForm: any; public actionType: any; public showFilterFields: boolean; - public filterByFieldvalues = [null, 'vm-number', 'vnfc-function-code']; - public ruleTypeConfiguaration = { - 'vnf-name': [ - { - 'key-name': 'unique-key-name', - 'key-value': 'parent-name' - }, - { - 'key-name': 'unique-key-value', - 'key-value': 'vnf' - }, - { - 'key-name': 'field-key-name', - 'key-value': 'vnf-name' - } - ], - 'vm-name-list': [ - { - 'key-name': 'unique-key-name', - 'key-value': 'parent-name' - }, - { - 'key-name': 'unique-key-value', - 'key-value': 'vserver' - }, - { - 'key-name': 'field-key-name', - 'key-value': 'vserver-name' - } - ], - 'vnfc-name-list': [ - { - 'key-name': 'unique-key-name', - 'key-value': 'parent-name' - }, - { - 'key-name': 'unique-key-value', - 'key-value': 'vnfc' - }, - { - 'key-name': 'field-key-name', - 'key-value': 'vnfc-name' - } - ], - 'vnf-oam-ipv4-address': [ - { - 'key-name': 'unique-key-name', - 'key-value': 'parent-name' - }, - { - 'key-name': 'unique-key-value', - 'key-value': 'vnf' - }, - { - 'key-name': 'field-key-name', - 'key-value': 'ipv4-oam-ipaddress' - } - ], - 'vnfc-oam-ipv4-address-list': [ - { - 'key-name': 'unique-key-name', - 'key-value': 'parent-name' - }, - { - 'key-name': 'unique-key-value', - 'key-value': 'vnfc' - }, - { - 'key-name': 'field-key-name', - 'key-value': 'ipaddress-v4-oam-vip' - } - ] - }; - public requiredValues: boolean[] = [null, true, false]; - public sourceValues = ['Manual', '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']; - public responseKeyValues = ['(none)', 'addressfqdn', 'ipaddress-v4', 'ipaddress-v6']; - public requestKeyNameValues = ['']; - public requestKeyValues = ['', '(none)']; + public filterByFieldvalues = appConstants.filterByFieldvalues; + public ruleTypeConfiguaration = appConstants.ruleTypeConfiguaration; + public requiredValues: boolean[] = appConstants.requiredValues; + public sourceValues = appConstants.sourceValues; + public ruleTypeValues = appConstants.ruleTypeValues; + public typeValues = appConstants.typeValues; + public responseKeyNameValues = appConstants.responseKeyNameValues; + public responseKeyValues = appConstants.responseKeyValues; + public requestKeyNameValues = appConstants.requestKeyNameValues; + public requestKeyValues = appConstants.requestKeyValues; public myKeyFileName = null; public myPdFileName = null; public disposable: any; @@ -145,32 +77,18 @@ export class ParameterComponent implements OnInit { public item: any = {}; public subscription: any; public Actions = [ - { action: 'ConfigBackup', value: 'ConfigBackup' }, - { action: 'ConfigModify', value: 'ConfigModify' }, - { action: 'ConfigRestore', value: 'ConfigRestore' }, - { action: 'Configure', value: 'Configure' }, - { action: 'GetRunningConfig', value: 'GetRunningConfig' }, - { action: 'HealthCheck', value: 'HealthCheck' }, - { action: 'StartApplication', value: 'StartApplication' }, - { action: 'StopApplication', value: 'StopApplication' } - ]; - public uploadTypes = [{ - value: 'External Key File', - display: 'KeyFile' - }, - { - value: 'Pd File', - display: 'Pd File' - } + { action: appConstants.Actions.configBackup, value: appConstants.Actions.configBackup }, + { action: appConstants.Actions.ConfigModify, value: appConstants.Actions.ConfigModify }, + { action: appConstants.Actions.configRestore, value: appConstants.Actions.configRestore }, + { action: appConstants.Actions.configure, value: appConstants.Actions.configure }, + { action: appConstants.Actions.getRunningConfig, value: appConstants.Actions.getRunningConfig }, + { action: appConstants.Actions.healthCheck, value: appConstants.Actions.healthCheck }, + { action: appConstants.Actions.startApplication, value: appConstants.Actions.startApplication }, + { action: appConstants.Actions.stopApplication, value: appConstants.Actions.stopApplication } ]; + public uploadTypes = appConstants.uploadTypes; - options = { - timeOut: 1000, - showProgressBar: true, - pauseOnHover: true, - clickToClose: true, - maxLength: 200 - }; + options = appConstants.optionsToNotificationComponent; public vnfcTypeData: string = ''; public selectedUploadType: string; @ViewChild(ModalComponent) modalComponent: ModalComponent; @@ -187,7 +105,7 @@ export class ParameterComponent implements OnInit { public artifactName; public appDataObject: any; public downloadDataObject: any; - public artifact_fileName=""; + public artifact_fileName = ""; identifier: any; private selectedActionReference: any; @@ -219,8 +137,8 @@ export class ParameterComponent implements OnInit { if (artifactName) { artifactNameWithoutExtension = artifactName.substring(0, artifactName.lastIndexOf(".")); } - if(this.mappingEditorService.identifier) { - if(artifactNameWithoutExtension.endsWith(this.mappingEditorService.identifier)) { + if (this.mappingEditorService.identifier) { + if (artifactNameWithoutExtension.endsWith(this.mappingEditorService.identifier)) { this.artifact_fileName = artifactName; } @@ -264,7 +182,7 @@ export class ParameterComponent implements OnInit { }, 3500); } } else { - this.nService.error('Error', 'Please enter Action and VNF type in Reference Data screen'); + this.nService.error(appConstants.errors.error, appConstants.errors["noAction&VNFTypeInRDscreenError"]); } return this.displayParamObjects; } @@ -295,22 +213,22 @@ export class ParameterComponent implements OnInit { }, - error => this.nService.error('Error', 'Error in connecting APPC Server')); - + error => this.nService.error(appConstants.errors.error, appConstants.errors.connectionError)); + } public getPDFromSession() { - + this.ngProgress.start(); return this.httpService.get({ url: 'testurl', }).subscribe(data => { - this.displayParamObjects = this.paramShareService.getSessionParamData(); + this.displayParamObjects = this.paramShareService.getSessionParamData(); this.ngProgress.done(); }, error => { - this.displayParamObjects = this.paramShareService.getSessionParamData(); - this.ngProgress.done(); + this.displayParamObjects = this.paramShareService.getSessionParamData(); + this.ngProgress.done(); }); } @@ -386,7 +304,7 @@ export class ParameterComponent implements OnInit { sourceChanged(data, obj) { if (data == 'A&AI') { - obj.ruleTypeValues = [null, 'vnf-name', 'vm-name-list', 'vnfc-name-list', 'vnf-oam-ipv4-address', 'vnfc-oam-ipv4-address-list']; + obj.ruleTypeValues = appConstants.ruleTypeValues; for (let x = 0; x < 5; x++) { obj['response-keys'][x]['key-name'] = null; obj['response-keys'][x]['key-value'] = null; @@ -447,4 +365,4 @@ export class ParameterComponent implements OnInit { } -} \ No newline at end of file +} -- cgit 1.2.3-korg