fix actions for other timeslots

This commit is contained in:
_Bastler 2021-08-12 20:31:52 +02:00
parent a11c74b91b
commit ffbcd7fe1a
2 changed files with 72 additions and 60 deletions

View File

@ -68,16 +68,18 @@
<th mat-header-cell *matHeaderCellDef mat-sort-header="stream"> {{'partey.timeslots.stream' | i18n}} <th mat-header-cell *matHeaderCellDef mat-sort-header="stream"> {{'partey.timeslots.stream' | i18n}}
</th> </th>
<td mat-cell *matCellDef="let timeslot"> <td mat-cell *matCellDef="let timeslot">
<div *ngIf="timeslot.owner == userId">
<button *ngIf="timeslot.type == 'AUDIO'" mat-raised-button <button *ngIf="timeslot.type == 'AUDIO'" mat-raised-button
(click)="copySecretToClipboard(timeslot.secret)">{{'partey.timeslots.secret.copy' | i18n}}</button> (click)="copySecretToClipboard(timeslot.secret)">{{'partey.timeslots.secret.copy' | i18n}}</button>
<span *ngIf="timeslot.type == 'VIDEO'"> {{ timeslot.stream }} </span> <span *ngIf="timeslot.type == 'VIDEO'"> {{ timeslot.stream }} </span>
</div>
</td> </td>
</ng-container> </ng-container>
<ng-container matColumnDef="edit"> <ng-container matColumnDef="edit">
<th mat-header-cell *matHeaderCellDef> {{'partey.timeslots.edit' | i18n}} </th> <th mat-header-cell *matHeaderCellDef> {{'partey.timeslots.edit' | i18n}} </th>
<td mat-cell *matCellDef="let timeslot" class="text-right"> <td mat-cell *matCellDef="let timeslot" class="text-right">
<a mat-icon-button> <a *ngIf="timeslot.owner == userId" mat-icon-button>
<mat-icon (click)="openEdit(timeslot)">edit</mat-icon> <mat-icon (click)="openEdit(timeslot)">edit</mat-icon>
</a> </a>
</td> </td>
@ -86,7 +88,7 @@
<ng-container matColumnDef="delete"> <ng-container matColumnDef="delete">
<th mat-header-cell *matHeaderCellDef class="align-right"> {{'partey.timeslots.delete' | i18n}} </th> <th mat-header-cell *matHeaderCellDef class="align-right"> {{'partey.timeslots.delete' | i18n}} </th>
<td mat-cell *matCellDef="let timeslot" class="text-right"> <td mat-cell *matCellDef="let timeslot" class="text-right">
<a mat-icon-button> <a *ngIf="timeslot.owner == userId" mat-icon-button>
<mat-icon (click)="confirmDelete(timeslot)">delete</mat-icon> <mat-icon (click)="confirmDelete(timeslot)">delete</mat-icon>
</a> </a>
</td> </td>

View File

@ -11,6 +11,7 @@ import {PageEvent} from '@angular/material/paginator';
import { ParteyTimeslotsService } from '../../../services/partey.timeslots.service'; import { ParteyTimeslotsService } from '../../../services/partey.timeslots.service';
import { ConfirmDialog } from '../../../ui/confirm/confirm.component'; import { ConfirmDialog } from '../../../ui/confirm/confirm.component';
import { I18nService } from './../../../services/i18n.service'; import { I18nService } from './../../../services/i18n.service';
import { AuthService } from './../../../services/auth.service';
@Component({ @Component({
selector: 'app-partey-timeslots', selector: 'app-partey-timeslots',
@ -32,6 +33,7 @@ export class ParteyTimeslotsComponent implements OnInit {
pageSizeOptions: number[] = [ 5, 10, 25, 50 ]; pageSizeOptions: number[] = [ 5, 10, 25, 50 ];
visibilities = [ "PRIVATE", "PROTECTED", "PUBLIC" ]; visibilities = [ "PRIVATE", "PROTECTED", "PUBLIC" ];
types = [ "VIDEO", "AUDIO" ]; types = [ "VIDEO", "AUDIO" ];
userId: any;
timeslotsColumns = [ "type", "starts", "ends", "title", "description", "stream", "edit", "delete" ]; timeslotsColumns = [ "type", "starts", "ends", "title", "description", "stream", "edit", "delete" ];
@ -43,12 +45,20 @@ export class ParteyTimeslotsComponent implements OnInit {
constructor( constructor(
private formBuilder: FormBuilder, private formBuilder: FormBuilder,
private parteyTimeslotsService: ParteyTimeslotsService, private parteyTimeslotsService: ParteyTimeslotsService,
private authService: AuthService,
private i18n: I18nService, private i18n: I18nService,
private datePipe: DatePipe, private datePipe: DatePipe,
private snackBar: MatSnackBar, private snackBar: MatSnackBar,
public dialog: MatDialog) { } public dialog: MatDialog) { }
ngOnInit(): void { ngOnInit(): void {
this.authService.auth.subscribe((auth: any) => {
if (auth.principal && auth.principal.userId) {
this.userId = auth.principal.userId;
}
});
this.datetimeformat = this.i18n.get('format.datetime', []); this.datetimeformat = this.i18n.get('format.datetime', []);
this.form = this.formBuilder.group({ this.form = this.formBuilder.group({