{{'jitsi.rooms.delete' | i18n}} |
@@ -99,7 +108,7 @@
+ placeholder="{{'jitsi.rooms.starts' | i18n}}" (dateChange)="clearModeration(jitsiRoom)">
diff --git a/src/app/pages/jitsi/jitsi.component.ts b/src/app/pages/jitsi/jitsi.component.ts
index 6b6dd04..168129b 100644
--- a/src/app/pages/jitsi/jitsi.component.ts
+++ b/src/app/pages/jitsi/jitsi.component.ts
@@ -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,
+ 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) {
diff --git a/src/app/pages/jitsi/jitsi.edit.html b/src/app/pages/jitsi/jitsi.edit.html
new file mode 100644
index 0000000..5c978fe
--- /dev/null
+++ b/src/app/pages/jitsi/jitsi.edit.html
@@ -0,0 +1,49 @@
+
+ edit {{'jitsi.rooms.edit' | i18n}}
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/app/pages/jitsi/jitsi.edit.scss b/src/app/pages/jitsi/jitsi.edit.scss
new file mode 100644
index 0000000..03bec19
--- /dev/null
+++ b/src/app/pages/jitsi/jitsi.edit.scss
@@ -0,0 +1,7 @@
+mat-form-field {
+ display: block;
+}
+
+mat-slide-toggle {
+ margin-bottom: 24px;
+}
\ No newline at end of file
diff --git a/src/app/pages/urlshortener/urlshortener.component.html b/src/app/pages/urlshortener/urlshortener.component.html
index 134447c..4953e13 100644
--- a/src/app/pages/urlshortener/urlshortener.component.html
+++ b/src/app/pages/urlshortener/urlshortener.component.html
@@ -36,7 +36,7 @@
{{'urlshortener.url' | i18n}} |
-
+
{{ shortenedUrl.url }}
open_in_new
@@ -133,6 +133,11 @@
+
+ {{'urlshortener.queryParameters' | i18n}}
+ info
+
+
diff --git a/src/app/pages/urlshortener/urlshortener.component.ts b/src/app/pages/urlshortener/urlshortener.component.ts
index 310edd0..4277ca4 100644
--- a/src/app/pages/urlshortener/urlshortener.component.ts
+++ b/src/app/pages/urlshortener/urlshortener.component.ts
@@ -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,
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 ],
});
}
diff --git a/src/app/pages/urlshortener/urlshortener.edit.html b/src/app/pages/urlshortener/urlshortener.edit.html
index 213677c..d0ec7f7 100644
--- a/src/app/pages/urlshortener/urlshortener.edit.html
+++ b/src/app/pages/urlshortener/urlshortener.edit.html
@@ -58,6 +58,11 @@
+
+ {{'urlshortener.queryParameters' | i18n}}
+ info
+
+
diff --git a/src/app/services/jitsi.service.ts b/src/app/services/jitsi.service.ts
index ec1dda6..a5e0474 100644
--- a/src/app/services/jitsi.service.ts
+++ b/src/app/services/jitsi.service.ts
@@ -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);
}
| |