diff options
author | 2018-08-29 17:01:32 +0300 | |
---|---|---|
committer | 2019-02-18 18:35:30 +0200 | |
commit | 6f900cc45d7dd7f97430812b86b5c1d1693c8ae3 (patch) | |
tree | 936005c364dc5a7264d6304d4777c3d83494db22 /vid-webpack-master/src/app/shared/components/model-information/model-information.component.ts | |
parent | 67d99f816cc583643c35193197594cf78d8ce60a (diff) |
merge from ecomp a88f0072 - Modern UI
Issue-ID: VID-378
Change-Id: Ibcb23dd27f550cf32ce2fe0239f0f496ae014ff6
Signed-off-by: Ittay Stern <ittay.stern@att.com>
Diffstat (limited to 'vid-webpack-master/src/app/shared/components/model-information/model-information.component.ts')
-rw-r--r-- | vid-webpack-master/src/app/shared/components/model-information/model-information.component.ts | 23 |
1 files changed, 16 insertions, 7 deletions
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<ModelInformationItem>; + constructor(private _modelInformationService : ModelInformationService){} + + private _modelInformationItems: ModelInformationItem[]; + + @Input() itemClass: string = 'item'; //default class for item is "item" - get modelInformationItems(): Array<ModelInformationItem> { + get modelInformationItems(): ModelInformationItem[] { return this._modelInformationItems; } @Input() - set modelInformationItems(_modelInformationItems: Array<ModelInformationItem>) { + 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<string>; + values: string[]; toolTipText: string; mandatory: boolean; - constructor(label: string, testsId: string, values: Array<any>, 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]); + } + } |