|
|
@ -24,6 +24,7 @@ import { |
|
|
ChangeDetectionStrategy, |
|
|
ChangeDetectionStrategy, |
|
|
Component, |
|
|
Component, |
|
|
CUSTOM_ELEMENTS_SCHEMA, |
|
|
CUSTOM_ELEMENTS_SCHEMA, |
|
|
|
|
|
DestroyRef, |
|
|
EventEmitter, |
|
|
EventEmitter, |
|
|
HostListener, |
|
|
HostListener, |
|
|
Input, |
|
|
Input, |
|
|
@ -31,6 +32,7 @@ import { |
|
|
Output, |
|
|
Output, |
|
|
ViewChild |
|
|
ViewChild |
|
|
} from '@angular/core'; |
|
|
} from '@angular/core'; |
|
|
|
|
|
import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; |
|
|
import { MatBadgeModule } from '@angular/material/badge'; |
|
|
import { MatBadgeModule } from '@angular/material/badge'; |
|
|
import { MatButtonModule } from '@angular/material/button'; |
|
|
import { MatButtonModule } from '@angular/material/button'; |
|
|
import { MatDialog } from '@angular/material/dialog'; |
|
|
import { MatDialog } from '@angular/material/dialog'; |
|
|
@ -48,8 +50,8 @@ import { |
|
|
radioButtonOffOutline, |
|
|
radioButtonOffOutline, |
|
|
radioButtonOnOutline |
|
|
radioButtonOnOutline |
|
|
} from 'ionicons/icons'; |
|
|
} from 'ionicons/icons'; |
|
|
import { EMPTY, Subject } from 'rxjs'; |
|
|
import { EMPTY } from 'rxjs'; |
|
|
import { catchError, takeUntil } from 'rxjs/operators'; |
|
|
import { catchError } from 'rxjs/operators'; |
|
|
|
|
|
|
|
|
@Component({ |
|
|
@Component({ |
|
|
changeDetection: ChangeDetectionStrategy.OnPush, |
|
|
changeDetection: ChangeDetectionStrategy.OnPush, |
|
|
@ -131,10 +133,9 @@ export class GfHeaderComponent implements OnChanges { |
|
|
public routerLinkRegister = publicRoutes.register.routerLink; |
|
|
public routerLinkRegister = publicRoutes.register.routerLink; |
|
|
public routerLinkResources = publicRoutes.resources.routerLink; |
|
|
public routerLinkResources = publicRoutes.resources.routerLink; |
|
|
|
|
|
|
|
|
private unsubscribeSubject = new Subject<void>(); |
|
|
|
|
|
|
|
|
|
|
|
public constructor( |
|
|
public constructor( |
|
|
private dataService: DataService, |
|
|
private dataService: DataService, |
|
|
|
|
|
private destroyRef: DestroyRef, |
|
|
private dialog: MatDialog, |
|
|
private dialog: MatDialog, |
|
|
private impersonationStorageService: ImpersonationStorageService, |
|
|
private impersonationStorageService: ImpersonationStorageService, |
|
|
private layoutService: LayoutService, |
|
|
private layoutService: LayoutService, |
|
|
@ -146,7 +147,7 @@ export class GfHeaderComponent implements OnChanges { |
|
|
) { |
|
|
) { |
|
|
this.impersonationStorageService |
|
|
this.impersonationStorageService |
|
|
.onChangeHasImpersonation() |
|
|
.onChangeHasImpersonation() |
|
|
.pipe(takeUntil(this.unsubscribeSubject)) |
|
|
.pipe(takeUntilDestroyed(this.destroyRef)) |
|
|
.subscribe((impersonationId) => { |
|
|
.subscribe((impersonationId) => { |
|
|
this.hasImpersonationId = !!impersonationId; |
|
|
this.hasImpersonationId = !!impersonationId; |
|
|
this.impersonationId = impersonationId; |
|
|
this.impersonationId = impersonationId; |
|
|
@ -224,11 +225,11 @@ export class GfHeaderComponent implements OnChanges { |
|
|
public onDateRangeChange(dateRange: DateRange) { |
|
|
public onDateRangeChange(dateRange: DateRange) { |
|
|
this.dataService |
|
|
this.dataService |
|
|
.putUserSetting({ dateRange }) |
|
|
.putUserSetting({ dateRange }) |
|
|
.pipe(takeUntil(this.unsubscribeSubject)) |
|
|
.pipe(takeUntilDestroyed(this.destroyRef)) |
|
|
.subscribe(() => { |
|
|
.subscribe(() => { |
|
|
this.userService |
|
|
this.userService |
|
|
.get(true) |
|
|
.get(true) |
|
|
.pipe(takeUntil(this.unsubscribeSubject)) |
|
|
.pipe(takeUntilDestroyed(this.destroyRef)) |
|
|
.subscribe(); |
|
|
.subscribe(); |
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |
|
|
@ -252,11 +253,11 @@ export class GfHeaderComponent implements OnChanges { |
|
|
|
|
|
|
|
|
this.dataService |
|
|
this.dataService |
|
|
.putUserSetting(userSetting) |
|
|
.putUserSetting(userSetting) |
|
|
.pipe(takeUntil(this.unsubscribeSubject)) |
|
|
.pipe(takeUntilDestroyed(this.destroyRef)) |
|
|
.subscribe(() => { |
|
|
.subscribe(() => { |
|
|
this.userService |
|
|
this.userService |
|
|
.get(true) |
|
|
.get(true) |
|
|
.pipe(takeUntil(this.unsubscribeSubject)) |
|
|
.pipe(takeUntilDestroyed(this.destroyRef)) |
|
|
.subscribe(); |
|
|
.subscribe(); |
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |
|
|
@ -301,7 +302,7 @@ export class GfHeaderComponent implements OnChanges { |
|
|
|
|
|
|
|
|
dialogRef |
|
|
dialogRef |
|
|
.afterClosed() |
|
|
.afterClosed() |
|
|
.pipe(takeUntil(this.unsubscribeSubject)) |
|
|
.pipe(takeUntilDestroyed(this.destroyRef)) |
|
|
.subscribe((data) => { |
|
|
.subscribe((data) => { |
|
|
if (data?.accessToken) { |
|
|
if (data?.accessToken) { |
|
|
this.dataService |
|
|
this.dataService |
|
|
@ -314,7 +315,7 @@ export class GfHeaderComponent implements OnChanges { |
|
|
|
|
|
|
|
|
return EMPTY; |
|
|
return EMPTY; |
|
|
}), |
|
|
}), |
|
|
takeUntil(this.unsubscribeSubject) |
|
|
takeUntilDestroyed(this.destroyRef) |
|
|
) |
|
|
) |
|
|
.subscribe(({ authToken }) => { |
|
|
.subscribe(({ authToken }) => { |
|
|
this.setToken(authToken); |
|
|
this.setToken(authToken); |
|
|
@ -331,7 +332,7 @@ export class GfHeaderComponent implements OnChanges { |
|
|
|
|
|
|
|
|
this.userService |
|
|
this.userService |
|
|
.get() |
|
|
.get() |
|
|
.pipe(takeUntil(this.unsubscribeSubject)) |
|
|
.pipe(takeUntilDestroyed(this.destroyRef)) |
|
|
.subscribe((user) => { |
|
|
.subscribe((user) => { |
|
|
const userLanguage = user?.settings?.language; |
|
|
const userLanguage = user?.settings?.language; |
|
|
|
|
|
|
|
|
@ -342,9 +343,4 @@ export class GfHeaderComponent implements OnChanges { |
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public ngOnDestroy() { |
|
|
|
|
|
this.unsubscribeSubject.next(); |
|
|
|
|
|
this.unsubscribeSubject.complete(); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|
|