All files / lib/fullscreen-message fullscreen-message.component.ts

88.07% Statements 96/109
100% Branches 8/8
55.55% Functions 5/9
88.07% Lines 96/109

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 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 1101x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x       5x 5x     5x 5x 5x 22x 22x 22x 5x 5x 5x 88x 88x 5x 5x 5x 5x 5x 5x 5x 1x 1x 1x 22x 22x 1x 1x 1x         1x 1x 1x         1x  
import {
  Component,
  EventEmitter,
  HostBinding,
  Input,
  Output,
} from '@angular/core';
 
import { ActionEvent } from '../utils/event.types';
import { FormattedTextContent } from '../utils/util.types';
import { createWidgetKeySet } from '../utils/utilities';
 
export type FullscreenMessageContent = string | FormattedTextContent;
 
@Component({
  selector: 'gc-fullscreen-message',
  templateUrl: './fullscreen-message.component.html',
  styleUrls: ['./fullscreen-message.component.css'],
  standalone: false,
})
export class FullscreenMessageComponent {
  /**
   * Headline of the message
   */
  @Input({ required: true })
  header = '';
 
  /** The message(s) to show */
  @Input({ required: true })
  description: string | readonly FullscreenMessageContent[] = '';
 
  /** The request ID to show */
  @Input()
  requestID = '';
 
  /** The label of the action button */
  @Input()
  actionLabel = 'Zurück zur Startseite';
 
  @Input()
  messageType:
    | 'peripheral-system'
    | 'authorization-error'
    | 'connection-error'
    | 'unknown-page'
    | 'generic-error' = 'generic-error';
 
  /**
   * Event delivered when action button is pressed
   */
  @Output()
  readonly onAction: EventEmitter<ActionEvent> =
    new EventEmitter<ActionEvent>();
 
  /**
   * Control the size of the icon (allowing to embedded in page sections)
   */
  @Input()
  size: 'default' | 'small' = 'default';
 
  /** The trace ID to show
   * @deprecated use requestID
   */
  @Input()
  get traceID(): string {
    return this.requestID;
  }
 
  set traceID(value: string) {
    this.requestID = value;
  }
 
  /** @ignore */
  @HostBinding('class')
  protected get sizeClass() {
    return this.size === 'small' ? 'gc-small' : 'gc-default';
  }
 
  /** @ignore */
  protected get errorMessage(): boolean {
    return this.messageType !== 'peripheral-system';
  }
 
  /** @ignore */
  protected readonly _widgetKeys = createWidgetKeySet('gc-fullscreen-message');
  /** @ignore */
  protected readonly _maskIdCon = `${this._widgetKeys.baseKey}-maskCon`;
  /** @ignore */
  protected readonly _maskIdUnknown = `${this._widgetKeys.baseKey}-maskUnknown`;
 
  /** @ignore */
  protected _isSingleValuedDescription() {
    return typeof this.description === 'string';
  }
 
  /** @ignore */
  protected _multiValueDescription(): readonly FullscreenMessageContent[] {
    return typeof this.description !== 'string'
      ? this.description
      : ['ERROR: single valued'];
  }
 
  /** @ignore */
  protected _isFormattedType(
    content: FullscreenMessageContent | string,
  ): content is Exclude<FullscreenMessageContent, string> {
    return typeof content !== 'string';
  }
}