From bef6dda2c21e5ef4f40352c34ebd2b62d0ad84a6 Mon Sep 17 00:00:00 2001 From: Alex Martzios Date: Tue, 24 Sep 2024 10:52:51 +0300 Subject: [PATCH] [develop | WIP | CHANGED] help-content.service.ts: mark some functions as unused - some moved to different services. TODO: deletion --- services/help-content.service.ts | 80 +++++++------------------------- 1 file changed, 16 insertions(+), 64 deletions(-) diff --git a/services/help-content.service.ts b/services/help-content.service.ts index 53acd273..1b7300b2 100644 --- a/services/help-content.service.ts +++ b/services/help-content.service.ts @@ -54,14 +54,6 @@ export class HelpContentService { .pipe(catchError(this.handleError)); } - // toggleEntity(selectedCommunityId: string, id : string,status : boolean) { - // let headers = new Headers({'Content-Type': 'application/json'}); - // let options = new RequestOptions({headers: headers}); - // - // return this.http.post(helpContentUrl + 'community/'+selectedCommunityId+'/entity/toggle?status='+ status.toString()+'&entityId='+id.toString(), options) - // .catch(this.handleError); - // } - getCommunityEntities(pid: string) { return this.http.get>(properties.adminToolsAPIURL + properties.adminToolsPortalType + '/'+pid+'/entities') .pipe(catchError(this.handleError)); @@ -81,27 +73,8 @@ export class HelpContentService { .pipe(catchError(this.handleError)); } - // getDivIdsFull(page_id: string, helpContentUrl:string, pid: string = null) { - // let parameters: string = ""; - // if(page_id || pid) { - // parameters = "?"; - // if(page_id) { - // parameters += "&page="+page_id; - // } - // if(pid) { - // parameters += "&portal="+pid; - // } - // } - // - // return this.http.get>(helpContentUrl + 'div/full'+parameters) - // //.map(res => > res.json()) - // .pipe(catchError(this.handleError)); - // } - - // Replacing getDivIdsFull getAllDivIdsFull() { return this.http.get>(properties.adminToolsAPIURL + 'div/full') - //.map(res => > res.json()) .pipe(catchError(this.handleError)); } @@ -111,7 +84,6 @@ export class HelpContentService { return this.http.get>(properties.adminToolsAPIURL + properties.adminToolsPortalType + '/'+pid + '/div/full'+parameters) .pipe(catchError(this.handleError)); } - // End of replacing getDivIdsFull // unused getDivId(divId: string, helpContentUrl:string) { @@ -119,6 +91,7 @@ export class HelpContentService { .pipe(catchError(this.handleError)); } + // unused getDivIdFull(divId: string, helpContentUrl:string, pid: string) { return this.http.get(helpContentUrl + properties.adminToolsPortalType + "/" + pid + '/div/'+divId+"/full") .pipe(catchError(this.handleError)); @@ -173,7 +146,6 @@ export class HelpContentService { } toggleDivHelpContents(ids : string[], status : boolean, pid: string) { - return this.http.post(properties.adminToolsAPIURL + properties.adminToolsPortalType + '/' + pid + '/divhelpcontent/toggle?status='+ status.toString(), JSON.stringify(ids), CustomOptions.getAuthOptionsWithBody()) .pipe(catchError(this.handleError)); @@ -196,7 +168,6 @@ export class HelpContentService { } getPageHelpContent(id : string, helpContentUrl:string, pid: string) { return this.http.get(helpContentUrl + properties.adminToolsPortalType + '/' + pid + '/pagehelpcontent/' + id) - //.map(res => res.json()) .pipe(catchError(this.handleError)); } @@ -208,6 +179,7 @@ export class HelpContentService { .pipe(catchError(this.handleError)); } + // unused updatePageHelpContent(pageHelpContent: PageHelpContent, helpContentUrl:string, pid: string) { HelpContentService.removeNulls(pageHelpContent); @@ -216,50 +188,43 @@ export class HelpContentService { .pipe(catchError(this.handleError)); } - deletePageHelpContents(ids : string[], pid: string) { + deletePageHelpContents(ids: string[], pid: string) { return this.http.post(properties.adminToolsAPIURL + properties.adminToolsPortalType + '/' + pid + '/pagehelpcontent/delete', JSON.stringify(ids), CustomOptions.getAuthOptionsWithBody()) .pipe(catchError(this.handleError)); } - togglePageHelpContents(ids : string[],status : boolean, pid: string) { + togglePageHelpContents(ids : string[], status : boolean, pid: string) { return this.http.post(properties.adminToolsAPIURL + properties.adminToolsPortalType + '/' + pid + '/pagehelpcontent/toggle?status='+ status.toString(), JSON.stringify(ids), CustomOptions.getAuthOptionsWithBody()) .pipe(catchError(this.handleError)); } + // unused getCommunityPagesWithDivId(pid: string, helpContentUrl:string) { return this.http.get>(helpContentUrl + properties.adminToolsPortalType + '/'+pid+'/pages?div=true') .pipe(catchError(this.handleError)); } - // getCommunityPages(pid: string, params: string, helpContentUrl:string) { - // return this.http.get>(helpContentUrl + properties.adminToolsPortalType + '/'+pid+'/pages'+params, CustomOptions.getAuthOptions()) - // //.map(res => > res.json()) - // .pipe(catchError(this.handleError)); - // } - getCommunityPagesByRoute(pid: string, route: string) { return this.http.get>(properties.adminToolsAPIURL + properties.adminToolsPortalType + '/'+pid+'/pages' + (route ? '?page_route='+route : '')) .pipe(map(pages => (pages.length>0?pages[0]:null)), catchError(this.handleError)); } - // Replacing getCommunityPages getCommunityPagesByType(pid: string, type: string) { return this.http.get>(properties.adminToolsAPIURL + properties.adminToolsPortalType + '/'+pid+'/pages' + (type ? '?page_type='+type : '')) .pipe(catchError(this.handleError)); } - // End of replacing getCommunityPages - // Replacing part of getPages (now getAllPages) + // unused getCommunityPagesWithPositions(pid: string, helpContentUrl:string) { return this.http.get>(helpContentUrl + properties.adminToolsPortalType + '/'+pid+'/pages?with_positions=true') .pipe(catchError(this.handleError)); } - // End of replacing part of getPages (now getAllPages) -//TODO double check with konstantina - there is no param that we are asking the community pages. without pid we get all portalTypes + + // TODO: double check with konstantina - there is no param that we are asking the community pages. without pid we get all portalTypes getAllPages(pid:string = null) {//with_positions:boolean=null) { // let parameters: string = ""; // if(pid || with_positions == true || with_positions == false) { @@ -278,7 +243,6 @@ export class HelpContentService { getAllPagesFull() { return this.http.get>(properties.adminToolsAPIURL + 'page/full')//+(pid?("?pid="+pid):"")) - //.map(res => > res.json()) .pipe(catchError(this.handleError)); } @@ -286,10 +250,13 @@ export class HelpContentService { return this.http.get(properties.adminToolsAPIURL + properties.adminToolsPortalType + '/' + pid + '/page/'+pageId) .pipe(catchError(this.handleError)); } + getPageById(pageId:string) { return this.http.get(properties.adminToolsAPIURL + 'page/' + pageId) .pipe(catchError(this.handleError)); } + + // unused getCommunityPageByRoute(route:string, helpContentUrl:string, pid: string) { return this.http.get(helpContentUrl + properties.adminToolsPortalType +'/' + pid + '/page/?page_route='+route) .pipe(catchError(this.handleError)); @@ -299,12 +266,10 @@ export class HelpContentService { HelpContentService.removeNulls(page); return this.http.post(properties.adminToolsAPIURL + 'page/save', JSON.stringify(page), CustomOptions.getAuthOptionsWithBody()) - //.map(res => res.json()) .pipe(catchError(this.handleError)); } updatePage(page: Page) { - HelpContentService.removeNulls(page); return this.http.post(properties.adminToolsAPIURL + 'page/update', JSON.stringify(page), CustomOptions.getAuthOptionsWithBody()) @@ -312,14 +277,12 @@ export class HelpContentService { } togglePages(selectedPortalPid: string, ids : string[], status: boolean) { - return this.http.post(properties.adminToolsAPIURL + properties.adminToolsPortalType + '/' + selectedPortalPid + '/page/toggle?status='+ status.toString(), JSON.stringify(ids), CustomOptions.getAuthOptionsWithBody()) .pipe(catchError(this.handleError)); } deletePages(ids : string[]) { - return this.http.post(properties.adminToolsAPIURL + 'page/delete',JSON.stringify(ids), CustomOptions.getAuthOptionsWithBody()) .pipe(catchError(this.handleError)); } @@ -363,7 +326,6 @@ export class HelpContentService { return this.http.post(properties.adminToolsAPIURL + properties.adminToolsPortalType + "/" + portalPid + "/menu/align?alignment=" + alignment, {}, CustomOptions.getAuthOptionsWithBody()) .pipe(catchError(this.handleError)); } - // unused getCommunities( helpContentUrl:string) { @@ -371,11 +333,13 @@ export class HelpContentService { .pipe(catchError(this.handleError)); } + // unused getCommunity(pid: string, helpContentUrl:string) { return this.http.get(helpContentUrl + properties.adminToolsPortalType + '/'+pid) .pipe(catchError(this.handleError)); } + // unused getCommunitiesFull( helpContentUrl:string) { return this.http.get>(helpContentUrl + properties.adminToolsPortalType + '/full') .pipe(catchError(this.handleError)); @@ -383,18 +347,16 @@ export class HelpContentService { getPortalsFull() { return this.http.get>(properties.adminToolsAPIURL + 'portal/full') - //.map(res => > res.json()) .pipe(catchError(this.handleError)); } + + // unused getCommunityFull(portal_pid: string, helpContentUrl:string) { return this.http.get(helpContentUrl + properties.adminToolsPortalType + '/'+portal_pid+'/full') .pipe(catchError(this.handleError)); } saveCommunity(portal: Portal) { - // let headers = new Headers({'Content-Type': 'application/json'}); - // let options = new RequestOptions({headers: headers}); - HelpContentService.removeNulls(portal); return this.http.post(properties.adminToolsAPIURL + portal.type + '/save', JSON.stringify(portal), CustomOptions.getAuthOptionsWithBody()) @@ -402,19 +364,13 @@ export class HelpContentService { } updateCommunity(portal: Portal) { - // let headers = new Headers({'Content-Type': 'application/json'}); - // let options = new RequestOptions({headers: headers}); - HelpContentService.removeNulls(portal); return this.http.post(properties.adminToolsAPIURL + portal.type + '/update', JSON.stringify(portal), CustomOptions.getAuthOptionsWithBody()) - //.map(res => res.json()) .pipe(catchError(this.handleError)); } - deleteCommunities(ids : string[], portalType:string) { - // let headers = new Headers({'Content-Type': 'application/json'}); - // let options = new RequestOptions({headers: headers}); + deleteCommunities(ids: string[], portalType:string) { return this.http.post(properties.adminToolsAPIURL + portalType + '/delete',JSON.stringify(ids), CustomOptions.getAuthOptionsWithBody()) .pipe(catchError(this.handleError)); } @@ -426,10 +382,6 @@ export class HelpContentService { return throwError(error.error || 'Server error'); } - // getDataProviders() { - // return this.http.get('https://beta.services.openaire.eu/search/v2/api/datasources?format=json').map(res => res.json()).map(res => res.results).do(res => {console.log(res)}).catch(this.handleError); - // } - getCommunityStatistics(apiUrl: string, portalId: string): Observable { const url = `${apiUrl}communities/${portalId}`; //console.log(`getting statistics summary from: ${url}`);