From 8b57fae58515adae81210f99fdef27905b9f4e8a Mon Sep 17 00:00:00 2001 From: "k.triantafyllou" Date: Thu, 13 Jul 2023 13:44:19 +0300 Subject: [PATCH] Add static configuration in configuration service --- utils/configuration/configuration.service.ts | 30 ++++++++++++-------- utils/entities/adminTool/portal.ts | 10 ++++--- 2 files changed, 24 insertions(+), 16 deletions(-) diff --git a/utils/configuration/configuration.service.ts b/utils/configuration/configuration.service.ts index b99fb263..6d50c4dc 100644 --- a/utils/configuration/configuration.service.ts +++ b/utils/configuration/configuration.service.ts @@ -24,22 +24,28 @@ export class ConfigurationService { this.sub.unsubscribe(); } } + + public initStaticPortal(portal: Portal) { + this.promise = new Promise(resolve => { + this.portal.next(portal); + resolve(); + }) + } public initPortal(properties: EnvProperties, pid: string) { - if (pid == null) return; + if (pid == null || this.portal?.getValue()?.static) return; let url = properties.adminToolsAPIURL + "/" + properties.adminToolsPortalType + "/" + pid + "/full"; - this.promise = new Promise((resolve => { + this.promise = new Promise(resolve => { this.sub = this.http.get((properties.useLongCache) ? (properties.cacheUrl + encodeURIComponent(url)) : url).subscribe( - (portal: Portal) => { - this.portal.next(portal); - resolve(); - }, - error => { - this.portal.next(null); - resolve(); - }); - })); - + (portal: Portal) => { + this.portal.next(portal); + resolve(); + }, + error => { + this.portal.next(null); + resolve(); + }); + }); } public get portalAsObservable(): Observable { diff --git a/utils/entities/adminTool/portal.ts b/utils/entities/adminTool/portal.ts index 909d8930..5af02b57 100644 --- a/utils/entities/adminTool/portal.ts +++ b/utils/entities/adminTool/portal.ts @@ -10,6 +10,7 @@ export class Portal { twitterAccount: string; entities: string[] | Entity[]; pages: string[] | Page[]; + static: boolean = false; private static getmockPortalInfo():any{ return { @@ -56,7 +57,7 @@ export class Portal { }, { "route": "/search/advanced/services", - "isEnabled": true + "isEnabled": false }, { "route": "/search/advanced/organizations", @@ -83,7 +84,7 @@ export class Portal { }, { "route": "/search/find/services", - "isEnabled": true + "isEnabled": false }, { @@ -174,14 +175,15 @@ export class Portal { }, { "pid": "service", - "isEnabled": true + "isEnabled": false }, { "pid": "orp", "isEnabled": true } ], - };; + "static": true + }; }; public static getMockCommunityInfo(pid: string, disabledEntities:string[],disabledPages:string[]): any {