moderationStarts

This commit is contained in:
_Bastler 2021-04-16 20:17:11 +02:00
parent 4e903bd09f
commit 1c4af82126
4 changed files with 32 additions and 9 deletions

View File

@ -14,13 +14,13 @@
<ng-container matColumnDef="room">
<th mat-header-cell *matHeaderCellDef mat-sort-header="room"> {{'jitsi.rooms.room' | i18n}} </th>
<td mat-cell *matCellDef="let jitsiRoom">
<a *ngIf="open(jitsiRoom)" mat-button color="accent" href="{{ jitsiRoom.url }}" target="_blank">
<a *ngIf="open(jitsiRoom, false)" mat-button color="accent" href="{{ jitsiRoom.url }}" target="_blank">
{{ jitsiRoom.room }}
<mat-icon style="font-size: 1em;">open_in_new
</mat-icon>
</a>
<a *ngIf="!open(jitsiRoom)" mat-button disabled matTooltip="{{'jitsi.rooms.notStarted' | i18n}}"
<a *ngIf="!open(jitsiRoom, false)" mat-button disabled matTooltip="{{'jitsi.rooms.notStarted' | i18n}}"
matTooltipPosition="above">
{{ jitsiRoom.room }}
</a>
@ -33,6 +33,11 @@
<td mat-cell *matCellDef="let jitsiRoom">{{ jitsiRoom.starts | date:datetimeformat}} </td>
</ng-container>
<ng-container matColumnDef="moderationStarts">
<th mat-header-cell *matHeaderCellDef mat-sort-header="moderationStarts"> {{'jitsi.rooms.moderationStarts' | i18n}} </th>
<td mat-cell *matCellDef="let jitsiRoom">{{ jitsiRoom.moderationStarts | date:datetimeformat}} </td>
</ng-container>
<ng-container matColumnDef="expires">
<th mat-header-cell *matHeaderCellDef mat-sort-header="expires"> {{'jitsi.rooms.expires' | i18n}} </th>
<td mat-cell *matCellDef="let jitsiRoom"> {{ jitsiRoom.expires | date:datetimeformat}} </td>
@ -41,13 +46,13 @@
<ng-container matColumnDef="moderationUrl">
<th mat-header-cell *matHeaderCellDef mat-sort-header="moderationUrl"> {{'jitsi.rooms.moderationUrl' | i18n}} </th>
<td mat-cell *matCellDef="let jitsiRoom">
<a *ngIf="open(jitsiRoom)" mat-button color="primary" class="url" href="{{ jitsiRoom.moderationUrl}}"
<a *ngIf="open(jitsiRoom, true)" mat-button color="primary" class="url" href="{{ jitsiRoom.moderationUrl}}"
target="_blank">
{{ jitsiRoom.moderationUrl }}
<mat-icon style="font-size: 1em;">open_in_new</mat-icon>
</a>
<a *ngIf="!open(jitsiRoom)" mat-button color="primary" class="url" disabled matTooltip="{{'jitsi.rooms.notStarted' | i18n}}"
<a *ngIf="!open(jitsiRoom, true)" mat-button color="primary" class="url" disabled matTooltip="{{'jitsi.rooms.notStarted' | i18n}}"
matTooltipPosition="above">
{{ jitsiRoom.moderationUrl }}
</a>
@ -92,6 +97,16 @@
</mat-error>
</mat-form-field>
<mat-form-field *ngIf="jitsiRoom.starts">
<input matInput [ngxMatDatetimePicker]="moderationStartsPicker" [(ngModel)]="jitsiRoom.moderationStarts" formControlName="moderationStarts"
placeholder="{{'jitsi.rooms.moderationStarts' | i18n}}">
<mat-datepicker-toggle matSuffix [for]="moderationStartsPicker"></mat-datepicker-toggle>
<ngx-mat-datetime-picker #moderationStartsPicker></ngx-mat-datetime-picker>
<mat-error>
{{'jitsi.rooms.error.moderationStarts' | i18n}}
</mat-error>
</mat-form-field>
<mat-form-field>
<input matInput [ngxMatDatetimePicker]="expiresPicker" [(ngModel)]="jitsiRoom.expires"
formControlName="expires" placeholder="{{'jitsi.rooms.expires' | i18n}}">

