editable jitis rooms
This commit is contained in:
parent
323ce0e885
commit
7a4839b2e6
@ -1,58 +1,58 @@
|
||||
|
||||
import {NgModule, Injectable, APP_INITIALIZER} from '@angular/core';
|
||||
import {BrowserModule} from '@angular/platform-browser';
|
||||
import {AppRoutingModule} from './app-routing.module';
|
||||
import {BrowserAnimationsModule} from '@angular/platform-browser/animations';
|
||||
import {FormsModule, ReactiveFormsModule} from '@angular/forms';
|
||||
import {HttpClientModule, HttpInterceptor, HttpHandler, HttpRequest, HTTP_INTERCEPTORS} from '@angular/common/http';
|
||||
import {MaterialModule} from './material/material.module';
|
||||
import {QRCodeModule} from 'angularx-qrcode';
|
||||
import {DatePipe} from '@angular/common';
|
||||
import { NgModule, Injectable, APP_INITIALIZER } from '@angular/core';
|
||||
import { BrowserModule } from '@angular/platform-browser';
|
||||
import { AppRoutingModule } from './app-routing.module';
|
||||
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
|
||||
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
|
||||
import { HttpClientModule, HttpInterceptor, HttpHandler, HttpRequest, HTTP_INTERCEPTORS } from '@angular/common/http';
|
||||
import { MaterialModule } from './material/material.module';
|
||||
import { QRCodeModule } from 'angularx-qrcode';
|
||||
import { DatePipe } from '@angular/common';
|
||||
|
||||
|
||||
import {AutofocusDirective} from './material/autofocus';
|
||||
import { AutofocusDirective } from './material/autofocus';
|
||||
|
||||
import {I18nPipe} from './utils/i18n.pipe';
|
||||
import {ImprintComponent, PrivacyPolicyComponent, TermsOfServiceComponent} from './pages/general/general.component';
|
||||
import {AccountComponent} from './pages/account/account.component';
|
||||
import {ServicesComponent} from './pages/services/services.component';
|
||||
import {AppComponent} from './app.component';
|
||||
import {LoginComponent} from './pages/login/login.component';
|
||||
import {FormLoginComponent} from './pages/form-login/form-login.component';
|
||||
import {FormLogin2FAComponent} from './pages/form-login-2fa/form-login-2fa.component';
|
||||
import {TokensComponent} from './pages/tokens/tokens.component';
|
||||
import {InvitesComponent} from './pages/invites/invites.component';
|
||||
import {PermissionsComponent} from './ui/permissions/permissions.component';
|
||||
import {ProfileFieldDialog, ProfileFieldsComponent, ProfileFieldBlob} from './ui/profilefields/profilefields.component';
|
||||
import {ProfileFieldPgpBlob} from './ui/profilefields/binary/pgp/profilefield.pgp-blob';
|
||||
import {QuotasComponent} from './ui/quotas/quotas.component';
|
||||
import {SecurityComponent, SecurityTotpDialog} from './pages/account/security/security.component';
|
||||
import {VoucherComponent} from './pages/account/voucher/voucher.component';
|
||||
import {VoucherDialog} from './pages/account/voucher/voucher.component';
|
||||
import {InfoComponent} from './pages/account/info/info.component';
|
||||
import {AliasesComponent} from './pages/account/aliases/aliases.component';
|
||||
import {DomainsComponent} from './pages/account/domains/domains.component';
|
||||
import {ProfileComponent} from './pages/account/profile/profile.component';
|
||||
import {PasswordComponent} from './pages/password/password.component';
|
||||
import {PasswordResetComponent} from './pages/password-reset/password-reset.component';
|
||||
import {RegisterComponent, RegisterDialog} from './pages/register/register.component';
|
||||
import {UsernameDialog} from './pages/register/username-dialog/username.dialog';
|
||||
import {UnavailableComponent} from './pages/unavailable/unavailable.component';
|
||||
import {NotfoundComponent} from './pages/notfound/notfound.component';
|
||||
import {HtmlComponent} from './utils/html/html.component';
|
||||
import {ConfirmDialog} from './ui/confirm/confirm.component'
|
||||
import {UserComponent} from './pages/user/user.component'
|
||||
import {JitsiComponent, JitsiShareDialog} from './pages/jitsi/jitsi.component'
|
||||
import {ParteyTimeslotsComponent, ParteyTimeslotDialog} from './pages/partey/timeslots/timeslots.compontent'
|
||||
import {UrlShortenerComponent, UrlShortenerPasswordComponent, UrlShortenerShareDialog, UrlShortenerEditDialog} from './pages/urlshortener/urlshortener.component'
|
||||
import { I18nPipe } from './utils/i18n.pipe';
|
||||
import { ImprintComponent, PrivacyPolicyComponent, TermsOfServiceComponent } from './pages/general/general.component';
|
||||
import { AccountComponent } from './pages/account/account.component';
|
||||
import { ServicesComponent } from './pages/services/services.component';
|
||||
import { AppComponent } from './app.component';
|
||||
import { LoginComponent } from './pages/login/login.component';
|
||||
import { FormLoginComponent } from './pages/form-login/form-login.component';
|
||||
import { FormLogin2FAComponent } from './pages/form-login-2fa/form-login-2fa.component';
|
||||
import { TokensComponent } from './pages/tokens/tokens.component';
|
||||
import { InvitesComponent } from './pages/invites/invites.component';
|
||||
import { PermissionsComponent } from './ui/permissions/permissions.component';
|
||||
import { ProfileFieldDialog, ProfileFieldsComponent, ProfileFieldBlob } from './ui/profilefields/profilefields.component';
|
||||
import { ProfileFieldPgpBlob } from './ui/profilefields/binary/pgp/profilefield.pgp-blob';
|
||||
import { QuotasComponent } from './ui/quotas/quotas.component';
|
||||
import { SecurityComponent, SecurityTotpDialog } from './pages/account/security/security.component';
|
||||
import { VoucherComponent } from './pages/account/voucher/voucher.component';
|
||||
import { VoucherDialog } from './pages/account/voucher/voucher.component';
|
||||
import { InfoComponent } from './pages/account/info/info.component';
|
||||
import { AliasesComponent } from './pages/account/aliases/aliases.component';
|
||||
import { DomainsComponent } from './pages/account/domains/domains.component';
|
||||
import { ProfileComponent } from './pages/account/profile/profile.component';
|
||||
import { PasswordComponent } from './pages/password/password.component';
|
||||
import { PasswordResetComponent } from './pages/password-reset/password-reset.component';
|
||||
import { RegisterComponent, RegisterDialog } from './pages/register/register.component';
|
||||
import { UsernameDialog } from './pages/register/username-dialog/username.dialog';
|
||||
import { UnavailableComponent } from './pages/unavailable/unavailable.component';
|
||||
import { NotfoundComponent } from './pages/notfound/notfound.component';
|
||||
import { HtmlComponent } from './utils/html/html.component';
|
||||
import { ConfirmDialog } from './ui/confirm/confirm.component'
|
||||
import { UserComponent } from './pages/user/user.component'
|
||||
import { JitsiComponent, JitsiEditDialog, JitsiShareDialog } from './pages/jitsi/jitsi.component'
|
||||
import { ParteyTimeslotsComponent, ParteyTimeslotDialog } from './pages/partey/timeslots/timeslots.compontent'
|
||||
import { UrlShortenerComponent, UrlShortenerPasswordComponent, UrlShortenerShareDialog, UrlShortenerEditDialog } from './pages/urlshortener/urlshortener.component'
|
||||
|
||||
|
||||
import {I18nService} from './services/i18n.service';
|
||||
import {MinetestAccountsComponent} from './pages/minetest/accounts/accounts.component';
|
||||
import { I18nService } from './services/i18n.service';
|
||||
import { MinetestAccountsComponent } from './pages/minetest/accounts/accounts.component';
|
||||
|
||||
|
||||
export function init_app(i18n: I18nService) {
|
||||
return () => i18n.fetch().then(response => {}, error => {});
|
||||
return () => i18n.fetch().then(response => { }, error => { });
|
||||
}
|
||||
|
||||
@Injectable()
|
||||
@ -100,7 +100,7 @@ export class XhrInterceptor implements HttpInterceptor {
|
||||
HtmlComponent,
|
||||
ConfirmDialog,
|
||||
UserComponent,
|
||||
JitsiComponent, JitsiShareDialog,
|
||||
JitsiComponent, JitsiEditDialog, JitsiShareDialog,
|
||||
ParteyTimeslotsComponent, ParteyTimeslotDialog,
|
||||
MinetestAccountsComponent,
|
||||
UrlShortenerComponent, UrlShortenerShareDialog, UrlShortenerEditDialog, UrlShortenerPasswordComponent
|
||||
@ -115,9 +115,9 @@ export class XhrInterceptor implements HttpInterceptor {
|
||||
ReactiveFormsModule,
|
||||
QRCodeModule,
|
||||
],
|
||||
exports: [MaterialModule],
|
||||
providers: [{provide: APP_INITIALIZER, useFactory: init_app, deps: [I18nService], multi: true}, {provide: HTTP_INTERCEPTORS, useClass: XhrInterceptor, multi: true}, DatePipe],
|
||||
bootstrap: [AppComponent],
|
||||
exports: [ MaterialModule ],
|
||||
providers: [ { provide: APP_INITIALIZER, useFactory: init_app, deps: [ I18nService ], multi: true }, { provide: HTTP_INTERCEPTORS, useClass: XhrInterceptor, multi: true }, DatePipe ],
|
||||
bootstrap: [ AppComponent ],
|
||||
})
|
||||
export class AppModule {
|
||||
}
|
||||
|
@ -65,6 +65,15 @@
|
||||
</td>
|
||||
</ng-container>
|
||||
|
||||
<ng-container matColumnDef="edit">
|
||||
<th mat-header-cell *matHeaderCellDef> {{'jitsi.rooms.edit' | i18n}} </th>
|
||||
<td mat-cell *matCellDef="let jitsiRoom" class="text-right">
|
||||
<a mat-icon-button>
|
||||
<mat-icon (click)="edit(jitsiRoom)">edit</mat-icon>
|
||||
</a>
|
||||
</td>
|
||||
</ng-container>
|
||||
|
||||
<ng-container matColumnDef="delete">
|
||||
<th mat-header-cell *matHeaderCellDef class="align-right"> {{'jitsi.rooms.delete' | i18n}} </th>
|
||||
<td mat-cell *matCellDef="let jitsiRoom" class="text-right">
|
||||
@ -99,7 +108,7 @@
|
||||
|
||||
<mat-form-field>
|
||||
<input matInput [ngxMatDatetimePicker]="startsPicker" [(ngModel)]="jitsiRoom.starts" formControlName="starts"
|
||||
placeholder="{{'jitsi.rooms.starts' | i18n}}">
|
||||
placeholder="{{'jitsi.rooms.starts' | i18n}}" (dateChange)="clearModeration(jitsiRoom)">
|
||||
<mat-datepicker-toggle matSuffix [for]="startsPicker"></mat-datepicker-toggle>
|
||||
<ngx-mat-datetime-picker #startsPicker></ngx-mat-datetime-picker>
|
||||
<mat-error>
|
||||
|
@ -1,21 +1,21 @@
|
||||
import {Component, OnInit, ViewChild, Inject} from '@angular/core';
|
||||
import {MatSnackBar} from '@angular/material/snack-bar';
|
||||
import {Sort} from '@angular/material/sort';
|
||||
import {FormBuilder, FormGroup, Validators, NgForm} from '@angular/forms';
|
||||
import {MatDialog, MatDialogRef, MAT_DIALOG_DATA} from '@angular/material/dialog';
|
||||
import {DatePipe} from '@angular/common';
|
||||
import {PageEvent} from '@angular/material/paginator';
|
||||
import { Component, OnInit, ViewChild, Inject } from '@angular/core';
|
||||
import { MatSnackBar } from '@angular/material/snack-bar';
|
||||
import { Sort } from '@angular/material/sort';
|
||||
import { FormBuilder, FormGroup, Validators, NgForm } from '@angular/forms';
|
||||
import { MatDialog, MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
|
||||
import { DatePipe } from '@angular/common';
|
||||
import { PageEvent } from '@angular/material/paginator';
|
||||
|
||||
import {QuotaService} from '../../services/quota.service';
|
||||
import {JitsiService} from '../../services/jitsi.service';
|
||||
import {UrlShortenerService} from '../../services/urlshortener.service';
|
||||
import {ConfirmDialog} from '../../ui/confirm/confirm.component';
|
||||
import {I18nService} from './../../services/i18n.service';
|
||||
import { QuotaService } from '../../services/quota.service';
|
||||
import { JitsiService } from '../../services/jitsi.service';
|
||||
import { UrlShortenerService } from '../../services/urlshortener.service';
|
||||
import { ConfirmDialog } from '../../ui/confirm/confirm.component';
|
||||
import { I18nService } from './../../services/i18n.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-account-jitsi',
|
||||
templateUrl: './jitsi.component.html',
|
||||
styleUrls: ['./jitsi.component.scss']
|
||||
styleUrls: [ './jitsi.component.scss' ]
|
||||
})
|
||||
export class JitsiComponent implements OnInit {
|
||||
|
||||
@ -28,10 +28,10 @@ export class JitsiComponent implements OnInit {
|
||||
working: boolean;
|
||||
shortenedUrlQuota: number = 0;
|
||||
datetimeformat: String;
|
||||
page: any = {page: 0, size: 10, sort: "id", desc: false};
|
||||
pageSizeOptions: number[] = [5, 10, 25, 50];
|
||||
page: any = { page: 0, size: 10, sort: "id", desc: false };
|
||||
pageSizeOptions: number[] = [ 5, 10, 25, 50 ];
|
||||
|
||||
jitsiRoomsColumns = ["share", "room", "starts", "moderationStarts", "expires", "moderationUrl", "delete"];
|
||||
jitsiRoomsColumns = [ "share", "room", "starts", "moderationStarts", "expires", "moderationUrl", "edit", "delete" ];
|
||||
|
||||
constructor(
|
||||
private quotaService: QuotaService,
|
||||
@ -39,56 +39,56 @@ export class JitsiComponent implements OnInit {
|
||||
private jitsiService: JitsiService,
|
||||
private snackBar: MatSnackBar,
|
||||
private i18n: I18nService,
|
||||
public dialog: MatDialog) {}
|
||||
public dialog: MatDialog) { }
|
||||
|
||||
ngOnInit(): void {
|
||||
this.datetimeformat = this.i18n.get('format.datetime', []);
|
||||
|
||||
this.form = this.formBuilder.group({
|
||||
room: ['', Validators.required],
|
||||
starts: ['', Validators.nullValidator],
|
||||
moderationStarts: ['', Validators.nullValidator],
|
||||
expires: ['', Validators.nullValidator],
|
||||
room: [ '', Validators.required ],
|
||||
starts: [ '', Validators.nullValidator ],
|
||||
moderationStarts: [ '', Validators.nullValidator ],
|
||||
expires: [ '', Validators.nullValidator ],
|
||||
});
|
||||
|
||||
this.update();
|
||||
this.refresh();
|
||||
}
|
||||
|
||||
create(): void {
|
||||
this.working = true;
|
||||
if(!this.jitsiRoom.starts) {
|
||||
if (!this.jitsiRoom.starts) {
|
||||
this.jitsiRoom.moderationStarts = null;
|
||||
}
|
||||
|
||||
this.jitsiService.create(this.jitsiRoom).subscribe(response => {
|
||||
this.update();
|
||||
this.refresh();
|
||||
this.formDirective.resetForm();
|
||||
this.jitsiRoom = {};
|
||||
this.working = false;
|
||||
}, (error) => {
|
||||
this.working = false;
|
||||
if(error.status == 409) {
|
||||
if (error.status == 409) {
|
||||
let errors = {};
|
||||
for(let code of error.error) {
|
||||
errors[code.field] = errors[code.field] || {};
|
||||
errors[code.field][code.code] = true;
|
||||
for (let code of error.error) {
|
||||
errors[ code.field ] = errors[ code.field ] || {};
|
||||
errors[ code.field ][ code.code ] = true;
|
||||
}
|
||||
|
||||
for(let code in errors) {
|
||||
this.form.get(code).setErrors(errors[code]);
|
||||
for (let code in errors) {
|
||||
this.form.get(code).setErrors(errors[ code ]);
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
update() {
|
||||
refresh() {
|
||||
this.jitsiRoomsQuota = 0;
|
||||
this.shortenedUrlQuota = 0;
|
||||
this.quotaService.quotas().subscribe((data: any) => {
|
||||
for(let quota of data) {
|
||||
if(quota.name == "jitsi") {
|
||||
for (let quota of data) {
|
||||
if (quota.name == "jitsi") {
|
||||
this.jitsiRoomsQuota = quota.value;
|
||||
} else if(quota.name == "url_shortener") {
|
||||
} else if (quota.name == "url_shortener") {
|
||||
this.shortenedUrlQuota = quota.value;
|
||||
}
|
||||
}
|
||||
@ -104,11 +104,11 @@ export class JitsiComponent implements OnInit {
|
||||
this.page.size = event.pageSize;
|
||||
this.jitsiService.get(this.page.page, this.page.size, this.page.sort, this.page.desc).subscribe((data: any) => {
|
||||
this.jitsiRooms = data;
|
||||
}, (error) => {})
|
||||
}, (error) => { })
|
||||
}
|
||||
|
||||
updateSort(sort: Sort) {
|
||||
if(sort.direction == "") {
|
||||
if (sort.direction == "") {
|
||||
this.page.sort = "id";
|
||||
this.page.desc = false;
|
||||
} else {
|
||||
@ -117,21 +117,21 @@ export class JitsiComponent implements OnInit {
|
||||
}
|
||||
this.jitsiService.get(this.page.page, this.page.size, this.page.sort, this.page.desc).subscribe((data: any) => {
|
||||
this.jitsiRooms = data;
|
||||
}, (error) => {})
|
||||
}, (error) => { })
|
||||
}
|
||||
|
||||
confirmDelete(jitsiRoom) {
|
||||
const dialogRef = this.dialog.open(ConfirmDialog, {
|
||||
data: {
|
||||
'label': 'jitsi.rooms.confirmDelete',
|
||||
'args': [jitsiRoom.room]
|
||||
'args': [ jitsiRoom.room ]
|
||||
}
|
||||
})
|
||||
|
||||
dialogRef.afterClosed().subscribe(result => {
|
||||
if(result) {
|
||||
if (result) {
|
||||
this.jitsiService.delete(jitsiRoom.id).subscribe((result: any) => {
|
||||
this.update();
|
||||
this.refresh();
|
||||
})
|
||||
}
|
||||
});
|
||||
@ -150,17 +150,93 @@ export class JitsiComponent implements OnInit {
|
||||
|
||||
createShortenedUrl(jitsiRoom: any) {
|
||||
this.jitsiService.createShortUrl(jitsiRoom.id).subscribe((result: any) => {
|
||||
this.update();
|
||||
this.refresh();
|
||||
}, (error: any) => {
|
||||
this.snackBar.open(this.i18n.get("urlshortener.noQuota", []), this.i18n.get("close", []));
|
||||
});
|
||||
}
|
||||
|
||||
clearModeration(jitsiRoom) {
|
||||
if (!jitsiRoom.starts) {
|
||||
jitsiRoom.moderationStarts = null;
|
||||
}
|
||||
}
|
||||
|
||||
edit(jitsiRoom) {
|
||||
const dialogRef = this.dialog.open(JitsiEditDialog, {
|
||||
data: jitsiRoom,
|
||||
minWidth: '400px',
|
||||
});
|
||||
|
||||
dialogRef.afterClosed().subscribe(result => {
|
||||
if (result) {
|
||||
this.refresh();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Component({
|
||||
selector: 'app-jitsi-edit-dialog',
|
||||
templateUrl: 'jitsi.edit.html',
|
||||
styleUrls: [ './jitsi.edit.scss' ]
|
||||
})
|
||||
export class JitsiEditDialog {
|
||||
|
||||
form: FormGroup;
|
||||
jitsiRoom: any;
|
||||
datetimeformat: string;
|
||||
|
||||
constructor(
|
||||
private i18n: I18nService,
|
||||
private jitsiService: JitsiService,
|
||||
public dialogRef: MatDialogRef<JitsiEditDialog>,
|
||||
private formBuilder: FormBuilder,
|
||||
@Inject(MAT_DIALOG_DATA) public data: any) {
|
||||
this.jitsiRoom = JSON.parse(JSON.stringify(data));
|
||||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
this.datetimeformat = this.i18n.get('format.datetime', []);
|
||||
this.form = this.formBuilder.group({
|
||||
room: [ '', Validators.required ],
|
||||
starts: [ '', Validators.nullValidator ],
|
||||
moderationStarts: [ '', Validators.nullValidator ],
|
||||
expires: [ '', Validators.nullValidator ],
|
||||
});
|
||||
}
|
||||
|
||||
clearModeration(jitsiRoom) {
|
||||
if (!jitsiRoom.starts) {
|
||||
jitsiRoom.moderationStarts = null;
|
||||
}
|
||||
}
|
||||
|
||||
save() {
|
||||
this.jitsiService.update(this.jitsiRoom).subscribe((result: any) => {
|
||||
this.dialogRef.close(result);
|
||||
}, (error) => {
|
||||
if (error.status == 409) {
|
||||
let errors = {};
|
||||
for (let code of error.error) {
|
||||
errors[ code.field ] = errors[ code.field ] || {};
|
||||
errors[ code.field ][ code.code ] = true;
|
||||
}
|
||||
|
||||
for (let code in errors) {
|
||||
this.form.get(code).setErrors(errors[ code ]);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Component({
|
||||
selector: 'app-jitsi-share-dialog',
|
||||
templateUrl: 'jitsi.share.html',
|
||||
styleUrls: ['./jitsi.share.scss']
|
||||
styleUrls: [ './jitsi.share.scss' ]
|
||||
})
|
||||
export class JitsiShareDialog {
|
||||
|
||||
@ -179,14 +255,14 @@ export class JitsiShareDialog {
|
||||
ngOnInit(): void {
|
||||
this.datetimeformat = this.i18n.get('format.datetime', []);
|
||||
this.jitsiRoom.shareText = this.i18n.get('jitsi.share.text.intro', []);
|
||||
if(this.jitsiRoom.starts && !this.jitsiRoom.expires) {
|
||||
this.jitsiRoom.shareText += "\n\n" + this.i18n.get('jitsi.share.text.starts', [this.datePipe.transform(new Date(this.jitsiRoom.starts), this.datetimeformat)]);
|
||||
} else if(!this.jitsiRoom.starts && this.jitsiRoom.expires) {
|
||||
this.jitsiRoom.shareText += "\n\n" + this.i18n.get('jitsi.share.text.expires', [this.datePipe.transform(new Date(this.jitsiRoom.expires), this.datetimeformat)]);
|
||||
} else if(this.jitsiRoom.starts && this.jitsiRoom.expires) {
|
||||
this.jitsiRoom.shareText += "\n\n" + this.i18n.get('jitsi.share.text.both', [this.datePipe.transform(new Date(this.jitsiRoom.starts), this.datetimeformat), this.datePipe.transform(new Date(this.jitsiRoom.expires), this.datetimeformat)]);
|
||||
if (this.jitsiRoom.starts && !this.jitsiRoom.expires) {
|
||||
this.jitsiRoom.shareText += "\n\n" + this.i18n.get('jitsi.share.text.starts', [ this.datePipe.transform(new Date(this.jitsiRoom.starts), this.datetimeformat) ]);
|
||||
} else if (!this.jitsiRoom.starts && this.jitsiRoom.expires) {
|
||||
this.jitsiRoom.shareText += "\n\n" + this.i18n.get('jitsi.share.text.expires', [ this.datePipe.transform(new Date(this.jitsiRoom.expires), this.datetimeformat) ]);
|
||||
} else if (this.jitsiRoom.starts && this.jitsiRoom.expires) {
|
||||
this.jitsiRoom.shareText += "\n\n" + this.i18n.get('jitsi.share.text.both', [ this.datePipe.transform(new Date(this.jitsiRoom.starts), this.datetimeformat), this.datePipe.transform(new Date(this.jitsiRoom.expires), this.datetimeformat) ]);
|
||||
}
|
||||
this.jitsiRoom.shareText += "\n\n" + this.i18n.get('jitsi.share.text.outro', [this.jitsiRoom.url]);
|
||||
this.jitsiRoom.shareText += "\n\n" + this.i18n.get('jitsi.share.text.outro', [ this.jitsiRoom.url ]);
|
||||
}
|
||||
|
||||
copyToClipboard(text) {
|
||||
|
49
src/app/pages/jitsi/jitsi.edit.html
Normal file
49
src/app/pages/jitsi/jitsi.edit.html
Normal file
@ -0,0 +1,49 @@
|
||||
<h1 mat-dialog-title>
|
||||
<mat-icon inline="true">edit</mat-icon> {{'jitsi.rooms.edit' | i18n}}
|
||||
</h1>
|
||||
<mat-dialog-content>
|
||||
<form [formGroup]="form">
|
||||
<mat-form-field>
|
||||
<input matInput placeholder="{{'jitsi.rooms.room' | i18n}}" formControlName="room" [(ngModel)]="jitsiRoom.room"
|
||||
required pattern="[a-zA-Z0-9]+">
|
||||
<mat-error>
|
||||
{{'jitsi.rooms.error.room' | i18n}}
|
||||
</mat-error>
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field>
|
||||
<input matInput [ngxMatDatetimePicker]="startsPicker" [(ngModel)]="jitsiRoom.starts" formControlName="starts"
|
||||
placeholder="{{'jitsi.rooms.starts' | i18n}}" (dateChange)="clearModeration(jitsiRoom)">
|
||||
<mat-datepicker-toggle matSuffix [for]="startsPicker"></mat-datepicker-toggle>
|
||||
<ngx-mat-datetime-picker #startsPicker></ngx-mat-datetime-picker>
|
||||
<mat-error>
|
||||
{{'jitsi.rooms.error.starts' | i18n}}
|
||||
</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}}">
|
||||
<mat-datepicker-toggle matSuffix [for]="expiresPicker"></mat-datepicker-toggle>
|
||||
<ngx-mat-datetime-picker #expiresPicker></ngx-mat-datetime-picker>
|
||||
<mat-error>
|
||||
{{'jitsi.rooms.error.expires' | i18n}}
|
||||
</mat-error>
|
||||
</mat-form-field>
|
||||
</form>
|
||||
</mat-dialog-content>
|
||||
<mat-dialog-actions>
|
||||
<button mat-button [mat-dialog-close]="false">{{'cancel' | i18n}}</button>
|
||||
<button [disabled]="form.invalid" mat-raised-button (click)="save()" color="accent">{{ 'jitsi.rooms.save' |
|
||||
i18n}}</button>
|
||||
</mat-dialog-actions>
|
7
src/app/pages/jitsi/jitsi.edit.scss
Normal file
7
src/app/pages/jitsi/jitsi.edit.scss
Normal file
@ -0,0 +1,7 @@
|
||||
mat-form-field {
|
||||
display: block;
|
||||
}
|
||||
|
||||
mat-slide-toggle {
|
||||
margin-bottom: 24px;
|
||||
}
|
@ -133,6 +133,11 @@
|
||||
</mat-error>
|
||||
</mat-form-field>
|
||||
|
||||
<mat-slide-toggle [(ngModel)]="shortenedUrl.queryParameters" formControlName="queryParameters">
|
||||
{{'urlshortener.queryParameters' | i18n}}
|
||||
<mat-icon inline="true" matTooltip="{{'urlshortener.queryParameters.info' | i18n}}">info</mat-icon>
|
||||
</mat-slide-toggle>
|
||||
|
||||
<mat-form-field>
|
||||
<input matInput placeholder="{{'urlshortener.code' | i18n}}" formControlName="code"
|
||||
[(ngModel)]="shortenedUrl.code">
|
||||
|
@ -52,6 +52,7 @@ export class UrlShortenerComponent implements OnInit {
|
||||
password: [ '', Validators.nullValidator ],
|
||||
password2: [ '', Validators.nullValidator ],
|
||||
expires: [ '', Validators.nullValidator ],
|
||||
queryParameters: [ '', Validators.nullValidator ],
|
||||
}, {
|
||||
validator: MatchingValidator('password', 'password2')
|
||||
});
|
||||
@ -64,14 +65,14 @@ export class UrlShortenerComponent implements OnInit {
|
||||
})
|
||||
})
|
||||
|
||||
this.update();
|
||||
this.refresh();
|
||||
}
|
||||
|
||||
create(): void {
|
||||
this.working = true;
|
||||
|
||||
this.urlShortenerService.create(this.shortenedUrl).subscribe(response => {
|
||||
this.update();
|
||||
this.refresh();
|
||||
this.formDirective.resetForm();
|
||||
this.shortenedUrl = {};
|
||||
this.working = false;
|
||||
@ -91,7 +92,7 @@ export class UrlShortenerComponent implements OnInit {
|
||||
})
|
||||
}
|
||||
|
||||
update() {
|
||||
refresh() {
|
||||
this.shortenedUrlQuota = 0;
|
||||
this.quotaService.quotas().subscribe((data: any) => {
|
||||
for (let quota of data) {
|
||||
@ -149,7 +150,7 @@ export class UrlShortenerComponent implements OnInit {
|
||||
dialogRef.afterClosed().subscribe(result => {
|
||||
if (result) {
|
||||
this.urlShortenerService.delete(shortenedUrl.code).subscribe((result: any) => {
|
||||
this.update();
|
||||
this.refresh();
|
||||
})
|
||||
}
|
||||
});
|
||||
@ -169,15 +170,13 @@ export class UrlShortenerComponent implements OnInit {
|
||||
});
|
||||
|
||||
dialogRef.afterClosed().subscribe(result => {
|
||||
console.log(result);
|
||||
if (result) {
|
||||
this.update();
|
||||
this.refresh();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Component({
|
||||
selector: 'app-urlshortener-edit-dialog',
|
||||
templateUrl: 'urlshortener.edit.html',
|
||||
@ -192,7 +191,6 @@ export class UrlShortenerEditDialog {
|
||||
constructor(
|
||||
private i18n: I18nService,
|
||||
private urlShortenerService: UrlShortenerService,
|
||||
private snackBar: MatSnackBar,
|
||||
public dialogRef: MatDialogRef<UrlShortenerShareDialog>,
|
||||
private formBuilder: FormBuilder,
|
||||
@Inject(MAT_DIALOG_DATA) public data: any) {
|
||||
@ -202,6 +200,7 @@ export class UrlShortenerEditDialog {
|
||||
this.shortenedUrlModel.newCode = data.code;
|
||||
this.shortenedUrlModel.note = data.note;
|
||||
this.shortenedUrlModel.expires = data.expires;
|
||||
this.shortenedUrlModel.queryParameters = data.queryParameters;
|
||||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
@ -214,6 +213,7 @@ export class UrlShortenerEditDialog {
|
||||
password: [ '', Validators.nullValidator ],
|
||||
password2: [ '', Validators.nullValidator ],
|
||||
expires: [ '', Validators.nullValidator ],
|
||||
queryParameters: [ '', Validators.nullValidator ],
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -58,6 +58,11 @@
|
||||
</mat-error>
|
||||
</mat-form-field>
|
||||
|
||||
<mat-slide-toggle [(ngModel)]="shortenedUrlModel.queryParameters" formControlName="queryParameters">
|
||||
{{'urlshortener.queryParameters' | i18n}}
|
||||
<mat-icon inline="true" matTooltip="{{'urlshortener.queryParameters.info' | i18n}}">info</mat-icon>
|
||||
</mat-slide-toggle>
|
||||
|
||||
<mat-form-field>
|
||||
<input matInput placeholder="{{'urlshortener.code' | i18n}}" formControlName="code"
|
||||
[(ngModel)]="shortenedUrlModel.newCode">
|
||||
|
@ -35,6 +35,10 @@ export class JitsiService {
|
||||
return this.http.post(environment.apiUrl + "/jitsi/rooms", jitsiRoom);
|
||||
}
|
||||
|
||||
update(jitsiRoom) {
|
||||
return this.http.patch(environment.apiUrl + "/jitsi/rooms", jitsiRoom);
|
||||
}
|
||||
|
||||
createShortUrl(id) {
|
||||
return this.http.patch(environment.apiUrl + "/jitsi/rooms/" + id, null);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user