1 import {Injectable} from '@angular/core';
2 import * as _ from "lodash";
3 import {ServicePlanningService} from "../../services/service-planning.service";
6 export class AvailableModelsTreeService {
7 constructor(private _servicePlanningService: ServicePlanningService) {
10 shouldShowAddIcon(node: any, serviceHierarchy: any, serviceModelId: string, currentNodeCount: number): boolean {
11 let maxNodes: number = 1;
12 if (node.data.children !== null && node.data.children.length == 0) {
13 let vnfModules = serviceHierarchy[serviceModelId].vfModules;
14 if (vnfModules[node.data.name]) {
15 maxNodes = vnfModules[node.data.name].properties.maxCountInstances || 1;
18 return !node.data.disabled && currentNodeCount < maxNodes
21 shouldOpenDialog(type: string, dynamicInputs: any, userProvidedNaming: boolean): boolean {
22 if (userProvidedNaming || this._servicePlanningService.requiredFields[type].length > 0) {
27 for(let input of dynamicInputs) {
28 if (input.isRequired && _.isEmpty(input.value)) {