RED-3800 some updates

This commit is contained in:
Dan Percic 2023-10-17 21:25:50 +03:00
parent 310cc69fdc
commit 7d6d63f277
4 changed files with 27 additions and 23 deletions

View File

@ -10,12 +10,12 @@
<div *ngIf="licenseService.licenseData$ | async" class="grid-container">
<div class="row">
<div translate="license-info-screen.backend-version"></div>
<div>{{ configService.values.BACKEND_APP_VERSION || '-' }}</div>
<div>{{ config.BACKEND_APP_VERSION || '-' }}</div>
</div>
<div class="row">
<div translate="license-info-screen.custom-app-title"></div>
<div>{{ configService.values.APP_NAME || '-' }}</div>
<div>{{ config.APP_NAME || '-' }}</div>
</div>
<div class="row">

View File

@ -1,23 +1,24 @@
import { Component } from '@angular/core';
import { ConfigService } from '@services/config.service';
import { TranslateService } from '@ngx-translate/core';
import { ButtonConfig, IconButtonTypes, IqserPermissionsService } from '@iqser/common-ui';
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
import { RouterHistoryService } from '@services/router-history.service';
import { LicenseService } from '@services/license.service';
import { Roles } from '@users/roles';
import type { User } from '@red/domain';
import { List } from '@common-ui/utils';
import { ButtonConfig, getConfig, IconButtonTypes, IqserPermissionsService } from '@iqser/common-ui';
import { getCurrentUser } from '@iqser/common-ui/lib/users';
import { TranslateService } from '@ngx-translate/core';
import type { AppConfig, User } from '@red/domain';
import { LicenseService } from '@services/license.service';
import { RouterHistoryService } from '@services/router-history.service';
import { Roles } from '@users/roles';
@Component({
templateUrl: './license-screen.component.html',
styleUrls: ['./license-screen.component.scss'],
})
export class LicenseScreenComponent {
readonly roles = Roles;
readonly currentUser = getCurrentUser<User>();
readonly currentYear = new Date().getFullYear();
readonly buttonConfigs: readonly ButtonConfig[] = [
protected readonly config = getConfig<AppConfig>();
protected readonly roles = Roles;
protected readonly currentUser = getCurrentUser<User>();
protected readonly currentYear = new Date().getFullYear();
protected readonly buttonConfigs: List<ButtonConfig> = [
{
label: _('license-info-screen.email-report'),
action: (): void => this.sendMail(),
@ -28,7 +29,6 @@ export class LicenseScreenComponent {
];
constructor(
readonly configService: ConfigService,
readonly licenseService: LicenseService,
readonly permissionsService: IqserPermissionsService,
readonly routerHistoryService: RouterHistoryService,

View File

@ -8,6 +8,6 @@ export class NavigateLastDossiersScreenDirective {
constructor(private readonly _routerHistoryService: RouterHistoryService) {}
@HostListener('click') onClick() {
this._routerHistoryService.navigateToLastDossiersScreen();
return this._routerHistoryService.navigateToLastDossiersScreen();
}
}

View File

@ -1,10 +1,10 @@
import { effect, Injectable } from '@angular/core';
import { NavigationEnd, Router } from '@angular/router';
import { filter } from 'rxjs/operators';
import { JwtToken } from '@guards/if-logged-in.guard';
import { TenantsService } from '@iqser/common-ui/lib/tenants';
import jwt_decode from 'jwt-decode';
import { KeycloakService } from 'keycloak-angular';
import { JwtToken } from '@guards/if-logged-in.guard';
import { filter } from 'rxjs/operators';
const LAST_DOSSIERS_SCREEN = 'routerHistory_lastDossiersScreen';
@ -28,6 +28,10 @@ export class RouterHistoryService {
}
});
const ref = effect(async () => {
if (!(await _keycloakService.isLoggedIn())) {
return;
}
const token = await this._keycloakService.getToken();
if (this._tenantsService.activeTenantId.length === 0 || !token) {
return;
@ -45,14 +49,14 @@ export class RouterHistoryService {
});
}
navigateToLastDossiersScreen(): void {
navigateToLastDossiersScreen() {
const lastDossiersScreen = localStorage.getItem(LAST_DOSSIERS_SCREEN);
if (this._router.url === decodeURI(lastDossiersScreen) || lastDossiersScreen === null) {
this._router.navigate(['/' + this._tenantsService.activeTenantId]);
} else {
const url = decodeURI(lastDossiersScreen).split('?')[0];
// todo links
this._router.navigate([url]);
return this._router.navigate(['/' + this._tenantsService.activeTenantId]);
}
const url = decodeURI(lastDossiersScreen).split('?')[0];
// todo links
return this._router.navigate([url]);
}
}