[develop]: Add new types in portal types.

This commit is contained in:
Konstantinos Triantafyllou 2024-06-27 15:36:38 +03:00
parent e535934fc2
commit 1747140063
2 changed files with 53 additions and 51 deletions

View File

@ -8,21 +8,22 @@ import {properties} from "../../../../environments/environment";
@Injectable()
export class HelperService {
constructor(private http: HttpClient) {}
constructor(private http: HttpClient) {
}
/**
* @deprecated
*/
getHelper (router: string, position: string, before: boolean, div: string, properties:EnvProperties, communityId:string ):any {
getHelper(router: string, position: string, before: boolean, div: string, properties: EnvProperties, communityId: string): any {
//console.info("get router helpText for : "+router+" - position="+position+" - before="+before + " - div="+div);
let url = properties.adminToolsAPIURL;
if(div) {
url += '/divhelpcontent?active=true&community='+communityId+'&page='+router+'&div=' + div;
if (div) {
url += '/divhelpcontent?active=true&community=' + communityId + '&page=' + router + '&div=' + div;
} else {
url += '/pagehelpcontent?active=true&community='+communityId+'&page='+router+'&position=' + position;
if(before) {
url += '&before='+before;
url += '/pagehelpcontent?active=true&community=' + communityId + '&page=' + router + '&position=' + position;
if (before) {
url += '&before=' + before;
}
}
@ -31,38 +32,38 @@ export class HelperService {
}
getPageHelpContents(properties:EnvProperties, portal:string, router: string, portalType = properties.adminToolsPortalType):any {
if(!portal) {
getPageHelpContents(properties: EnvProperties, portal: string, router: string, portalType = properties.adminToolsPortalType): any {
if (!portal) {
portal = properties.adminToolsCommunity;
}
if(!portal) {
if (!portal) {
portal = 'openaire';
}
if(typeof properties.useHelpTexts == "undefined" || properties.useHelpTexts) {
if (typeof properties.useHelpTexts == "undefined" || properties.useHelpTexts) {
let page_route: string = router.split('?')[0].substring(0);
let url = properties.adminToolsAPIURL;
url += '/' + portalType + '/' + portal + '/pagehelpcontent/grouped?active=true&page=' +
((page_route.indexOf("/"+portal+"/")!=-1 ) ? ("/" + page_route.split("/"+portal+"/")[1]) : page_route);
((page_route.indexOf("/" + portal + "/") != -1) ? ("/" + page_route.split("/" + portal + "/")[1]) : page_route);
return this.http.get(/*(properties.useLongCache) ? (properties.cacheUrl + encodeURIComponent(url)+ (properties.forceCacheReload?'&forceReload=true':'')) :*/ url);
}else {
} else {
return of(null);
}
}
getDivHelpContents(properties:EnvProperties, communityId:string, router: string):any {
if(!communityId) {
getDivHelpContents(properties: EnvProperties, communityId: string, router: string): any {
if (!communityId) {
communityId = properties.adminToolsCommunity;
}
if(!communityId) {
if (!communityId) {
communityId = 'openaire';
}
if(typeof properties.useHelpTexts == "undefined" || properties.useHelpTexts) {
if (typeof properties.useHelpTexts == "undefined" || properties.useHelpTexts) {
let page_route: string = router.split('?')[0].substring(0);
let url = properties.adminToolsAPIURL;
url += '/'+properties.adminToolsPortalType+'/' + communityId + '/divhelpcontent/grouped?active=true&page='+
((page_route.indexOf("/"+communityId+"/")!=-1 ) ? ("/" + page_route.split("/"+communityId+"/")[1]) : page_route);
return this.http.get((properties.useLongCache)? (properties.cacheUrl+encodeURIComponent(url)+ (properties.forceCacheReload?'&forceReload=true':'')): url);
}else {
url += '/' + properties.adminToolsPortalType + '/' + communityId + '/divhelpcontent/grouped?active=true&page=' +
((page_route.indexOf("/" + communityId + "/") != -1) ? ("/" + page_route.split("/" + communityId + "/")[1]) : page_route);
return this.http.get((properties.useLongCache) ? (properties.cacheUrl + encodeURIComponent(url) + (properties.forceCacheReload ? '&forceReload=true' : '')) : url);
} else {
return of(null);
}
}

View File

@ -1,6 +1,7 @@
export type Environment = "development" | "test" | "beta" | "production";
export type Dashboard = "explore" | "connect" | "monitor" | "aggregator" | "eosc" | "developers" | "faircore4eosc" | "irish";
export type PortalType = "explore" | "connect" | "community" | "monitor" | "funder" | "ri" | "project" | "organization" | "aggregator" | "eosc" | "faircore4eosc" | "country";
export type PortalType = "explore" | "connect" | "community" | "monitor" | "funder" | "ri" | "project" | "organization" |
"aggregator" | "eosc" | "faircore4eosc" | "country" | "datasource" | "journal" | "publisher";
export interface EnvProperties {
environment?: Environment;