This commit is contained in:
Daniel Ponte 2025-02-01 14:28:39 -05:00
parent 8a223b8897
commit c10070a52b
2 changed files with 9 additions and 7 deletions

View file

@ -1,7 +1,7 @@
import { Component, inject, Input, input, Sanitizer } from '@angular/core'; import { Component, inject, Input } from '@angular/core';
import { switchMap, tap } from 'rxjs/operators'; import { tap } from 'rxjs/operators';
import { CommonModule, Location } from '@angular/common'; import { CommonModule, Location } from '@angular/common';
import { BehaviorSubject, merge, Subscription } from 'rxjs'; import { BehaviorSubject, merge, Subject, Subscription } from 'rxjs';
import { Observable } from 'rxjs'; import { Observable } from 'rxjs';
import { import {
ReactiveFormsModule, ReactiveFormsModule,
@ -40,7 +40,6 @@ import { CallPlayerComponent } from '../../calls/player/call-player/call-player.
import { FmtDatePipe } from '../incidents.component'; import { FmtDatePipe } from '../incidents.component';
import { MatMenuModule } from '@angular/material/menu'; import { MatMenuModule } from '@angular/material/menu';
import { Share } from '../../share/share.service'; import { Share } from '../../share/share.service';
import { toObservable } from '@angular/core/rxjs-interop';
export interface EditDialogData { export interface EditDialogData {
incID: string; incID: string;
@ -153,7 +152,7 @@ export class IncidentEditDialogComponent {
styleUrl: './incident.component.scss', styleUrl: './incident.component.scss',
}) })
export class IncidentComponent { export class IncidentComponent {
incPrime = new BehaviorSubject<IncidentRecord>(<IncidentRecord>{}); incPrime = new Subject<IncidentRecord>();
inc$!: Observable<IncidentRecord>; inc$!: Observable<IncidentRecord>;
@Input() incident?: Share; @Input() incident?: Share;
subscriptions: Subscription = new Subscription(); subscriptions: Subscription = new Subscription();
@ -196,7 +195,7 @@ export class IncidentComponent {
} }
this.inc$ = merge(incOb, this.incPrime).pipe( this.inc$ = merge(incOb, this.incPrime).pipe(
tap((inc) => { tap((inc) => {
if (inc.calls) { if (inc && inc.calls) {
this.callsResult.data = inc.calls; this.callsResult.data = inc.calls;
} }
}), }),

View file

@ -1,6 +1,9 @@
@let sh = share | async; @let sh = share | async;
@if (sh == null) { @if (sh == null) {
<h1 class="error">Share invalid!</h1>
} @else if (sh.shareType == "incident") { } @else if (sh.shareType == "incident") {
<app-incident [incident]="sh"></app-incident> <app-incident [incident]="sh"></app-incident>
} @else if (sh.shareType == "call") { } @else if (sh.shareType == "call") {
} @else {} } @else {
<h1 class="error">Share type {{sh.shareType}} unknown</h1>
}