Add static configuration in configuration service

This commit is contained in:
Konstantinos Triantafyllou 2023-07-13 13:44:19 +03:00
parent 46b3e937bf
commit 8b57fae585
2 changed files with 24 additions and 16 deletions

View File

@ -25,21 +25,27 @@ export class ConfigurationService {
}
}
public initPortal(properties: EnvProperties, pid: string) {
if (pid == null) return;
let url = properties.adminToolsAPIURL + "/" + properties.adminToolsPortalType + "/" + pid + "/full";
this.promise = new Promise<void>((resolve => {
this.sub = this.http.get<Portal>((properties.useLongCache) ? (properties.cacheUrl + encodeURIComponent(url)) : url).subscribe(
(portal: Portal) => {
this.portal.next(portal);
resolve();
},
error => {
this.portal.next(null);
resolve();
});
}));
public initStaticPortal(portal: Portal) {
this.promise = new Promise<void>(resolve => {
this.portal.next(portal);
resolve();
})
}
public initPortal(properties: EnvProperties, pid: string) {
if (pid == null || this.portal?.getValue()?.static) return;
let url = properties.adminToolsAPIURL + "/" + properties.adminToolsPortalType + "/" + pid + "/full";
this.promise = new Promise<void>(resolve => {
this.sub = this.http.get<Portal>((properties.useLongCache) ? (properties.cacheUrl + encodeURIComponent(url)) : url).subscribe(
(portal: Portal) => {
this.portal.next(portal);
resolve();
},
error => {
this.portal.next(null);
resolve();
});
});
}
public get portalAsObservable(): Observable<Portal> {

View File

@ -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 {