Add a readme file
remove unused file update services that have POST & DELETE methods in admin tool API with options using authorization headers git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-admin-portal/trunk@53669 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
parent
f4c2cccbf2
commit
3d64e0ebae
|
@ -0,0 +1,14 @@
|
|||
*******Useful project infrmation***********
|
||||
Project has 2 external folders. Check them using
|
||||
svn propget svn:externals ./
|
||||
|
||||
Above command should show the following:
|
||||
./src/app/openaireLibrary https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app
|
||||
./src/assets/common-assets https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/assets
|
||||
|
||||
After initial checkout, you may have to exlude ./src/app/openaireLibrary/app.* files in order the project to run properly.
|
||||
Exclude the files from your local copy, but keep them in the repository.
|
||||
|
||||
Use the following command, to exclude the files:
|
||||
cd ./src/app/openaireLibrary
|
||||
svn update --set-depth exclude ./app.*
|
|
@ -1,6 +0,0 @@
|
|||
// getDataProviders() {
|
||||
// return this.http.get('https://beta.services.openaire.eu/search/v2/api/datasources?format=json')
|
||||
// .map(res => <any> res.json())
|
||||
// .map(res => res.results)
|
||||
// .do(res => {console.log(res)}).catch(this.handleError);
|
||||
// }
|
|
@ -7,6 +7,7 @@ import { Observable } from 'rxjs/Rx';
|
|||
import { Topic } from './../domain/topic';
|
||||
import { Question } from './../domain/question';
|
||||
import { ActiveTopicQuestions } from './../domain/active-topic-questions';
|
||||
import { CustomOptions } from '../openaireLibrary/services/servicesUtils/customOptions.class';
|
||||
|
||||
@Injectable()
|
||||
export class FAQService {
|
||||
|
@ -30,41 +31,32 @@ export class FAQService {
|
|||
}
|
||||
|
||||
saveTopic(topic: Topic) {
|
||||
|
||||
let headers = new Headers({'Content-Type': 'application/json'});
|
||||
let options = new RequestOptions({headers: headers});
|
||||
|
||||
FAQService.removeNulls(topic);
|
||||
|
||||
return this.http.post(this._faqsUrl + 'topic', JSON.stringify(topic), options)
|
||||
return this.http.post(this._faqsUrl + 'topic', JSON.stringify(topic), CustomOptions.getAuthOptionsWithBody())
|
||||
.map(res => <Topic> res.json())
|
||||
.catch(this.handleError);
|
||||
}
|
||||
|
||||
updateTopic(topic: Topic) {
|
||||
let headers = new Headers({'Content-Type': 'application/json'});
|
||||
let options = new RequestOptions({headers: headers});
|
||||
|
||||
FAQService.removeNulls(topic);
|
||||
|
||||
return this.http.put(this._faqsUrl + 'topic', JSON.stringify(topic), options)
|
||||
return this.http.put(this._faqsUrl + 'topic', JSON.stringify(topic), CustomOptions.getAuthOptionsWithBody())
|
||||
.map(res => <Topic> res.json())
|
||||
.catch(this.handleError);
|
||||
}
|
||||
|
||||
deleteTopics(ids : string[]) {
|
||||
let headers = new Headers({'Content-Type': 'application/json'});
|
||||
let options = new RequestOptions({headers: headers});
|
||||
|
||||
return this.http.post(this._faqsUrl + 'topic/delete',JSON.stringify(ids), options)
|
||||
|
||||
return this.http.post(this._faqsUrl + 'topic/delete',JSON.stringify(ids), CustomOptions.getAuthOptionsWithBody())
|
||||
.catch(this.handleError);
|
||||
}
|
||||
|
||||
orderTopic(ids: string[], order: string) {
|
||||
let headers = new Headers({'Content-Type': 'application/json'});
|
||||
let options = new RequestOptions({headers: headers});
|
||||
|
||||
return this.http.post(this._faqsUrl + 'topic/toggle?order='+ order, JSON.stringify(ids), options)
|
||||
return this.http.post(this._faqsUrl + 'topic/toggle?order='+ order, JSON.stringify(ids), CustomOptions.getAuthOptionsWithBody())
|
||||
.map( res => <string[]> res.json())
|
||||
.catch(this.handleError);
|
||||
}
|
||||
|
@ -77,21 +69,17 @@ export class FAQService {
|
|||
|
||||
saveQuestion(question: Question) {
|
||||
|
||||
let headers = new Headers({'Content-Type': 'application/json'});
|
||||
let options = new RequestOptions({headers: headers});
|
||||
|
||||
FAQService.removeNulls(question);
|
||||
|
||||
return this.http.post(this._faqsUrl + 'question', JSON.stringify(question), options)
|
||||
return this.http.post(this._faqsUrl + 'question', JSON.stringify(question), CustomOptions.getAuthOptionsWithBody())
|
||||
.map(res => <Question> res.json())
|
||||
.catch(this.handleError);
|
||||
}
|
||||
|
||||
toggleQuestion(ids : string[],status : boolean) {
|
||||
let headers = new Headers({'Content-Type': 'application/json'});
|
||||
let options = new RequestOptions({headers: headers});
|
||||
|
||||
return this.http.post(this._faqsUrl + 'question/toggle?status='+ status.toString(), JSON.stringify(ids), options)
|
||||
|
||||
return this.http.post(this._faqsUrl + 'question/toggle?status='+ status.toString(), JSON.stringify(ids), CustomOptions.getAuthOptionsWithBody())
|
||||
.map( res => <string[]> res.json())
|
||||
.catch(this.handleError);
|
||||
}
|
||||
|
@ -102,25 +90,11 @@ export class FAQService {
|
|||
}
|
||||
|
||||
deleteQuestions(ids : string[]) {
|
||||
let headers = new Headers({'Content-Type': 'application/json'});
|
||||
let options = new RequestOptions({headers: headers});
|
||||
|
||||
return this.http.post(this._faqsUrl + 'question/delete',JSON.stringify(ids), options)
|
||||
return this.http.post(this._faqsUrl + 'question/delete',JSON.stringify(ids), CustomOptions.getAuthOptionsWithBody())
|
||||
.catch(this.handleError);
|
||||
}
|
||||
|
||||
// getResources() {
|
||||
// return this.http.get(this._resourcesUrl)
|
||||
// .map(res => <ResourcePage> res.json())
|
||||
// .catch(this.handleError);
|
||||
// }
|
||||
//
|
||||
// getResource(resourceType: string, id: string) {
|
||||
// return this.http.get(this._resourcesUrl + resourceType + "/" + id)
|
||||
// .map(res => <Resource> res.json())
|
||||
// .catch(this.handleError);
|
||||
// }
|
||||
|
||||
private handleError(error: Response) {
|
||||
// in a real world app, we may send the error to some remote logging infrastructure
|
||||
// instead of just logging it to the console
|
||||
|
@ -129,4 +103,4 @@ export class FAQService {
|
|||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,6 +12,7 @@ import { DivId } from "../domain/divId";
|
|||
import { DivHelpContent } from "../domain/div-help-content";
|
||||
import {COOKIE} from "../openaireLibrary/login/utils/helper.class"
|
||||
import {StatisticsDisplay, StatisticsSummary} from '../openaireLibrary/connect/statistics/statisticsEntities';
|
||||
import { CustomOptions } from '../openaireLibrary/services/servicesUtils/customOptions.class';
|
||||
|
||||
|
||||
@Injectable()
|
||||
|
@ -41,12 +42,9 @@ export class HelpContentService {
|
|||
}
|
||||
|
||||
updateDivId(divId: DivId, helpContentUrl:string) {
|
||||
let headers = new Headers({'Content-Type': 'application/json'});
|
||||
let options = new RequestOptions({headers: headers});
|
||||
|
||||
HelpContentService.removeNulls(divId);
|
||||
|
||||
return this.http.post(helpContentUrl + 'div/update', JSON.stringify(divId), options)
|
||||
return this.http.post(helpContentUrl + 'div/update', JSON.stringify(divId), CustomOptions.getAuthOptionsWithBody())
|
||||
.map(res => <DivId> res.json())
|
||||
.catch(this.handleError);
|
||||
}
|
||||
|
@ -64,12 +62,9 @@ export class HelpContentService {
|
|||
}
|
||||
|
||||
saveDivId(divId: DivId, helpContentUrl:string) {
|
||||
let headers = new Headers({'Content-Type': 'application/json'});
|
||||
let options = new RequestOptions({headers: headers});
|
||||
|
||||
HelpContentService.removeNulls(divId);
|
||||
|
||||
return this.http.post(helpContentUrl + 'div/save', JSON.stringify(divId), options)
|
||||
return this.http.post(helpContentUrl + 'div/save', JSON.stringify(divId), CustomOptions.getAuthOptionsWithBody())
|
||||
.map(res => <DivId> res.json())
|
||||
.catch(this.handleError);
|
||||
}
|
||||
|
@ -99,38 +94,26 @@ export class HelpContentService {
|
|||
}
|
||||
|
||||
insertOrUpdateDivHelpContent(divHelpContent: DivHelpContent, helpContentUrl:string) {
|
||||
|
||||
let headers = new Headers({'Content-Type': 'application/json'});
|
||||
let options = new RequestOptions({headers: headers});
|
||||
|
||||
HelpContentService.removeNulls(divHelpContent);
|
||||
|
||||
return this.http.post(helpContentUrl + 'divhelpcontent', JSON.stringify(divHelpContent), options)
|
||||
return this.http.post(helpContentUrl + 'divhelpcontent', JSON.stringify(divHelpContent), CustomOptions.getAuthOptionsWithBody())
|
||||
.map(res => <DivHelpContent> res.json())
|
||||
.catch(this.handleError);
|
||||
}
|
||||
|
||||
deleteDivIds(ids : string[], helpContentUrl:string) {
|
||||
let headers = new Headers({'Content-Type': 'application/json'});
|
||||
let options = new RequestOptions({headers: headers});
|
||||
|
||||
return this.http.post(helpContentUrl + 'div/delete',JSON.stringify(ids), options)
|
||||
return this.http.post(helpContentUrl + 'div/delete',JSON.stringify(ids), CustomOptions.getAuthOptionsWithBody())
|
||||
.catch(this.handleError);
|
||||
}
|
||||
|
||||
deleteDivHelpContents(ids : string[], helpContentUrl:string) {
|
||||
let headers = new Headers({'Content-Type': 'application/json'});
|
||||
let options = new RequestOptions({headers: headers});
|
||||
|
||||
return this.http.post(helpContentUrl + 'divhelpcontent/delete',JSON.stringify(ids), options)
|
||||
return this.http.post(helpContentUrl + 'divhelpcontent/delete',JSON.stringify(ids), CustomOptions.getAuthOptionsWithBody())
|
||||
.catch(this.handleError);
|
||||
}
|
||||
|
||||
toggleDivHelpContents(ids : string[],status : boolean, helpContentUrl:string) {
|
||||
let headers = new Headers({'Content-Type': 'application/json'});
|
||||
let options = new RequestOptions({headers: headers});
|
||||
|
||||
return this.http.post(helpContentUrl + 'divhelpcontent/toggle?status='+ status.toString(), JSON.stringify(ids), options)
|
||||
return this.http.post(helpContentUrl + 'divhelpcontent/toggle?status='+ status.toString(), JSON.stringify(ids), CustomOptions.getAuthOptionsWithBody())
|
||||
//.map( res => <string[]> res.json())
|
||||
.catch(this.handleError);
|
||||
}
|
||||
|
@ -183,7 +166,7 @@ export class HelpContentService {
|
|||
|
||||
HelpContentService.removeNulls(community);
|
||||
|
||||
return this.http.post(helpContentUrl + 'community/save', JSON.stringify(community), this.getAuthOptionsWithBody())
|
||||
return this.http.post(helpContentUrl + 'community/save', JSON.stringify(community),CustomOptions.getAuthOptionsWithBody())
|
||||
.map(res => <Community> res.json())
|
||||
.catch(this.handleError);
|
||||
}
|
||||
|
@ -194,7 +177,7 @@ export class HelpContentService {
|
|||
|
||||
HelpContentService.removeNulls(community);
|
||||
|
||||
return this.http.post(helpContentUrl + 'community/update', JSON.stringify(community), this.getAuthOptionsWithBody())
|
||||
return this.http.post(helpContentUrl + 'community/update', JSON.stringify(community), CustomOptions.getAuthOptionsWithBody())
|
||||
.map(res => <Community> res.json())
|
||||
.catch(this.handleError);
|
||||
}
|
||||
|
@ -203,7 +186,7 @@ export class HelpContentService {
|
|||
// let headers = new Headers({'Content-Type': 'application/json'});
|
||||
// let options = new RequestOptions({headers: headers});
|
||||
|
||||
return this.http.post(helpContentUrl + 'community/delete',JSON.stringify(ids), this.getAuthOptionsWithBody())
|
||||
return this.http.post(helpContentUrl + 'community/delete',JSON.stringify(ids), CustomOptions.getAuthOptionsWithBody())
|
||||
.catch(this.handleError);
|
||||
}
|
||||
|
||||
|
@ -227,23 +210,17 @@ export class HelpContentService {
|
|||
|
||||
|
||||
saveEntity(entity: Entity, helpContentUrl:string) {
|
||||
let headers = new Headers({'Content-Type': 'application/json'});
|
||||
let options = new RequestOptions({headers: headers});
|
||||
|
||||
HelpContentService.removeNulls(entity);
|
||||
|
||||
return this.http.post(helpContentUrl + 'entity/save', JSON.stringify(entity), options)
|
||||
return this.http.post(helpContentUrl + 'entity/save', JSON.stringify(entity), CustomOptions.getAuthOptionsWithBody())
|
||||
.map(res => <Entity> res.json())
|
||||
.catch(this.handleError);
|
||||
}
|
||||
|
||||
updateEntity(entity: Entity, helpContentUrl:string) {
|
||||
let headers = new Headers({'Content-Type': 'application/json'});
|
||||
let options = new RequestOptions({headers: headers});
|
||||
|
||||
HelpContentService.removeNulls(entity);
|
||||
|
||||
return this.http.post(helpContentUrl + 'entity/update', JSON.stringify(entity), options)
|
||||
return this.http.post(helpContentUrl + 'entity/update', JSON.stringify(entity), CustomOptions.getAuthOptionsWithBody())
|
||||
.map(res => <Entity> res.json())
|
||||
.catch(this.handleError);
|
||||
}
|
||||
|
@ -257,66 +234,49 @@ export class HelpContentService {
|
|||
// }
|
||||
|
||||
toggleEntities(selectedCommunityPid: string, ids : string[],status : boolean, helpContentUrl:string) {
|
||||
let headers = new Headers({'Content-Type': 'application/json'});
|
||||
let options = new RequestOptions({headers: headers});
|
||||
|
||||
return this.http.post(helpContentUrl +'community/'+selectedCommunityPid+ '/entity/toggle?status='+ status.toString(), JSON.stringify(ids), options)
|
||||
return this.http.post(helpContentUrl +'community/'+selectedCommunityPid+ '/entity/toggle?status='+ status.toString(), JSON.stringify(ids), CustomOptions.getAuthOptionsWithBody())
|
||||
//.map( res => <string[]> res.json())
|
||||
.catch(this.handleError);
|
||||
}
|
||||
|
||||
deleteEntities(ids : string[], helpContentUrl:string) {
|
||||
let headers = new Headers({'Content-Type': 'application/json'});
|
||||
let options = new RequestOptions({headers: headers});
|
||||
|
||||
return this.http.post(helpContentUrl + 'entity/delete',JSON.stringify(ids), options)
|
||||
return this.http.post(helpContentUrl + 'entity/delete',JSON.stringify(ids), CustomOptions.getAuthOptionsWithBody())
|
||||
.catch(this.handleError);
|
||||
}
|
||||
|
||||
|
||||
toggleEntityOfPage(pageId: string, entityId : string,status : boolean, helpContentUrl:string) {
|
||||
let headers = new Headers({'Content-Type': 'application/json'});
|
||||
let options = new RequestOptions({headers: headers});
|
||||
|
||||
return this.http.post(helpContentUrl + 'page/'+pageId+'/entity/toggle?status='+ status.toString()+'&entityId='+entityId.toString(), options)
|
||||
return this.http.post(helpContentUrl + 'page/'+pageId+'/entity/toggle?status='+ status.toString()+'&entityId='+entityId.toString(), CustomOptions.getAuthOptionsWithBody())
|
||||
.catch(this.handleError);
|
||||
}
|
||||
|
||||
savePage(page: Page, helpContentUrl:string) {
|
||||
let headers = new Headers({'Content-Type': 'application/json'});
|
||||
let options = new RequestOptions({headers: headers});
|
||||
HelpContentService.removeNulls(page);
|
||||
|
||||
HelpContentService.removeNulls(page);
|
||||
|
||||
return this.http.post(helpContentUrl + 'page/save', JSON.stringify(page), options)
|
||||
return this.http.post(helpContentUrl + 'page/save', JSON.stringify(page), CustomOptions.getAuthOptionsWithBody())
|
||||
.map(res => <Page> res.json())
|
||||
.catch(this.handleError);
|
||||
}
|
||||
|
||||
updatePage(page: Page, helpContentUrl:string) {
|
||||
let headers = new Headers({'Content-Type': 'application/json'});
|
||||
let options = new RequestOptions({headers: headers});
|
||||
|
||||
HelpContentService.removeNulls(page);
|
||||
|
||||
return this.http.post(helpContentUrl + 'page/update', JSON.stringify(page), options)
|
||||
return this.http.post(helpContentUrl + 'page/update', JSON.stringify(page), CustomOptions.getAuthOptionsWithBody())
|
||||
.map(res => <Page> res.json())
|
||||
.catch(this.handleError);
|
||||
}
|
||||
|
||||
togglePages(selectedCommunityPid: string, ids : string[],status : boolean, helpContentUrl:string) {
|
||||
let headers = new Headers({'Content-Type': 'application/json'});
|
||||
let options = new RequestOptions({headers: headers});
|
||||
|
||||
return this.http.post(helpContentUrl + 'community/'+selectedCommunityPid+'/page/toggle?status='+ status.toString(),JSON.stringify(ids), options)
|
||||
return this.http.post(helpContentUrl + 'community/'+selectedCommunityPid+'/page/toggle?status='+ status.toString(),JSON.stringify(ids), CustomOptions.getAuthOptionsWithBody())
|
||||
.catch(this.handleError);
|
||||
}
|
||||
|
||||
deletePages(ids : string[], helpContentUrl:string) {
|
||||
let headers = new Headers({'Content-Type': 'application/json'});
|
||||
let options = new RequestOptions({headers: headers});
|
||||
|
||||
return this.http.post(helpContentUrl + 'page/delete',JSON.stringify(ids), options)
|
||||
return this.http.post(helpContentUrl + 'page/delete',JSON.stringify(ids), CustomOptions.getAuthOptionsWithBody())
|
||||
.catch(this.handleError);
|
||||
}
|
||||
|
||||
|
@ -339,41 +299,28 @@ export class HelpContentService {
|
|||
}
|
||||
|
||||
savePageHelpContent(pageHelpContent: PageHelpContent, helpContentUrl:string) {
|
||||
|
||||
let headers = new Headers({'Content-Type': 'application/json'});
|
||||
let options = new RequestOptions({headers: headers});
|
||||
|
||||
HelpContentService.removeNulls(pageHelpContent);
|
||||
|
||||
return this.http.post(helpContentUrl + 'pagehelpcontent/save', JSON.stringify(pageHelpContent), options)
|
||||
return this.http.post(helpContentUrl + 'pagehelpcontent/save', JSON.stringify(pageHelpContent), CustomOptions.getAuthOptionsWithBody())
|
||||
.map(res => <PageHelpContent> res.json())
|
||||
.catch(this.handleError);
|
||||
}
|
||||
|
||||
updatePageHelpContent(pageHelpContent: PageHelpContent, helpContentUrl:string) {
|
||||
let headers = new Headers({'Content-Type': 'application/json'});
|
||||
let options = new RequestOptions({headers: headers});
|
||||
|
||||
HelpContentService.removeNulls(pageHelpContent);
|
||||
|
||||
return this.http.post(helpContentUrl + 'pagehelpcontent/update', JSON.stringify(pageHelpContent), options)
|
||||
return this.http.post(helpContentUrl + 'pagehelpcontent/update', JSON.stringify(pageHelpContent), CustomOptions.getAuthOptionsWithBody())
|
||||
.map(res => <PageHelpContent> res.json())
|
||||
.catch(this.handleError);
|
||||
}
|
||||
|
||||
deletePageHelpContents(ids : string[], helpContentUrl:string) {
|
||||
let headers = new Headers({'Content-Type': 'application/json'});
|
||||
let options = new RequestOptions({headers: headers});
|
||||
|
||||
return this.http.post(helpContentUrl + 'pagehelpcontent/delete',JSON.stringify(ids), options)
|
||||
return this.http.post(helpContentUrl + 'pagehelpcontent/delete',JSON.stringify(ids), CustomOptions.getAuthOptionsWithBody())
|
||||
.catch(this.handleError);
|
||||
}
|
||||
|
||||
togglePageHelpContents(ids : string[],status : boolean, helpContentUrl:string) {
|
||||
let headers = new Headers({'Content-Type': 'application/json'});
|
||||
let options = new RequestOptions({headers: headers});
|
||||
|
||||
return this.http.post(helpContentUrl + 'pagehelpcontent/toggle?status='+ status.toString(), JSON.stringify(ids), options)
|
||||
return this.http.post(helpContentUrl + 'pagehelpcontent/toggle?status='+ status.toString(), JSON.stringify(ids), CustomOptions.getAuthOptionsWithBody())
|
||||
//.map( res => <string[]> res.json())
|
||||
.catch(this.handleError);
|
||||
}
|
||||
|
@ -384,17 +331,10 @@ export class HelpContentService {
|
|||
console.error(error);
|
||||
return Observable.throw(error.json().error || 'Server error');
|
||||
}
|
||||
public getAuthOptionsWithBody():RequestOptions{
|
||||
let headers = new Headers();
|
||||
headers.append('Content-Type', 'application/json');
|
||||
headers.append('X-XSRF-TOKEN', COOKIE.getCookie(COOKIE.cookieName_id));
|
||||
let options = new RequestOptions({ headers: headers, withCredentials:true });
|
||||
return options;
|
||||
}
|
||||
|
||||
getDataProviders() {
|
||||
return this.http.get('https://beta.services.openaire.eu/search/v2/api/datasources?format=json').map(res => <any> res.json()).map(res => res.results).do(res => {console.log(res)}).catch(this.handleError);
|
||||
}
|
||||
// getDataProviders() {
|
||||
// return this.http.get('https://beta.services.openaire.eu/search/v2/api/datasources?format=json').map(res => <any> res.json()).map(res => res.results).do(res => {console.log(res)}).catch(this.handleError);
|
||||
// }
|
||||
|
||||
getCommunityStatistics(apiUrl: string, communityId: string): Observable<StatisticsSummary> {
|
||||
const url = `${apiUrl}communities/${communityId}`;
|
||||
|
@ -424,10 +364,7 @@ export class HelpContentService {
|
|||
const url = `${apiUrl}statistics/${communityId}/${entity}/${chartsOrNumbers}?status=${status.toString()}&monitor=${monitor.toString()}`;
|
||||
console.log(`getting admin choices for statistics from: ${url}`);
|
||||
|
||||
const headers = new Headers({'Content-Type': 'application/json'});
|
||||
const options = new RequestOptions({headers: headers});
|
||||
|
||||
return this.http.post(url, title, options)
|
||||
return this.http.post(url, title, CustomOptions.getAuthOptionsWithBody())
|
||||
.map(stats => <any>stats.json())
|
||||
.catch(this.handleError);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue