diff options
author | Arundathi Patil <arundpil@in.ibm.com> | 2018-07-17 15:46:17 +0530 |
---|---|---|
committer | Takamune Cho <tc012c@att.com> | 2018-07-24 14:47:06 +0000 |
commit | 9d5e8e703674224e87f972dea22900b20db9df49 (patch) | |
tree | a029847298aa3c5a0c3a4b936469e6a282355d38 /src | |
parent | 465d29eba2c191e768963a1987819b8f72e9e7c8 (diff) |
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<arundpil@in.ibm.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/app/vnfs/build-artifacts/parameter-definitions/parameter.component.ts | 152 | ||||
-rw-r--r-- | src/constants/app-constants.ts | 191 |
2 files changed, 177 insertions, 166 deletions
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 +} diff --git a/src/constants/app-constants.ts b/src/constants/app-constants.ts index dc39068..0f44f0f 100644 --- a/src/constants/app-constants.ts +++ b/src/constants/app-constants.ts @@ -23,56 +23,149 @@ limitations under the License. export const appConstants = { - "errors": { - "error": "Error", - "noActionVnfProtocolError": "Select Valid Action, VNF Type, Device Protocol", - "noActionError": "Select a valid Action", - "noVnfTypeError": "Select a valid VNF Type", - "noDeviceProtocolError": "Select a valid Device Protocol", - "noValidTemplateIdentifierError": "Select a valid Template Identifier" - }, - "tabs": [ + "errors": { + "error": "Error", + "noActionVnfProtocolError": "Select Valid Action, VNF Type, Device Protocol", + "noActionError": "Select a valid Action", + "noVnfTypeError": "Select a valid VNF Type", + "noDeviceProtocolError": "Select a valid Device Protocol", + "noValidTemplateIdentifierError": "Select a valid Template Identifier", + "noAction&VNFTypeInRDscreenError": "Please enter Action and VNF type in Reference Data screen", + "connectionError": "Error in connecting APPC Server" + }, + "tabs": [ + { + type: 'dropdown', + name: 'Reference Data', + url: 'references', + }, { + name: 'Template', + type: 'dropdown', + url: 'templates/myTemplates', + }, { + name: 'Parameter Definition', + type: 'dropdown', + url: 'parameterDefinitions/create' + } + ], + "Actions": { + "blank": '', + "configure": "Configure", + "ConfigModify": "ConfigModify", + "configBackup": "ConfigBackup", + "configRestore": "ConfigRestore", + "getRunningConfig": "GetRunningConfig", + "healthCheck": "HealthCheck", + "startApplication": "StartApplication", + "stopApplication": "StopApplication", + "quiesceTraffic": "QuiesceTraffic", + "resumeTraffic": "ResumeTraffic", + "upgradeBackout": "UpgradeBackout", + "upgradeBackup": "UpgradeBackup", + "upgradePostCheck": "UpgradePostCheck", + "upgradePreCheck": "UpgradePreCheck", + "upgradeSoftware": "UpgradeSoftware", + "openStackActions": "OpenStack Actions", + "configScaleOut": "ConfigScaleOut" + }, + "DeviceProtocols": { + "blank": '', + "ansible": "ANSIBLE", + "chef": "CHEF", + "netconfXML": "NETCONF-XML", + "rest": "REST", + "cli": "CLI", + "restConf": "RESTCONF" + }, + "ruleTypeConfiguaration": { + 'vnf-name': [ + { + 'key-name': 'unique-key-name', + 'key-value': 'parent-name' + }, + { + 'key-name': 'unique-key-value', + 'key-value': 'vnf' + }, { - type: 'dropdown', - name: 'Reference Data', - url: 'references', - }, { - name: 'Template', - type: 'dropdown', - url: 'templates/myTemplates', - }, { - name: 'Parameter Definition', - type: 'dropdown', - url: 'parameterDefinitions/create' + 'key-name': 'field-key-name', + 'key-value': 'vnf-name' } ], - "Actions" : { - "blank" : '', - "configure" : "Configure", - "ConfigModify" : "ConfigModify", - "configBackup" : "ConfigBackup", - "configRestore" : "ConfigRestore", - "getRunningConfig" : "GetRunningConfig", - "healthCheck" : "HealthCheck", - "startApplication" : "StartApplication", - "stopApplication" : "StopApplication", - "quiesceTraffic" : "QuiesceTraffic", - "resumeTraffic" : "ResumeTraffic", - "upgradeBackout" : "UpgradeBackout", - "upgradeBackup" : "UpgradeBackup", - "upgradePostCheck" : "UpgradePostCheck", - "upgradePreCheck" : "UpgradePreCheck", - "upgradeSoftware" : "UpgradeSoftware", - "openStackActions" : "OpenStack Actions", - "configScaleOut" : "ConfigScaleOut" - }, - "DeviceProtocols" : { - "blank" : '', - "ansible" : "ANSIBLE", - "chef" : "CHEF", - "netconfXML" : "NETCONF-XML", - "rest" : "REST", - "cli" : "CLI", - "restConf" : "RESTCONF" - } + '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' + } + ] + }, + "ruleTypeValues": [null, 'vnf-name', 'vm-name-list', 'vnfc-name-list', 'vnf-oam-ipv4-address', 'vnfc-oam-ipv4-address-list'], + "typeValues": [null, 'ipv4-address', 'ipv6-address', 'ipv4-prefix', 'ipv6-prefix'], + "responseKeyNameValues": ['', 'unique-key-name', 'unique-key-value', 'field-key-name'], + "responseKeyValues": ['(none)', 'addressfqdn', 'ipaddress-v4', 'ipaddress-v6'], + "requestKeyNameValues": [''], + "requestKeyValues": ['', '(none)'], + "sourceValues": ['Manual', 'A&AI'], + "filterByFieldvalues": [null, 'vm-number', 'vnfc-function-code'], + "requiredValues": [null, true, false], + "uploadTypes": [{ value: 'External Key File', display: 'KeyFile' }, + { value: 'Pd File', display: 'Pd File' } + ], + "optionsToNotificationComponent": { + timeOut: 1000, + showProgressBar: true, + pauseOnHover: true, + clickToClose: true, + maxLength: 200 + } };
\ No newline at end of file |