openaire-library/utils/configuration/configuration.service.ts

58 lines
2.0 KiB
TypeScript

import {Injectable} from '@angular/core';
import {Http, Response, Headers} from '@angular/http';
import {Observable} from 'rxjs/Observable';
import {OpenaireProperties} from '../properties/openaireProperties';
import 'rxjs/add/operator/mapTo';
import 'rxjs/add/observable/of';
// import 'rxjs/add/operator/do';
// import 'rxjs/add/operator/share';
import { mapTo } from 'rxjs/operators';
@Injectable()
export class ConfigurationService {
constructor(private http: Http ) {}
isEntityEnabled(entity: string){
console.log("isEntityEnabled: "+entity);
let url = "isEntityEnabled-"+entity;
// if(entity == "publication" || entity == "dataset" || entity == "datasource"){
// return Observable.of(new Object()).mapTo(false);
// }
// return Observable.of(new Object()).mapTo(true);
return this.http.get("http://duffy.di.uoa.gr:8080/uoa-admin-tools/page")
.map(res => true);
}
isPageEnabled(router: string){
let url = "isPageEnabled-"+router;
// if(router == "search/journals" ){
//
// return Observable.of(new Object()).mapTo(false);
// }
return this.http.get("http://duffy.di.uoa.gr:8080/uoa-admin-tools/page")
.map(res => true);
}
getMainPageContent(){
return this.http.get("http://duffy.di.uoa.gr:8080/uoa-admin-tools/page")
.map(res => true);
}
getSpecialAnouncementContent(){
return this.http.get("http://duffy.di.uoa.gr:8080/uoa-admin-tools/page")
.map(res => "");
}
getHelpPageContent(router:string){
return this.http.get("http://duffy.di.uoa.gr:8080/uoa-admin-tools/page")
.map(res => true);
}
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
console.log(error);
return this.http.get("http://duffy.di.uoa.gr:8080/uoa-admin-tools/page")
.map(res => true);
}
}