From 7f0939f148645d3b47653dbee7fadc341b16c1c2 Mon Sep 17 00:00:00 2001 From: "Mohamed Asgar Samiulla(ma926a)" Date: Tue, 17 Apr 2018 15:14:28 +0530 Subject: VM data retrieval from APPC for open stack action VM data retrieval and stopping user not to navigate to PD and template if mandatory fields are missing in reference data. Issue-ID: APPC-853 Change-Id: Id43500579c6d222a2c17a53db9213372afec565f Signed-off-by: Mohamed Asgar Samiulla(ma926a) --- .../build-artifacts/build-artifacts.component.ts | 32 ++++++++++++++++++++-- 1 file changed, 29 insertions(+), 3 deletions(-) (limited to 'src/app/vnfs/build-artifacts/build-artifacts.component.ts') diff --git a/src/app/vnfs/build-artifacts/build-artifacts.component.ts b/src/app/vnfs/build-artifacts/build-artifacts.component.ts index 265fd77..ba88717 100644 --- a/src/app/vnfs/build-artifacts/build-artifacts.component.ts +++ b/src/app/vnfs/build-artifacts/build-artifacts.component.ts @@ -23,14 +23,17 @@ limitations under the License. import { Component, OnInit } from '@angular/core'; import { Router } from '@angular/router'; import * as _ from 'underscore'; +import { NotificationsService } from 'angular2-notifications'; + @Component({ selector: 'app-build-design', templateUrl: './build-artifacts.component.html', styleUrls: ['./build-artifacts.component.css'] }) export class BuildDesignComponent implements OnInit { tabs: Array = []; private allowOtherUpdates: boolean = true; public refDataRequiredFiels: boolean = false; + public refList; - constructor(private router: Router) { + constructor (private router: Router, private notificationsService: NotificationsService) { } ngOnInit() { @@ -81,12 +84,35 @@ export class BuildDesignComponent implements OnInit { } public getRefData(referenceList) { - if (referenceList.action !== '' && referenceList['vnf-type'] !== '' && referenceList['device-protocol'] !== '') { - this.refDataRequiredFiels = true; + this.refList = referenceList; + if(referenceList.action !== '' && referenceList.scope['vnf-type'] !== '' && referenceList['device-protocol'] !== '') { + if(referenceList.action === 'ConfigScaleOut') { + if(referenceList.hasOwnProperty('template-id') && referenceList['template-id'] !== undefined && referenceList['template-id'] != '') + this.refDataRequiredFiels = true; + } + else this.refDataRequiredFiels = true; } else { this.refDataRequiredFiels = false; } } + public checkRefDataReqFields() { + if(this.refList.action == '' && this.refList.scope['vnf-type'] == '' && this.refList['device-protocol'] == '') { + this.notificationsService.error('Error', 'Select Valid Action, VNF Type, Device Protocol'); + } + else if(this.refList.action == '') { + this.notificationsService.error('Error', 'Select a valid Action'); + } + else if(this.refList.scope['vnf-type'] == '') { + this.notificationsService.error('Error', 'Select a valid VNF Type'); + } + else if(this.refList['device-protocol'] == '') { + this.notificationsService.error('Error', 'Select a valid Device Protocol'); + } + else if (this.refList.action === 'ConfigScaleOut') { + this.notificationsService.error('Error', 'Select a valid Template Identifier'); + } + } + } -- cgit 1.2.3-korg