[pluginsFunctionality | DONE | CHANGED] add property forceCacheReload, for requests that pass from cache (useLongCache=true) check and pass forceReload parameter, get from cache plugin requests

This commit is contained in:
argirok 2024-03-27 09:29:07 +02:00
parent 7d5b82e0dc
commit 8eba807906
5 changed files with 14 additions and 11 deletions

View File

@ -51,13 +51,11 @@ export class PluginsService {
return this.http.get<Array<PluginTemplate>>(api + properties.adminToolsPortalType + '/' + pid + '/pluginTemplates/page/' + pageId);
}
getPluginsByPageRoute(api:string, pid:string, route:string){
return this.http.get<Array<Plugin>>(api + 'community/' +pid+'/plugins/page/route?route=' + route);
let url = api + 'community/' +pid+'/plugins/page/route?route=' + route;
return this.http.get<Array<Plugin>>((properties.useLongCache) ? (properties.cacheUrl + encodeURIComponent(url) + (properties.forceCacheReload?'&forceReload=true':'')) : url);
}
getPluginTemplatesByPageRoute(api:string, pid:string, route:string){
return this.http.get<Array<PluginTemplate>>(api + 'community/' +pid+'/pluginTemplates/page/route?route=' + route);
}
togglePlugin(id: string, status: boolean, api: string) {
return this.http.post(api + 'plugin/status/' + id, status, CustomOptions.getAuthOptionsWithBody());
let url = api + 'community/' + pid + '/pluginTemplates/page/route?route=' + route;
return this.http.get<Array<PluginTemplate>>((properties.useLongCache) ? (properties.cacheUrl + encodeURIComponent(url) + (properties.forceCacheReload?'&forceReload=true':'')) : url);
}
}

View File

@ -5,6 +5,7 @@ import {EnvProperties} from "../properties/env-properties";
import {Portal} from "../entities/adminTool/portal";
import {Page} from "../entities/adminTool/page";
import {AdvancedAsyncSubject} from "../AdvancedAsyncSubject";
import {properties} from "../../../../environments/environment";
@Injectable({providedIn: 'root'})
export class ConfigurationService {
@ -36,7 +37,7 @@ export class ConfigurationService {
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(
this.sub = this.http.get<Portal>((properties.useLongCache) ? (properties.cacheUrl + encodeURIComponent(url) + (properties.forceCacheReload?'&forceReload=true':'')) : url).subscribe(
(portal: Portal) => {
this.portal.next(portal);
resolve();

View File

@ -4,6 +4,7 @@ import {HttpClient} from "@angular/common/http";
import {EnvProperties} from '../properties/env-properties';
import {of} from "rxjs";
import {properties} from "../../../../environments/environment";
@Injectable()
export class HelperService {
@ -25,7 +26,7 @@ export class HelperService {
}
}
return this.http.get((properties.useLongCache)? (properties.cacheUrl+encodeURIComponent(url)): url);
return this.http.get((properties.useLongCache)? (properties.cacheUrl+encodeURIComponent(url)+ (properties.forceCacheReload?'&forceReload=true':'')): url);
//.map(res => <any> res.json());
}
@ -42,7 +43,7 @@ export class HelperService {
let url = properties.adminToolsAPIURL;
url += '/' + portalType + '/' + portal + '/pagehelpcontent/grouped?active=true&page=' +
((page_route.indexOf("/"+portal+"/")!=-1 ) ? ("/" + page_route.split("/"+portal+"/")[1]) : page_route);
return this.http.get((properties.useLongCache) ? (properties.cacheUrl + encodeURIComponent(url)) : url);
return this.http.get((properties.useLongCache) ? (properties.cacheUrl + encodeURIComponent(url)+ (properties.forceCacheReload?'&forceReload=true':'')) : url);
}else {
return of(null);
}
@ -60,7 +61,7 @@ export class HelperService {
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)): url);
return this.http.get((properties.useLongCache)? (properties.cacheUrl+encodeURIComponent(url)+ (properties.forceCacheReload?'&forceReload=true':'')): url);
}else {
return of(null);
}

View File

@ -156,6 +156,9 @@ export interface EnvProperties {
zenodoDumpUrl?:string;
openOrgsUrl?:string;
orcidDiscoverLinksPage?:string;
//connect dashboards
forceCacheReload?:boolean;
}
export function checkPropertyValues(properties:EnvProperties){

View File

@ -115,7 +115,7 @@ export let commonDev: EnvProperties = {
loginServiceURL: "http://mpagasas.di.uoa.gr:19080/login-service/",
cookieDomain: ".di.uoa.gr",
feedbackmail: "kostis30fylloy@gmail.com",
cacheUrl: "http://dl170.madgik.di.uoa.gr:3000/get?url=",
cacheUrl: "http://scoobydoo.di.uoa.gr:3200/get?url=",
monitorServiceAPIURL: "http://duffy.di.uoa.gr:19380/uoa-monitor-service",
adminToolsAPIURL: "http://duffy.di.uoa.gr:19280/uoa-admin-tools/",
datasourcesAPI: "https://beta.services.openaire.eu/openaire/ds/api/",