Merge "Product family ID on VNF should be mandatory"
[vid.git] / vid-webpack-master / src / app / shared / components / model-information / model-information.component.ts
1 import {Component, Input} from '@angular/core';
2 import {ModelInformationService} from "./model-information.service";
3
4
5 @Component({
6   selector: 'model-information',
7   templateUrl: 'model-information.html',
8   styleUrls: ['model-information.scss']
9 })
10
11 export class ModelInformationComponent {
12
13   constructor(private _modelInformationService : ModelInformationService){}
14
15   private _modelInformationItems: ModelInformationItem[];
16
17   @Input() itemClass: string = 'item'; //default class for item is "item"
18
19   get modelInformationItems(): ModelInformationItem[] {
20     return this._modelInformationItems;
21   }
22
23   @Input()
24   set modelInformationItems(_modelInformationItems: ModelInformationItem[]) {
25     if (_modelInformationItems) {
26       this._modelInformationItems = this._modelInformationService.filterModelItems(_modelInformationItems);
27     }
28   }
29 }
30
31
32 export class ModelInformationItem {
33   label: string;
34   testsId: string;
35   values: string[];
36   toolTipText: string;
37   mandatory: boolean;
38
39   constructor(label: string, testsId: string, values: any[], toolTipText: string = "", mandatory: boolean = false) {
40     this.label = label;
41     this.testsId = testsId;
42     this.values = values;
43     this.toolTipText = toolTipText;
44     this.mandatory = mandatory;
45   }
46
47   static createInstance(label: string, value: any):ModelInformationItem {
48     return new ModelInformationItem(label, label, [value]);
49   }
50
51 }