fixes on tenant urls

This commit is contained in:
Sofia Papacharalampous 2024-06-13 14:44:45 +03:00
parent 5142e5cd56
commit 9e992b4ea5
13 changed files with 39 additions and 20 deletions

View File

@ -4,6 +4,7 @@ import { Router } from '@angular/router';
import { SupportiveMaterialFieldType } from '@app/core/common/enum/supportive-material-field-type';
import { LanguageService } from '@app/core/services/language/language.service';
import { AnalyticsService } from '@app/core/services/matomo/analytics-service';
import { RouterUtilsService } from '@app/core/services/router/router-utils.service';
import { SupportiveMaterialService } from '@app/core/services/supportive-material/supportive-material.service';
import { BaseComponent } from '@common/base/base.component';
import { HttpErrorHandlingService } from '@common/modules/errors/error-handling/http-error-handling.service';
@ -26,6 +27,7 @@ export class AboutComponent extends BaseComponent implements OnInit {
private languageService: LanguageService,
private translate: TranslateService,
private router: Router,
private routerUtils: RouterUtilsService,
private analyticsService: AnalyticsService,
private httpErrorHandlingService: HttpErrorHandlingService
) { super(); }
@ -33,7 +35,7 @@ export class AboutComponent extends BaseComponent implements OnInit {
ngOnInit() {
this.analyticsService.trackPageView(AnalyticsService.About);
this.translate.onLangChange.subscribe((event: LangChangeEvent) => {
this.router.navigate(['/reload'], { skipLocationChange: true }).then(() => this.router.navigate(['/about']));
this.router.navigate(['/reload'], { skipLocationChange: true }).then(() => this.router.navigate([this.routerUtils.generateUrl('/about')]));
});
this.supportiveMaterialService.getPayload(SupportiveMaterialFieldType.About, this.languageService.getCurrentLanguage())

View File

@ -1,6 +1,7 @@
import { Component, Input, NgZone, OnInit } from '@angular/core';
import { ActivatedRoute, Router } from '@angular/router';
import { AuthService } from '@app/core/services/auth/auth.service';
import { RouterUtilsService } from '@app/core/services/router/router-utils.service';
import { TenantHandlingService } from '@app/core/services/tenant/tenant-handling.service';
import { BaseComponent } from '@common/base/base.component';
import { KeycloakService } from 'keycloak-angular';
@ -23,6 +24,7 @@ export class LoginComponent extends BaseComponent implements OnInit {
constructor(
private zone: NgZone,
private router: Router,
private routerUtils: RouterUtilsService,
private authService: AuthService,
private route: ActivatedRoute,
private tenantHandlingService: TenantHandlingService,
@ -38,7 +40,7 @@ export class LoginComponent extends BaseComponent implements OnInit {
this.authService.prepareAuthRequest(from(this.keycloakService.getToken()), tenantCode).pipe(takeUntil(this._destroyed)).subscribe(
() => {
let returnUrL = this.returnUrl;
this.zone.run(() => this.router.navigateByUrl(returnUrL));
this.zone.run(() => this.router.navigateByUrl(this.routerUtils.generateUrl(returnUrL)));
},
(error) => this.authService.authenticate('/'));
}

View File

@ -7,12 +7,14 @@ import { BaseService } from '@common/base/base.service';
import { TranslateService } from '@ngx-translate/core';
import { TranslateServerLoader } from '@app/core/services/language/server.loader';
import { LanguageService } from '@app/core/services/language/language.service';
import { RouterUtilsService } from '@app/core/services/router/router-utils.service';
@Injectable()
export class LoginService extends BaseService {
constructor(
private router: Router,
private routerUtils: RouterUtilsService,
private authService: AuthService,
private translate: TranslateService,
private zone: NgZone,
@ -29,7 +31,7 @@ export class LoginService extends BaseService {
if (this.authService.currentAccountIsAuthenticated() && this.authService.getUserProfileCulture()) { this.cultureService.cultureSelected(this.authService.getUserProfileCulture()); }
if (this.authService.currentAccountIsAuthenticated() && this.authService.getUserProfileLanguage()) { this.language.changeLanguage(this.authService.getUserProfileLanguage()); }
const redirectUrl = returnUrl || '/';
this.zone.run(() => this.router.navigateByUrl(redirectUrl));
this.zone.run(() => this.router.navigateByUrl(this.routerUtils.generateUrl(redirectUrl)));
});
}

View File

@ -97,7 +97,6 @@ export class StartNewDmpDialogComponent extends BaseComponent {
private onCallbackImportComplete() {
this.uiNotificationService.snackBarNotification(this.language.instant('DMP-UPLOAD.UPLOAD-SUCCESS'), SnackBarNotificationLevel.Success);
this.router.navigate(['/reload']).then(() => this.router.navigate([this.routerUtils.generateUrl('/plans')]));
// this.router.navigate(['/reload']).then(() => this.isPublic ? this.router.navigate(['/explore-plans']) : this.router.navigate(['/plans']));
}
private onCallbackImportFail(error: any) {

View File

@ -4,6 +4,7 @@ import { Router } from '@angular/router';
import { SupportiveMaterialFieldType } from '@app/core/common/enum/supportive-material-field-type';
import { LanguageService } from '@app/core/services/language/language.service';
import { AnalyticsService } from '@app/core/services/matomo/analytics-service';
import { RouterUtilsService } from '@app/core/services/router/router-utils.service';
import { SupportiveMaterialService } from '@app/core/services/supportive-material/supportive-material.service';
import { BaseComponent } from '@common/base/base.component';
import { LangChangeEvent, TranslateService } from '@ngx-translate/core';
@ -27,6 +28,7 @@ export class GlossaryContentComponent extends BaseComponent implements OnInit {
private languageService: LanguageService,
private translate: TranslateService,
private router: Router,
private routerUtils: RouterUtilsService,
private analyticsService: AnalyticsService,
) { super(); }
@ -34,7 +36,7 @@ export class GlossaryContentComponent extends BaseComponent implements OnInit {
this.analyticsService.trackPageView(AnalyticsService.Glossary);
this.translate.onLangChange.subscribe((event: LangChangeEvent) => {
this.router.navigate(['/reload'], { skipLocationChange: true }).then(() => this.router.navigate(['/glossary']));
this.router.navigate(['/reload'], { skipLocationChange: true }).then(() => this.router.navigate([this.routerUtils.generateUrl('/glossary')]));
});
this.supportiveMaterialService.getPayload(SupportiveMaterialFieldType.Glossary, this.languageService.getCurrentLanguage())

View File

@ -1,6 +1,7 @@
import { AfterViewInit, Component, Input } from '@angular/core';
import { ActivatedRoute, Router } from '@angular/router';
import { AuthService } from '@app/core/services/auth/auth.service';
import { RouterUtilsService } from '@app/core/services/router/router-utils.service';
import { BaseComponent } from '@common/base/base.component';
import { takeUntil } from 'rxjs/operators';
@ -14,7 +15,8 @@ export class UnauthorizedComponent extends BaseComponent implements AfterViewIni
constructor(
private authService: AuthService,
private route: ActivatedRoute,
private router: Router
private router: Router,
private routerUtils: RouterUtilsService
) { super(); }
ngAfterViewInit() {
@ -26,7 +28,7 @@ export class UnauthorizedComponent extends BaseComponent implements AfterViewIni
.pipe(takeUntil(this._destroyed))
.subscribe( //TODO HANDLE-ERRORS
result => {
if (!result) { this.router.navigate(['/login'], { queryParams: { returnUrl: returnUrl } }); } else { this.router.navigate(['/']); }
if (!result) { this.router.navigate(['/login'], { queryParams: { returnUrl: returnUrl } }); } else { this.router.navigate([this.routerUtils.generateUrl('/home')]); }
},
err => console.error('An error occurred', err));
}

View File

@ -65,7 +65,7 @@ export class UserDialogComponent implements OnInit, OnDestroy {
public navigateToProfile() {
this.dialogRef.close();
this.router.navigate(['/profile']);
this.router.navigate([this.routerUtils.generateUrl('/profile')]);
}
public navigateToMyDmps() {

View File

@ -5,20 +5,20 @@
{{'FOOTER.ABOUT' | translate}}</p>
</div>
<div class="col-auto ml-3">
<p class="option" [routerLink]="['/terms-and-conditions']" [routerLinkActive]="['option-active']">
<p class="option" [routerLink]="routerUtils.generateUrl('/terms-and-conditions')" [routerLinkActive]="['option-active']">
{{'FOOTER.TERMS-OF-SERVICE' | translate}}</p>
</div>
</div>
<div class="row ml-2">
<div class="col-auto">
<p class="option" [routerLink]="['/glossary']" [routerLinkActive]="['option-active']">
<p class="option" [routerLink]="routerUtils.generateUrl('/glossary')" [routerLinkActive]="['option-active']">
{{'FOOTER.GLOSSARY' | translate}}</p>
<!-- <p class="option" (click)="openGlossaryDialog()" [ngClass]="{'option-active': this.router.url === '/glossary'}">
{{'FOOTER.GLOSSARY' | translate}}</p> -->
</div>
<div class="col-auto">
<p class="option" [routerLink]="['/user-guide']" [routerLinkActive]="['option-active']">
<p class="option" [routerLink]="routerUtils.generateUrl('/user-guide')" [routerLinkActive]="['option-active']">
{{'FOOTER.GUIDE' | translate}}</p>
<!-- <p class="option" (click)="openUserGuideDialog()" [ngClass]="{'option-active': this.router.url === '/user-guide'}">
{{'FOOTER.GUIDE' | translate}}</p> -->
@ -31,7 +31,7 @@
</div>
<div class="row ml-2">
<div *ngIf="isAuthenticated()" class="col-auto">
<p class="option" [routerLink]="['/contact-support']" [routerLinkActive]="['option-active']">
<p class="option" [routerLink]="routerUtils.generateUrl('/contact-support')" [routerLinkActive]="['option-active']">
{{'FOOTER.CONTACT-SUPPORT' | translate}}</p>
<!-- <p class="option" (click)="openContactDialog()" [ngClass]="{'option-active': this.router.url === '/contact-support'}">
{{'FOOTER.CONTACT-SUPPORT' | translate}}</p> -->

View File

@ -18,6 +18,7 @@ import { UserGuideDialogComponent } from '@app/ui/user-guide/dialog/user-guide-d
import { HttpClient, HttpErrorResponse } from '@angular/common/http';
import { AnalyticsService } from '@app/core/services/matomo/analytics-service';
import { HttpErrorHandlingService } from '@common/modules/errors/error-handling/http-error-handling.service';
import { RouterUtilsService } from '@app/core/services/router/router-utils.service';
@Component({
selector: 'app-sidebar-footer',
@ -33,6 +34,7 @@ export class SidebarFooterComponent extends BaseComponent implements OnInit {
private dialog: MatDialog,
private language: TranslateService,
public router: Router,
public routerUtils: RouterUtilsService,
private contactSupportService: ContactSupportService,
private uiNotificationService: UiNotificationService,
private formService: FormService,
@ -145,6 +147,6 @@ export class SidebarFooterComponent extends BaseComponent implements OnInit {
}
public navigate(): any {
this.router.navigateByUrl('/about');
this.router.navigateByUrl(this.routerUtils.generateUrl('/about'));
}
}

View File

@ -4,6 +4,7 @@ import { Router } from '@angular/router';
import { SupportiveMaterialFieldType } from '@app/core/common/enum/supportive-material-field-type';
import { LanguageService } from '@app/core/services/language/language.service';
import { AnalyticsService } from '@app/core/services/matomo/analytics-service';
import { RouterUtilsService } from '@app/core/services/router/router-utils.service';
import { SupportiveMaterialService } from '@app/core/services/supportive-material/supportive-material.service';
import { BaseComponent } from '@common/base/base.component';
import { TranslateService, LangChangeEvent } from '@ngx-translate/core';
@ -25,6 +26,7 @@ export class TermsComponent extends BaseComponent implements OnInit {
private languageService: LanguageService,
private translate: TranslateService,
private router: Router,
private routerUtils: RouterUtilsService,
private analyticsService: AnalyticsService,
) { super(); }
@ -32,7 +34,7 @@ export class TermsComponent extends BaseComponent implements OnInit {
this.analyticsService.trackPageView(AnalyticsService.Terms);
this.translate.onLangChange.subscribe((event: LangChangeEvent) => {
this.router.navigate(['/reload'], { skipLocationChange: true }).then(() => this.router.navigate(['/terms-and-conditions']));
this.router.navigate(['/reload'], { skipLocationChange: true }).then(() => this.router.navigate([this.routerUtils.generateUrl('/terms-and-conditions')]));
});
this.supportiveMaterialService.getPayload(SupportiveMaterialFieldType.TermsOfService, this.languageService.getCurrentLanguage())

View File

@ -6,6 +6,7 @@ import { SupportiveMaterialFieldType } from '@app/core/common/enum/supportive-ma
import { ConfigurationService } from '@app/core/services/configuration/configuration.service';
import { LanguageService } from '@app/core/services/language/language.service';
import { AnalyticsService } from '@app/core/services/matomo/analytics-service';
import { RouterUtilsService } from '@app/core/services/router/router-utils.service';
import { SupportiveMaterialService } from '@app/core/services/supportive-material/supportive-material.service';
import { BaseComponent } from '@common/base/base.component';
import { LangChangeEvent, TranslateService } from '@ngx-translate/core';
@ -38,6 +39,7 @@ export class UserGuideContentComponent extends BaseComponent implements OnInit {
private configurationService: ConfigurationService,
private translate: TranslateService,
private router: Router,
private routerUtils: RouterUtilsService,
private analyticsService: AnalyticsService,
) { super(); }
@ -50,7 +52,7 @@ export class UserGuideContentComponent extends BaseComponent implements OnInit {
this.scroll(ev);
});
this.translate.onLangChange.subscribe((event: LangChangeEvent) => {
this.router.navigate(['/reload'], { skipLocationChange: true }).then(() => this.router.navigate(['/user-guide']));
this.router.navigate(['/reload'], { skipLocationChange: true }).then(() => this.router.navigate([this.routerUtils.generateUrl('/user-guide')]));
});
this.supportiveMaterialService.getPayload(SupportiveMaterialFieldType.UserGuide, this.languageService.getCurrentLanguage())
.pipe(takeUntil(this._destroyed))

View File

@ -5,6 +5,7 @@ import { IsActive } from '@app/core/common/enum/is-active.enum';
import { AuthService } from '@app/core/services/auth/auth.service';
import { LoggingService } from '@app/core/services/logging/logging-service';
import { UiNotificationService } from '@app/core/services/notification/ui-notification-service';
import { RouterUtilsService } from '@app/core/services/router/router-utils.service';
import { EnumUtils } from '@app/core/services/utilities/enum-utils.service';
import { BaseComponent } from '@common/base/base.component';
import { FormService } from '@common/forms/form-service';
@ -37,6 +38,7 @@ export class InAppNotificationEditorComponent extends BaseComponent implements O
private inappNotificationService: InAppNotificationService,
private route: ActivatedRoute,
private router: Router,
private routerUtils: RouterUtilsService,
private language: TranslateService,
public enumUtils: EnumUtils,
private formService: FormService,
@ -115,7 +117,7 @@ export class InAppNotificationEditorComponent extends BaseComponent implements O
}
public cancel(): void {
this.router.navigate(['/mine-notifications']);
this.router.navigate([this.routerUtils.generateUrl('/mine-notifications')]);
}
onCallbackSuccess(data?: any): void {

View File

@ -14,6 +14,7 @@ import { nameof } from 'ts-simple-nameof';
import { IsActive } from '@notification-service/core/enum/is-active.enum';
import { NotificationInAppTracking } from "@notification-service/core/enum/notification-inapp-tracking.enum";
import { InAppNotification } from "@notification-service/core/model/inapp-notification.model";
import { RouterUtilsService } from "@app/core/services/router/router-utils.service";
@Component({
selector: 'app-mine-inapp-notification-listing-dialog',
@ -33,6 +34,7 @@ export class MineInAppNotificationListingDialogComponent extends BaseComponent i
@Inject(MAT_DIALOG_DATA) public data: any,
private inappNotificationService: InAppNotificationService,
private router: Router,
private routerUtils: RouterUtilsService,
private uiNotificationService: UiNotificationService,
private httpErrorHandlingService: HttpErrorHandlingService,
public authService: AuthService,
@ -64,21 +66,21 @@ export class MineInAppNotificationListingDialogComponent extends BaseComponent i
.subscribe(
data => {
this.dialogRef.close();
this.router.navigate(['/mine-notifications/dialog/' + item.id]);
this.router.navigate([this.routerUtils.generateUrl(['/mine-notifications/dialog', item.id.toString()], '/')]);
},
error => {
this.dialogRef.close();
this.router.navigate(['/mine-notifications/dialog/' + item.id]);
this.router.navigate([this.routerUtils.generateUrl(['/mine-notifications/dialog', item.id.toString()], '/')]);
},
);
} else {
this.dialogRef.close();
this.router.navigate(['/mine-notifications/dialog/' + item.id]);
this.router.navigate([this.routerUtils.generateUrl(['/mine-notifications/dialog', item.id.toString()], '/')]);
}
}
goToNotifications() {
this.router.navigate(['/mine-notifications']);
this.router.navigate([this.routerUtils.generateUrl(['/mine-notifications'])]);
this.dialogRef.close();
}