fea4c44c74f8ab9ccad44121b6656171c50a1f45
[vid.git] / vid-webpack-master / src / app / shared / components / model-information / model-information.component.ts
1 import {Component, Input} from '@angular/core';
2 import * as _ from 'lodash';
3
4 @Component({
5   selector: 'model-information',
6   templateUrl: 'model-information.html',
7   styleUrls: ['model-information.scss']
8 })
9
10 export class ModelInformationComponent {
11   private _modelInformationItems: Array<ModelInformationItem>;
12
13
14   get modelInformationItems(): Array<ModelInformationItem> {
15     return this._modelInformationItems;
16   }
17
18   @Input()
19   set modelInformationItems(_modelInformationItems: Array<ModelInformationItem>) {
20     if (_modelInformationItems) {
21       this._modelInformationItems = _modelInformationItems.filter(x => x.mandatory || (!_.isEmpty(x.values) && !_.isEmpty(x.values[0])));
22     }
23   }
24 }
25
26
27 export class ModelInformationItem {
28   label: string;
29   testsId: string;
30   values: Array<string>;
31   toolTipText: string;
32   mandatory: boolean;
33
34   constructor(label: string, testsId: string, values: Array<any>, toolTipText: string = "", mandatory: boolean = false,nested:boolean=false) {
35     this.label = label;
36     this.testsId = testsId;
37     this.values = values;
38     this.toolTipText = toolTipText;
39     this.mandatory = mandatory;
40   }
41
42 }