blob: 2876362e2bba3f0558aea6d8399160ec4bf79fce [file] [log] [blame]
Sonsino, Ofir (os0695)ff76b5e2018-07-10 15:57:37 +03001import {PipeTransform, Pipe} from '@angular/core';
Ittay Stern6f900cc2018-08-29 17:01:32 +03002import * as _ from 'lodash';
Sonsino, Ofir (os0695)ff76b5e2018-07-10 15:57:37 +03003
4@Pipe({ name: 'serviceInfo'})
5export class ServiceInfoPipe implements PipeTransform {
6 transform(service: string, store : any , modelId : string, fieldName : string): string {
7 const serviceHierarchy = store.getState().service.serviceHierarchy;
Ittay Stern6f900cc2018-08-29 17:01:32 +03008 if(!_.isNil(serviceHierarchy) && !_.isNil(serviceHierarchy[modelId])){
Sonsino, Ofir (os0695)ff76b5e2018-07-10 15:57:37 +03009 return serviceHierarchy[modelId].service[fieldName] || null;
10 }
11 return null;
12 }
13}