aboutsummaryrefslogtreecommitdiffstats
path: root/vid-webpack-master/src/app/shared/components/model-information/model-information.component.ts
blob: 9401aca05cfb1555296fdb37bb3ca8463da71b2b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import {Component, Input} from '@angular/core';
import {ModelInformationService} from "./model-information.service";


@Component({
  selector: 'model-information',
  templateUrl: 'model-information.html',
  styleUrls: ['model-information.scss']
})

export class ModelInformationComponent {

  constructor(private _modelInformationService : ModelInformationService){}

  private _modelInformationItems: ModelInformationItem[];

  @Input() itemClass: string = 'item'; //default class for item is "item"

  get modelInformationItems(): ModelInformationItem[] {
    return this._modelInformationItems;
  }

  @Input()
  set modelInformationItems(_modelInformationItems: ModelInformationItem[]) {
    if (_modelInformationItems) {
      this._modelInformationItems = this._modelInformationService.filterModelItems(_modelInformationItems);
    }
  }
}


export class ModelInformationItem {
  label: string;
  testsId: string;
  values: string[];
  toolTipText: string;
  mandatory: boolean;

  constructor(label: string, testsId: string, values: any[], toolTipText: string = "", mandatory: boolean = false) {
    this.label = label;
    this.testsId = testsId;
    this.values = values;
    this.toolTipText = toolTipText;
    this.mandatory = mandatory;
  }

  static createInstance(label: string, value: any):ModelInformationItem {
    return new ModelInformationItem(label, label, [value]);
  }

}