taurus-tv/src/app/tsp-info/tr-flow-errors/tr-flow-errors.component.ts
2017-09-08 09:43:50 +02:00

32 lines
772 B
TypeScript

import {Component, Input, OnInit} from '@angular/core';
import {InfoBoxComponent} from "../info-box/info-box.component";
import {TrFlowError} from "../shared/tr-flow-error.model";
@Component({
selector: 'app-tr-flow-errors',
templateUrl: './tr-flow-errors.component.html',
styleUrls: [
'../info-box/info-box.component.css',
'./tr-flow-errors.component.css'
]
})
export class TrFlowErrorsComponent extends InfoBoxComponent implements OnInit {
@Input() data: Array<TrFlowError> = [];
constructor() {
super();
}
ngOnInit() {
}
get errorSum(): number {
return this.data.reduce((sum: number, flowError: TrFlowError) => sum + flowError.value, 0);
}
get widgetClass(): string {
return this.data.length ? 'warn' : 'ok';
}
}