[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); return this.http.get<Array<PluginTemplate>>(api + properties.adminToolsPortalType + '/' + pid + '/pluginTemplates/page/' + pageId);
} }
getPluginsByPageRoute(api:string, pid:string, route:string){ 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){ getPluginTemplatesByPageRoute(api:string, pid:string, route:string){
return this.http.get<Array<PluginTemplate>>(api + 'community/' +pid+'/pluginTemplates/page/route?route=' + route); 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);
togglePlugin(id: string, status: boolean, api: string) {
return this.http.post(api + 'plugin/status/' + id, status, CustomOptions.getAuthOptionsWithBody());
} }
} }

View File

@ -5,6 +5,7 @@ import {EnvProperties} from "../properties/env-properties";
import {Portal} from "../entities/adminTool/portal"; import {Portal} from "../entities/adminTool/portal";
import {Page} from "../entities/adminTool/page"; import {Page} from "../entities/adminTool/page";
import {AdvancedAsyncSubject} from "../AdvancedAsyncSubject"; import {AdvancedAsyncSubject} from "../AdvancedAsyncSubject";
import {properties} from "../../../../environments/environment";
@Injectable({providedIn: 'root'}) @Injectable({providedIn: 'root'})
export class ConfigurationService { export class ConfigurationService {
@ -36,7 +37,7 @@ export class ConfigurationService {
if (pid == null || this.portal?.getValue()?.static) return; if (pid == null || this.portal?.getValue()?.static) return;
let url = properties.adminToolsAPIURL + "/" + properties.adminToolsPortalType + "/" + pid + "/full"; let url = properties.adminToolsAPIURL + "/" + properties.adminToolsPortalType + "/" + pid + "/full";
this.promise = new Promise<void>(resolve => { 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) => { (portal: Portal) => {
this.portal.next(portal); this.portal.next(portal);
resolve(); resolve();

View File

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

View File

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

View File

@ -115,7 +115,7 @@ export let commonDev: EnvProperties = {
loginServiceURL: "http://mpagasas.di.uoa.gr:19080/login-service/", loginServiceURL: "http://mpagasas.di.uoa.gr:19080/login-service/",
cookieDomain: ".di.uoa.gr", cookieDomain: ".di.uoa.gr",
feedbackmail: "kostis30fylloy@gmail.com", 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", monitorServiceAPIURL: "http://duffy.di.uoa.gr:19380/uoa-monitor-service",
adminToolsAPIURL: "http://duffy.di.uoa.gr:19280/uoa-admin-tools/", adminToolsAPIURL: "http://duffy.di.uoa.gr:19280/uoa-admin-tools/",
datasourcesAPI: "https://beta.services.openaire.eu/openaire/ds/api/", datasourcesAPI: "https://beta.services.openaire.eu/openaire/ds/api/",