[Trunk | Library]:

1. configuration.service.ts:
        a. Mark unused methods as "deprecated".
        b. isRouteEnabled.guard.ts --> isPageEnabled() method: Extract page_route from url in service.
2. helper.service.ts:
        a. Mark unused methods as "deprecated".
        b. searchPageTableView.component.ts & searchPage.component.ts & newSearchPage.component.ts & advancedSearchPage.component.ts &
           resultLanding.component.ts & project.component.ts & organization.component.ts & dataProvider.component.ts & htmlProjectReport.component.ts &
           depositFirstPage.component.ts & linkingGeneric.component.ts & displayClaims.component.ts:
                "properties" as first parameter in methods.


git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@58417 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
konstantina.galouni 2020-04-07 11:15:28 +00:00
parent 5a1f545b52
commit a040fc6bdb
15 changed files with 52 additions and 34 deletions

View File

@ -102,7 +102,7 @@ export class DisplayClaimsComponent {
this.piwiksub = this._piwikService.trackView(this.properties, this.title, this.piwikSiteId).subscribe();
}
this.helper.getPageHelpContents(this._router.url, this.properties, this.communityId).subscribe(contents => {
this.helper.getPageHelpContents(this.properties, this.communityId, this._router.url).subscribe(contents => {
this.pageContents = contents;
});
this.indexInfoService.getLastIndexDate(this.properties).subscribe(res => {

View File

@ -71,7 +71,7 @@ export class LinkingGenericComponent {
this.piwiksub = this._piwikService.trackView(this.properties, this.pageTitle, this.piwikSiteId).subscribe();
}
this.helper.getPageHelpContents(this._router.url, this.properties, this.communityId).subscribe(contents => {
this.helper.getPageHelpContents(this.properties, this.communityId, this._router.url).subscribe(contents => {
this.pageContents = contents;
})

View File

@ -241,13 +241,13 @@ export class DepositFirstPageComponent {
}
public getPageContents() {
this.helper.getPageHelpContents(this._router.url, this.properties, this.communityId).subscribe(contents => {
this.helper.getPageHelpContents(this.properties, this.communityId, this._router.url).subscribe(contents => {
this.pageContents = contents;
})
}
public getDivContents() {
this.helper.getDivHelpContents(this._router.url, this.properties, this.communityId).subscribe(contents => {
this.helper.getDivHelpContents(this.properties, this.communityId, this._router.url).subscribe(contents => {
this.divContents = contents;
})
}

View File

@ -42,7 +42,7 @@ export class IsRouteEnabled implements CanActivate {
if (!community) {
community = prop.adminToolsCommunity;
}
return this.config.isPageEnabled(prop, community, '/' + path.split('?')[0].substring(1));
return this.config.isPageEnabled(prop, community, '/' + path);
}),);
obs.pipe(filter(enabled => !enabled))
.subscribe(() => this.router.navigate([redirect], {queryParams: {'page': path}}));

View File

@ -166,13 +166,13 @@ export class DataProviderComponent {
}
private getPageContents() {
this.helper.getPageHelpContents(this._router.url, this.properties, this.communityId).subscribe(contents => {
this.helper.getPageHelpContents(this.properties, this.communityId, this._router.url).subscribe(contents => {
this.pageContents = contents;
})
}
private getDivContents() {
this.helper.getDivHelpContents(this._router.url, this.properties, this.communityId).subscribe(contents => {
this.helper.getDivHelpContents(this.properties, this.communityId, this._router.url).subscribe(contents => {
this.divContents = contents;
})
}

View File

@ -140,13 +140,13 @@ export class HtmlProjectReportComponent {
}
private getPageContents() {
this.helper.getPageHelpContents(this._router.url, this.properties, this.communityId).subscribe(contents => {
this.helper.getPageHelpContents(this.properties, this.communityId, this._router.url).subscribe(contents => {
this.pageContents = contents;
})
}
private getDivContents() {
this.helper.getDivHelpContents(this._router.url, this.properties, this.communityId).subscribe(contents => {
this.helper.getDivHelpContents(this.properties, this.communityId, this._router.url).subscribe(contents => {
this.divContents = contents;
})
}

View File

@ -172,13 +172,13 @@ export class OrganizationComponent {
}
private getPageContents() {
this.helper.getPageHelpContents(this._router.url, this.properties, this.communityId).subscribe(contents => {
this.helper.getPageHelpContents(this.properties, this.communityId, this._router.url).subscribe(contents => {
this.pageContents = contents;
})
}
private getDivContents() {
this.helper.getDivHelpContents(this._router.url, this.properties, this.communityId).subscribe(contents => {
this.helper.getDivHelpContents(this.properties, this.communityId, this._router.url).subscribe(contents => {
this.divContents = contents;
})
}

View File

@ -211,13 +211,13 @@ export class ProjectComponent {
}
private getPageContents() {
this.helper.getPageHelpContents(this._router.url, this.properties, this.communityId).subscribe(contents => {
this.helper.getPageHelpContents(this.properties, this.communityId, this._router.url).subscribe(contents => {
this.pageContents = contents;
})
}
private getDivContents() {
this.helper.getDivHelpContents(this._router.url, this.properties, this.communityId).subscribe(contents => {
this.helper.getDivHelpContents(this.properties, this.communityId, this._router.url).subscribe(contents => {
this.divContents = contents;
})
}

View File

@ -183,13 +183,13 @@ export class ResultLandingComponent {
}
private getPageContents() {
this.helper.getPageHelpContents(this._router.url, this.properties, this.communityId).subscribe(contents => {
this.helper.getPageHelpContents(this.properties, this.communityId, this._router.url).subscribe(contents => {
this.pageContents = contents;
});
}
private getDivContents() {
this.helper.getDivHelpContents(this._router.url, this.properties, this.communityId).subscribe(contents => {
this.helper.getDivHelpContents(this.properties, this.communityId, this._router.url).subscribe(contents => {
this.divContents = contents;
});
}

View File

@ -103,14 +103,14 @@ export class AdvancedSearchPageComponent {
}
private getPageContents() {
this.helper.getPageHelpContents(this.router.url, this.properties, (this.customFilter)?this.customFilter.valueId:null).subscribe(contents => {
this.helper.getPageHelpContents(this.properties, (this.customFilter)?this.customFilter.valueId:null, this.router.url).subscribe(contents => {
this.pageContents = contents;
})
}
private getDivContents() {
this.helper.getDivHelpContents(this.router.url, this.properties, (this.customFilter)?this.customFilter.valueId:null).subscribe(contents => {
this.helper.getDivHelpContents(this.properties, (this.customFilter)?this.customFilter.valueId:null, this.router.url).subscribe(contents => {
this.divContents = contents;
})
}

View File

@ -137,14 +137,14 @@ export class NewSearchPageComponent {
}
private getPageContents() {
this.helper.getPageHelpContents(this.router.url, this.properties, (this.customFilter) ? this.customFilter.valueId : null).subscribe(contents => {
this.helper.getPageHelpContents(this.properties, (this.customFilter) ? this.customFilter.valueId : null, this.router.url).subscribe(contents => {
this.pageContents = contents;
})
}
private getDivContents() {
this.helper.getDivHelpContents(this.router.url, this.properties, (this.customFilter) ? this.customFilter.valueId : null).subscribe(contents => {
this.helper.getDivHelpContents(this.properties, (this.customFilter) ? this.customFilter.valueId : null, this.router.url).subscribe(contents => {
this.divContents = contents;
})
}

View File

@ -119,14 +119,14 @@ export class SearchPageComponent {
}
private getPageContents() {
this.helper.getPageHelpContents(this.router.url, this.properties, (this.customFilter)?this.customFilter.valueId:null).subscribe(contents => {
this.helper.getPageHelpContents(this.properties, (this.customFilter)?this.customFilter.valueId:null, this.router.url).subscribe(contents => {
this.pageContents = contents;
})
}
private getDivContents() {
this.helper.getDivHelpContents(this.router.url, this.properties, (this.customFilter)?this.customFilter.valueId:null).subscribe(contents => {
this.helper.getDivHelpContents(this.properties, (this.customFilter)?this.customFilter.valueId:null, this.router.url).subscribe(contents => {
this.divContents = contents;
})
}

View File

@ -571,7 +571,7 @@ Transform initial - not filtered results to get the filtered number
return filters;
}
private getPageContents() {
this.helper.getPageHelpContents(this.router.url, this.properties, (this.customFilter) ? this.customFilter.valueId : null).subscribe(contents => {
this.helper.getPageHelpContents(this.properties, (this.customFilter) ? this.customFilter.valueId : null, this.router.url).subscribe(contents => {
this.pageContents = contents;
})

View File

@ -20,6 +20,9 @@ export class ConfigurationService {
//.map(res => res.json());
}
/**
* @deprecated
*/
isEntityEnabled(APIUrl:string, community:string,entity: string){
//console.log("isEntityEnabled: "+entity);
let url = "isEntityEnabled-"+entity;
@ -33,28 +36,40 @@ export class ConfigurationService {
}
isPageEnabled(properties:EnvProperties, community:string,router: string){
let url = properties.adminToolsAPIURL + "/community/" + community+"/pages?page_route="+router;
let page_route: string = router.split('?')[0].substring(1);
let url = properties.adminToolsAPIURL + "/community/" + community+"/pages?page_route="+page_route;
return this.http.get((properties.useCache) ? (properties.cacheUrl + encodeURIComponent(url)) : url)
//.map(res => res.json())
.pipe(map(res => {
let result = false;
if(res['length'] >0 && res[0].route == router){
if(res['length'] >0 && res[0].route == page_route){
result = res[0].isEnabled;
}
return result;
}));//.do(res => {console.log("Route "+router +" is "+res)});
}));//.do(res => {console.log("Route "+page_route +" is "+res)});
}
getMainPageContent(APIUrl:string, community:string,){
/**
* @deprecated
*/
getMainPageContent(APIUrl:string, community:string,){
return this.http.get(APIUrl + "/page")
.pipe(map(res => true));
}
getSpecialAnouncementContent(APIUrl:string, community:string,){
/**
* @deprecated
*/
getSpecialAnouncementContent(APIUrl:string, community:string,){
return this.http.get(APIUrl + "/page")
.pipe(map(res => ""));
}
getHelpPageContent(APIUrl:string, community:string, router:string){
/**
* @deprecated
*/
getHelpPageContent(APIUrl:string, community:string, router:string){
return this.http.get(APIUrl + "/page")
.pipe(map(res => true));
}

View File

@ -9,6 +9,9 @@ import{EnvProperties} from '../properties/env-properties';
export class HelperService {
constructor(private http: HttpClient) {}
/**
* @deprecated
*/
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);
@ -27,23 +30,23 @@ export class HelperService {
}
getPageHelpContents(router: string, properties:EnvProperties, communityId:string ):any {
getPageHelpContents(properties:EnvProperties, communityId:string, router: string):any {
if(!communityId) {
communityId = 'openaire';
}
router = router.split('?')[0].substring(0);
let page_route: string = router.split('?')[0].substring(0);
let url = properties.adminToolsAPIURL;
url += '/community/' + communityId + '/pagehelpcontent?active=true&page='+router;
url += '/community/' + communityId + '/pagehelpcontent?active=true&page='+page_route;
return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url);
}
getDivHelpContents(router: string, properties:EnvProperties, communityId:string ):any {
getDivHelpContents(properties:EnvProperties, communityId:string, router: string):any {
if(!communityId) {
communityId = 'openaire';
}
router = router.split('?')[0].substring(0);
let page_route: string = router.split('?')[0].substring(0);
let url = properties.adminToolsAPIURL;
url += '/community/' + communityId + '/divhelpcontent?active=true&page='+router;
url += '/community/' + communityId + '/divhelpcontent?active=true&page='+page_route;
return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url);
}