fixed user profile update and file workload issue

This commit is contained in:
Timo 2021-06-24 13:22:34 +03:00
parent 7c16482957
commit 8fb02f60c7
6 changed files with 32 additions and 26 deletions

View File

@ -1,18 +1,11 @@
import { Component, OnInit } from '@angular/core';
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
import { UserService } from '@services/user.service';
import { ProfileModel, UserService } from '@services/user.service';
import { PermissionsService } from '@services/permissions.service';
import { LanguageService } from '@i18n/language.service';
import { TranslateService } from '@ngx-translate/core';
import { UserControllerService } from '@redaction/red-ui-http';
interface ProfileModel {
email: string;
firstName: string;
lastName: string;
language: string;
}
@Component({
selector: 'redaction-user-profile-screen',
templateUrl: './user-profile-screen.component.html',

View File

@ -575,6 +575,7 @@ export class FilePreviewScreenComponent implements OnInit, OnDestroy, OnAttach,
private async _loadFileData(performUpdate: boolean = false): Promise<void> {
const fileData = await this._fileDownloadService.loadActiveFileData().toPromise();
console.log(fileData);
if (!fileData.fileStatus.isPending && !fileData.fileStatus.isError) {
if (performUpdate) {
this.fileData.redactionLog = fileData.redactionLog;

View File

@ -1,6 +1,6 @@
<button [class.overlay]="showDot" mat-button>
<redaction-initials-avatar
[userId]="user?.id"
[user]="user"
[withName]="true"
size="small"
></redaction-initials-avatar>

View File

@ -1,4 +1,4 @@
import { Component, Input, OnChanges } from '@angular/core';
import { Component, Input, OnChanges, SimpleChanges } from '@angular/core';
import { UserService } from '@services/user.service';
import { User } from '@redaction/red-ui-http';
import { TranslateService } from '@ngx-translate/core';
@ -46,7 +46,7 @@ export class InitialsAvatarComponent implements OnChanges {
return this.user && this._userService.userId === this.user.userId;
}
ngOnChanges(): void {
ngOnChanges(changes: SimpleChanges): void {
const isSystemUser = this.userId && this.userId.toLowerCase() === 'system';
if (isSystemUser) {
this.displayName = 'System';

View File

@ -6,13 +6,25 @@ import { User, UserControllerService } from '@redaction/red-ui-http';
import { wipeCaches } from '@redaction/red-cache';
import { BASE_HREF } from '../tokens';
export class UserWrapper {
constructor(private _currentUser: KeycloakProfile, public roles: string[], public id: string) {}
export interface ProfileModel {
email: string;
firstName: string;
lastName: string;
language: string;
}
get name() {
return this._currentUser.firstName && this._currentUser.lastName
? `${this._currentUser.firstName} ${this._currentUser.lastName}`
: this._currentUser.username;
export class UserWrapper {
name: string;
constructor(private _currentUser: KeycloakProfile, public roles: string[], public id: string) {
this.name =
this._currentUser.firstName && this._currentUser.lastName
? `${this._currentUser.firstName} ${this._currentUser.lastName}`
: this._currentUser.username;
}
get userId() {
return this.id;
}
get email() {
@ -106,7 +118,7 @@ export class UserService {
const decoded = jwt_decode(token) as any;
const userId = decoded.sub;
this._currentUser = new UserWrapper(
await this._keycloakService.loadUserProfile(false),
await this._keycloakService.loadUserProfile(true),
this._keycloakService.getUserRoles(true),
userId
);

View File

@ -50,28 +50,28 @@ export class RedactionLogControllerService {
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
* @param reportProgress flag to report request and response progress.
*/
public getRedactionLog(
public getRedactionChangeLog(
dossierId: string,
fileId: string,
observe?: 'body',
reportProgress?: boolean
): Observable<RedactionChangeLog>;
public getRedactionLog(
public getRedactionChangeLog(
dossierId: string,
fileId: string,
observe?: 'response',
reportProgress?: boolean
): Observable<HttpResponse<RedactionChangeLog>>;
public getRedactionLog(
public getRedactionChangeLog(
dossierId: string,
fileId: string,
observe?: 'events',
reportProgress?: boolean
): Observable<HttpEvent<RedactionChangeLog>>;
public getRedactionLog(
public getRedactionChangeLog(
dossierId: string,
fileId: string,
observe: any = 'body',
@ -130,28 +130,28 @@ export class RedactionLogControllerService {
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
* @param reportProgress flag to report request and response progress.
*/
public getRedactionChangeLog(
public getRedactionLog(
dossierId: string,
fileId: string,
observe?: 'body',
reportProgress?: boolean
): Observable<RedactionLog>;
public getRedactionChangeLog(
public getRedactionLog(
dossierId: string,
fileId: string,
observe?: 'response',
reportProgress?: boolean
): Observable<HttpResponse<RedactionLog>>;
public getRedactionChangeLog(
public getRedactionLog(
dossierId: string,
fileId: string,
observe?: 'events',
reportProgress?: boolean
): Observable<HttpEvent<RedactionLog>>;
public getRedactionChangeLog(
public getRedactionLog(
dossierId: string,
fileId: string,
observe: any = 'body',