All files / src/app/extensions/order-templates/pages/account-order-template account-order-template-page.component.ts

87.5% Statements 7/8
75% Branches 3/4
66.66% Functions 2/3
87.5% Lines 7/8

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 32 33 34 35 36 37 38 39 40 411x         1x               1x                           1x     1x 1x 1x                
import { ChangeDetectionStrategy, Component, OnInit } from '@angular/core';
import { Observable } from 'rxjs';
 
import { HttpError } from 'ish-core/models/http-error/http-error.model';
 
import { OrderTemplatesFacade } from '../../facades/order-templates.facade';
import { OrderTemplate } from '../../models/order-template/order-template.model';
 
@Component({
  selector: 'ish-account-order-template-page',
  templateUrl: './account-order-template-page.component.html',
  changeDetection: ChangeDetectionStrategy.OnPush,
})
export class AccountOrderTemplatePageComponent implements OnInit {
  /**
   * The list of order templates of the customer.
   */
  orderTemplates$: Observable<OrderTemplate[]>;
  /**
   * Indicator for loading state of order templates
   */
  orderTemplateLoading$: Observable<boolean>;
  /**
   * Error state in case of an error during creation of a new order template.
   */
  orderTemplateError$: Observable<HttpError>;
 
  constructor(private orderTemplatesFacade: OrderTemplatesFacade) {}
 
  ngOnInit() {
    this.orderTemplates$ = this.orderTemplatesFacade.orderTemplates$;
    this.orderTemplateLoading$ = this.orderTemplatesFacade.orderTemplateLoading$;
    this.orderTemplateError$ = this.orderTemplatesFacade.orderTemplateError$;
  }
 
  /** dispatch creation request */
  addOrderTemplate(orderTemplate: OrderTemplate) {
    this.orderTemplatesFacade.addOrderTemplate(orderTemplate);
  }
}