|
|
@ -17,7 +17,12 @@ import { |
|
|
OnInit |
|
|
OnInit |
|
|
} from '@angular/core'; |
|
|
} from '@angular/core'; |
|
|
import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; |
|
|
import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; |
|
|
import { FormBuilder, ReactiveFormsModule, Validators } from '@angular/forms'; |
|
|
import { |
|
|
|
|
|
FormControl, |
|
|
|
|
|
FormGroup, |
|
|
|
|
|
ReactiveFormsModule, |
|
|
|
|
|
Validators |
|
|
|
|
|
} from '@angular/forms'; |
|
|
import { MatButtonModule } from '@angular/material/button'; |
|
|
import { MatButtonModule } from '@angular/material/button'; |
|
|
import { MatDialog, MatDialogModule } from '@angular/material/dialog'; |
|
|
import { MatDialog, MatDialogModule } from '@angular/material/dialog'; |
|
|
import { MatFormFieldModule } from '@angular/material/form-field'; |
|
|
import { MatFormFieldModule } from '@angular/material/form-field'; |
|
|
@ -60,8 +65,11 @@ export class GfUserAccountAccessComponent implements OnInit { |
|
|
public hasPermissionToDeleteAccess: boolean; |
|
|
public hasPermissionToDeleteAccess: boolean; |
|
|
public hasPermissionToUpdateOwnAccessToken: boolean; |
|
|
public hasPermissionToUpdateOwnAccessToken: boolean; |
|
|
public isAccessTokenHidden = true; |
|
|
public isAccessTokenHidden = true; |
|
|
public updateOwnAccessTokenForm = this.formBuilder.group({ |
|
|
public updateOwnAccessTokenForm = new FormGroup({ |
|
|
accessToken: ['', Validators.required] |
|
|
accessToken: new FormControl<string>('', { |
|
|
|
|
|
nonNullable: true, |
|
|
|
|
|
validators: [Validators.required] |
|
|
|
|
|
}) |
|
|
}); |
|
|
}); |
|
|
public user: User; |
|
|
public user: User; |
|
|
|
|
|
|
|
|
@ -71,7 +79,6 @@ export class GfUserAccountAccessComponent implements OnInit { |
|
|
private destroyRef: DestroyRef, |
|
|
private destroyRef: DestroyRef, |
|
|
private deviceDetectorService: DeviceDetectorService, |
|
|
private deviceDetectorService: DeviceDetectorService, |
|
|
private dialog: MatDialog, |
|
|
private dialog: MatDialog, |
|
|
private formBuilder: FormBuilder, |
|
|
|
|
|
private notificationService: NotificationService, |
|
|
private notificationService: NotificationService, |
|
|
private route: ActivatedRoute, |
|
|
private route: ActivatedRoute, |
|
|
private router: Router, |
|
|
private router: Router, |
|
|
@ -144,7 +151,8 @@ export class GfUserAccountAccessComponent implements OnInit { |
|
|
confirmFn: () => { |
|
|
confirmFn: () => { |
|
|
this.dataService |
|
|
this.dataService |
|
|
.updateOwnAccessToken({ |
|
|
.updateOwnAccessToken({ |
|
|
accessToken: this.updateOwnAccessTokenForm.get('accessToken').value |
|
|
accessToken: |
|
|
|
|
|
this.updateOwnAccessTokenForm.controls.accessToken.value |
|
|
}) |
|
|
}) |
|
|
.pipe( |
|
|
.pipe( |
|
|
catchError(() => { |
|
|
catchError(() => { |
|
|
@ -184,15 +192,7 @@ export class GfUserAccountAccessComponent implements OnInit { |
|
|
GfCreateOrUpdateAccessDialogComponent, |
|
|
GfCreateOrUpdateAccessDialogComponent, |
|
|
CreateOrUpdateAccessDialogParams |
|
|
CreateOrUpdateAccessDialogParams |
|
|
>(GfCreateOrUpdateAccessDialogComponent, { |
|
|
>(GfCreateOrUpdateAccessDialogComponent, { |
|
|
data: { |
|
|
data: {} satisfies CreateOrUpdateAccessDialogParams, |
|
|
access: { |
|
|
|
|
|
alias: '', |
|
|
|
|
|
grantee: null, |
|
|
|
|
|
id: null, |
|
|
|
|
|
permissions: ['READ_RESTRICTED'], |
|
|
|
|
|
type: 'PRIVATE' |
|
|
|
|
|
} |
|
|
|
|
|
}, |
|
|
|
|
|
height: this.deviceType === 'mobile' ? '98vh' : undefined, |
|
|
height: this.deviceType === 'mobile' ? '98vh' : undefined, |
|
|
width: this.deviceType === 'mobile' ? '100vw' : '50rem' |
|
|
width: this.deviceType === 'mobile' ? '100vw' : '50rem' |
|
|
}); |
|
|
}); |
|
|
@ -222,12 +222,12 @@ export class GfUserAccountAccessComponent implements OnInit { |
|
|
data: { |
|
|
data: { |
|
|
access: { |
|
|
access: { |
|
|
alias: access.alias, |
|
|
alias: access.alias, |
|
|
grantee: access.grantee === 'Public' ? null : access.grantee, |
|
|
grantee: access.grantee === 'Public' ? undefined : access.grantee, |
|
|
id: access.id, |
|
|
id: access.id, |
|
|
permissions: access.permissions, |
|
|
permissions: access.permissions, |
|
|
type: access.type |
|
|
type: access.type |
|
|
} |
|
|
} |
|
|
}, |
|
|
} satisfies CreateOrUpdateAccessDialogParams, |
|
|
height: this.deviceType === 'mobile' ? '98vh' : undefined, |
|
|
height: this.deviceType === 'mobile' ? '98vh' : undefined, |
|
|
width: this.deviceType === 'mobile' ? '100vw' : '50rem' |
|
|
width: this.deviceType === 'mobile' ? '100vw' : '50rem' |
|
|
}); |
|
|
}); |
|
|
@ -244,9 +244,9 @@ export class GfUserAccountAccessComponent implements OnInit { |
|
|
private update() { |
|
|
private update() { |
|
|
this.accessesGet = this.user.access.map(({ alias, id, permissions }) => { |
|
|
this.accessesGet = this.user.access.map(({ alias, id, permissions }) => { |
|
|
return { |
|
|
return { |
|
|
alias, |
|
|
|
|
|
id, |
|
|
id, |
|
|
permissions, |
|
|
permissions, |
|
|
|
|
|
alias: alias ?? '', |
|
|
grantee: $localize`Me`, |
|
|
grantee: $localize`Me`, |
|
|
type: 'PRIVATE' |
|
|
type: 'PRIVATE' |
|
|
}; |
|
|
}; |
|
|
|