migration
This commit is contained in:
parent
5cf6230005
commit
578e6e6981
@ -47,7 +47,8 @@ export class AuthenticatedGuard implements CanActivate {
|
|||||||
return that.router.navigateByUrl(that.router.parseUrl('/login?target=' + encodeURIComponent(state.url)), { skipLocationChange: true, replaceUrl: true });
|
return that.router.navigateByUrl(that.router.parseUrl('/login?target=' + encodeURIComponent(state.url)), { skipLocationChange: true, replaceUrl: true });
|
||||||
}
|
}
|
||||||
|
|
||||||
this.profileService.get([ "locale", "darkTheme" ]).subscribe((profileFields: any) => {
|
this.profileService.get([ "locale", "darkTheme" ]).subscribe({
|
||||||
|
next: (profileFields: any) => {
|
||||||
let updateLocale = false;
|
let updateLocale = false;
|
||||||
let darktheme = 'false';
|
let darktheme = 'false';
|
||||||
let updateTheme = false;
|
let updateTheme = false;
|
||||||
@ -70,6 +71,7 @@ export class AuthenticatedGuard implements CanActivate {
|
|||||||
if (updateLocale || updateTheme) {
|
if (updateLocale || updateTheme) {
|
||||||
window.location.reload();
|
window.location.reload();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
import {Component, OnInit} from '@angular/core';
|
import { Component, OnInit } from '@angular/core';
|
||||||
|
|
||||||
import {AuthService} from './../../services/auth.service';
|
import { AuthService } from './../../services/auth.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-account',
|
selector: 'app-account',
|
||||||
templateUrl: './account.component.html',
|
templateUrl: './account.component.html',
|
||||||
styleUrls: ['./account.component.scss']
|
styleUrls: [ './account.component.scss' ]
|
||||||
})
|
})
|
||||||
export class AccountComponent implements OnInit {
|
export class AccountComponent implements OnInit {
|
||||||
|
|
||||||
@ -13,8 +13,10 @@ export class AccountComponent implements OnInit {
|
|||||||
auth;
|
auth;
|
||||||
|
|
||||||
constructor(private authService: AuthService) {
|
constructor(private authService: AuthService) {
|
||||||
this.authService.auth.subscribe(data => {
|
this.authService.auth.subscribe({
|
||||||
|
next: (data) => {
|
||||||
this.auth = data;
|
this.auth = data;
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,16 +1,16 @@
|
|||||||
import {Component, OnInit, ViewChild} from '@angular/core';
|
import { Component, OnInit, ViewChild } from '@angular/core';
|
||||||
import {QuotaService} from '../../../services/quota.service';
|
import { QuotaService } from '../../../services/quota.service';
|
||||||
import {I18nService} from '../../../services/i18n.service';
|
import { I18nService } from '../../../services/i18n.service';
|
||||||
import {Sort} from '@angular/material/sort';
|
import { Sort } from '@angular/material/sort';
|
||||||
import {UserAliasService} from '../../../services/useralias.service';
|
import { UserAliasService } from '../../../services/useralias.service';
|
||||||
import {FormBuilder, FormGroup, Validators, NgForm} from '@angular/forms';
|
import { FormBuilder, FormGroup, Validators, NgForm } from '@angular/forms';
|
||||||
import {MatDialog} from '@angular/material/dialog';
|
import { MatDialog } from '@angular/material/dialog';
|
||||||
import {ConfirmDialog} from '../../../ui/confirm/confirm.component';
|
import { ConfirmDialog } from '../../../ui/confirm/confirm.component';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-account-aliases',
|
selector: 'app-account-aliases',
|
||||||
templateUrl: './aliases.component.html',
|
templateUrl: './aliases.component.html',
|
||||||
styleUrls: ['./aliases.component.scss']
|
styleUrls: [ './aliases.component.scss' ]
|
||||||
})
|
})
|
||||||
export class AliasesComponent implements OnInit {
|
export class AliasesComponent implements OnInit {
|
||||||
|
|
||||||
@ -24,21 +24,21 @@ export class AliasesComponent implements OnInit {
|
|||||||
success: boolean;
|
success: boolean;
|
||||||
working: boolean;
|
working: boolean;
|
||||||
|
|
||||||
aliasesColumns = ["alias", "visibility", "delete"];
|
aliasesColumns = [ "alias", "visibility", "delete" ];
|
||||||
visibilities = ["PRIVATE", "PROTECTED", "PUBLIC"];
|
visibilities = [ "PRIVATE", "PROTECTED", "PUBLIC" ];
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private quotaService: QuotaService,
|
private quotaService: QuotaService,
|
||||||
private formBuilder: FormBuilder,
|
private formBuilder: FormBuilder,
|
||||||
private userAliasService: UserAliasService,
|
private userAliasService: UserAliasService,
|
||||||
private i18n : I18nService,
|
private i18n: I18nService,
|
||||||
public dialog: MatDialog) {}
|
public dialog: MatDialog) { }
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
|
|
||||||
this.form = this.formBuilder.group({
|
this.form = this.formBuilder.group({
|
||||||
alias: ['', Validators.required],
|
alias: [ '', Validators.required ],
|
||||||
visibility: ['', Validators.required],
|
visibility: [ '', Validators.required ],
|
||||||
});
|
});
|
||||||
|
|
||||||
this.update();
|
this.update();
|
||||||
@ -46,47 +46,57 @@ export class AliasesComponent implements OnInit {
|
|||||||
|
|
||||||
create(): void {
|
create(): void {
|
||||||
this.working = true;
|
this.working = true;
|
||||||
this.userAliasService.create(this.alias).subscribe(response => {
|
this.userAliasService.create(this.alias).subscribe(
|
||||||
|
{
|
||||||
|
next: (response) => {
|
||||||
this.update();
|
this.update();
|
||||||
this.formDirective.resetForm();
|
this.formDirective.resetForm();
|
||||||
this.alias = {
|
this.alias = {
|
||||||
visibility: "PROTECTED"
|
visibility: "PROTECTED"
|
||||||
};
|
};
|
||||||
this.working = false;
|
this.working = false;
|
||||||
}, (error) => {
|
},
|
||||||
|
error: (error) => {
|
||||||
this.working = false;
|
this.working = false;
|
||||||
if(error.status == 409) {
|
if (error.status == 409) {
|
||||||
let errors = {};
|
let errors = {};
|
||||||
for(let code of error.error) {
|
for (let code of error.error) {
|
||||||
errors[code.field] = errors[code.field] || {};
|
errors[ code.field ] = errors[ code.field ] || {};
|
||||||
errors[code.field][code.code] = true;
|
errors[ code.field ][ code.code ] = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
for(let code in errors) {
|
for (let code in errors) {
|
||||||
this.form.get(code).setErrors(errors[code]);
|
this.form.get(code).setErrors(errors[ code ]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
updateAlias(alias) {
|
updateAlias(alias) {
|
||||||
this.userAliasService.update(alias).subscribe((response: any) => {
|
this.userAliasService.update(alias).subscribe({
|
||||||
|
next: (response: any) => {
|
||||||
alias = response;
|
alias = response;
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
update() {
|
update() {
|
||||||
this.aliasCreation = 0;
|
this.aliasCreation = 0;
|
||||||
this.quotaService.quotas().subscribe((data: any) => {
|
this.quotaService.quotas().subscribe({
|
||||||
for(let quota of data) {
|
next: (data: any) => {
|
||||||
if(quota.name == "alias_creation") {
|
for (let quota of data) {
|
||||||
|
if (quota.name == "alias_creation") {
|
||||||
this.aliasCreation = quota.value;
|
this.aliasCreation = quota.value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
this.userAliasService.get().subscribe((data: any) => {
|
this.userAliasService.get().subscribe({
|
||||||
|
next: (data: any) => {
|
||||||
this.aliases = data;
|
this.aliases = data;
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -94,29 +104,33 @@ export class AliasesComponent implements OnInit {
|
|||||||
const dialogRef = this.dialog.open(ConfirmDialog, {
|
const dialogRef = this.dialog.open(ConfirmDialog, {
|
||||||
data: {
|
data: {
|
||||||
'label': 'user.aliases.confirmDelete',
|
'label': 'user.aliases.confirmDelete',
|
||||||
'args': [alias.alias]
|
'args': [ alias.alias ]
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
dialogRef.afterClosed().subscribe(result => {
|
dialogRef.afterClosed().subscribe({
|
||||||
if(result) {
|
next: (result) => {
|
||||||
this.userAliasService.delete(alias.id).subscribe((result: any) => {
|
if (result) {
|
||||||
|
this.userAliasService.delete(alias.id).subscribe({
|
||||||
|
next: (result: any) => {
|
||||||
this.update();
|
this.update();
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
sortData(sort: Sort) {
|
sortData(sort: Sort) {
|
||||||
const data = this.aliases.slice();
|
const data = this.aliases.slice();
|
||||||
if(!sort.active || sort.direction === '') {
|
if (!sort.active || sort.direction === '') {
|
||||||
this.aliases = data;
|
this.aliases = data;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.aliases = data.sort((a, b) => {
|
this.aliases = data.sort((a, b) => {
|
||||||
const isAsc = sort.direction === 'asc';
|
const isAsc = sort.direction === 'asc';
|
||||||
switch(sort.active) {
|
switch (sort.active) {
|
||||||
case 'alias': return this.compare(a.alias, b.alias, isAsc);
|
case 'alias': return this.compare(a.alias, b.alias, isAsc);
|
||||||
case 'visibility': return this.compare(this.i18n.get('visibility.' + a.visibility, []), this.i18n.get('visibility.' + b.visibility, []), isAsc);
|
case 'visibility': return this.compare(this.i18n.get('visibility.' + a.visibility, []), this.i18n.get('visibility.' + b.visibility, []), isAsc);
|
||||||
default: return 0;
|
default: return 0;
|
||||||
@ -124,9 +138,9 @@ export class AliasesComponent implements OnInit {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
compare(a: number | string , b: number | string , isAsc: boolean) {
|
compare(a: number | string, b: number | string, isAsc: boolean) {
|
||||||
if (typeof a === 'string' && typeof b === 'string') {
|
if (typeof a === 'string' && typeof b === 'string') {
|
||||||
return a.localeCompare(b,undefined, { sensitivity: 'accent' } ) * (isAsc ? 1 : -1);
|
return a.localeCompare(b, undefined, { sensitivity: 'accent' }) * (isAsc ? 1 : -1);
|
||||||
}
|
}
|
||||||
return (a < b ? -1 : 1) * (isAsc ? 1 : -1);
|
return (a < b ? -1 : 1) * (isAsc ? 1 : -1);
|
||||||
}
|
}
|
||||||
|
@ -46,14 +46,16 @@ export class DomainsComponent implements OnInit {
|
|||||||
|
|
||||||
create(): void {
|
create(): void {
|
||||||
this.working = true;
|
this.working = true;
|
||||||
this.userDomainService.create(this.domain).subscribe(response => {
|
this.userDomainService.create(this.domain).subscribe({
|
||||||
|
next: (response) => {
|
||||||
this.update();
|
this.update();
|
||||||
this.formDirective.resetForm();
|
this.formDirective.resetForm();
|
||||||
this.domain = {
|
this.domain = {
|
||||||
visibility: "PRIVATE"
|
visibility: "PRIVATE"
|
||||||
};
|
};
|
||||||
this.working = false;
|
this.working = false;
|
||||||
}, (error) => {
|
},
|
||||||
|
error: (error) => {
|
||||||
this.working = false;
|
this.working = false;
|
||||||
if (error.status == 409) {
|
if (error.status == 409) {
|
||||||
let errors = {};
|
let errors = {};
|
||||||
@ -66,18 +68,23 @@ export class DomainsComponent implements OnInit {
|
|||||||
this.form.get(code).setErrors(errors[ code ]);
|
this.form.get(code).setErrors(errors[ code ]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
updateDomain(domain) {
|
updateDomain(domain) {
|
||||||
this.userDomainService.update(domain).subscribe((response: any) => {
|
this.userDomainService.update(domain).subscribe({
|
||||||
|
next: (response: any) => {
|
||||||
domain = response;
|
domain = response;
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
update() {
|
update() {
|
||||||
this.userDomainService.get().subscribe((data: any) => {
|
this.userDomainService.get().subscribe({
|
||||||
|
next: (data: any) => {
|
||||||
this.domains = data;
|
this.domains = data;
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -89,12 +96,16 @@ export class DomainsComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
dialogRef.afterClosed().subscribe(result => {
|
dialogRef.afterClosed().subscribe({
|
||||||
|
next: (result) => {
|
||||||
if (result) {
|
if (result) {
|
||||||
this.userDomainService.delete(domain.id).subscribe((result: any) => {
|
this.userDomainService.delete(domain.id).subscribe({
|
||||||
|
next: (result: any) => {
|
||||||
this.update();
|
this.update();
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,26 +1,30 @@
|
|||||||
import {Component, OnInit} from '@angular/core';
|
import { Component, OnInit } from '@angular/core';
|
||||||
import {PermissionService} from './../../../services/permission.service';
|
import { PermissionService } from './../../../services/permission.service';
|
||||||
import {QuotaService} from './../../../services/quota.service';
|
import { QuotaService } from './../../../services/quota.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-account-info',
|
selector: 'app-account-info',
|
||||||
templateUrl: './info.component.html',
|
templateUrl: './info.component.html',
|
||||||
styleUrls: ['./info.component.scss']
|
styleUrls: [ './info.component.scss' ]
|
||||||
})
|
})
|
||||||
export class InfoComponent implements OnInit {
|
export class InfoComponent implements OnInit {
|
||||||
|
|
||||||
permissions = [];
|
permissions = [];
|
||||||
quotas = [];
|
quotas = [];
|
||||||
|
|
||||||
constructor(private permissionService: PermissionService, private quotaService: QuotaService) {}
|
constructor(private permissionService: PermissionService, private quotaService: QuotaService) { }
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
this.permissionService.permissions().subscribe((data: any) => {
|
this.permissionService.permissions().subscribe({
|
||||||
|
next: (data: any) => {
|
||||||
this.permissions = data;
|
this.permissions = data;
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
this.quotaService.quotasAll().subscribe((data: any) => {
|
this.quotaService.quotasAll().subscribe({
|
||||||
|
next: (data: any) => {
|
||||||
this.quotas = data;
|
this.quotas = data;
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,15 +1,15 @@
|
|||||||
import {Component, OnInit, ViewChild, Inject} from '@angular/core';
|
import { Component, OnInit, ViewChild, Inject } from '@angular/core';
|
||||||
import {FormBuilder, FormGroup, FormControl, Validators, NgForm} from '@angular/forms';
|
import { FormBuilder, FormGroup, FormControl, Validators, NgForm } from '@angular/forms';
|
||||||
import {MatDialog, MatDialogRef, MAT_DIALOG_DATA} from '@angular/material/dialog';
|
import { MatDialog, MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
|
||||||
|
|
||||||
import {Auth2FAService} from './../../../services/auth.2fa.service';
|
import { Auth2FAService } from './../../../services/auth.2fa.service';
|
||||||
import {UserService} from './../../../services/user.service';
|
import { UserService } from './../../../services/user.service';
|
||||||
import {MatchingValidator} from './../../../utils/matching.validator';
|
import { MatchingValidator } from './../../../utils/matching.validator';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-account-security',
|
selector: 'app-account-security',
|
||||||
templateUrl: './security.component.html',
|
templateUrl: './security.component.html',
|
||||||
styleUrls: ['./security.component.scss']
|
styleUrls: [ './security.component.scss' ]
|
||||||
})
|
})
|
||||||
export class SecurityComponent implements OnInit {
|
export class SecurityComponent implements OnInit {
|
||||||
|
|
||||||
@ -20,7 +20,7 @@ export class SecurityComponent implements OnInit {
|
|||||||
public successStatus: boolean;
|
public successStatus: boolean;
|
||||||
public totp: boolean = false;
|
public totp: boolean = false;
|
||||||
|
|
||||||
statuses = ["NORMAL", "SLEEP", "PURGE"];
|
statuses = [ "NORMAL", "SLEEP", "PURGE" ];
|
||||||
|
|
||||||
passwordForm: FormGroup;
|
passwordForm: FormGroup;
|
||||||
statusForm: FormGroup;
|
statusForm: FormGroup;
|
||||||
@ -30,54 +30,60 @@ export class SecurityComponent implements OnInit {
|
|||||||
private formBuilder: FormBuilder,
|
private formBuilder: FormBuilder,
|
||||||
private userService: UserService,
|
private userService: UserService,
|
||||||
private auth2FAService: Auth2FAService,
|
private auth2FAService: Auth2FAService,
|
||||||
public dialog: MatDialog) {}
|
public dialog: MatDialog) { }
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
this.passwordForm = this.formBuilder.group({
|
this.passwordForm = this.formBuilder.group({
|
||||||
oldPassword: ['', Validators.required],
|
oldPassword: [ '', Validators.required ],
|
||||||
password: ['', Validators.required],
|
password: [ '', Validators.required ],
|
||||||
password2: ['', Validators.required]
|
password2: [ '', Validators.required ]
|
||||||
}, {
|
}, {
|
||||||
validator: MatchingValidator('password', 'password2')
|
validator: MatchingValidator('password', 'password2')
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
this.statusForm = this.formBuilder.group({
|
this.statusForm = this.formBuilder.group({
|
||||||
status: ['', Validators.required]
|
status: [ '', Validators.required ]
|
||||||
});
|
});
|
||||||
|
|
||||||
this.userService.get().subscribe((response: any) => {
|
this.userService.get().subscribe({
|
||||||
|
next: (response: any) => {
|
||||||
this.model.status = response.status;
|
this.model.status = response.status;
|
||||||
}, error => {
|
}, error: (error) => { }
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
this.auth2FAService.isEnabled('totp').subscribe(response => {
|
this.auth2FAService.isEnabled('totp').subscribe({
|
||||||
|
next: (response) => {
|
||||||
this.totp = true;
|
this.totp = true;
|
||||||
}, error => {
|
},
|
||||||
|
error: (error) => {
|
||||||
this.totp = false;
|
this.totp = false;
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
changePassword() {
|
changePassword() {
|
||||||
if(this.passwordForm.valid && !this.working) {
|
if (this.passwordForm.valid && !this.working) {
|
||||||
this.working = true;
|
this.working = true;
|
||||||
|
|
||||||
this.userService.password(this.model).subscribe((result: any) => {
|
this.userService.password(this.model).subscribe({
|
||||||
|
next: (result: any) => {
|
||||||
this.passwordFormDirective.resetForm();
|
this.passwordFormDirective.resetForm();
|
||||||
this.success = true;
|
this.success = true;
|
||||||
this.working = false;
|
this.working = false;
|
||||||
}, (error) => {
|
},
|
||||||
|
error: (error) => {
|
||||||
this.working = false;
|
this.working = false;
|
||||||
if(error.status == 409) {
|
if (error.status == 409) {
|
||||||
let errors = {};
|
let errors = {};
|
||||||
for(let code of error.error) {
|
for (let code of error.error) {
|
||||||
errors[code.field] = errors[code.field] || {};
|
errors[ code.field ] = errors[ code.field ] || {};
|
||||||
errors[code.field][code.code] = true;
|
errors[ code.field ][ code.code ] = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
for(let code in errors) {
|
for (let code in errors) {
|
||||||
this.passwordForm.get(code).setErrors(errors[code]);
|
this.passwordForm.get(code).setErrors(errors[ code ]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -86,37 +92,48 @@ export class SecurityComponent implements OnInit {
|
|||||||
|
|
||||||
|
|
||||||
changeStatus() {
|
changeStatus() {
|
||||||
if(this.statusForm.valid && !this.working) {
|
if (this.statusForm.valid && !this.working) {
|
||||||
this.working = true;
|
this.working = true;
|
||||||
|
|
||||||
this.userService.update({status : this.model.status}).subscribe((result: any) => {
|
this.userService.update({ status: this.model.status }).subscribe({
|
||||||
|
next: (result: any) => {
|
||||||
this.successStatus = true;
|
this.successStatus = true;
|
||||||
this.working = false;
|
this.working = false;
|
||||||
}, (error) => {
|
},
|
||||||
|
error: (error) => {
|
||||||
this.working = false;
|
this.working = false;
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
createTotp() {
|
createTotp() {
|
||||||
this.auth2FAService.create('totp').subscribe((result: any) => {
|
this.auth2FAService.create('totp').subscribe({
|
||||||
|
next: (result: any) => {
|
||||||
const dialogRef = this.dialog.open(SecurityTotpDialog, {
|
const dialogRef = this.dialog.open(SecurityTotpDialog, {
|
||||||
closeOnNavigation: false,
|
closeOnNavigation: false,
|
||||||
disableClose: true,
|
disableClose: true,
|
||||||
data: result
|
data: result
|
||||||
});
|
});
|
||||||
|
|
||||||
dialogRef.afterClosed().subscribe(result => {
|
dialogRef.afterClosed().subscribe({
|
||||||
if(result) {
|
next: (result) => {
|
||||||
this.auth2FAService.enable('totp', result).subscribe((result: any) => {
|
if (result) {
|
||||||
|
this.auth2FAService.enable('totp', result).subscribe({
|
||||||
|
next: (result: any) => {
|
||||||
this.totp = true;
|
this.totp = true;
|
||||||
|
}
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
this.auth2FAService.remove('totp').subscribe((result: any) => {
|
this.auth2FAService.remove('totp').subscribe({
|
||||||
|
next: (result: any) => {
|
||||||
this.totp = false;
|
this.totp = false;
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -130,8 +147,10 @@ export class SecurityComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
removeTotp() {
|
removeTotp() {
|
||||||
this.auth2FAService.remove('totp').subscribe((result: any) => {
|
this.auth2FAService.remove('totp').subscribe({
|
||||||
|
next: (result: any) => {
|
||||||
this.totp = false;
|
this.totp = false;
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -141,7 +160,7 @@ export class SecurityComponent implements OnInit {
|
|||||||
@Component({
|
@Component({
|
||||||
selector: 'app-security-totp-dialog',
|
selector: 'app-security-totp-dialog',
|
||||||
templateUrl: 'security-totp.dialog.html',
|
templateUrl: 'security-totp.dialog.html',
|
||||||
styleUrls: ['./security.component.scss']
|
styleUrls: [ './security.component.scss' ]
|
||||||
})
|
})
|
||||||
export class SecurityTotpDialog {
|
export class SecurityTotpDialog {
|
||||||
|
|
||||||
@ -150,9 +169,9 @@ export class SecurityTotpDialog {
|
|||||||
constructor(
|
constructor(
|
||||||
public dialogRef: MatDialogRef<SecurityTotpDialog>,
|
public dialogRef: MatDialogRef<SecurityTotpDialog>,
|
||||||
@Inject(MAT_DIALOG_DATA) public data: any
|
@Inject(MAT_DIALOG_DATA) public data: any
|
||||||
) {}
|
) { }
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
this.code = new FormControl('', [Validators.required, Validators.pattern("[0-9]{6}")]);
|
this.code = new FormControl('', [ Validators.required, Validators.pattern("[0-9]{6}") ]);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -23,8 +23,10 @@ export class VoucherComponent implements OnInit {
|
|||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
this.voucherSource.data = this.vouchers;
|
this.voucherSource.data = this.vouchers;
|
||||||
this.voucherService.get().subscribe((data: any) => {
|
this.voucherService.get().subscribe({
|
||||||
|
next: (data: any) => {
|
||||||
this.available = data;
|
this.available = data;
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -33,39 +33,55 @@ export class BorrowItemsComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.authService.auth.subscribe((auth: any) => {
|
this.authService.auth.subscribe({
|
||||||
|
next: (auth: any) => {
|
||||||
if (auth.principal && auth.principal.userId) {
|
if (auth.principal && auth.principal.userId) {
|
||||||
this.userId = auth.principal.userId;
|
this.userId = auth.principal.userId;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
this.searchFormControl.valueChanges.pipe(debounceTime(500)).subscribe(value => {
|
this.searchFormControl.valueChanges.pipe(debounceTime(500)).subscribe({
|
||||||
this.borrowItemsService.getItems(0, this.page.size, this.page.sort, this.page.desc, value, this.ownerFormControl.value).subscribe((data: any) => {
|
next: (value) => {
|
||||||
|
this.borrowItemsService.getItems(0, this.page.size, this.page.sort, this.page.desc, value, this.ownerFormControl.value).subscribe(
|
||||||
|
{
|
||||||
|
next: (data: any) => {
|
||||||
this.borrowItems = data;
|
this.borrowItems = data;
|
||||||
}, (error) => { })
|
}, error: (error) => { }
|
||||||
|
})
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
this.ownerFormControl.valueChanges.subscribe(value => {
|
this.ownerFormControl.valueChanges.subscribe({
|
||||||
this.borrowItemsService.getItems(0, this.page.size, this.page.sort, this.page.desc, this.searchFormControl.value, value).subscribe((data: any) => {
|
next: (value) => {
|
||||||
|
this.borrowItemsService.getItems(0, this.page.size, this.page.sort, this.page.desc, this.searchFormControl.value, value).subscribe({
|
||||||
|
next: (data: any) => {
|
||||||
this.borrowItems = data;
|
this.borrowItems = data;
|
||||||
}, (error) => { })
|
}, error: (error) => { }
|
||||||
|
})
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
this.refresh();
|
this.refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
refresh(): void {
|
refresh(): void {
|
||||||
this.borrowItemsService.getItems(this.page.page, this.page.size, this.page.sort, this.page.desc, this.searchFormControl.value, this.ownerFormControl.value).subscribe((data: any) => {
|
this.borrowItemsService.getItems(this.page.page, this.page.size, this.page.sort, this.page.desc, this.searchFormControl.value, this.ownerFormControl.value).subscribe({
|
||||||
|
next: (data: any) => {
|
||||||
this.borrowItems = data;
|
this.borrowItems = data;
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
updatePages(event: PageEvent) {
|
updatePages(event: PageEvent) {
|
||||||
this.page.page = event.pageIndex;
|
this.page.page = event.pageIndex;
|
||||||
this.page.size = event.pageSize;
|
this.page.size = event.pageSize;
|
||||||
this.borrowItemsService.getItems(this.page.page, this.page.size, this.page.sort, this.page.desc, this.searchFormControl.value, this.ownerFormControl.value).subscribe((data: any) => {
|
this.borrowItemsService.getItems(this.page.page, this.page.size, this.page.sort, this.page.desc, this.searchFormControl.value, this.ownerFormControl.value).subscribe({
|
||||||
|
next: (data: any) => {
|
||||||
this.borrowItems = data;
|
this.borrowItems = data;
|
||||||
}, (error) => { })
|
},
|
||||||
|
error: (error) => { }
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
updateSort(sort: Sort) {
|
updateSort(sort: Sort) {
|
||||||
@ -76,9 +92,13 @@ export class BorrowItemsComponent implements OnInit {
|
|||||||
this.page.sort = sort.active;
|
this.page.sort = sort.active;
|
||||||
this.page.desc = sort.direction == "desc";
|
this.page.desc = sort.direction == "desc";
|
||||||
}
|
}
|
||||||
this.borrowItemsService.getItems(this.page.page, this.page.size, this.page.sort, this.page.desc, this.searchFormControl.value, this.ownerFormControl.value).subscribe((data: any) => {
|
this.borrowItemsService.getItems(this.page.page, this.page.size, this.page.sort, this.page.desc, this.searchFormControl.value, this.ownerFormControl.value).subscribe({
|
||||||
|
next: (data: any) => {
|
||||||
this.borrowItems = data;
|
this.borrowItems = data;
|
||||||
}, (error) => { })
|
},
|
||||||
|
error: (error) => { }
|
||||||
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
edit(borrowItem) {
|
edit(borrowItem) {
|
||||||
@ -87,10 +107,12 @@ export class BorrowItemsComponent implements OnInit {
|
|||||||
minWidth: '80%'
|
minWidth: '80%'
|
||||||
});
|
});
|
||||||
|
|
||||||
dialogRef.afterClosed().subscribe(result => {
|
dialogRef.afterClosed().subscribe({
|
||||||
|
next: (result) => {
|
||||||
if (result) {
|
if (result) {
|
||||||
this.refresh();
|
this.refresh();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -100,10 +122,12 @@ export class BorrowItemsComponent implements OnInit {
|
|||||||
minWidth: '80%'
|
minWidth: '80%'
|
||||||
});
|
});
|
||||||
|
|
||||||
dialogRef.afterClosed().subscribe(result => {
|
dialogRef.afterClosed().subscribe({
|
||||||
|
next: result => {
|
||||||
if (result) {
|
if (result) {
|
||||||
this.refresh();
|
this.refresh();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -115,10 +139,12 @@ export class BorrowItemsComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
dialogRef.afterClosed().subscribe(result => {
|
dialogRef.afterClosed().subscribe({
|
||||||
|
next: (result) => {
|
||||||
if (result) {
|
if (result) {
|
||||||
this.refresh();
|
this.refresh();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -130,12 +156,16 @@ export class BorrowItemsComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
dialogRef.afterClosed().subscribe(result => {
|
dialogRef.afterClosed().subscribe({
|
||||||
|
next: (result) => {
|
||||||
if (result) {
|
if (result) {
|
||||||
this.borrowItemsService.deleteItem(borrowItem.id).subscribe((result: any) => {
|
this.borrowItemsService.deleteItem(borrowItem.id).subscribe({
|
||||||
|
next: (result: any) => {
|
||||||
this.refresh();
|
this.refresh();
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -172,13 +202,15 @@ export class BorrowItemEditComponent {
|
|||||||
slots: this.formBuilder.array([])
|
slots: this.formBuilder.array([])
|
||||||
}, { validators: [ durationValidator ] })
|
}, { validators: [ durationValidator ] })
|
||||||
|
|
||||||
this.form.get('availability').valueChanges.subscribe((value) => {
|
this.form.get('availability').valueChanges.subscribe({
|
||||||
|
next: (value) => {
|
||||||
this.slots.clear();
|
this.slots.clear();
|
||||||
if (value == 'MANUAL') {
|
if (value == 'MANUAL') {
|
||||||
this.addManualSlot('', '', '');
|
this.addManualSlot('', '', '');
|
||||||
} else if (value == 'PERIOD') {
|
} else if (value == 'PERIOD') {
|
||||||
this.addPeriodSlot('', '', '', '', '');
|
this.addPeriodSlot('', '', '', '', '');
|
||||||
}
|
}
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
if (data.id) {
|
if (data.id) {
|
||||||
@ -285,9 +317,11 @@ export class BorrowItemEditComponent {
|
|||||||
|
|
||||||
|
|
||||||
save() {
|
save() {
|
||||||
this.borrowItemsService.createOrUpdateItem(this.formToBorrowItem()).subscribe((data: any) => {
|
this.borrowItemsService.createOrUpdateItem(this.formToBorrowItem()).subscribe({
|
||||||
|
next: (data: any) => {
|
||||||
this.dialogRef.close(data);
|
this.dialogRef.close(data);
|
||||||
}, (error) => {
|
},
|
||||||
|
error: (error) => {
|
||||||
if (error.status == 409) {
|
if (error.status == 409) {
|
||||||
let errors = {};
|
let errors = {};
|
||||||
for (let code of error.error) {
|
for (let code of error.error) {
|
||||||
@ -299,6 +333,7 @@ export class BorrowItemEditComponent {
|
|||||||
this.form.get(code).setErrors(errors[ code ]);
|
this.form.get(code).setErrors(errors[ code ]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -312,12 +347,16 @@ export class BorrowItemEditComponent {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
dialogRef.afterClosed().subscribe(result => {
|
dialogRef.afterClosed().subscribe({
|
||||||
|
next: (result) => {
|
||||||
if (result) {
|
if (result) {
|
||||||
this.borrowItemsService.deleteItem(borrowItem.id).subscribe((result: any) => {
|
this.borrowItemsService.deleteItem(borrowItem.id).subscribe({
|
||||||
|
next: (result: any) => {
|
||||||
this.dialogRef.close(true);
|
this.dialogRef.close(true);
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -38,8 +38,10 @@ export class BorrowProvingComponent implements AfterViewInit {
|
|||||||
if (this.cameras.length) {
|
if (this.cameras.length) {
|
||||||
this.noCamera = false;
|
this.noCamera = false;
|
||||||
this.camera.setValue(this.cameras[ 0 ].id, { emitEvent: false });
|
this.camera.setValue(this.cameras[ 0 ].id, { emitEvent: false });
|
||||||
this.camera.valueChanges.subscribe((value) => {
|
this.camera.valueChanges.subscribe({
|
||||||
|
next: (value) => {
|
||||||
this.qrScanner.setCamera(value);
|
this.qrScanner.setCamera(value);
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -47,12 +49,14 @@ export class BorrowProvingComponent implements AfterViewInit {
|
|||||||
this.qrScanner.hasFlash().then(hasFlash => {
|
this.qrScanner.hasFlash().then(hasFlash => {
|
||||||
if (hasFlash) {
|
if (hasFlash) {
|
||||||
this.toggleFlash.enable();
|
this.toggleFlash.enable();
|
||||||
this.toggleFlash.valueChanges.subscribe(value => {
|
this.toggleFlash.valueChanges.subscribe({
|
||||||
|
next: (value) => {
|
||||||
if (value) {
|
if (value) {
|
||||||
this.qrScanner.turnFlashOn();
|
this.qrScanner.turnFlashOn();
|
||||||
} else {
|
} else {
|
||||||
this.qrScanner.turnFlashOff();
|
this.qrScanner.turnFlashOff();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
this.toggleFlash.disable();
|
this.toggleFlash.disable();
|
||||||
@ -64,10 +68,13 @@ export class BorrowProvingComponent implements AfterViewInit {
|
|||||||
|
|
||||||
onResult(result: string) {
|
onResult(result: string) {
|
||||||
this.qrScanner.pause();
|
this.qrScanner.pause();
|
||||||
this.borrowRequestService.verifyRequest(result).subscribe((response) => {
|
this.borrowRequestService.verifyRequest(result).subscribe({
|
||||||
|
next: (response) => {
|
||||||
this.openResultDialog(response, true);
|
this.openResultDialog(response, true);
|
||||||
}, (error) => {
|
},
|
||||||
|
error: (error) => {
|
||||||
this.openResultDialog(error, false);
|
this.openResultDialog(error, false);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -80,8 +87,10 @@ export class BorrowProvingComponent implements AfterViewInit {
|
|||||||
disableClose: true,
|
disableClose: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
dialogRef.afterClosed().subscribe(result => {
|
dialogRef.afterClosed().subscribe({
|
||||||
|
next: (result) => {
|
||||||
this.qrScanner.start();
|
this.qrScanner.start();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -33,34 +33,46 @@ export class BorrowRequestsComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.authService.auth.subscribe((auth: any) => {
|
this.authService.auth.subscribe({
|
||||||
|
next: (auth: any) => {
|
||||||
if (auth.principal && auth.principal.userId) {
|
if (auth.principal && auth.principal.userId) {
|
||||||
this.userId = auth.principal.userId;
|
this.userId = auth.principal.userId;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
this.ownerFormControl.valueChanges.subscribe(value => {
|
this.ownerFormControl.valueChanges.subscribe({
|
||||||
this.borrowRequestsService.getRequests(0, this.page.size, this.page.sort, this.page.desc, value).subscribe((data: any) => {
|
next: (value) => {
|
||||||
|
this.borrowRequestsService.getRequests(0, this.page.size, this.page.sort, this.page.desc, value).subscribe({
|
||||||
|
next: (data: any) => {
|
||||||
this.borrowRequests = data;
|
this.borrowRequests = data;
|
||||||
}, (error) => { })
|
},
|
||||||
|
error: (error) => { }
|
||||||
|
})
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
this.refresh();
|
this.refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
refresh(): void {
|
refresh(): void {
|
||||||
this.borrowRequestsService.getRequests(this.page.page, this.page.size, this.page.sort, this.page.desc, this.ownerFormControl.value).subscribe((data: any) => {
|
this.borrowRequestsService.getRequests(this.page.page, this.page.size, this.page.sort, this.page.desc, this.ownerFormControl.value).subscribe({
|
||||||
|
next: (data: any) => {
|
||||||
this.borrowRequests = data;
|
this.borrowRequests = data;
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
updatePages(event: PageEvent) {
|
updatePages(event: PageEvent) {
|
||||||
this.page.page = event.pageIndex;
|
this.page.page = event.pageIndex;
|
||||||
this.page.size = event.pageSize;
|
this.page.size = event.pageSize;
|
||||||
this.borrowRequestsService.getRequests(this.page.page, this.page.size, this.page.sort, this.page.desc, this.ownerFormControl.value).subscribe((data: any) => {
|
this.borrowRequestsService.getRequests(this.page.page, this.page.size, this.page.sort, this.page.desc, this.ownerFormControl.value).subscribe({
|
||||||
|
next: (data: any) => {
|
||||||
this.borrowRequests = data;
|
this.borrowRequests = data;
|
||||||
}, (error) => { })
|
},
|
||||||
|
error: (error) => { }
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
updateSort(sort: Sort) {
|
updateSort(sort: Sort) {
|
||||||
@ -71,9 +83,12 @@ export class BorrowRequestsComponent implements OnInit {
|
|||||||
this.page.sort = sort.active;
|
this.page.sort = sort.active;
|
||||||
this.page.desc = sort.direction == "desc";
|
this.page.desc = sort.direction == "desc";
|
||||||
}
|
}
|
||||||
this.borrowRequestsService.getRequests(this.page.page, this.page.size, this.page.sort, this.page.desc, this.ownerFormControl.value).subscribe((data: any) => {
|
this.borrowRequestsService.getRequests(this.page.page, this.page.size, this.page.sort, this.page.desc, this.ownerFormControl.value).subscribe({
|
||||||
|
next: (data: any) => {
|
||||||
this.borrowRequests = data;
|
this.borrowRequests = data;
|
||||||
}, (error) => { })
|
},
|
||||||
|
error: (error) => { }
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
edit(borrowRequest) {
|
edit(borrowRequest) {
|
||||||
@ -81,10 +96,12 @@ export class BorrowRequestsComponent implements OnInit {
|
|||||||
data: borrowRequest
|
data: borrowRequest
|
||||||
});
|
});
|
||||||
|
|
||||||
dialogRef.afterClosed().subscribe(result => {
|
dialogRef.afterClosed().subscribe({
|
||||||
|
next: (result) => {
|
||||||
if (result) {
|
if (result) {
|
||||||
this.refresh();
|
this.refresh();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -96,12 +113,16 @@ export class BorrowRequestsComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
dialogRef.afterClosed().subscribe(result => {
|
dialogRef.afterClosed().subscribe({
|
||||||
|
next: (result) => {
|
||||||
if (result) {
|
if (result) {
|
||||||
this.borrowRequestsService.deleteRequest(borrowRequest.id).subscribe((result: any) => {
|
this.borrowRequestsService.deleteRequest(borrowRequest.id).subscribe({
|
||||||
|
next: (result: any) => {
|
||||||
this.refresh();
|
this.refresh();
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -143,9 +164,11 @@ export class BorrowRequestEditComponent {
|
|||||||
|
|
||||||
|
|
||||||
save() {
|
save() {
|
||||||
this.borrowRequestsService.createOrUpdateRequest(this.formToBorrowRequest()).subscribe((data: any) => {
|
this.borrowRequestsService.createOrUpdateRequest(this.formToBorrowRequest()).subscribe({
|
||||||
|
next: (data: any) => {
|
||||||
this.dialogRef.close(data);
|
this.dialogRef.close(data);
|
||||||
}, (error) => {
|
},
|
||||||
|
error: (error) => {
|
||||||
if (error.status == 409) {
|
if (error.status == 409) {
|
||||||
let errors = {};
|
let errors = {};
|
||||||
for (let code of error.error) {
|
for (let code of error.error) {
|
||||||
@ -157,6 +180,7 @@ export class BorrowRequestEditComponent {
|
|||||||
this.form.get(code).setErrors(errors[ code ]);
|
this.form.get(code).setErrors(errors[ code ]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -170,12 +194,16 @@ export class BorrowRequestEditComponent {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
dialogRef.afterClosed().subscribe(result => {
|
dialogRef.afterClosed().subscribe({
|
||||||
|
next: (result) => {
|
||||||
if (result) {
|
if (result) {
|
||||||
this.borrowRequestsService.deleteRequest(borrowRequest.id).subscribe((result: any) => {
|
this.borrowRequestsService.deleteRequest(borrowRequest.id).subscribe({
|
||||||
|
next: (result: any) => {
|
||||||
this.dialogRef.close(true);
|
this.dialogRef.close(true);
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,44 +1,48 @@
|
|||||||
import {Component, OnInit} from '@angular/core';
|
import { Component, OnInit } from '@angular/core';
|
||||||
import {ActivatedRoute, Router} from '@angular/router';
|
import { ActivatedRoute, Router } from '@angular/router';
|
||||||
|
|
||||||
import {environment} from '../../../environments/environment';
|
import { environment } from '../../../environments/environment';
|
||||||
|
|
||||||
import {Auth2FAService} from '../../services/auth.2fa.service';
|
import { Auth2FAService } from '../../services/auth.2fa.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-form-login-2fa',
|
selector: 'app-form-login-2fa',
|
||||||
templateUrl: './form-login-2fa.component.html',
|
templateUrl: './form-login-2fa.component.html',
|
||||||
styleUrls: ['./form-login-2fa.component.scss']
|
styleUrls: [ './form-login-2fa.component.scss' ]
|
||||||
})
|
})
|
||||||
export class FormLogin2FAComponent implements OnInit {
|
export class FormLogin2FAComponent implements OnInit {
|
||||||
|
|
||||||
loginInvalid: boolean;
|
loginInvalid: boolean;
|
||||||
keep: boolean = false;
|
keep: boolean = false;
|
||||||
apiUrl = environment.apiUrl;
|
apiUrl = environment.apiUrl;
|
||||||
selectedProvider = {id: "", request: false};
|
selectedProvider = { id: "", request: false };
|
||||||
providers = [];
|
providers = [];
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private router: Router,
|
private router: Router,
|
||||||
private route: ActivatedRoute,
|
private route: ActivatedRoute,
|
||||||
private auth2FAService: Auth2FAService) {}
|
private auth2FAService: Auth2FAService) { }
|
||||||
|
|
||||||
async ngOnInit() {
|
async ngOnInit() {
|
||||||
this.route.queryParams.subscribe(params => {
|
this.route.queryParams.subscribe({
|
||||||
if(params['error'] || params['error'] == '') {
|
next: (params) => {
|
||||||
|
if (params[ 'error' ] || params[ 'error' ] == '') {
|
||||||
this.loginInvalid = true;
|
this.loginInvalid = true;
|
||||||
this.router.navigate([], {queryParams: {error: null}, queryParamsHandling: 'merge'});
|
this.router.navigate([], { queryParams: { error: null }, queryParamsHandling: 'merge' });
|
||||||
}
|
}
|
||||||
if(params['keep'] || params['keep'] == '') {
|
if (params[ 'keep' ] || params[ 'keep' ] == '') {
|
||||||
this.keep = true;
|
this.keep = true;
|
||||||
this.router.navigate([], {queryParams: {keep: null}, queryParamsHandling: 'merge'});
|
this.router.navigate([], { queryParams: { keep: null }, queryParamsHandling: 'merge' });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
this.auth2FAService.getEnabled().subscribe((providers: any) => {
|
this.auth2FAService.getEnabled().subscribe({
|
||||||
|
next: (providers: any) => {
|
||||||
this.providers = providers;
|
this.providers = providers;
|
||||||
if(this.providers[0]) {
|
if (this.providers[ 0 ]) {
|
||||||
this.selectedProvider = this.providers[0];
|
this.selectedProvider = this.providers[ 0 ];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -20,7 +20,8 @@ export class FormLoginComponent implements OnInit {
|
|||||||
private route: ActivatedRoute) { }
|
private route: ActivatedRoute) { }
|
||||||
|
|
||||||
async ngOnInit() {
|
async ngOnInit() {
|
||||||
this.route.queryParams.subscribe(params => {
|
this.route.queryParams.subscribe({
|
||||||
|
next: (params) => {
|
||||||
if (params[ 'target' ]) {
|
if (params[ 'target' ]) {
|
||||||
this.targetRoute = params[ 'target' ];
|
this.targetRoute = params[ 'target' ];
|
||||||
this.router.navigate([], { queryParams: { target: null }, queryParamsHandling: 'merge', replaceUrl: true });
|
this.router.navigate([], { queryParams: { target: null }, queryParamsHandling: 'merge', replaceUrl: true });
|
||||||
@ -29,6 +30,7 @@ export class FormLoginComponent implements OnInit {
|
|||||||
this.loginInvalid = true;
|
this.loginInvalid = true;
|
||||||
this.router.navigate([], { queryParams: { error: null }, queryParamsHandling: 'merge', replaceUrl: true });
|
this.router.navigate([], { queryParams: { error: null }, queryParamsHandling: 'merge', replaceUrl: true });
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -35,8 +35,10 @@ export class InviteCodeComponent implements OnInit {
|
|||||||
private i18n: I18nService,
|
private i18n: I18nService,
|
||||||
public dialog: MatDialog,
|
public dialog: MatDialog,
|
||||||
private route: ActivatedRoute) {
|
private route: ActivatedRoute) {
|
||||||
this.authService.auth.subscribe(data => {
|
this.authService.auth.subscribe({
|
||||||
|
next: (data) => {
|
||||||
this.auth = data;
|
this.auth = data;
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -53,7 +55,8 @@ export class InviteCodeComponent implements OnInit {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const code = this.route.snapshot.paramMap.get('code');
|
const code = this.route.snapshot.paramMap.get('code');
|
||||||
this.inviteService.code(code).subscribe((data) => {
|
this.inviteService.code(code).subscribe({
|
||||||
|
next: (data) => {
|
||||||
this.invite = data;
|
this.invite = data;
|
||||||
|
|
||||||
if (this.invite.redeemed) {
|
if (this.invite.redeemed) {
|
||||||
@ -71,19 +74,25 @@ export class InviteCodeComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.working = false;
|
this.working = false;
|
||||||
}, (error) => {
|
},
|
||||||
|
error: (error) => {
|
||||||
this.working = false;
|
this.working = false;
|
||||||
if (error.status == 406) {
|
if (error.status == 406) {
|
||||||
this.error = "INVALID_CODE";
|
this.error = "INVALID_CODE";
|
||||||
}
|
}
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
this.inviteService.permissions(code).subscribe((data: any) => {
|
this.inviteService.permissions(code).subscribe({
|
||||||
|
next: (data: any) => {
|
||||||
this.permissions = data;
|
this.permissions = data;
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
this.inviteService.quotas(code).subscribe((data: any) => {
|
this.inviteService.quotas(code).subscribe({
|
||||||
|
next: (data: any) => {
|
||||||
this.quotas = data;
|
this.quotas = data;
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -108,10 +117,12 @@ export class InviteCodeComponent implements OnInit {
|
|||||||
model.password = this.form.get("password").value;
|
model.password = this.form.get("password").value;
|
||||||
model.password2 = this.form.get("password2").value;
|
model.password2 = this.form.get("password2").value;
|
||||||
|
|
||||||
this.inviteService.register(model).subscribe((result: any) => {
|
this.inviteService.register(model).subscribe({
|
||||||
|
next: (result: any) => {
|
||||||
this.working = false;
|
this.working = false;
|
||||||
this.success = true;
|
this.success = true;
|
||||||
}, (error) => {
|
},
|
||||||
|
error: (error) => {
|
||||||
this.working = false;
|
this.working = false;
|
||||||
if (error.status == 401) {
|
if (error.status == 401) {
|
||||||
this.error = "NO_CODE";
|
this.error = "NO_CODE";
|
||||||
@ -130,6 +141,7 @@ export class InviteCodeComponent implements OnInit {
|
|||||||
this.form.get(code).setErrors(errors[ code ]);
|
this.form.get(code).setErrors(errors[ code ]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -140,10 +152,12 @@ export class InviteCodeComponent implements OnInit {
|
|||||||
this.working = true;
|
this.working = true;
|
||||||
this.invite.message = this.form.get("message").value;
|
this.invite.message = this.form.get("message").value;
|
||||||
this.invite.note = this.form.get("note").value;
|
this.invite.note = this.form.get("note").value;
|
||||||
this.inviteService.update(this.invite).subscribe((result: any) => {
|
this.inviteService.update(this.invite).subscribe({
|
||||||
|
next: (result: any) => {
|
||||||
this.invite = result;
|
this.invite = result;
|
||||||
this.working = false;
|
this.working = false;
|
||||||
}, (error) => {
|
},
|
||||||
|
error: (error) => {
|
||||||
this.working = false;
|
this.working = false;
|
||||||
if (error.status == 406) {
|
if (error.status == 406) {
|
||||||
this.error = "INVALID_CODE";
|
this.error = "INVALID_CODE";
|
||||||
@ -160,6 +174,7 @@ export class InviteCodeComponent implements OnInit {
|
|||||||
this.form.get(code).setErrors(errors[ code ]);
|
this.form.get(code).setErrors(errors[ code ]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -44,10 +44,12 @@ export class InviteEditComponent {
|
|||||||
this.invite.message = this.form.get("message").value;
|
this.invite.message = this.form.get("message").value;
|
||||||
this.invite.note = this.form.get("note").value;
|
this.invite.note = this.form.get("note").value;
|
||||||
|
|
||||||
this.inviteService.update(this.invite).subscribe((result: any) => {
|
this.inviteService.update(this.invite).subscribe({
|
||||||
|
next: (result: any) => {
|
||||||
this.working = false;
|
this.working = false;
|
||||||
this.dialogRef.close(result);
|
this.dialogRef.close(result);
|
||||||
}, (error) => {
|
},
|
||||||
|
error: (error) => {
|
||||||
this.working = false;
|
this.working = false;
|
||||||
if (error.status == 406) {
|
if (error.status == 406) {
|
||||||
this.error = "INVALID_CODE";
|
this.error = "INVALID_CODE";
|
||||||
@ -64,6 +66,7 @@ export class InviteEditComponent {
|
|||||||
this.form.get(code).setErrors(errors[ code ]);
|
this.form.get(code).setErrors(errors[ code ]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -47,26 +47,46 @@ export class InvitesComponent implements OnInit {
|
|||||||
this.datetimeformat = this.i18n.get('format.datetime', []);
|
this.datetimeformat = this.i18n.get('format.datetime', []);
|
||||||
this.quota = this.route.snapshot.paramMap.get('quota');
|
this.quota = this.route.snapshot.paramMap.get('quota');
|
||||||
|
|
||||||
this.searchFormControl.valueChanges.pipe(debounceTime(500)).subscribe(value => {
|
this.searchFormControl.valueChanges.pipe(debounceTime(500)).subscribe({
|
||||||
this.inviteService.getPages(this.quota, 0, this.invites.size, value, this.redeemedFormControl.value).subscribe((data: any) => {
|
next: (value) => {
|
||||||
|
this.inviteService.getPages(this.quota, 0, this.invites.size, value, this.redeemedFormControl.value).subscribe({
|
||||||
|
next: (data: any) => {
|
||||||
this.invites = data;
|
this.invites = data;
|
||||||
}, (error) => { })
|
},
|
||||||
|
error: (error) => { }
|
||||||
})
|
})
|
||||||
this.redeemedFormControl.valueChanges.subscribe(value => {
|
}
|
||||||
this.inviteService.getPages(this.quota, 0, this.invites.size, this.searchFormControl.value ? this.searchFormControl.value : "", value).subscribe((data: any) => {
|
})
|
||||||
|
this.redeemedFormControl.valueChanges.subscribe({
|
||||||
|
next: (value) => {
|
||||||
|
this.inviteService.getPages(this.quota, 0, this.invites.size, this.searchFormControl.value ? this.searchFormControl.value : "", value).subscribe({
|
||||||
|
next: (data: any) => {
|
||||||
this.invites = data;
|
this.invites = data;
|
||||||
}, (error) => { })
|
},
|
||||||
|
error: (error) => { }
|
||||||
|
})
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
this.searchOthersFormControl.valueChanges.pipe(debounceTime(500)).subscribe(value => {
|
this.searchOthersFormControl.valueChanges.pipe(debounceTime(500)).subscribe({
|
||||||
this.inviteService.getOthersPages(this.quota, 0, this.others.size, value, this.redeemedOthersFormControl.value).subscribe((data: any) => {
|
next: (value) => {
|
||||||
|
this.inviteService.getOthersPages(this.quota, 0, this.others.size, value, this.redeemedOthersFormControl.value).subscribe({
|
||||||
|
next: (data: any) => {
|
||||||
this.others = data;
|
this.others = data;
|
||||||
}, (error) => { })
|
},
|
||||||
|
error: (error) => { }
|
||||||
})
|
})
|
||||||
this.redeemedOthersFormControl.valueChanges.subscribe(value => {
|
}
|
||||||
this.inviteService.getOthersPages(this.quota, 0, this.others.size, this.searchOthersFormControl.value ? this.searchOthersFormControl.value : "", value).subscribe((data: any) => {
|
})
|
||||||
|
|
||||||
|
this.redeemedOthersFormControl.valueChanges.subscribe({
|
||||||
|
next: (value) => {
|
||||||
|
this.inviteService.getOthersPages(this.quota, 0, this.others.size, this.searchOthersFormControl.value ? this.searchOthersFormControl.value : "", value).subscribe({
|
||||||
|
next: (data: any) => {
|
||||||
this.others = data;
|
this.others = data;
|
||||||
}, (error) => { })
|
}, error: (error) => { }
|
||||||
|
})
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
this.update();
|
this.update();
|
||||||
@ -75,41 +95,56 @@ export class InvitesComponent implements OnInit {
|
|||||||
|
|
||||||
update(): void {
|
update(): void {
|
||||||
this.inviteQuota = 0;
|
this.inviteQuota = 0;
|
||||||
this.quotaService.quotas().subscribe((data: any) => {
|
this.quotaService.quotas().subscribe({
|
||||||
|
next: (data: any) => {
|
||||||
for (let quota of data) {
|
for (let quota of data) {
|
||||||
if (quota.name == "invite_" + this.quota) {
|
if (quota.name == "invite_" + this.quota) {
|
||||||
this.inviteQuota = quota.value;
|
this.inviteQuota = quota.value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
if (!this.invites) {
|
if (!this.invites) {
|
||||||
this.inviteService.get(this.quota).subscribe((data: any) => {
|
this.inviteService.get(this.quota).subscribe({
|
||||||
|
next: (data: any) => {
|
||||||
this.invites = data;
|
this.invites = data;
|
||||||
|
}
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
this.inviteService.getPages(this.quota, this.invites.number || 0, this.invites.size || 10, this.searchFormControl.value ? this.searchFormControl.value : "", this.redeemedFormControl.value).subscribe((data: any) => {
|
this.inviteService.getPages(this.quota, this.invites.number || 0, this.invites.size || 10, this.searchFormControl.value ? this.searchFormControl.value : "", this.redeemedFormControl.value).subscribe({
|
||||||
|
next: (data: any) => {
|
||||||
this.invites = data;
|
this.invites = data;
|
||||||
}, (error) => { })
|
},
|
||||||
|
error: (error) => { }
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
this.inviteService.getOthers(this.quota).subscribe((data: any) => {
|
this.inviteService.getOthers(this.quota).subscribe({
|
||||||
|
next: (data: any) => {
|
||||||
this.others = data;
|
this.others = data;
|
||||||
}, (error) => { })
|
},
|
||||||
|
error: (error) => { }
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
updatePages(event: PageEvent) {
|
updatePages(event: PageEvent) {
|
||||||
this.inviteService.getPages(this.quota, event.pageIndex, event.pageSize, this.searchFormControl.value ? this.searchFormControl.value : "", this.redeemedFormControl.value).subscribe((data: any) => {
|
this.inviteService.getPages(this.quota, event.pageIndex, event.pageSize, this.searchFormControl.value ? this.searchFormControl.value : "", this.redeemedFormControl.value).subscribe({
|
||||||
|
next: (data: any) => {
|
||||||
this.invites = data;
|
this.invites = data;
|
||||||
}, (error) => { })
|
},
|
||||||
|
error: (error) => { }
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
create(): void {
|
create(): void {
|
||||||
this.working = true;
|
this.working = true;
|
||||||
this.inviteService.create(this.quota, {}).subscribe(response => {
|
this.inviteService.create(this.quota, {}).subscribe({
|
||||||
|
next: (response) => {
|
||||||
this.update();
|
this.update();
|
||||||
this.working = false;
|
this.working = false;
|
||||||
}, (error) => {
|
},
|
||||||
|
error: (error) => {
|
||||||
this.working = false;
|
this.working = false;
|
||||||
if (error.status == 409) {
|
if (error.status == 409) {
|
||||||
let errors = {};
|
let errors = {};
|
||||||
@ -118,6 +153,7 @@ export class InvitesComponent implements OnInit {
|
|||||||
errors[ code.field ][ code.code ] = true;
|
errors[ code.field ][ code.code ] = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -127,16 +163,21 @@ export class InvitesComponent implements OnInit {
|
|||||||
minWidth: "400px"
|
minWidth: "400px"
|
||||||
});
|
});
|
||||||
|
|
||||||
dialogRef.afterClosed().subscribe(result => {
|
dialogRef.afterClosed().subscribe({
|
||||||
|
next: (result) => {
|
||||||
if (result) {
|
if (result) {
|
||||||
this.update();
|
this.update();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
updateOthers(event: PageEvent) {
|
updateOthers(event: PageEvent) {
|
||||||
this.inviteService.getOthersPages(this.quota, event.pageIndex, event.pageSize, this.searchOthersFormControl.value ? this.searchOthersFormControl.value : "", this.redeemedOthersFormControl.value).subscribe((data: any) => {
|
this.inviteService.getOthersPages(this.quota, event.pageIndex, event.pageSize, this.searchOthersFormControl.value ? this.searchOthersFormControl.value : "", this.redeemedOthersFormControl.value).subscribe({
|
||||||
|
next: (data: any) => {
|
||||||
this.others = data;
|
this.others = data;
|
||||||
}, (error) => { })
|
},
|
||||||
|
error: (error) => { }
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -61,12 +61,14 @@ export class JitsiComponent implements OnInit {
|
|||||||
this.jitsiRoom.moderationStarts = null;
|
this.jitsiRoom.moderationStarts = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.jitsiService.create(this.jitsiRoom).subscribe(response => {
|
this.jitsiService.create(this.jitsiRoom).subscribe({
|
||||||
|
next: (response) => {
|
||||||
this.refresh();
|
this.refresh();
|
||||||
this.formDirective.resetForm();
|
this.formDirective.resetForm();
|
||||||
this.jitsiRoom = {};
|
this.jitsiRoom = {};
|
||||||
this.working = false;
|
this.working = false;
|
||||||
}, (error) => {
|
},
|
||||||
|
error: (error) => {
|
||||||
this.working = false;
|
this.working = false;
|
||||||
if (error.status == 409) {
|
if (error.status == 409) {
|
||||||
let errors = {};
|
let errors = {};
|
||||||
@ -79,13 +81,15 @@ export class JitsiComponent implements OnInit {
|
|||||||
this.form.get(code).setErrors(errors[ code ]);
|
this.form.get(code).setErrors(errors[ code ]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
refresh() {
|
refresh() {
|
||||||
this.jitsiRoomsQuota = 0;
|
this.jitsiRoomsQuota = 0;
|
||||||
this.shortenedUrlQuota = 0;
|
this.shortenedUrlQuota = 0;
|
||||||
this.quotaService.quotas().subscribe((data: any) => {
|
this.quotaService.quotas().subscribe({
|
||||||
|
next: (data: any) => {
|
||||||
for (let quota of data) {
|
for (let quota of data) {
|
||||||
if (quota.name == "jitsi") {
|
if (quota.name == "jitsi") {
|
||||||
this.jitsiRoomsQuota = quota.value;
|
this.jitsiRoomsQuota = quota.value;
|
||||||
@ -93,19 +97,25 @@ export class JitsiComponent implements OnInit {
|
|||||||
this.shortenedUrlQuota = quota.value;
|
this.shortenedUrlQuota = quota.value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
this.jitsiService.get(this.page.page, this.page.size, this.page.sort, this.page.desc).subscribe((data: any) => {
|
this.jitsiService.get(this.page.page, this.page.size, this.page.sort, this.page.desc).subscribe({
|
||||||
|
next: (data: any) => {
|
||||||
this.jitsiRooms = data;
|
this.jitsiRooms = data;
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
updatePages(event: PageEvent) {
|
updatePages(event: PageEvent) {
|
||||||
this.page.page = event.pageIndex;
|
this.page.page = event.pageIndex;
|
||||||
this.page.size = event.pageSize;
|
this.page.size = event.pageSize;
|
||||||
this.jitsiService.get(this.page.page, this.page.size, this.page.sort, this.page.desc).subscribe((data: any) => {
|
this.jitsiService.get(this.page.page, this.page.size, this.page.sort, this.page.desc).subscribe({
|
||||||
|
next: (data: any) => {
|
||||||
this.jitsiRooms = data;
|
this.jitsiRooms = data;
|
||||||
}, (error) => { })
|
},
|
||||||
|
error: (error) => { }
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
updateSort(sort: Sort) {
|
updateSort(sort: Sort) {
|
||||||
@ -116,9 +126,12 @@ export class JitsiComponent implements OnInit {
|
|||||||
this.page.sort = sort.active;
|
this.page.sort = sort.active;
|
||||||
this.page.desc = sort.direction == "desc";
|
this.page.desc = sort.direction == "desc";
|
||||||
}
|
}
|
||||||
this.jitsiService.get(this.page.page, this.page.size, this.page.sort, this.page.desc).subscribe((data: any) => {
|
this.jitsiService.get(this.page.page, this.page.size, this.page.sort, this.page.desc).subscribe({
|
||||||
|
next: (data: any) => {
|
||||||
this.jitsiRooms = data;
|
this.jitsiRooms = data;
|
||||||
}, (error) => { })
|
},
|
||||||
|
error: (error) => { }
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
confirmDelete(jitsiRoom) {
|
confirmDelete(jitsiRoom) {
|
||||||
@ -129,12 +142,16 @@ export class JitsiComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
dialogRef.afterClosed().subscribe(result => {
|
dialogRef.afterClosed().subscribe({
|
||||||
|
next: (result) => {
|
||||||
if (result) {
|
if (result) {
|
||||||
this.jitsiService.delete(jitsiRoom.id).subscribe((result: any) => {
|
this.jitsiService.delete(jitsiRoom.id).subscribe({
|
||||||
|
next: (result: any) => {
|
||||||
this.refresh();
|
this.refresh();
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -150,10 +167,13 @@ export class JitsiComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
createShortenedUrl(jitsiRoom: any) {
|
createShortenedUrl(jitsiRoom: any) {
|
||||||
this.jitsiService.createShortUrl(jitsiRoom.id).subscribe((result: any) => {
|
this.jitsiService.createShortUrl(jitsiRoom.id).subscribe({
|
||||||
|
next: (result: any) => {
|
||||||
this.refresh();
|
this.refresh();
|
||||||
}, (error: any) => {
|
},
|
||||||
|
error: (error: any) => {
|
||||||
this.snackBar.open(this.i18n.get("urlshortener.noQuota", []), this.i18n.get("close", []));
|
this.snackBar.open(this.i18n.get("urlshortener.noQuota", []), this.i18n.get("close", []));
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -176,10 +196,12 @@ export class JitsiComponent implements OnInit {
|
|||||||
minWidth: '400px',
|
minWidth: '400px',
|
||||||
});
|
});
|
||||||
|
|
||||||
dialogRef.afterClosed().subscribe(result => {
|
dialogRef.afterClosed().subscribe({
|
||||||
|
next: (result) => {
|
||||||
if (result) {
|
if (result) {
|
||||||
this.refresh();
|
this.refresh();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -222,9 +244,11 @@ export class JitsiEditDialog {
|
|||||||
}
|
}
|
||||||
|
|
||||||
save() {
|
save() {
|
||||||
this.jitsiService.update(this.jitsiRoom).subscribe((result: any) => {
|
this.jitsiService.update(this.jitsiRoom).subscribe({
|
||||||
|
next: (result: any) => {
|
||||||
this.dialogRef.close(result);
|
this.dialogRef.close(result);
|
||||||
}, (error) => {
|
},
|
||||||
|
error: (error) => {
|
||||||
if (error.status == 409) {
|
if (error.status == 409) {
|
||||||
let errors = {};
|
let errors = {};
|
||||||
for (let code of error.error) {
|
for (let code of error.error) {
|
||||||
@ -236,6 +260,7 @@ export class JitsiEditDialog {
|
|||||||
this.form.get(code).setErrors(errors[ code ]);
|
this.form.get(code).setErrors(errors[ code ]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
<mat-card-header>
|
<mat-card-header>
|
||||||
<mat-card-title>{{'jukebox' | i18n}}</mat-card-title>
|
<mat-card-title>{{'jukebox' | i18n}}</mat-card-title>
|
||||||
</mat-card-header>
|
</mat-card-header>
|
||||||
|
<ng-container *ngIf="!checking">
|
||||||
<mat-card-title-group *ngIf="currentTrack">
|
<mat-card-title-group *ngIf="currentTrack">
|
||||||
<img *ngIf="getImageUrl(currentTrack)" mat-card-sm-image [src]="getImageUrl(currentTrack)">
|
<img *ngIf="getImageUrl(currentTrack)" mat-card-sm-image [src]="getImageUrl(currentTrack)">
|
||||||
<mat-card-title><small>{{'jukebox.current' | i18n}}</small></mat-card-title>
|
<mat-card-title><small>{{'jukebox.current' | i18n}}</small></mat-card-title>
|
||||||
@ -22,11 +23,25 @@
|
|||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
</mat-card-content>
|
</mat-card-content>
|
||||||
<mat-card-actions>
|
<mat-card-actions>
|
||||||
<button mat-raised-button type="submit" [disabled]="!searchFormControl.value || timeout > 0 || searchDisabled">
|
<button mat-raised-button type="submit"
|
||||||
|
[disabled]="!searchFormControl.value || timeout > 0 || searchDisabled">
|
||||||
<mat-icon inline="true">{{'jukebox.search.icon' | i18n}}</mat-icon>
|
<mat-icon inline="true">{{'jukebox.search.icon' | i18n}}</mat-icon>
|
||||||
{{'jukebox.search.submit' | i18n}}
|
{{'jukebox.search.submit' | i18n}}
|
||||||
</button>
|
</button>
|
||||||
</mat-card-actions>
|
</mat-card-actions>
|
||||||
|
<mat-card-footer>
|
||||||
|
<a (click)="check()" class="help-button" mat-fab color="accent">
|
||||||
|
<mat-icon>refresh</mat-icon>
|
||||||
|
</a>
|
||||||
|
</mat-card-footer>
|
||||||
|
</ng-container>
|
||||||
|
|
||||||
|
<ng-container *ngIf="checking">
|
||||||
|
<mat-card-actions>
|
||||||
|
<mat-progress-bar mode="indeterminate"></mat-progress-bar>
|
||||||
|
</mat-card-actions>
|
||||||
|
</ng-container>
|
||||||
|
|
||||||
</mat-card>
|
</mat-card>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, OnDestroy, OnInit } from '@angular/core';
|
||||||
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
|
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
|
||||||
import { MatDialog } from '@angular/material/dialog';
|
import { MatDialog } from '@angular/material/dialog';
|
||||||
import { MatSnackBar } from '@angular/material/snack-bar';
|
import { MatSnackBar } from '@angular/material/snack-bar';
|
||||||
@ -15,18 +15,20 @@ import { Data } from '@angular/router';
|
|||||||
templateUrl: './jukebox.component.html',
|
templateUrl: './jukebox.component.html',
|
||||||
styleUrls: [ './jukebox.component.scss' ]
|
styleUrls: [ './jukebox.component.scss' ]
|
||||||
})
|
})
|
||||||
export class JukeboxComponent implements OnInit {
|
export class JukeboxComponent implements OnInit, OnDestroy {
|
||||||
|
|
||||||
timeout: number = 0;
|
timeout: number = 0;
|
||||||
timer;
|
timer;
|
||||||
searchResult: any;
|
searchResult: any;
|
||||||
currentTrack: any;
|
currentTrack: any;
|
||||||
|
checking: boolean = false;
|
||||||
active: boolean = false;
|
active: boolean = false;
|
||||||
wait: boolean = false;
|
wait: boolean = false;
|
||||||
forbidden: boolean = false;
|
forbidden: boolean = false;
|
||||||
unavailable: boolean = false;
|
unavailable: boolean = false;
|
||||||
searchDisabled = true;
|
searchDisabled = true;
|
||||||
searchFormControl = new FormControl();
|
searchFormControl = new FormControl();
|
||||||
|
automaticCheck;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
public dialog: MatDialog,
|
public dialog: MatDialog,
|
||||||
@ -37,23 +39,38 @@ export class JukeboxComponent implements OnInit {
|
|||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
this.check();
|
this.check();
|
||||||
|
|
||||||
this.searchFormControl.valueChanges.subscribe(value => {
|
this.searchFormControl.valueChanges.subscribe({
|
||||||
|
next: (value) => {
|
||||||
this.searchDisabled = false;
|
this.searchDisabled = false;
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
this.automaticCheck = setInterval(() => {
|
||||||
|
this.check();
|
||||||
|
}, 15000);
|
||||||
|
}
|
||||||
|
|
||||||
|
ngOnDestroy(): void {
|
||||||
|
if (this.automaticCheck) {
|
||||||
|
clearInterval(this.automaticCheck);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
check() {
|
check() {
|
||||||
this.timeout = 0;
|
this.timeout = 0;
|
||||||
this.wait = false;
|
this.wait = false;
|
||||||
|
this.checking = true;
|
||||||
this.forbidden = false;
|
this.forbidden = false;
|
||||||
this.unavailable = false;
|
this.unavailable = false;
|
||||||
this.jukeboxService.check().subscribe((response) => {
|
this.jukeboxService.check().subscribe({
|
||||||
|
next: (response) => {
|
||||||
if (response) {
|
if (response) {
|
||||||
this.currentTrack = response;
|
this.currentTrack = response;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.active = true;
|
this.active = true;
|
||||||
}, (error) => {
|
this.checking = false;
|
||||||
|
},
|
||||||
|
error: (error) => {
|
||||||
this.active = false;
|
this.active = false;
|
||||||
if (error.status == 403) {
|
if (error.status == 403) {
|
||||||
this.forbidden = true;
|
this.forbidden = true;
|
||||||
@ -63,8 +80,10 @@ export class JukeboxComponent implements OnInit {
|
|||||||
this.wait = true;
|
this.wait = true;
|
||||||
this.timeout = 60 - error.error;
|
this.timeout = 60 - error.error;
|
||||||
|
|
||||||
this.jukeboxService.current().subscribe((response) => {
|
this.jukeboxService.current().subscribe({
|
||||||
|
next: (response) => {
|
||||||
this.currentTrack = response;
|
this.currentTrack = response;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
this.timer = setInterval(() => {
|
this.timer = setInterval(() => {
|
||||||
@ -75,24 +94,30 @@ export class JukeboxComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
}, 1000)
|
}, 1000)
|
||||||
}
|
}
|
||||||
|
this.checking = false;
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
search() {
|
search() {
|
||||||
this.searchDisabled = true;
|
this.searchDisabled = true;
|
||||||
this.jukeboxService.search(this.searchFormControl.value).subscribe((data: any) => {
|
this.jukeboxService.search(this.searchFormControl.value).subscribe({
|
||||||
|
next: (data: any) => {
|
||||||
this.searchResult = data.tracks;
|
this.searchResult = data.tracks;
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
searchMore() {
|
searchMore() {
|
||||||
this.searchDisabled = true;
|
this.searchDisabled = true;
|
||||||
this.jukeboxService.searchOffset(this.searchFormControl.value, this.searchResult.offset + this.searchResult.limit).subscribe((data: any) => {
|
this.jukeboxService.searchOffset(this.searchFormControl.value, this.searchResult.offset + this.searchResult.limit).subscribe({
|
||||||
|
next: (data: any) => {
|
||||||
this.searchResult.offset = data.tracks.offset;
|
this.searchResult.offset = data.tracks.offset;
|
||||||
this.searchResult.total = data.tracks.total;
|
this.searchResult.total = data.tracks.total;
|
||||||
for (let track of data.tracks.items) {
|
for (let track of data.tracks.items) {
|
||||||
this.searchResult.items.push(track);
|
this.searchResult.items.push(track);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -117,9 +142,11 @@ export class JukeboxComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
dialogRef.afterClosed().subscribe(result => {
|
dialogRef.afterClosed().subscribe({
|
||||||
|
next: (result) => {
|
||||||
if (result) {
|
if (result) {
|
||||||
this.jukeboxService.queue(track.uri).subscribe(() => {
|
this.jukeboxService.queue(track.uri).subscribe({
|
||||||
|
next: () => {
|
||||||
this.active = false;
|
this.active = false;
|
||||||
this.wait = true;
|
this.wait = true;
|
||||||
this.timeout = 60;
|
this.timeout = 60;
|
||||||
@ -134,12 +161,15 @@ export class JukeboxComponent implements OnInit {
|
|||||||
this.snackBar.open(this.i18n.get("jukebox.addToQueue.success", []), this.i18n.get("close", []), {
|
this.snackBar.open(this.i18n.get("jukebox.addToQueue.success", []), this.i18n.get("close", []), {
|
||||||
duration: 3000
|
duration: 3000
|
||||||
});
|
});
|
||||||
}, (error) => {
|
},
|
||||||
|
error: (error) => {
|
||||||
this.snackBar.open(this.i18n.get("jukebox.addToQueue.error", []), this.i18n.get("close", []), {
|
this.snackBar.open(this.i18n.get("jukebox.addToQueue.error", []), this.i18n.get("close", []), {
|
||||||
duration: 3000
|
duration: 3000
|
||||||
});
|
});
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
import {Component, OnInit} from '@angular/core';
|
import { Component, OnInit } from '@angular/core';
|
||||||
import {FormBuilder, FormGroup, Validators} from '@angular/forms';
|
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
|
||||||
import {Auth2FAService} from '../../services/auth.2fa.service';
|
import { Auth2FAService } from '../../services/auth.2fa.service';
|
||||||
import {Router, ActivatedRoute} from '@angular/router';
|
import { Router, ActivatedRoute } from '@angular/router';
|
||||||
|
|
||||||
import {environment} from '../../../environments/environment';
|
import { environment } from '../../../environments/environment';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-login',
|
selector: 'app-login',
|
||||||
templateUrl: './login-totp.component.html',
|
templateUrl: './login-totp.component.html',
|
||||||
styleUrls: ['./login-totp.component.scss']
|
styleUrls: [ './login-totp.component.scss' ]
|
||||||
})
|
})
|
||||||
export class LoginTotpComponent implements OnInit {
|
export class LoginTotpComponent implements OnInit {
|
||||||
|
|
||||||
@ -17,29 +17,34 @@ export class LoginTotpComponent implements OnInit {
|
|||||||
public apiUrl = environment.apiUrl;
|
public apiUrl = environment.apiUrl;
|
||||||
targetRoute = '/account/info';
|
targetRoute = '/account/info';
|
||||||
|
|
||||||
constructor(private formBuilder: FormBuilder, private auth2FAService: Auth2FAService, private router: Router, private route: ActivatedRoute) {}
|
constructor(private formBuilder: FormBuilder, private auth2FAService: Auth2FAService, private router: Router, private route: ActivatedRoute) { }
|
||||||
|
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.form = this.formBuilder.group({
|
this.form = this.formBuilder.group({
|
||||||
code: ['', Validators.required],
|
code: [ '', Validators.required ],
|
||||||
keep: ['']
|
keep: [ '' ]
|
||||||
});
|
});
|
||||||
|
|
||||||
this.route.queryParams.subscribe(params => {
|
this.route.queryParams.subscribe({
|
||||||
if(params['target']) {
|
next: (params) => {
|
||||||
this.targetRoute = params['target'];
|
if (params[ 'target' ]) {
|
||||||
|
this.targetRoute = params[ 'target' ];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async loginTotp() {
|
async loginTotp() {
|
||||||
this.loginInvalid = false;
|
this.loginInvalid = false;
|
||||||
if(this.form.valid) {
|
if (this.form.valid) {
|
||||||
this.auth2FAService.login('totp', this.form.get('code').value, this.form.get('keep').value).subscribe((response: any) => {
|
this.auth2FAService.login('totp', this.form.get('code').value, this.form.get('keep').value).subscribe({
|
||||||
this.router.navigate([this.targetRoute]);
|
next: (response: any) => {
|
||||||
}, error => {
|
this.router.navigate([ this.targetRoute ]);
|
||||||
|
},
|
||||||
|
error: (error) => {
|
||||||
this.loginInvalid = true;
|
this.loginInvalid = true;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
import {Component, OnInit} from '@angular/core';
|
import { Component, OnInit } from '@angular/core';
|
||||||
import {FormBuilder, FormGroup, Validators} from '@angular/forms';
|
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
|
||||||
import {AuthService} from './../../services/auth.service';
|
import { AuthService } from './../../services/auth.service';
|
||||||
import {Router, ActivatedRoute} from '@angular/router';
|
import { Router, ActivatedRoute } from '@angular/router';
|
||||||
|
|
||||||
import {environment} from './../../../environments/environment';
|
import { environment } from './../../../environments/environment';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-login',
|
selector: 'app-login',
|
||||||
templateUrl: './login.component.html',
|
templateUrl: './login.component.html',
|
||||||
styleUrls: ['./login.component.scss']
|
styleUrls: [ './login.component.scss' ]
|
||||||
})
|
})
|
||||||
export class LoginComponent implements OnInit {
|
export class LoginComponent implements OnInit {
|
||||||
|
|
||||||
@ -22,26 +22,28 @@ export class LoginComponent implements OnInit {
|
|||||||
private formBuilder: FormBuilder,
|
private formBuilder: FormBuilder,
|
||||||
private authService: AuthService,
|
private authService: AuthService,
|
||||||
private router: Router,
|
private router: Router,
|
||||||
private route: ActivatedRoute) {}
|
private route: ActivatedRoute) { }
|
||||||
|
|
||||||
async ngOnInit() {
|
async ngOnInit() {
|
||||||
this.form = this.formBuilder.group({
|
this.form = this.formBuilder.group({
|
||||||
username: ['', Validators.required],
|
username: [ '', Validators.required ],
|
||||||
password: ['', Validators.required],
|
password: [ '', Validators.required ],
|
||||||
keep: ['']
|
keep: [ '' ]
|
||||||
});
|
});
|
||||||
|
|
||||||
this.route.queryParams.subscribe(params => {
|
this.route.queryParams.subscribe({
|
||||||
if(params['target']) {
|
next: (params) => {
|
||||||
this.targetRoute = params['target'];
|
if (params[ 'target' ]) {
|
||||||
this.router.navigate([], {queryParams: {target: null}, queryParamsHandling: 'merge'});
|
this.targetRoute = params[ 'target' ];
|
||||||
|
this.router.navigate([], { queryParams: { target: null }, queryParamsHandling: 'merge' });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async login() {
|
async login() {
|
||||||
this.loginInvalid = false;
|
this.loginInvalid = false;
|
||||||
if(this.form.valid) {
|
if (this.form.valid) {
|
||||||
|
|
||||||
const loginModel = {
|
const loginModel = {
|
||||||
username: this.form.get('username').value,
|
username: this.form.get('username').value,
|
||||||
@ -49,14 +51,17 @@ export class LoginComponent implements OnInit {
|
|||||||
keep: this.form.get('keep').value
|
keep: this.form.get('keep').value
|
||||||
};
|
};
|
||||||
|
|
||||||
this.authService.login(loginModel).subscribe((response: any) => {
|
this.authService.login(loginModel).subscribe({
|
||||||
this.router.navigate([this.targetRoute]);
|
next: (response: any) => {
|
||||||
}, error => {
|
this.router.navigate([ this.targetRoute ]);
|
||||||
if(error.status == 428) {
|
},
|
||||||
this.router.navigate(["/login/totp"], {queryParams: {target: this.targetRoute}});
|
error: (error) => {
|
||||||
|
if (error.status == 428) {
|
||||||
|
this.router.navigate([ "/login/totp" ], { queryParams: { target: this.targetRoute } });
|
||||||
} else {
|
} else {
|
||||||
this.loginInvalid = true;
|
this.loginInvalid = true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -41,12 +41,14 @@ export class MinetestAccountsComponent implements OnInit {
|
|||||||
create(): void {
|
create(): void {
|
||||||
this.working = true;
|
this.working = true;
|
||||||
|
|
||||||
this.minetestAccountsService.create(this.minetestAccount).subscribe(response => {
|
this.minetestAccountsService.create(this.minetestAccount).subscribe({
|
||||||
|
next: (response) => {
|
||||||
this.refresh();
|
this.refresh();
|
||||||
this.formDirective.resetForm();
|
this.formDirective.resetForm();
|
||||||
this.minetestAccount = {};
|
this.minetestAccount = {};
|
||||||
this.working = false;
|
this.working = false;
|
||||||
}, (error) => {
|
},
|
||||||
|
error: (error) => {
|
||||||
this.working = false;
|
this.working = false;
|
||||||
if (error.status == 409) {
|
if (error.status == 409) {
|
||||||
let errors = {};
|
let errors = {};
|
||||||
@ -59,21 +61,26 @@ export class MinetestAccountsComponent implements OnInit {
|
|||||||
this.form.get(code).setErrors(errors[ code ]);
|
this.form.get(code).setErrors(errors[ code ]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
refresh() {
|
refresh() {
|
||||||
this.minetestAccountsQuota = 0;
|
this.minetestAccountsQuota = 0;
|
||||||
this.quotaService.quotas().subscribe((data: any) => {
|
this.quotaService.quotas().subscribe({
|
||||||
|
next: (data: any) => {
|
||||||
for (let quota of data) {
|
for (let quota of data) {
|
||||||
if (quota.name == "minetest_accounts") {
|
if (quota.name == "minetest_accounts") {
|
||||||
this.minetestAccountsQuota = quota.value;
|
this.minetestAccountsQuota = quota.value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
this.minetestAccountsService.get().subscribe((data: any) => {
|
this.minetestAccountsService.get().subscribe({
|
||||||
|
next: (data: any) => {
|
||||||
this.minetestAccounts = data;
|
this.minetestAccounts = data;
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -86,12 +93,16 @@ export class MinetestAccountsComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
dialogRef.afterClosed().subscribe(result => {
|
dialogRef.afterClosed().subscribe({
|
||||||
|
next: (result) => {
|
||||||
if (result) {
|
if (result) {
|
||||||
this.minetestAccountsService.delete(name).subscribe((result: any) => {
|
this.minetestAccountsService.delete(name).subscribe({
|
||||||
|
next: (result: any) => {
|
||||||
this.refresh();
|
this.refresh();
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,12 +16,14 @@ export class ParteyComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
this.parteyTagsService.get().subscribe((data: any[]) => {
|
this.parteyTagsService.get().subscribe({
|
||||||
|
next: (data: any[]) => {
|
||||||
this.tags = data;
|
this.tags = data;
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
toDate(value : string) {
|
toDate(value: string) {
|
||||||
return new Date(value);
|
return new Date(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -56,10 +56,12 @@ export class ParteyTimeslotsComponent implements OnInit {
|
|||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
|
|
||||||
this.authService.auth.subscribe((auth: any) => {
|
this.authService.auth.subscribe({
|
||||||
|
next: (auth: any) => {
|
||||||
if (auth.principal && auth.principal.userId) {
|
if (auth.principal && auth.principal.userId) {
|
||||||
this.userId = auth.principal.userId;
|
this.userId = auth.principal.userId;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
this.datetimeformat = this.i18n.get('format.datetime', []);
|
this.datetimeformat = this.i18n.get('format.datetime', []);
|
||||||
@ -78,29 +80,51 @@ export class ParteyTimeslotsComponent implements OnInit {
|
|||||||
this.filter.after = moment.utc().format();
|
this.filter.after = moment.utc().format();
|
||||||
this.afterFormControl.setValue(new Date());
|
this.afterFormControl.setValue(new Date());
|
||||||
|
|
||||||
this.searchFormControl.valueChanges.pipe(debounceTime(500)).subscribe(value => {
|
this.searchFormControl.valueChanges.pipe(debounceTime(500)).subscribe({
|
||||||
|
next: (value) => {
|
||||||
this.filter.search = value;
|
this.filter.search = value;
|
||||||
this.parteyTimeslotsService.get(this.page.page, this.page.size, this.page.sort, this.page.desc, this.filter).subscribe((data: any) => {
|
this.parteyTimeslotsService.get(this.page.page, this.page.size, this.page.sort, this.page.desc, this.filter).subscribe({
|
||||||
|
next: (data: any) => {
|
||||||
this.timeslots = data;
|
this.timeslots = data;
|
||||||
}, (error) => { })
|
},
|
||||||
|
error: (error) => { }
|
||||||
})
|
})
|
||||||
this.ownerFormControl.valueChanges.subscribe(value => {
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
this.ownerFormControl.valueChanges.subscribe({
|
||||||
|
next: (value) => {
|
||||||
this.filter.owner = value;
|
this.filter.owner = value;
|
||||||
this.parteyTimeslotsService.get(this.page.page, this.page.size, this.page.sort, this.page.desc, this.filter).subscribe((data: any) => {
|
this.parteyTimeslotsService.get(this.page.page, this.page.size, this.page.sort, this.page.desc, this.filter).subscribe({
|
||||||
|
next: (data: any) => {
|
||||||
this.timeslots = data;
|
this.timeslots = data;
|
||||||
}, (error) => { })
|
},
|
||||||
|
error: (error) => { }
|
||||||
})
|
})
|
||||||
this.typeFormControl.valueChanges.subscribe(value => {
|
}
|
||||||
|
})
|
||||||
|
this.typeFormControl.valueChanges.subscribe({
|
||||||
|
next: (value) => {
|
||||||
this.filter.type = value;
|
this.filter.type = value;
|
||||||
this.parteyTimeslotsService.get(this.page.page, this.page.size, this.page.sort, this.page.desc, this.filter).subscribe((data: any) => {
|
this.parteyTimeslotsService.get(this.page.page, this.page.size, this.page.sort, this.page.desc, this.filter).subscribe({
|
||||||
|
next: (data: any) => {
|
||||||
this.timeslots = data;
|
this.timeslots = data;
|
||||||
}, (error) => { })
|
},
|
||||||
|
error: (error) => { }
|
||||||
})
|
})
|
||||||
this.afterFormControl.valueChanges.subscribe((value: Date) => {
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
this.afterFormControl.valueChanges.subscribe({
|
||||||
|
next: (value: Date) => {
|
||||||
this.filter.after = value && moment.utc(value).format() || undefined;
|
this.filter.after = value && moment.utc(value).format() || undefined;
|
||||||
this.parteyTimeslotsService.get(this.page.page, this.page.size, this.page.sort, this.page.desc, this.filter).subscribe((data: any) => {
|
this.parteyTimeslotsService.get(this.page.page, this.page.size, this.page.sort, this.page.desc, this.filter).subscribe({
|
||||||
|
next: (data: any) => {
|
||||||
this.timeslots = data;
|
this.timeslots = data;
|
||||||
}, (error) => { })
|
},
|
||||||
|
error: (error) => { }
|
||||||
|
})
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
this.refresh();
|
this.refresh();
|
||||||
@ -109,21 +133,28 @@ export class ParteyTimeslotsComponent implements OnInit {
|
|||||||
refresh() {
|
refresh() {
|
||||||
this.timeslotsQuota = 0;
|
this.timeslotsQuota = 0;
|
||||||
|
|
||||||
this.parteyTimeslotsService.quota().subscribe((data: number) => {
|
this.parteyTimeslotsService.quota().subscribe({
|
||||||
|
next: (data: number) => {
|
||||||
this.timeslotsQuota = data;
|
this.timeslotsQuota = data;
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
this.parteyTimeslotsService.get(this.page.page, this.page.size, this.page.sort, this.page.desc, this.filter).subscribe((data: any) => {
|
this.parteyTimeslotsService.get(this.page.page, this.page.size, this.page.sort, this.page.desc, this.filter).subscribe({
|
||||||
|
next: (data: any) => {
|
||||||
this.timeslots = data;
|
this.timeslots = data;
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
updatePages(event: PageEvent) {
|
updatePages(event: PageEvent) {
|
||||||
this.page.page = event.pageIndex;
|
this.page.page = event.pageIndex;
|
||||||
this.page.size = event.pageSize;
|
this.page.size = event.pageSize;
|
||||||
this.parteyTimeslotsService.get(this.page.page, this.page.size, this.page.sort, this.page.desc, this.filter).subscribe((data: any) => {
|
this.parteyTimeslotsService.get(this.page.page, this.page.size, this.page.sort, this.page.desc, this.filter).subscribe({
|
||||||
|
next: (data: any) => {
|
||||||
this.timeslots = data;
|
this.timeslots = data;
|
||||||
}, (error) => { })
|
},
|
||||||
|
error: (error) => { }
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
updateSort(sort: Sort) {
|
updateSort(sort: Sort) {
|
||||||
@ -134,9 +165,12 @@ export class ParteyTimeslotsComponent implements OnInit {
|
|||||||
this.page.sort = sort.active;
|
this.page.sort = sort.active;
|
||||||
this.page.desc = sort.direction == "desc";
|
this.page.desc = sort.direction == "desc";
|
||||||
}
|
}
|
||||||
this.parteyTimeslotsService.get(this.page.page, this.page.size, this.page.sort, this.page.desc, this.filter).subscribe((data: any) => {
|
this.parteyTimeslotsService.get(this.page.page, this.page.size, this.page.sort, this.page.desc, this.filter).subscribe({
|
||||||
|
next: (data: any) => {
|
||||||
this.timeslots = data;
|
this.timeslots = data;
|
||||||
}, (error) => { })
|
},
|
||||||
|
error: (error) => { }
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
confirmDelete(timeslot) {
|
confirmDelete(timeslot) {
|
||||||
@ -147,12 +181,16 @@ export class ParteyTimeslotsComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
dialogRef.afterClosed().subscribe(result => {
|
dialogRef.afterClosed().subscribe({
|
||||||
|
next: (result) => {
|
||||||
if (result) {
|
if (result) {
|
||||||
this.parteyTimeslotsService.delete(timeslot.id).subscribe((result: any) => {
|
this.parteyTimeslotsService.delete(timeslot.id).subscribe({
|
||||||
|
next: (result: any) => {
|
||||||
this.refresh();
|
this.refresh();
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -162,10 +200,12 @@ export class ParteyTimeslotsComponent implements OnInit {
|
|||||||
minWidth: '400px'
|
minWidth: '400px'
|
||||||
});
|
});
|
||||||
|
|
||||||
dialogRef.afterClosed().subscribe(result => {
|
dialogRef.afterClosed().subscribe({
|
||||||
|
next: (result) => {
|
||||||
if (result) {
|
if (result) {
|
||||||
this.refresh();
|
this.refresh();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -176,10 +216,12 @@ export class ParteyTimeslotsComponent implements OnInit {
|
|||||||
minWidth: '400px'
|
minWidth: '400px'
|
||||||
});
|
});
|
||||||
|
|
||||||
dialogRef.afterClosed().subscribe(result => {
|
dialogRef.afterClosed().subscribe({
|
||||||
|
next: (result) => {
|
||||||
if (result) {
|
if (result) {
|
||||||
this.refresh();
|
this.refresh();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -229,9 +271,11 @@ export class ParteyTimeslotDialog {
|
|||||||
}
|
}
|
||||||
|
|
||||||
create(timeslot) {
|
create(timeslot) {
|
||||||
this.parteyTimeslotsService.create(timeslot).subscribe((result: any) => {
|
this.parteyTimeslotsService.create(timeslot).subscribe({
|
||||||
|
next: (result: any) => {
|
||||||
this.dialogRef.close(timeslot);
|
this.dialogRef.close(timeslot);
|
||||||
}, (error) => {
|
},
|
||||||
|
error: (error) => {
|
||||||
if (error.status == 409) {
|
if (error.status == 409) {
|
||||||
let errors = {};
|
let errors = {};
|
||||||
for (let code of error.error) {
|
for (let code of error.error) {
|
||||||
@ -243,13 +287,16 @@ export class ParteyTimeslotDialog {
|
|||||||
this.form.get(code).setErrors(errors[ code ]);
|
this.form.get(code).setErrors(errors[ code ]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
save(timeslot) {
|
save(timeslot) {
|
||||||
this.parteyTimeslotsService.update(timeslot).subscribe((result: any) => {
|
this.parteyTimeslotsService.update(timeslot).subscribe({
|
||||||
|
next: (result: any) => {
|
||||||
this.dialogRef.close(timeslot);
|
this.dialogRef.close(timeslot);
|
||||||
}, (error) => {
|
},
|
||||||
|
error: (error) => {
|
||||||
if (error.status == 409) {
|
if (error.status == 409) {
|
||||||
let errors = {};
|
let errors = {};
|
||||||
for (let code of error.error) {
|
for (let code of error.error) {
|
||||||
@ -261,6 +308,7 @@ export class ParteyTimeslotDialog {
|
|||||||
this.form.get(code).setErrors(errors[ code ]);
|
this.form.get(code).setErrors(errors[ code ]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ import { ActivatedRoute, Router } from '@angular/router';
|
|||||||
@Component({
|
@Component({
|
||||||
selector: 'app-password-reset',
|
selector: 'app-password-reset',
|
||||||
templateUrl: './password-reset.component.html',
|
templateUrl: './password-reset.component.html',
|
||||||
styleUrls: ['./password-reset.component.scss']
|
styleUrls: [ './password-reset.component.scss' ]
|
||||||
})
|
})
|
||||||
export class PasswordResetComponent implements OnInit {
|
export class PasswordResetComponent implements OnInit {
|
||||||
|
|
||||||
@ -26,39 +26,44 @@ export class PasswordResetComponent implements OnInit {
|
|||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
this.form = this.formBuilder.group({
|
this.form = this.formBuilder.group({
|
||||||
password: ['', Validators.required],
|
password: [ '', Validators.required ],
|
||||||
password2: ['', Validators.required]
|
password2: [ '', Validators.required ]
|
||||||
}, {
|
}, {
|
||||||
validator: MatchingValidator('password', 'password2')
|
validator: MatchingValidator('password', 'password2')
|
||||||
});
|
});
|
||||||
|
|
||||||
this.route.queryParams.subscribe(params => {
|
this.route.queryParams.subscribe({
|
||||||
|
next: (params) => {
|
||||||
if (params.token) {
|
if (params.token) {
|
||||||
this.model.token = params.token;
|
this.model.token = params.token;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
passwordReset() {
|
passwordReset() {
|
||||||
this.working = true;
|
this.working = true;
|
||||||
this.authService.passwordReset(this.model).subscribe(response => {
|
this.authService.passwordReset(this.model).subscribe({
|
||||||
|
next: (response) => {
|
||||||
this.success = true;
|
this.success = true;
|
||||||
}, (error) => {
|
},
|
||||||
|
error: (error) => {
|
||||||
this.working = false;
|
this.working = false;
|
||||||
if (error.status == 409) {
|
if (error.status == 409) {
|
||||||
let errors = {};
|
let errors = {};
|
||||||
for (let code of error.error) {
|
for (let code of error.error) {
|
||||||
errors[code.field] = errors[code.field] || {};
|
errors[ code.field ] = errors[ code.field ] || {};
|
||||||
errors[code.field][code.code] = true;
|
errors[ code.field ][ code.code ] = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (let code in errors) {
|
for (let code in errors) {
|
||||||
this.form.get(code).setErrors(errors[code]);
|
this.form.get(code).setErrors(errors[ code ]);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
this.tokenInvalid = true;
|
this.tokenInvalid = true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ var openpgp = require('openpgp');
|
|||||||
@Component({
|
@Component({
|
||||||
selector: 'app-password',
|
selector: 'app-password',
|
||||||
templateUrl: './password.component.html',
|
templateUrl: './password.component.html',
|
||||||
styleUrls: ['./password.component.scss']
|
styleUrls: [ './password.component.scss' ]
|
||||||
})
|
})
|
||||||
export class PasswordComponent implements OnInit {
|
export class PasswordComponent implements OnInit {
|
||||||
|
|
||||||
@ -20,33 +20,35 @@ export class PasswordComponent implements OnInit {
|
|||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
this.form = this.formBuilder.group({
|
this.form = this.formBuilder.group({
|
||||||
username: ['', Validators.required],
|
username: [ '', Validators.required ],
|
||||||
privateKey: ['']
|
privateKey: [ '' ]
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async passwordRequest() {
|
async passwordRequest() {
|
||||||
this.working = true;
|
this.working = true;
|
||||||
const { keys: [privateKey] } = await openpgp.key.readArmored(this.model.privateKey);
|
const { keys: [ privateKey ] } = await openpgp.key.readArmored(this.model.privateKey);
|
||||||
|
|
||||||
const model = {
|
const model = {
|
||||||
username: this.model.username
|
username: this.model.username
|
||||||
}
|
}
|
||||||
|
|
||||||
this.authService.passwordRequest(this.model.username).subscribe(async response => {
|
this.authService.passwordRequest(this.model.username).subscribe({
|
||||||
|
next: async response => {
|
||||||
|
|
||||||
if (privateKey) {
|
if (privateKey) {
|
||||||
const message = await openpgp.message.readArmored(response);
|
const message = await openpgp.message.readArmored(response);
|
||||||
|
|
||||||
const decrypted = await openpgp.decrypt({
|
const decrypted = await openpgp.decrypt({
|
||||||
message: message,
|
message: message,
|
||||||
privateKeys: [privateKey]
|
privateKeys: [ privateKey ]
|
||||||
});
|
});
|
||||||
this.working = false;
|
this.working = false;
|
||||||
this.router.navigate(['/password-reset'], { queryParams: { token: decrypted.data.trim() } });
|
this.router.navigate([ '/password-reset' ], { queryParams: { token: decrypted.data.trim() } });
|
||||||
} else {
|
} else {
|
||||||
this.working = false;
|
this.working = false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -60,17 +60,23 @@ export class RegisterComponent implements OnInit {
|
|||||||
validator: MatchingValidator('password', 'password2')
|
validator: MatchingValidator('password', 'password2')
|
||||||
});
|
});
|
||||||
|
|
||||||
this.itemService.items().subscribe((data: any) => {
|
this.itemService.items().subscribe({
|
||||||
|
next: (data: any) => {
|
||||||
this.items = data;
|
this.items = data;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
this.permissionService.permissionsNew().subscribe((data: any) => {
|
this.permissionService.permissionsNew().subscribe({
|
||||||
|
next: (data: any) => {
|
||||||
this.permissions = data;
|
this.permissions = data;
|
||||||
})
|
}
|
||||||
|
});
|
||||||
|
|
||||||
this.quotaService.quotasNew().subscribe((data: any) => {
|
this.quotaService.quotasNew().subscribe({
|
||||||
|
next: (data: any) => {
|
||||||
this.quotas = data;
|
this.quotas = data;
|
||||||
})
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
onPrimaryChange() {
|
onPrimaryChange() {
|
||||||
@ -119,7 +125,8 @@ export class RegisterComponent implements OnInit {
|
|||||||
this.model.profileFields.push({ "name": "primaryEmail", "type": "BOOL", "visibility": "PRIVATE", "value": this.model.primaryEmail });
|
this.model.profileFields.push({ "name": "primaryEmail", "type": "BOOL", "visibility": "PRIVATE", "value": this.model.primaryEmail });
|
||||||
}
|
}
|
||||||
|
|
||||||
this.userService.register(this.model).subscribe((result: any) => {
|
this.userService.register(this.model).subscribe({
|
||||||
|
next: (result: any) => {
|
||||||
result.privateKey = privKey;
|
result.privateKey = privKey;
|
||||||
|
|
||||||
const dialogRef = this.dialog.open(RegisterDialog, {
|
const dialogRef = this.dialog.open(RegisterDialog, {
|
||||||
@ -128,14 +135,17 @@ export class RegisterComponent implements OnInit {
|
|||||||
data: result
|
data: result
|
||||||
});
|
});
|
||||||
|
|
||||||
dialogRef.afterClosed().subscribe(result => {
|
dialogRef.afterClosed().subscribe({
|
||||||
|
next: (result) => {
|
||||||
if (result) {
|
if (result) {
|
||||||
this.success = true;
|
this.success = true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
this.working = false;
|
this.working = false;
|
||||||
}, (error) => {
|
},
|
||||||
|
error: (error) => {
|
||||||
this.working = false;
|
this.working = false;
|
||||||
if (error.status == 401) {
|
if (error.status == 401) {
|
||||||
this.missingToken = true;
|
this.missingToken = true;
|
||||||
@ -152,6 +162,7 @@ export class RegisterComponent implements OnInit {
|
|||||||
this.form.get(code).setErrors(errors[ code ]);
|
this.form.get(code).setErrors(errors[ code ]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
})
|
})
|
||||||
|
@ -20,7 +20,8 @@ export class ServicesComponent implements OnInit {
|
|||||||
|
|
||||||
this.view = localStorage.getItem("bstly.servicesView") || 'grid';
|
this.view = localStorage.getItem("bstly.servicesView") || 'grid';
|
||||||
|
|
||||||
this.serviceService.services().subscribe((data: Array<any>) => {
|
this.serviceService.services().subscribe({
|
||||||
|
next: (data: Array<any>) => {
|
||||||
let that = this;
|
let that = this;
|
||||||
that.baseServices = [];
|
that.baseServices = [];
|
||||||
data.forEach(function (service) {
|
data.forEach(function (service) {
|
||||||
@ -33,6 +34,7 @@ export class ServicesComponent implements OnInit {
|
|||||||
that.serviceCategory[ service.category ].push(service);
|
that.serviceCategory[ service.category ].push(service);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@ import { QuotaService } from './../../services/quota.service';
|
|||||||
@Component({
|
@Component({
|
||||||
selector: 'app-tokens',
|
selector: 'app-tokens',
|
||||||
templateUrl: './tokens.component.html',
|
templateUrl: './tokens.component.html',
|
||||||
styleUrls: ['./tokens.component.scss']
|
styleUrls: [ './tokens.component.scss' ]
|
||||||
})
|
})
|
||||||
export class TokensComponent implements OnInit {
|
export class TokensComponent implements OnInit {
|
||||||
|
|
||||||
@ -37,8 +37,10 @@ export class TokensComponent implements OnInit {
|
|||||||
|
|
||||||
this.currentLocale = this.i18n.getLocale();
|
this.currentLocale = this.i18n.getLocale();
|
||||||
|
|
||||||
this.authService.auth.subscribe(data => {
|
this.authService.auth.subscribe({
|
||||||
|
next: (data) => {
|
||||||
this.auth = data;
|
this.auth = data;
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
this.update();
|
this.update();
|
||||||
@ -46,22 +48,27 @@ export class TokensComponent implements OnInit {
|
|||||||
|
|
||||||
async ngOnInit() {
|
async ngOnInit() {
|
||||||
this.form = this.formBuilder.group({
|
this.form = this.formBuilder.group({
|
||||||
token: ['', Validators.required]
|
token: [ '', Validators.required ]
|
||||||
});
|
});
|
||||||
|
|
||||||
this.route.queryParams.subscribe(params => {
|
this.route.queryParams.subscribe({
|
||||||
|
next: (params) => {
|
||||||
if (params.token) {
|
if (params.token) {
|
||||||
this.itemService.redeemSecret(params.token).subscribe((data: any) => {
|
this.itemService.redeemSecret(params.token).subscribe({
|
||||||
|
next: (data: any) => {
|
||||||
this.update();
|
this.update();
|
||||||
}, error => {
|
},
|
||||||
|
error: error => {
|
||||||
this.form.get('token').patchValue(params.token);
|
this.form.get('token').patchValue(params.token);
|
||||||
if (error.status == 410) {
|
if (error.status == 410) {
|
||||||
this.tokenRedeemed = true;
|
this.tokenRedeemed = true;
|
||||||
} else {
|
} else {
|
||||||
this.tokenInvalid = true;
|
this.tokenInvalid = true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -70,46 +77,60 @@ export class TokensComponent implements OnInit {
|
|||||||
this.tokenRedeemed = false;
|
this.tokenRedeemed = false;
|
||||||
if (this.form.valid) {
|
if (this.form.valid) {
|
||||||
const secret = this.form.get('token').value;
|
const secret = this.form.get('token').value;
|
||||||
this.itemService.redeemSecret(secret).subscribe((data: any) => {
|
this.itemService.redeemSecret(secret).subscribe({
|
||||||
|
next: (data: any) => {
|
||||||
this.formDirective.resetForm();
|
this.formDirective.resetForm();
|
||||||
this.update();
|
this.update();
|
||||||
}, error => {
|
},
|
||||||
|
error: (error) => {
|
||||||
if (error.status == 410) {
|
if (error.status == 410) {
|
||||||
this.tokenRedeemed = true;
|
this.tokenRedeemed = true;
|
||||||
} else {
|
} else {
|
||||||
this.tokenInvalid = true;
|
this.tokenInvalid = true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
removeSecret(secret: String) {
|
removeSecret(secret: String) {
|
||||||
this.itemService.removeSecret(secret).subscribe((data: any) => {
|
this.itemService.removeSecret(secret).subscribe({
|
||||||
|
next: (data: any) => {
|
||||||
this.update();
|
this.update();
|
||||||
}, error => {
|
},
|
||||||
|
error: (error) => {
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
redeem() {
|
redeem() {
|
||||||
if (this.auth.authenticated) {
|
if (this.auth.authenticated) {
|
||||||
this.itemService.redeem().subscribe((data: any) => {
|
this.itemService.redeem().subscribe({
|
||||||
this.router.navigate(["/account/info"]);
|
next: (data: any) => {
|
||||||
|
this.router.navigate([ "/account/info" ]);
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
update() {
|
update() {
|
||||||
this.authService.getAuth().then(response => {
|
this.authService.getAuth().then(response => {
|
||||||
this.itemService.items().subscribe((data: any) => {
|
this.itemService.items().subscribe({
|
||||||
|
next: (data: any) => {
|
||||||
this.items = data;
|
this.items = data;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
this.permissionService.permissionsNew().subscribe((data: any) => {
|
this.permissionService.permissionsNew().subscribe({
|
||||||
|
next: (data: any) => {
|
||||||
this.permissions = data;
|
this.permissions = data;
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
this.quotaService.quotasNew().subscribe((data: any) => {
|
this.quotaService.quotasNew().subscribe({
|
||||||
|
next: (data: any) => {
|
||||||
this.quotas = data;
|
this.quotas = data;
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}).catch(function (error) { });;
|
}).catch(function (error) { });;
|
||||||
}
|
}
|
||||||
|
@ -16,11 +16,13 @@ export class UnavailableComponent implements OnInit {
|
|||||||
private route: ActivatedRoute) { }
|
private route: ActivatedRoute) { }
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
this.route.queryParams.subscribe(params => {
|
this.route.queryParams.subscribe({
|
||||||
|
next: (params) => {
|
||||||
if (params[ 'target' ]) {
|
if (params[ 'target' ]) {
|
||||||
this.targetRoute = params[ 'target' ];
|
this.targetRoute = params[ 'target' ];
|
||||||
this.router.navigate([], { queryParams: { target: null }, queryParamsHandling: 'merge', skipLocationChange: true });
|
this.router.navigate([], { queryParams: { target: null }, queryParamsHandling: 'merge', skipLocationChange: true });
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -60,17 +60,23 @@ export class UrlShortenerComponent implements OnInit {
|
|||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
this.searchFormControl.valueChanges.pipe(debounceTime(500)).subscribe(value => {
|
this.searchFormControl.valueChanges.pipe(debounceTime(500)).subscribe({
|
||||||
|
next: (value) => {
|
||||||
this.page.search = this.searchFormControl.value ? this.searchFormControl.value : "";
|
this.page.search = this.searchFormControl.value ? this.searchFormControl.value : "";
|
||||||
this.urlShortenerService.get(this.page.page, this.page.size, this.page.sort, this.page.desc, this.page.search).subscribe((data: any) => {
|
this.urlShortenerService.get(this.page.page, this.page.size, this.page.sort, this.page.desc, this.page.search).subscribe({
|
||||||
|
next: (data: any) => {
|
||||||
this.shortenedUrls = data;
|
this.shortenedUrls = data;
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
this.route.queryParams.subscribe(params => {
|
this.route.queryParams.subscribe({
|
||||||
|
next: (params) => {
|
||||||
if (params.url) {
|
if (params.url) {
|
||||||
this.shortenedUrl.url = decodeURIComponent(params.url);
|
this.shortenedUrl.url = decodeURIComponent(params.url);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
this.refresh();
|
this.refresh();
|
||||||
@ -79,12 +85,14 @@ export class UrlShortenerComponent implements OnInit {
|
|||||||
create(): void {
|
create(): void {
|
||||||
this.working = true;
|
this.working = true;
|
||||||
|
|
||||||
this.urlShortenerService.create(this.shortenedUrl).subscribe(response => {
|
this.urlShortenerService.create(this.shortenedUrl).subscribe({
|
||||||
|
next: (response) => {
|
||||||
this.refresh();
|
this.refresh();
|
||||||
this.formDirective.resetForm();
|
this.formDirective.resetForm();
|
||||||
this.shortenedUrl = {};
|
this.shortenedUrl = {};
|
||||||
this.working = false;
|
this.working = false;
|
||||||
}, (error) => {
|
},
|
||||||
|
error: (error) => {
|
||||||
this.working = false;
|
this.working = false;
|
||||||
if (error.status == 409) {
|
if (error.status == 409) {
|
||||||
let errors = {};
|
let errors = {};
|
||||||
@ -97,40 +105,51 @@ export class UrlShortenerComponent implements OnInit {
|
|||||||
this.form.get(code).setErrors(errors[ code ]);
|
this.form.get(code).setErrors(errors[ code ]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
refresh() {
|
refresh() {
|
||||||
this.shortenedUrlQuota = 0;
|
this.shortenedUrlQuota = 0;
|
||||||
this.quotaService.quotas().subscribe((data: any) => {
|
this.quotaService.quotas().subscribe({
|
||||||
|
next: (data: any) => {
|
||||||
for (let quota of data) {
|
for (let quota of data) {
|
||||||
if (quota.name == "url_shortener") {
|
if (quota.name == "url_shortener") {
|
||||||
this.shortenedUrlQuota = quota.value;
|
this.shortenedUrlQuota = quota.value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
this.page.search = this.searchFormControl.value ? this.searchFormControl.value : "";
|
this.page.search = this.searchFormControl.value ? this.searchFormControl.value : "";
|
||||||
|
|
||||||
this.urlShortenerService.get(this.page.page, this.page.size, this.page.sort, this.page.desc, this.page.search).subscribe((data: any) => {
|
this.urlShortenerService.get(this.page.page, this.page.size, this.page.sort, this.page.desc, this.page.search).subscribe({
|
||||||
|
next: (data: any) => {
|
||||||
this.shortenedUrls = data;
|
this.shortenedUrls = data;
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
updateSearch() {
|
updateSearch() {
|
||||||
this.page.search = this.searchFormControl.value ? this.searchFormControl.value : "";
|
this.page.search = this.searchFormControl.value ? this.searchFormControl.value : "";
|
||||||
this.urlShortenerService.get(this.page.page, this.page.size, this.page.sort, this.page.desc, this.page.search).subscribe((data: any) => {
|
this.urlShortenerService.get(this.page.page, this.page.size, this.page.sort, this.page.desc, this.page.search).subscribe({
|
||||||
|
next: (data: any) => {
|
||||||
this.shortenedUrls = data;
|
this.shortenedUrls = data;
|
||||||
}, (error) => { })
|
},
|
||||||
|
error: (error) => { }
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
updatePages(event: PageEvent) {
|
updatePages(event: PageEvent) {
|
||||||
this.page.page = event.pageIndex;
|
this.page.page = event.pageIndex;
|
||||||
this.page.size = event.pageSize;
|
this.page.size = event.pageSize;
|
||||||
this.page.search = this.searchFormControl.value ? this.searchFormControl.value : "";
|
this.page.search = this.searchFormControl.value ? this.searchFormControl.value : "";
|
||||||
this.urlShortenerService.get(this.page.page, this.page.size, this.page.sort, this.page.desc, this.page.search).subscribe((data: any) => {
|
this.urlShortenerService.get(this.page.page, this.page.size, this.page.sort, this.page.desc, this.page.search).subscribe({
|
||||||
|
next: (data: any) => {
|
||||||
this.shortenedUrls = data;
|
this.shortenedUrls = data;
|
||||||
}, (error) => { })
|
},
|
||||||
|
error: (error) => { }
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
updateSort(sort: Sort) {
|
updateSort(sort: Sort) {
|
||||||
@ -142,9 +161,12 @@ export class UrlShortenerComponent implements OnInit {
|
|||||||
this.page.desc = sort.direction == "desc";
|
this.page.desc = sort.direction == "desc";
|
||||||
}
|
}
|
||||||
this.page.search = this.searchFormControl.value ? this.searchFormControl.value : "";
|
this.page.search = this.searchFormControl.value ? this.searchFormControl.value : "";
|
||||||
this.urlShortenerService.get(this.page.page, this.page.size, this.page.sort, this.page.desc, this.page.search).subscribe((data: any) => {
|
this.urlShortenerService.get(this.page.page, this.page.size, this.page.sort, this.page.desc, this.page.search).subscribe({
|
||||||
|
next: (data: any) => {
|
||||||
this.shortenedUrls = data;
|
this.shortenedUrls = data;
|
||||||
}, (error) => { })
|
},
|
||||||
|
error: (error) => { }
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
confirmDelete(shortenedUrl) {
|
confirmDelete(shortenedUrl) {
|
||||||
@ -155,12 +177,16 @@ export class UrlShortenerComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
dialogRef.afterClosed().subscribe(result => {
|
dialogRef.afterClosed().subscribe({
|
||||||
|
next: (result) => {
|
||||||
if (result) {
|
if (result) {
|
||||||
this.urlShortenerService.delete(shortenedUrl.code).subscribe((result: any) => {
|
this.urlShortenerService.delete(shortenedUrl.code).subscribe({
|
||||||
|
next: (result: any) => {
|
||||||
this.refresh();
|
this.refresh();
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -177,10 +203,12 @@ export class UrlShortenerComponent implements OnInit {
|
|||||||
minWidth: '400px',
|
minWidth: '400px',
|
||||||
});
|
});
|
||||||
|
|
||||||
dialogRef.afterClosed().subscribe(result => {
|
dialogRef.afterClosed().subscribe({
|
||||||
|
next: (result) => {
|
||||||
if (result) {
|
if (result) {
|
||||||
this.refresh();
|
this.refresh();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -236,9 +264,11 @@ export class UrlShortenerEditDialog {
|
|||||||
}
|
}
|
||||||
|
|
||||||
save() {
|
save() {
|
||||||
this.urlShortenerService.update(this.shortenedUrlModel).subscribe((result: any) => {
|
this.urlShortenerService.update(this.shortenedUrlModel).subscribe({
|
||||||
|
next: (result: any) => {
|
||||||
this.dialogRef.close(result);
|
this.dialogRef.close(result);
|
||||||
}, (error) => {
|
},
|
||||||
|
error: (error) => {
|
||||||
if (error.status == 409) {
|
if (error.status == 409) {
|
||||||
let errors = {};
|
let errors = {};
|
||||||
for (let code of error.error) {
|
for (let code of error.error) {
|
||||||
@ -250,6 +280,7 @@ export class UrlShortenerEditDialog {
|
|||||||
this.form.get(code).setErrors(errors[ code ]);
|
this.form.get(code).setErrors(errors[ code ]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -308,10 +339,12 @@ export class UrlShortenerPasswordComponent implements OnInit {
|
|||||||
async ngOnInit() {
|
async ngOnInit() {
|
||||||
this.code = this.route.snapshot.paramMap.get('code');
|
this.code = this.route.snapshot.paramMap.get('code');
|
||||||
|
|
||||||
this.route.queryParams.subscribe(params => {
|
this.route.queryParams.subscribe({
|
||||||
|
next: (params) => {
|
||||||
if (params[ 'error' ] || params[ 'error' ] == '') {
|
if (params[ 'error' ] || params[ 'error' ] == '') {
|
||||||
this.invalidPassword = true;
|
this.invalidPassword = true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
import {Component, OnInit} from '@angular/core';
|
import { Component, OnInit } from '@angular/core';
|
||||||
|
|
||||||
import {ActivatedRoute} from '@angular/router';
|
import { ActivatedRoute } from '@angular/router';
|
||||||
|
|
||||||
import {AuthService} from '../../services/auth.service';
|
import { AuthService } from '../../services/auth.service';
|
||||||
import {ProfileService} from '../../services/profile.service';
|
import { ProfileService } from '../../services/profile.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-user',
|
selector: 'app-user',
|
||||||
@ -20,19 +20,24 @@ export class UserComponent implements OnInit {
|
|||||||
constructor(
|
constructor(
|
||||||
private authService: AuthService,
|
private authService: AuthService,
|
||||||
private profileService: ProfileService,
|
private profileService: ProfileService,
|
||||||
private route: ActivatedRoute) {}
|
private route: ActivatedRoute) { }
|
||||||
|
|
||||||
async ngOnInit() {
|
async ngOnInit() {
|
||||||
this.username = this.route.snapshot.paramMap.get('username');
|
this.username = this.route.snapshot.paramMap.get('username');
|
||||||
this.profileService.getForUser(this.username).subscribe((data: any) => {
|
this.profileService.getForUser(this.username).subscribe({
|
||||||
|
next: (data: any) => {
|
||||||
this.success = true;
|
this.success = true;
|
||||||
this.model = data;
|
this.model = data;
|
||||||
|
|
||||||
this.authService.auth.subscribe((auth: any) => {
|
this.authService.auth.subscribe({
|
||||||
|
next: (auth: any) => {
|
||||||
this.isMe = auth && auth.principal && auth.principal.username == this.model.username;
|
this.isMe = auth && auth.principal && auth.principal.username == this.model.username;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}, error => {
|
},
|
||||||
|
error: (error) => {
|
||||||
this.error = error;
|
this.error = error;
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
@ -29,31 +29,37 @@ export class DurationpickerComponent implements OnInit, ControlValueAccessor {
|
|||||||
constructor() { }
|
constructor() { }
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
this.days.valueChanges.subscribe(value => {
|
this.days.valueChanges.subscribe({
|
||||||
|
next: (value) => {
|
||||||
if (value < this.model.days()) {
|
if (value < this.model.days()) {
|
||||||
this.model.subtract((this.model.days() - value), "days");
|
this.model.subtract((this.model.days() - value), "days");
|
||||||
} else {
|
} else {
|
||||||
this.model.add((value - this.model.days()), "days");
|
this.model.add((value - this.model.days()), "days");
|
||||||
}
|
}
|
||||||
this.checkValue();
|
this.checkValue();
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
this.hours.valueChanges.subscribe(value => {
|
this.hours.valueChanges.subscribe({
|
||||||
|
next: (value) => {
|
||||||
if (value < this.model.hours()) {
|
if (value < this.model.hours()) {
|
||||||
this.model.subtract((this.model.hours() - value), "hours");
|
this.model.subtract((this.model.hours() - value), "hours");
|
||||||
} else {
|
} else {
|
||||||
this.model.add((value - this.model.hours()), "hours");
|
this.model.add((value - this.model.hours()), "hours");
|
||||||
}
|
}
|
||||||
this.checkValue();
|
this.checkValue();
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
this.minutes.valueChanges.subscribe(value => {
|
this.minutes.valueChanges.subscribe({
|
||||||
|
next: (value) => {
|
||||||
if (value < this.model.minutes()) {
|
if (value < this.model.minutes()) {
|
||||||
this.model.subtract((this.model.minutes() - value), "minutes");
|
this.model.subtract((this.model.minutes() - value), "minutes");
|
||||||
} else {
|
} else {
|
||||||
this.model.add((value - this.model.minutes()), "minutes");
|
this.model.add((value - this.model.minutes()), "minutes");
|
||||||
}
|
}
|
||||||
this.checkValue();
|
this.checkValue();
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@ import { MatSidenav } from '@angular/material/sidenav';
|
|||||||
})
|
})
|
||||||
export class MainComponent {
|
export class MainComponent {
|
||||||
|
|
||||||
opened : boolean = true;
|
opened: boolean = true;
|
||||||
darkTheme = "false";
|
darkTheme = "false";
|
||||||
title = 'we.bstly';
|
title = 'we.bstly';
|
||||||
currentLocale: String;
|
currentLocale: String;
|
||||||
@ -44,8 +44,10 @@ export class MainComponent {
|
|||||||
this.datetimeformat = this.i18n.get('format.datetime', []);
|
this.datetimeformat = this.i18n.get('format.datetime', []);
|
||||||
this.currentLocale = this.i18n.getLocale();
|
this.currentLocale = this.i18n.getLocale();
|
||||||
this.locales = this.i18n.getLocales();
|
this.locales = this.i18n.getLocales();
|
||||||
this.authService.auth.subscribe(data => {
|
this.authService.auth.subscribe({
|
||||||
|
next: (data) => {
|
||||||
this.auth = data;
|
this.auth = data;
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
this._adapter.setLocale(this.currentLocale);
|
this._adapter.setLocale(this.currentLocale);
|
||||||
@ -69,7 +71,8 @@ export class MainComponent {
|
|||||||
localStorage.setItem("bstly.locale", locale);
|
localStorage.setItem("bstly.locale", locale);
|
||||||
|
|
||||||
if (this.auth && this.auth.authenticated) {
|
if (this.auth && this.auth.authenticated) {
|
||||||
this.profileService.getField("locale").subscribe((profileField: any) => {
|
this.profileService.getField("locale").subscribe({
|
||||||
|
next: (profileField: any) => {
|
||||||
|
|
||||||
if (profileField == null) {
|
if (profileField == null) {
|
||||||
profileField = {
|
profileField = {
|
||||||
@ -80,9 +83,12 @@ export class MainComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
profileField.value = locale;
|
profileField.value = locale;
|
||||||
this.profileService.createOrUpdate(profileField).subscribe((response) => {
|
this.profileService.createOrUpdate(profileField).subscribe({
|
||||||
|
next: (response) => {
|
||||||
window.location.reload();
|
window.location.reload();
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
}
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
window.location.reload();
|
window.location.reload();
|
||||||
@ -99,7 +105,8 @@ export class MainComponent {
|
|||||||
localStorage.setItem("bstly.darkTheme", this.darkTheme);
|
localStorage.setItem("bstly.darkTheme", this.darkTheme);
|
||||||
|
|
||||||
if (this.auth && this.auth.authenticated) {
|
if (this.auth && this.auth.authenticated) {
|
||||||
this.profileService.getField("darkTheme").subscribe((profileField: any) => {
|
this.profileService.getField("darkTheme").subscribe({
|
||||||
|
next: (profileField: any) => {
|
||||||
|
|
||||||
if (profileField == null) {
|
if (profileField == null) {
|
||||||
profileField = {
|
profileField = {
|
||||||
@ -110,9 +117,12 @@ export class MainComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
profileField.value = this.darkTheme;
|
profileField.value = this.darkTheme;
|
||||||
this.profileService.createOrUpdate(profileField).subscribe((response) => {
|
this.profileService.createOrUpdate(profileField).subscribe({
|
||||||
|
next: (response) => {
|
||||||
window.location.reload();
|
window.location.reload();
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
}
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
window.location.reload();
|
window.location.reload();
|
||||||
@ -121,10 +131,12 @@ export class MainComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
logout() {
|
logout() {
|
||||||
this.authService.logout().subscribe(data => {
|
this.authService.logout().subscribe({
|
||||||
|
next: (data) => {
|
||||||
this.router.navigate([ "" ]).then(() => {
|
this.router.navigate([ "" ]).then(() => {
|
||||||
window.location.reload();
|
window.location.reload();
|
||||||
});
|
});
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -151,20 +163,25 @@ export class MainComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
touchEvents(): void {
|
touchEvents(): void {
|
||||||
fromEvent(document, 'touchstart').subscribe((event: TouchEvent) => {
|
fromEvent(document, 'touchstart').subscribe({
|
||||||
|
next: (event: TouchEvent) => {
|
||||||
if (event.touches[ 0 ]) {
|
if (event.touches[ 0 ]) {
|
||||||
this.touchStartX = event.touches[ 0 ].screenX;
|
this.touchStartX = event.touches[ 0 ].screenX;
|
||||||
|
|
||||||
}
|
}
|
||||||
})
|
|
||||||
|
|
||||||
fromEvent(document, 'touchmove').subscribe((event: TouchEvent) => {
|
|
||||||
if (event.touches[ 0 ]) {
|
|
||||||
this.touchX = event.touches[ 0 ].screenX;
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
fromEvent(document, 'touchend').subscribe((event: TouchEvent) => {
|
fromEvent(document, 'touchmove').subscribe({
|
||||||
|
next: (event: TouchEvent) => {
|
||||||
|
if (event.touches[ 0 ]) {
|
||||||
|
this.touchX = event.touches[ 0 ].screenX;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
fromEvent(document, 'touchend').subscribe({
|
||||||
|
next: (event: TouchEvent) => {
|
||||||
if (this.touchX != 0) {
|
if (this.touchX != 0) {
|
||||||
const touchDiff = this.touchStartX - this.touchX;
|
const touchDiff = this.touchStartX - this.touchX;
|
||||||
this.touchStartX = 0;
|
this.touchStartX = 0;
|
||||||
@ -175,6 +192,7 @@ export class MainComponent {
|
|||||||
this.opened = false;
|
this.opened = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -29,7 +29,8 @@ export class ProfileFieldPgpBlob implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
this.authService.auth.subscribe((auth: any) => {
|
this.authService.auth.subscribe({
|
||||||
|
next: (auth: any) => {
|
||||||
if (!auth.authenticated) {
|
if (!auth.authenticated) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -47,7 +48,7 @@ export class ProfileFieldPgpBlob implements OnInit {
|
|||||||
this.downloadKey.nativeElement.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(this.data.privateKey));
|
this.downloadKey.nativeElement.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(this.data.privateKey));
|
||||||
this.downloadKey.nativeElement.setAttribute('download', auth.principal.username + ".private.key");
|
this.downloadKey.nativeElement.setAttribute('download', auth.principal.username + ".private.key");
|
||||||
});
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,12 +41,16 @@ export class ProfileFieldsComponent implements OnInit {
|
|||||||
|
|
||||||
update() {
|
update() {
|
||||||
if (this.username) {
|
if (this.username) {
|
||||||
this.profileService.getForUser(this.username).subscribe((data: any) => {
|
this.profileService.getForUser(this.username).subscribe({
|
||||||
|
next: (data: any) => {
|
||||||
this.profileFields = data.profileFields;
|
this.profileFields = data.profileFields;
|
||||||
|
}
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
this.profileService.get().subscribe((data: any) => {
|
this.profileService.get().subscribe({
|
||||||
|
next: (data: any) => {
|
||||||
this.profileFields = data;
|
this.profileFields = data;
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -87,9 +91,10 @@ export class ProfileFieldsComponent implements OnInit {
|
|||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
dialogRef.afterClosed().subscribe(result => {
|
dialogRef.afterClosed().subscribe({
|
||||||
|
next: (result) => {
|
||||||
if (result) {
|
if (result) {
|
||||||
this.profileService.createOrUpdate(result).subscribe();
|
this.profileService.createOrUpdate(result);
|
||||||
} else {
|
} else {
|
||||||
profileField.name = resetProfileField.name;
|
profileField.name = resetProfileField.name;
|
||||||
profileField.value = resetProfileField.value;
|
profileField.value = resetProfileField.value;
|
||||||
@ -97,6 +102,7 @@ export class ProfileFieldsComponent implements OnInit {
|
|||||||
profileField.visibility = resetProfileField.visibility;
|
profileField.visibility = resetProfileField.visibility;
|
||||||
profileField.index = resetProfileField.index;
|
profileField.index = resetProfileField.index;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -110,12 +116,16 @@ export class ProfileFieldsComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
dialogRef.afterClosed().subscribe(result => {
|
dialogRef.afterClosed().subscribe({
|
||||||
|
next: (result) => {
|
||||||
if (result) {
|
if (result) {
|
||||||
this.profileService.delete(profileField.name).subscribe((result: any) => {
|
this.profileService.delete(profileField.name).subscribe({
|
||||||
|
next: (result: any) => {
|
||||||
this.update();
|
this.update();
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -125,10 +135,12 @@ export class ProfileFieldsComponent implements OnInit {
|
|||||||
minWidth: '400px'
|
minWidth: '400px'
|
||||||
});
|
});
|
||||||
|
|
||||||
dialogRef.afterClosed().subscribe(result => {
|
dialogRef.afterClosed().subscribe({
|
||||||
|
next: (result) => {
|
||||||
if (result) {
|
if (result) {
|
||||||
this.update();
|
this.update();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -185,9 +197,11 @@ export class ProfileFieldDialog {
|
|||||||
|
|
||||||
|
|
||||||
save(profileField) {
|
save(profileField) {
|
||||||
this.profileService.createOrUpdate(profileField).subscribe((result: any) => {
|
this.profileService.createOrUpdate(profileField).subscribe({
|
||||||
|
next: (result: any) => {
|
||||||
this.dialogRef.close(profileField);
|
this.dialogRef.close(profileField);
|
||||||
}, (error) => {
|
},
|
||||||
|
error: (error) => {
|
||||||
if (error.status == 409) {
|
if (error.status == 409) {
|
||||||
let errors = {};
|
let errors = {};
|
||||||
for (let code of error.error) {
|
for (let code of error.error) {
|
||||||
@ -199,6 +213,7 @@ export class ProfileFieldDialog {
|
|||||||
this.form.get(code).setErrors(errors[ code ]);
|
this.form.get(code).setErrors(errors[ code ]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -207,10 +222,12 @@ export class ProfileFieldDialog {
|
|||||||
minWidth: '400px'
|
minWidth: '400px'
|
||||||
});
|
});
|
||||||
|
|
||||||
dialogRef.afterClosed().subscribe(result => {
|
dialogRef.afterClosed().subscribe({
|
||||||
|
next: (result) => {
|
||||||
if (result) {
|
if (result) {
|
||||||
profileField.blob = result;
|
profileField.blob = result;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,7 @@ import { I18nService } from './../../services/i18n.service';
|
|||||||
@Component({
|
@Component({
|
||||||
selector: 'app-html',
|
selector: 'app-html',
|
||||||
templateUrl: './html.component.html',
|
templateUrl: './html.component.html',
|
||||||
styleUrls: ['./html.component.scss']
|
styleUrls: [ './html.component.scss' ]
|
||||||
})
|
})
|
||||||
export class HtmlComponent implements OnInit {
|
export class HtmlComponent implements OnInit {
|
||||||
|
|
||||||
@ -26,7 +26,9 @@ export class HtmlComponent implements OnInit {
|
|||||||
{
|
{
|
||||||
headers: headers,
|
headers: headers,
|
||||||
responseType: 'text'
|
responseType: 'text'
|
||||||
}).subscribe(response => this.htmlTemplate = response);
|
}).subscribe({
|
||||||
|
next: (response) => this.htmlTemplate = response
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user