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) <ma926a@us.att.com>
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 @@
 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<Object> = [];
     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 @@
     }
 
     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');
+        }
+    }
+
 }