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"> <ng-container matColumnDef="room">
<th mat-header-cell *matHeaderCellDef mat-sort-header="room"> {{'jitsi.rooms.room' | i18n}} </th> <th mat-header-cell *matHeaderCellDef mat-sort-header="room"> {{'jitsi.rooms.room' | i18n}} </th>
<td mat-cell *matCellDef="let jitsiRoom"> <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 }} {{ jitsiRoom.room }}
<mat-icon style="font-size: 1em;">open_in_new <mat-icon style="font-size: 1em;">open_in_new
</mat-icon> </mat-icon>
</a> </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"> matTooltipPosition="above">
{{ jitsiRoom.room }} {{ jitsiRoom.room }}
</a> </a>
@ -33,6 +33,11 @@
<td mat-cell *matCellDef="let jitsiRoom">{{ jitsiRoom.starts | date:datetimeformat}} </td> <td mat-cell *matCellDef="let jitsiRoom">{{ jitsiRoom.starts | date:datetimeformat}} </td>
</ng-container> </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"> <ng-container matColumnDef="expires">
<th mat-header-cell *matHeaderCellDef mat-sort-header="expires"> {{'jitsi.rooms.expires' | i18n}} </th> <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> <td mat-cell *matCellDef="let jitsiRoom"> {{ jitsiRoom.expires | date:datetimeformat}} </td>
@ -41,13 +46,13 @@
<ng-container matColumnDef="moderationUrl"> <ng-container matColumnDef="moderationUrl">
<th mat-header-cell *matHeaderCellDef mat-sort-header="moderationUrl"> {{'jitsi.rooms.moderationUrl' | i18n}} </th> <th mat-header-cell *matHeaderCellDef mat-sort-header="moderationUrl"> {{'jitsi.rooms.moderationUrl' | i18n}} </th>
<td mat-cell *matCellDef="let jitsiRoom"> <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"> target="_blank">
{{ jitsiRoom.moderationUrl }} {{ jitsiRoom.moderationUrl }}
<mat-icon style="font-size: 1em;">open_in_new</mat-icon> <mat-icon style="font-size: 1em;">open_in_new</mat-icon>
</a> </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"> matTooltipPosition="above">
{{ jitsiRoom.moderationUrl }} {{ jitsiRoom.moderationUrl }}
</a> </a>
@ -92,6 +97,16 @@
</mat-error> </mat-error>
</mat-form-field> </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> <mat-form-field>
<input matInput [ngxMatDatetimePicker]="expiresPicker" [(ngModel)]="jitsiRoom.expires" <input matInput [ngxMatDatetimePicker]="expiresPicker" [(ngModel)]="jitsiRoom.expires"
formControlName="expires" placeholder="{{'jitsi.rooms.expires' | i18n}}"> formControlName="expires" placeholder="{{'jitsi.rooms.expires' | i18n}}">

View File

@ -26,7 +26,7 @@ export class JitsiComponent implements OnInit {
working: boolean; working: boolean;
datetimeformat: String; datetimeformat: String;
jitsiRoomsColumns = ["share", "room", "starts", "expires", "moderationUrl", "delete"]; jitsiRoomsColumns = ["share", "room", "starts", "moderationStarts", "expires", "moderationUrl", "delete"];
constructor( constructor(
private quotaService: QuotaService, private quotaService: QuotaService,
@ -41,6 +41,7 @@ export class JitsiComponent implements OnInit {
this.form = this.formBuilder.group({ this.form = this.formBuilder.group({
room: ['', Validators.required], room: ['', Validators.required],
starts: ['', Validators.nullValidator], starts: ['', Validators.nullValidator],
moderationStarts: ['', Validators.nullValidator],
expires: ['', Validators.nullValidator], expires: ['', Validators.nullValidator],
}); });
@ -49,6 +50,10 @@ export class JitsiComponent implements OnInit {
create(): void { create(): void {
this.working = true; this.working = true;
if(!this.jitsiRoom.starts) {
this.jitsiRoom.moderationStarts = null;
}
this.jitsiService.create(this.jitsiRoom).subscribe(response => { this.jitsiService.create(this.jitsiRoom).subscribe(response => {
this.update(); this.update();
this.formDirective.resetForm(); this.formDirective.resetForm();
@ -114,6 +119,7 @@ export class JitsiComponent implements OnInit {
switch(sort.active) { switch(sort.active) {
case 'room': return this.compare(a.room, b.room, isAsc); case 'room': return this.compare(a.room, b.room, isAsc);
case 'starts': 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); case 'expires': return this.compare(a.room, b.room, isAsc);
default: return 0; default: return 0;
} }
@ -131,8 +137,8 @@ export class JitsiComponent implements OnInit {
}); });
} }
open(jitsiRoom: any) { open(jitsiRoom: any, moderation: boolean) {
return (!jitsiRoom.starts || new Date(jitsiRoom.start) < new Date()) && (!jitsiRoom.expires || new Date(jitsiRoom.expires) > new Date()); 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", "delete": "Löschen",
"error": { "error": {
"expires": "Ungültiges Ende.", "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." "starts": "Ungültiger Beginn."
}, },
"expires": "Ende", "expires": "Ende",
"info": "Du kannst hier Jitsi Räume erstellen. Die Anzahl wird über eine Quota begrenzt.", "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.", "left": "Du kannst noch {0} Jitsi Raum/Räume erstellen.",
"moderationUrl": "Url für Moderation", "moderationUrl": "Url für Moderation",
"moderationStarts" : "Beginn Moderation",
"noQuota": "Deine Quota für Jitsi Räume ist leider aufgebraucht.", "noQuota": "Deine Quota für Jitsi Räume ist leider aufgebraucht.",
"notStarted" : "Die Konferenz hat noch nicht begonnen.", "notStarted" : "Die Konferenz hat noch nicht begonnen.",
"room": "Name", "room": "Name",

View File

@ -35,12 +35,13 @@
"delete": "Delete", "delete": "Delete",
"error": { "error": {
"expires": "Invalid expiry.", "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." "starts": "Invalid start."
}, },
"expires": "Expires", "expires": "Expires",
"info": "You can create new Jitsi Rooms here. The number is limited due to a quota.", "info": "You can create new Jitsi Rooms here. The number is limited due to a quota.",
"left": "You have {0} Jitsi Room(s) left.", "left": "You have {0} Jitsi Room(s) left.",
"moderationStarts" : "Moderation starts",
"moderationUrl": "Moderation url", "moderationUrl": "Moderation url",
"noQuota": "Your quota for Jitsi Rooms is depleted.", "noQuota": "Your quota for Jitsi Rooms is depleted.",
"notStarted" : "The conference has not started yet.", "notStarted" : "The conference has not started yet.",