From 6f900cc45d7dd7f97430812b86b5c1d1693c8ae3 Mon Sep 17 00:00:00 2001 From: Ittay Stern Date: Wed, 29 Aug 2018 17:01:32 +0300 Subject: merge from ecomp a88f0072 - Modern UI Issue-ID: VID-378 Change-Id: Ibcb23dd27f550cf32ce2fe0239f0f496ae014ff6 Signed-off-by: Ittay Stern --- .../model-information.component.ts | 23 +++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) (limited to 'vid-webpack-master/src/app/shared/components/model-information/model-information.component.ts') diff --git a/vid-webpack-master/src/app/shared/components/model-information/model-information.component.ts b/vid-webpack-master/src/app/shared/components/model-information/model-information.component.ts index fea4c44c7..9401aca05 100644 --- a/vid-webpack-master/src/app/shared/components/model-information/model-information.component.ts +++ b/vid-webpack-master/src/app/shared/components/model-information/model-information.component.ts @@ -1,5 +1,6 @@ import {Component, Input} from '@angular/core'; -import * as _ from 'lodash'; +import {ModelInformationService} from "./model-information.service"; + @Component({ selector: 'model-information', @@ -8,17 +9,21 @@ import * as _ from 'lodash'; }) export class ModelInformationComponent { - private _modelInformationItems: Array; + constructor(private _modelInformationService : ModelInformationService){} + + private _modelInformationItems: ModelInformationItem[]; + + @Input() itemClass: string = 'item'; //default class for item is "item" - get modelInformationItems(): Array { + get modelInformationItems(): ModelInformationItem[] { return this._modelInformationItems; } @Input() - set modelInformationItems(_modelInformationItems: Array) { + set modelInformationItems(_modelInformationItems: ModelInformationItem[]) { if (_modelInformationItems) { - this._modelInformationItems = _modelInformationItems.filter(x => x.mandatory || (!_.isEmpty(x.values) && !_.isEmpty(x.values[0]))); + this._modelInformationItems = this._modelInformationService.filterModelItems(_modelInformationItems); } } } @@ -27,11 +32,11 @@ export class ModelInformationComponent { export class ModelInformationItem { label: string; testsId: string; - values: Array; + values: string[]; toolTipText: string; mandatory: boolean; - constructor(label: string, testsId: string, values: Array, toolTipText: string = "", mandatory: boolean = false,nested:boolean=false) { + constructor(label: string, testsId: string, values: any[], toolTipText: string = "", mandatory: boolean = false) { this.label = label; this.testsId = testsId; this.values = values; @@ -39,4 +44,8 @@ export class ModelInformationItem { this.mandatory = mandatory; } + static createInstance(label: string, value: any):ModelInformationItem { + return new ModelInformationItem(label, label, [value]); + } + } -- cgit 1.2.3-korg