update clipboard, fix timeslots

This commit is contained in:
_Bastler
2021-11-18 17:48:28 +01:00
parent 2cede86ea8
commit 86d352f549
7 changed files with 103 additions and 128 deletions
@@ -7,6 +7,7 @@ import { DatePipe } from '@angular/common';
import { FormControl } from '@angular/forms';
import { debounceTime } from 'rxjs/operators';
import { PageEvent } from '@angular/material/paginator';
import { Clipboard } from '@angular/cdk/clipboard';
import { ParteyTimeslotsService } from '../../../services/partey.service';
import { ConfirmDialog } from '../../../ui/confirm/confirm.component';
@@ -49,7 +50,8 @@ export class ParteyTimeslotsComponent implements OnInit {
private i18n: I18nService,
private datePipe: DatePipe,
private snackBar: MatSnackBar,
public dialog: MatDialog) { }
public dialog: MatDialog,
private clipboard: Clipboard) { }
ngOnInit(): void {
@@ -182,13 +184,7 @@ export class ParteyTimeslotsComponent implements OnInit {
}
copySecretToClipboard(secret) {
const selBox = document.createElement('textarea');
selBox.value = secret;
document.body.appendChild(selBox);
selBox.focus();
selBox.select();
document.execCommand('copy');
document.body.removeChild(selBox);
this.clipboard.copy(secret);
this.snackBar.open(this.i18n.get("partey.timeslots.secret.copied", []), this.i18n.get("close", []), {
duration: 3000
});
@@ -209,7 +205,7 @@ export class ParteyTimeslotDialog {
timeslot;
visibilities = [ "PRIVATE", "PROTECTED", "PUBLIC" ];
types = [ "VIDEO", "AUDIO" ];
types = [ "VIDEO", "AUDIO", "AUDIO_STREAM", "VIDEO_STREAM" ];
constructor(
private parteyTimeslotsService: ParteyTimeslotsService,
@@ -226,12 +222,11 @@ export class ParteyTimeslotDialog {
ends: [ '', Validators.required ],
title: [ '', Validators.nullValidator ],
description: [ '', Validators.nullValidator ],
stream: [ '', this.timeslot.type == 'VIDEO' ? Validators.required : Validators.nullValidator ],
stream: [ '', this.timeslot.type == 'VIDEO_STREAM' ? Validators.required : Validators.nullValidator ],
share: [ '', (this.timeslot.type == 'VIDEO' || this.timeslot.type == 'AUDIO') ? Validators.required : Validators.nullValidator ],
});
}
create(timeslot) {
this.parteyTimeslotsService.create(timeslot).subscribe((result: any) => {
this.dialogRef.close(timeslot);