View File

@ -26,7 +26,7 @@ export class JitsiComponent implements OnInit {
working: boolean;
datetimeformat: String;
jitsiRoomsColumns = ["share", "room", "starts", "expires", "moderationUrl", "delete"];
jitsiRoomsColumns = ["share", "room", "starts", "moderationStarts", "expires", "moderationUrl", "delete"];
constructor(
private quotaService: QuotaService,
@ -41,6 +41,7 @@ export class JitsiComponent implements OnInit {
this.form = this.formBuilder.group({
room: ['', Validators.required],
starts: ['', Validators.nullValidator],
moderationStarts: ['', Validators.nullValidator],
expires: ['', Validators.nullValidator],
});
@ -49,6 +50,10 @@ export class JitsiComponent implements OnInit {
create(): void {
this.working = true;
if(!this.jitsiRoom.starts) {
this.jitsiRoom.moderationStarts = null;
}
this.jitsiService.create(this.jitsiRoom).subscribe(response => {
this.update();
this.formDirective.resetForm();
@ -114,6 +119,7 @@ export class JitsiComponent implements OnInit {
switch(sort.active) {
case 'room': return this.compare(a.room, b.room, isAsc);
case 'starts': return this.compare(a.room, b.room, isAsc);
case 'moderationStarts': return this.compare(a.room, b.room, isAsc);
case 'expires': return this.compare(a.room, b.room, isAsc);
default: return 0;
}
@ -131,8 +137,8 @@ export class JitsiComponent implements OnInit {
});
}
open(jitsiRoom: any) {
return (!jitsiRoom.starts || new Date(jitsiRoom.start) < new Date()) && (!jitsiRoom.expires || new Date(jitsiRoom.expires) > new Date());
open(jitsiRoom: any, moderation: boolean) {
return (moderation || !jitsiRoom.starts || Date.parse(jitsiRoom.starts) < new Date().getTime()) && (!jitsiRoom.expires || Date.parse(jitsiRoom.expires) > new Date().getTime()) && (!moderation || (jitsiRoom.moderationStarts != null && Date.parse(jitsiRoom.moderationStarts) < new Date().getTime()));
}
}

View File

@ -35,13 +35,14 @@
"delete": "Löschen",
"error": {
"expires": "Ungültiges Ende.",
"room": "Bitte gebe einen gültigen Namen an. Erlaubt sind nur Buchstaben und Zahlen.",
"room": "Bitte gebe einen anderen Namen an. Der Name ist schon vergeben oder enthält ungültige Zeichen. Erlaubt sind nur Buchstaben und Zahlen.",
"starts": "Ungültiger Beginn."
},
"expires": "Ende",
"info": "Du kannst hier Jitsi Räume erstellen. Die Anzahl wird über eine Quota begrenzt.",
"left": "Du kannst noch {0} Jitsi Raum/Räume erstellen.",
"moderationUrl": "Url für Moderation",
"moderationStarts" : "Beginn Moderation",
"noQuota": "Deine Quota für Jitsi Räume ist leider aufgebraucht.",
"notStarted" : "Die Konferenz hat noch nicht begonnen.",
"room": "Name",

View File

@ -35,12 +35,13 @@
"delete": "Delete",
"error": {
"expires": "Invalid expiry.",
"room": "Please provide a valid name. Only letters and numbers are allowed.",
"room": "Please choose a different name. The name is already taken or contains invalid characters. Only letters and numbers are allowed.",
"starts": "Invalid start."
},
"expires": "Expires",
"info": "You can create new Jitsi Rooms here. The number is limited due to a quota.",
"left": "You have {0} Jitsi Room(s) left.",
"moderationStarts" : "Moderation starts",
"moderationUrl": "Moderation url",
"noQuota": "Your quota for Jitsi Rooms is depleted.",
"notStarted" : "The conference has not started yet.",