From af56b68e030085aa523152e83811705636ead79c Mon Sep 17 00:00:00 2001 From: asgar Date: Fri, 8 Mar 2019 19:52:33 +0530 Subject: added ansible server functionality multiple ansible server for CDT Issue-ID: APPC-1510 Change-Id: I383bc63705418654efb596c617309821ebbeb9b4 Signed-off-by: Mohamed Asgar Samiulla --- .../vnfs/LoginGuardService/Login-guard-service.ts | 6 +- src/app/vnfs/auth-guard-modal/auth-guard-modal.ts | 4 +- .../build-artifacts/build-artifacts.component.html | 8 +- .../build-artifacts/build-artifacts.component.ts | 49 +- .../parameter-definition.service.ts | 145 +- .../parameter-definitions/parameter.component.html | 7 +- .../parameter-definitions/parameter.component.ts | 118 +- .../reference-dataform.component.css | 6 +- .../reference-dataform.component.html | 100 +- .../reference-dataform.component.ts | 1479 ++++++++++---------- .../reference-dataform/reference-dataform.util.ts | 15 +- .../param-name-value.component.html | 24 +- .../param-name-value/param-name-value.component.ts | 107 +- .../template-configuration.component.css | 13 +- .../template-configuration.component.html | 35 +- .../template-configuration.component.ts | 550 ++++---- src/app/vnfs/myvnfs/myvnfs.component.css | 6 +- src/app/vnfs/myvnfs/myvnfs.component.html | 28 +- src/app/vnfs/myvnfs/myvnfs.component.ts | 67 +- .../userlogin-form/userlogin-form.component.css | 8 +- .../userlogin-form/userlogin-form.component.html | 7 +- .../userlogin-form/userlogin-form.component.ts | 21 + src/app/vnfs/vnfs.module.ts | 74 +- 23 files changed, 1542 insertions(+), 1335 deletions(-) (limited to 'src/app/vnfs') diff --git a/src/app/vnfs/LoginGuardService/Login-guard-service.ts b/src/app/vnfs/LoginGuardService/Login-guard-service.ts index ddec7b5..1e7e752 100644 --- a/src/app/vnfs/LoginGuardService/Login-guard-service.ts +++ b/src/app/vnfs/LoginGuardService/Login-guard-service.ts @@ -24,11 +24,13 @@ limitations under the License. import {ActivatedRouteSnapshot, CanActivate, Router, RouterStateSnapshot} from '@angular/router'; import {Injectable} from '@angular/core'; +import {MappingEditorService} from '../../shared/services/mapping-editor.service'; +import {NgbModal} from '@ng-bootstrap/ng-bootstrap'; @Injectable() export class LoginGuardService implements CanActivate { - constructor(private router: Router) { + constructor(private ngbModal: NgbModal, private mapService: MappingEditorService, private router: Router) { } canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): boolean { @@ -42,4 +44,4 @@ export class LoginGuardService implements CanActivate { } } -} +} \ No newline at end of file diff --git a/src/app/vnfs/auth-guard-modal/auth-guard-modal.ts b/src/app/vnfs/auth-guard-modal/auth-guard-modal.ts index ec03978..3f53d57 100644 --- a/src/app/vnfs/auth-guard-modal/auth-guard-modal.ts +++ b/src/app/vnfs/auth-guard-modal/auth-guard-modal.ts @@ -19,10 +19,10 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. -ECOMP is a trademark and service mark of AT&T Intellectual Property. ============LICENSE_END============================================ */ import {Component, OnInit} from '@angular/core'; +import {NgbActiveModal} from '@ng-bootstrap/ng-bootstrap'; @Component({ selector: 'app-auth-guard-modal', @@ -31,7 +31,7 @@ import {Component, OnInit} from '@angular/core'; }) export class AuthGuardModalComponent implements OnInit { - constructor() { + constructor(public activeModal: NgbActiveModal) { } ngOnInit() { diff --git a/src/app/vnfs/build-artifacts/build-artifacts.component.html b/src/app/vnfs/build-artifacts/build-artifacts.component.html index 33d8064..fad94cb 100644 --- a/src/app/vnfs/build-artifacts/build-artifacts.component.html +++ b/src/app/vnfs/build-artifacts/build-artifacts.component.html @@ -23,9 +23,11 @@ limitations under the License.
-
- + +
- +
@@ -142,7 +143,7 @@ limitations under the License. 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 f7d1837..6ba8e52 100644 --- a/src/app/vnfs/build-artifacts/parameter-definitions/parameter.component.ts +++ b/src/app/vnfs/build-artifacts/parameter-definitions/parameter.component.ts @@ -38,6 +38,7 @@ import 'rxjs/add/operator/map'; import { NgProgress } from 'ngx-progressbar'; import { NgxSpinnerService } from 'ngx-spinner'; import { appConstants } from '../../../../constants/app-constants'; +import { APIService } from "../../../shared/services/cdt.apicall"; let YAML = require('yamljs'); @@ -50,9 +51,11 @@ declare var $: any; providers: [ParameterDefinitionService] }) export class ParameterComponent implements OnInit { + clName= "ParameterCompon"; public paramForm: any; public actionType: any; public showFilterFields: boolean; + public filterByFieldvalues = appConstants.filterByFieldvalues; public ruleTypeConfiguaration = appConstants.ruleTypeConfiguaration; public requiredValues: boolean[] = appConstants.requiredValues; @@ -106,11 +109,12 @@ export class ParameterComponent implements OnInit { public artifactName; public appDataObject: any; public downloadDataObject: any; - public artifact_fileName = ""; + public artifact_fileName=""; template_id: any; private selectedActionReference: any; constructor(private httpService: HttpUtilService, + private apiService:APIService, private parameterDefinitionService: ParameterDefinitionService, private paramShareService: ParamShareService, private mappingEditorService: MappingEditorService, @@ -122,33 +126,26 @@ export class ParameterComponent implements OnInit { } ngOnInit() { - this.selectedActionReference = this.parameterDefinitionService.prepareFileName(); + var methName= "ngOnInit"; + this.selectedActionReference = this.mappingEditorService.newObject; if (this.selectedActionReference && this.selectedActionReference != undefined) { - - this.vnfType = this.selectedActionReference.scope['vnf-type']; - this.vnfcType = this.selectedActionReference.scope['vnfc-type']; - this.protocol = this.selectedActionReference['device-protocol']; - this.action = this.selectedActionReference.action; - - for (let i = 0; i < this.selectedActionReference['artifact-list'].length; i++) { - let artifactList = this.selectedActionReference['artifact-list']; - if (artifactList[i]['artifact-type'] === 'parameter_definitions') { - var artifactName = artifactList[i]['artifact-name']; - var artifactNameWithoutExtension = ''; - if (artifactName) { - artifactNameWithoutExtension = artifactName.substring(0, artifactName.lastIndexOf(".")); - } - if (this.mappingEditorService.identifier) { - if (artifactNameWithoutExtension.endsWith(this.mappingEditorService.identifier)) { - this.artifact_fileName = artifactName; - } - - } - else { - this.artifact_fileName = artifactName; - } - } + this.vnfType = this.selectedActionReference.vnf; + this.protocol = this.selectedActionReference.protocol; + this.action = this.selectedActionReference.action; + if( this.utilService.getTracelvl() > 0 ) + console.log( this.clName+": "+methName+": vnfType:["+this.vnfType+ + "] action:["+this.action+"] protocol:["+this.protocol+"]"); + if(this.selectedActionReference.vnfc) { + this.vnfcType = this.selectedActionReference.vnfc; + if( this.utilService.getTracelvl() > 0 ) + console.log( this.clName+": "+methName+": have vnfcType:["+ + this.vnfcType+"]"); + } + if( this.action === 'ConfigScaleOut'){ + // this.template_id = this.selectedActionReference.templateId; + this.template_id = this.mappingEditorService.identifier; } + this.artifact_fileName = this.selectedActionReference.pd_artifact; this.parameterDefinitionService.setValues(this.vnfType, this.vnfcType, this.protocol, this.action, this.artifact_fileName); } else { @@ -165,22 +162,26 @@ export class ParameterComponent implements OnInit { 'scopeType': '' }; } - - this.template_id = this.mappingEditorService.identifier; + //let path = this.location.path + /* this.activeRoutes.url.subscribe(UrlSegment => { + this.actionType = UrlSegment[0].path + }) + */ } ngAfterViewInit() { - if (this.mappingEditorService.latestAction) { + if( this.mappingEditorService.latestAction) { this.displayParamObjects = []; this.modelParamDefinitionObjects = []; - if (this.paramShareService.getSessionParamData() != undefined && this.paramShareService.getSessionParamData().length > 0) { - this.getPDFromSession(); + this.displayParamObjects= this.paramShareService.getSessionParamData(); + // if( this.paramShareService.getSessionParamData() != undefined && + // this.paramShareService.getSessionParamData().length > 0) + if( this.displayParamObjects != undefined && + this.displayParamObjects.length > 0 ) + { + this.parameterDefinitionService.populateDataUponSource( this.displayParamObjects); } else { - this.ngProgress.start(); - this.getPD(); - setTimeout(() => { - this.ngProgress.done(); - }, 3500); + this.getPD(); } } else { this.nService.error(appConstants.errors.error, appConstants.errors["noAction&VNFTypeInRDscreenError"]); @@ -191,19 +192,20 @@ export class ParameterComponent implements OnInit { public getPD() { let result: any; - let input=this.utilService.createPayloadForRetrieve(false, this.action, this.vnfType,this.artifact_fileName); + let input= + this.utilService.createPayloadForRetrieve( false, this.action, this.vnfType,this.artifact_fileName); let artifactContent: any; - return this.httpService.post({ - url: environment.getDesigns, - data: input - }).subscribe(data => { - if (this.utilService.checkResult(data)) { - let result: any = JSON.parse(data.output.data.block).artifactInfo[0]; + this.ngProgress.start(); + return this.apiService.callGetArtifactsApi(input).subscribe( data => { + if( this.utilService.checkResult(data)) { + let result: any = JSON.parse(data.output.data.block).artifactInfo[0]; var pdObject = YAML.parse(result['artifact-content']); let fileModel = pdObject['vnf-parameter-list']; this.displayParamObjects = this.parameterDefinitionService.populatePD(fileModel); } - + else { + } + this.ngProgress.done(); }, error => this.nService.error(appConstants.errors.error, appConstants.errors.connectionError)); @@ -212,20 +214,19 @@ export class ParameterComponent implements OnInit { public getPDFromSession() { - this.ngProgress.start(); + this.ngProgress.start(); return this.httpService.get({ url: 'testurl', - }).subscribe(data => { - this.displayParamObjects = this.paramShareService.getSessionParamData(); - this.ngProgress.done(); + }).subscribe( data => { + this.displayParamObjects = this.paramShareService.getSessionParamData(); + this.ngProgress.done(); }, - error => { - this.displayParamObjects = this.paramShareService.getSessionParamData(); - this.ngProgress.done(); - }); + error => { + this.displayParamObjects = this.paramShareService.getSessionParamData(); + this.ngProgress.done(); + }); } - //========================== End of NGInit() Method============================================ selectedNavItem(item: any) { this.item = item; } @@ -266,6 +267,10 @@ export class ParameterComponent implements OnInit { // Create the file reader let reader = new FileReader(); this.readFile(input.files[0], reader, (result) => { + if ('keyfile' === uploadType) { + this.myKeyFileName = input.files[0].name; + this.displayParamObjects = this.parameterDefinitionService.processKeyFile(this.myKeyFileName, result); + } if ('pdfile' === uploadType) { this.myPdFileName = input.files[0].name; this.displayParamObjects = this.parameterDefinitionService.processPDfile(this.myPdFileName, result); @@ -294,8 +299,7 @@ export class ParameterComponent implements OnInit { let obj: any = fileInput.target.files; } - - sourceChanged(data, obj) { + sourceChanged( data, obj) { if (data == 'A&AI') { obj.ruleTypeValues = appConstants.ruleTypeValues; for (let x = 0; x < 5; x++) { @@ -317,7 +321,7 @@ export class ParameterComponent implements OnInit { } //========================== End of sourceChanged() Method============================================ - ruleTypeChanged(data, obj) { + ruleTypeChanged( data, obj) { if (data == null || data == undefined || data == 'null') { obj.showFilterFields = false; obj['rule-type'] = null; @@ -340,7 +344,7 @@ export class ParameterComponent implements OnInit { } for (let x = 0; x < sourceObject.length; x++) { obj['response-keys'][x]['key-name'] = sourceObject[x]['key-name']; - obj['response-keys'][x]['key-value'] = sourceObject[x]['key-value']; + obj['response-keys'][x]['key-value'] = sourceObject[x]['key-value']; } } diff --git a/src/app/vnfs/build-artifacts/reference-dataform/reference-dataform.component.css b/src/app/vnfs/build-artifacts/reference-dataform/reference-dataform.component.css index 1b4c470..54e0148 100644 --- a/src/app/vnfs/build-artifacts/reference-dataform/reference-dataform.component.css +++ b/src/app/vnfs/build-artifacts/reference-dataform/reference-dataform.component.css @@ -17,7 +17,6 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. -ECOMP is a trademark and service mark of AT&T Intellectual Property. ============LICENSE_END============================================ */ @@ -134,4 +133,7 @@ td { .file { visibility: hidden; position: absolute; -} \ No newline at end of file +} + +.col-md-1point5 {width: 12%} +.col-md-2point5 {width: 21%;} diff --git a/src/app/vnfs/build-artifacts/reference-dataform/reference-dataform.component.html b/src/app/vnfs/build-artifacts/reference-dataform/reference-dataform.component.html index 564cd32..6225ea0 100644 --- a/src/app/vnfs/build-artifacts/reference-dataform/reference-dataform.component.html +++ b/src/app/vnfs/build-artifacts/reference-dataform/reference-dataform.component.html @@ -44,18 +44,19 @@ limitations under the License. Required Field
-
- +
+ - Add New VNFC Type
+ -
+
@@ -72,16 +73,19 @@ limitations under the License. - +
Assign New Template Identifier + (click)="identifierModal.open()">Assign New Template Identifier
+ +
+
@@ -137,6 +141,7 @@ limitations under the License.
+
VNFC Information @@ -150,15 +155,15 @@ limitations under the License.
- +
-
- +
+
- +
-
+
@@ -198,29 +203,29 @@ limitations under the License.
-
-
+
+
VM Number: {{j+1}}
-
+
- + Required Field
-
- +
+ Required Field
- + - {{errorMessage}} + {{errorMessage}}
@@ -328,45 +333,20 @@ limitations under the License. -