Press n or j to go to the next uncovered block, b, p or k for the previous block.
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 | 1x 1x 1x 1x 1x 1x 3x 3x 4x 3x | import { ChangeDetectionStrategy, Component, OnInit } from '@angular/core';
import { Observable } from 'rxjs';
import { map } from 'rxjs/operators';
import { CostCenter } from 'ish-core/models/cost-center/cost-center.model';
import { GenerateLazyComponent } from 'ish-core/utils/module-loader/generate-lazy-component.decorator';
import { whenTruthy } from 'ish-core/utils/operators';
import { OrganizationManagementFacade } from '../../facades/organization-management.facade';
@GenerateLazyComponent()
@Component({
selector: 'ish-cost-center-widget',
templateUrl: './cost-center-widget.component.html',
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class CostCenterWidgetComponent implements OnInit {
costCenters$: Observable<CostCenter[]>;
loading$: Observable<boolean>;
constructor(private organizationManagementFacade: OrganizationManagementFacade) {}
ngOnInit() {
this.costCenters$ = this.organizationManagementFacade.costCentersOfCurrentUser$().pipe(
whenTruthy(),
map(costCenters => costCenters.slice(0, 3))
);
this.loading$ = this.organizationManagementFacade.costCentersLoading$;
}
}
|