share context
This commit is contained in:
parent
b5eb5800b0
commit
f14e50d258
3 changed files with 13 additions and 2 deletions
|
@ -7,6 +7,7 @@
|
|||
><mat-icon>playlist_play</mat-icon></a
|
||||
>
|
||||
</h1>
|
||||
@if (!inShare) {
|
||||
<button mat-icon-button (click)="editIncident(incID)">
|
||||
<mat-icon>edit</mat-icon>
|
||||
</button>
|
||||
|
@ -18,6 +19,7 @@
|
|||
Delete
|
||||
</button>
|
||||
</mat-menu>
|
||||
}
|
||||
</div>
|
||||
<div class="inc-heading">
|
||||
<div class="field field-start field-label">Start</div>
|
||||
|
|
|
@ -9,7 +9,7 @@ import {
|
|||
FormControl,
|
||||
FormsModule,
|
||||
} from '@angular/forms';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import { MatInputModule } from '@angular/material/input';
|
||||
import { MatFormFieldModule } from '@angular/material/form-field';
|
||||
import { MatCheckboxModule } from '@angular/material/checkbox';
|
||||
|
@ -40,6 +40,7 @@ import { CallPlayerComponent } from '../../calls/player/call-player/call-player.
|
|||
import { FmtDatePipe } from '../incidents.component';
|
||||
import { MatMenuModule } from '@angular/material/menu';
|
||||
import { Share } from '../../shares';
|
||||
import { ShareService } from '../../share/share.service';
|
||||
|
||||
export interface EditDialogData {
|
||||
incID: string;
|
||||
|
@ -152,6 +153,7 @@ export class IncidentEditDialogComponent {
|
|||
styleUrl: './incident.component.scss',
|
||||
})
|
||||
export class IncidentComponent {
|
||||
inShare = false;
|
||||
incPrime = new Subject<IncidentRecord>();
|
||||
inc$!: Observable<IncidentRecord>;
|
||||
@Input() share?: Share;
|
||||
|
@ -174,6 +176,7 @@ export class IncidentComponent {
|
|||
|
||||
constructor(
|
||||
private route: ActivatedRoute,
|
||||
private shareSvc: ShareService,
|
||||
private incSvc: IncidentsService,
|
||||
private location: Location,
|
||||
) {}
|
||||
|
@ -181,6 +184,7 @@ export class IncidentComponent {
|
|||
saveIncName(ev: Event) {}
|
||||
|
||||
ngOnInit() {
|
||||
this.inShare = this.shareSvc.isInShare();
|
||||
let incOb: Observable<IncidentRecord>;
|
||||
if (this.route.component === this.constructor) {
|
||||
// loaded by route
|
||||
|
|
|
@ -4,12 +4,17 @@ import { map, Observable, switchMap } from 'rxjs';
|
|||
import { IncidentRecord } from '../incidents';
|
||||
import { CallRecord } from '../calls';
|
||||
import { Share, ShareType } from '../shares';
|
||||
import { Router } from '@angular/router';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class ShareService {
|
||||
constructor(private http: HttpClient) {}
|
||||
constructor(private http: HttpClient, private router: Router) {}
|
||||
|
||||
isInShare(): boolean {
|
||||
return this.router.url.startsWith('/s/');
|
||||
}
|
||||
|
||||
getShare(id: string): Observable<Share> {
|
||||
return this.http.get<Share>(`/share/${id}`);
|
||||
|
|
Loading…
Add table
Reference in a new issue