From 04ef1ba8cc3947d11389f76808a6c2be08821cc3 Mon Sep 17 00:00:00 2001 From: "argiro.kokogiannaki" Date: Mon, 21 Sep 2020 07:27:19 +0000 Subject: [PATCH] [Library|Trunk] apply in all pages domain and baseLink changes (part 4..) git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@59438 d315682c-612b-4755-9ff5-7f18f6832af3 --- .../claim-utils/claimContextSearchForm.component.ts | 2 +- .../divhelpcontent/div-help-contents.component.ts | 10 +++++----- .../helpTexts/edit-page-help-content.component.ts | 5 +++-- .../helpTexts/new-page-help-content.component.ts | 3 ++- dashboard/helpTexts/page-help-contents.component.ts | 13 +++++++------ login/user.component.ts | 3 ++- login/userMini.component.ts | 3 ++- reload/reload.component.ts | 2 +- 8 files changed, 23 insertions(+), 18 deletions(-) diff --git a/claims/claim-utils/claimContextSearchForm.component.ts b/claims/claim-utils/claimContextSearchForm.component.ts index 4c61a03d..95e3234b 100644 --- a/claims/claim-utils/claimContextSearchForm.component.ts +++ b/claims/claim-utils/claimContextSearchForm.component.ts @@ -362,7 +362,7 @@ export class ClaimContextSearchFormComponent { this.router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, - "redirectUrl": this.properties.domain + this.properties.baseLink + this.router.url + "redirectUrl": this.router.url } }); } diff --git a/dashboard/divhelpcontent/div-help-contents.component.ts b/dashboard/divhelpcontent/div-help-contents.component.ts index 1f17f90d..c9b771cf 100644 --- a/dashboard/divhelpcontent/div-help-contents.component.ts +++ b/dashboard/divhelpcontent/div-help-contents.component.ts @@ -112,7 +112,7 @@ export class DivHelpContentsComponent implements OnInit { this.router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, - "redirectUrl": this.properties.domain + this.properties.baseLink + this.router.url + "redirectUrl": this.router.url } }); } else { @@ -140,7 +140,7 @@ export class DivHelpContentsComponent implements OnInit { this.router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, - "redirectUrl": this.properties.domain + this.properties.baseLink + this.router.url + "redirectUrl": this.router.url } }); } else { @@ -180,7 +180,7 @@ export class DivHelpContentsComponent implements OnInit { this.router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, - "redirectUrl":this.properties.domain + this.properties.baseLink + this.router.url + "redirectUrl": this.router.url } }); } else { @@ -246,7 +246,7 @@ export class DivHelpContentsComponent implements OnInit { this.router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, - "redirectUrl":this.properties.domain + this.properties.baseLink + this.router.url + "redirectUrl": this.router.url } }); } else { @@ -264,7 +264,7 @@ export class DivHelpContentsComponent implements OnInit { this.router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, - "redirectUrl": this.properties.domain + this.properties.baseLink + this.router.url + "redirectUrl": this.router.url } }); } else { diff --git a/dashboard/helpTexts/edit-page-help-content.component.ts b/dashboard/helpTexts/edit-page-help-content.component.ts index 090084fb..911193e1 100644 --- a/dashboard/helpTexts/edit-page-help-content.component.ts +++ b/dashboard/helpTexts/edit-page-help-content.component.ts @@ -10,6 +10,7 @@ import {Session} from '../../login/utils/helper.class'; import {LoginErrorCodes} from '../../login/utils/guardHelper.class'; import {HelperFunctions} from "../../utils/HelperFunctions.class"; import {Page} from "../../utils/entities/adminTool/page"; +import {properties} from "../../../../environments/environment"; @Component({ selector: 'edit-page-help-content', @@ -97,7 +98,7 @@ export class EditPageHelpContentComponent implements OnInit, OnDestroy{ private getPageHelpContent(pageContentId: string) { if(!Session.isLoggedIn()){ - this.router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this.properties.baseLink + this.router.url} }); + this.router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this.router.url} }); } else { this.showLoading = true; this.errorMessage = ""; @@ -127,7 +128,7 @@ export class EditPageHelpContentComponent implements OnInit, OnDestroy{ public saveCustom() { if(!Session.isLoggedIn()){ - this.router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this.properties.baseLink + this.router.url} }); + this.router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this.router.url} }); } else { if(this.formComponent.myForm.valid) { this.showLoading = true; diff --git a/dashboard/helpTexts/new-page-help-content.component.ts b/dashboard/helpTexts/new-page-help-content.component.ts index dea2c7c6..8b2fb4d2 100644 --- a/dashboard/helpTexts/new-page-help-content.component.ts +++ b/dashboard/helpTexts/new-page-help-content.component.ts @@ -9,6 +9,7 @@ import {Session} from '../../login/utils/helper.class'; import {LoginErrorCodes} from '../../login/utils/guardHelper.class'; import {HelperFunctions} from "../../utils/HelperFunctions.class"; import {Page} from "../../utils/entities/adminTool/page"; +import {properties} from "../../../../environments/environment"; @Component({ selector: 'new-page-help-content', @@ -78,7 +79,7 @@ export class NewPageHelpContentComponent { public saveCustom() { if(!Session.isLoggedIn()){ - this.router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this.properties.baseLink + this.router.url} }); + this.router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this.router.url} }); } else { //this.errorMessage = null; diff --git a/dashboard/helpTexts/page-help-contents.component.ts b/dashboard/helpTexts/page-help-contents.component.ts index ea141437..f7a3bf35 100644 --- a/dashboard/helpTexts/page-help-contents.component.ts +++ b/dashboard/helpTexts/page-help-contents.component.ts @@ -14,6 +14,7 @@ import {Session} from '../../login/utils/helper.class'; import {LoginErrorCodes} from '../../login/utils/guardHelper.class'; import {HelperFunctions} from "../../utils/HelperFunctions.class"; import {Subscriber} from "rxjs"; +import {properties} from "../../../../environments/environment"; @Component({ selector: 'page-help-contents', @@ -104,7 +105,7 @@ export class PageHelpContentsComponent implements OnInit { this.router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, - "redirectUrl": this.properties.baseLink + this.router.url + "redirectUrl": this.router.url } }); } else { @@ -132,7 +133,7 @@ export class PageHelpContentsComponent implements OnInit { this.router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, - "redirectUrl": this.properties.baseLink + this.router.url + "redirectUrl": this.router.url } }); } else { @@ -172,7 +173,7 @@ export class PageHelpContentsComponent implements OnInit { this.router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, - "redirectUrl": this.properties.baseLink + this.router.url + "redirectUrl": this.router.url } }); } else { @@ -242,7 +243,7 @@ export class PageHelpContentsComponent implements OnInit { this.router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, - "redirectUrl": this.properties.baseLink + this.router.url + "redirectUrl": this.router.url } }); } else { @@ -260,7 +261,7 @@ export class PageHelpContentsComponent implements OnInit { this.router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, - "redirectUrl": this.properties.baseLink + this.router.url + "redirectUrl": this.router.url } }); } else { @@ -312,7 +313,7 @@ export class PageHelpContentsComponent implements OnInit { this.router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, - "redirectUrl":this.properties.baseLink + this.router.url + "redirectUrl": this.router.url } }); } else { diff --git a/login/user.component.ts b/login/user.component.ts index 50843b28..890eef49 100644 --- a/login/user.component.ts +++ b/login/user.component.ts @@ -7,6 +7,7 @@ import {RouterHelper} from '../utils/routerHelper.class'; import {EnvProperties} from '../utils/properties/env-properties'; import {UserManagementService} from "../services/user-management.service"; +import {properties} from "../../../environments/environment"; @Component({ selector: 'user', @@ -114,7 +115,7 @@ export class UserComponent { queryParams = splits[1]; } } - Session.setReloadUrl(location.protocol + "//" + location.host, baseUrl, queryParams); + Session.setReloadUrl(properties.domain, properties.baseLink + baseUrl, queryParams); } console.log(Session.getReloadUrl()); window.location.href = this.properties.loginUrl; diff --git a/login/userMini.component.ts b/login/userMini.component.ts index 56b75d5c..1ff5ad98 100644 --- a/login/userMini.component.ts +++ b/login/userMini.component.ts @@ -5,6 +5,7 @@ import {User, Session} from './utils/helper.class'; import {RouterHelper} from '../utils/routerHelper.class'; import {StringUtils} from '../utils/string-utils.class'; import {EnvProperties} from '../utils/properties/env-properties'; +import {properties} from "../../../environments/environment"; // declare var logoutClicked; @Component({ @@ -238,7 +239,7 @@ export class UserMiniComponent implements OnInit, OnChanges { } logIn() { - Session.setReloadUrl(location.protocol + "//" + location.host, this.redirectUrl, this.search); + Session.setReloadUrl(properties.domain, properties.baseLink + this.redirectUrl, this.search); window.location.href = this.logInUrl; } diff --git a/reload/reload.component.ts b/reload/reload.component.ts index 8c8b1c16..64aae728 100644 --- a/reload/reload.component.ts +++ b/reload/reload.component.ts @@ -32,7 +32,7 @@ export class ReloadComponent { var paramsObject = ((URL["params"] && URL["params"] != null)? Session.getParamsObj(URL["params"]):null); if(host == (location.protocol+"//"+location.host)){ let baseUrl = (document && document.getElementsByTagName('base'))?document.getElementsByTagName('base')[0].href.split(document.location.host)[1]:"/"; - url = (baseUrl.length>1)?"/"+url.split(baseUrl)[1]:url; + url = (baseUrl.length>1 && url.indexOf(baseUrl)!=-1 )?("/"+url.split(baseUrl)[1]):url; if(paramsObject && paramsObject != null){ Session.setReloadUrl("","","") this._router.navigate([url],{ queryParams: paramsObject});