Revision 51440
Added by Myrto Koukouli about 6 years ago
help-content.service.ts | ||
---|---|---|
5 | 5 |
import { Http, Response } from '@angular/http'; |
6 | 6 |
import { Observable } from 'rxjs/Rx'; |
7 | 7 |
import { Content, PageContent } from "../domain/page-content"; |
8 |
import {helpServiceUrl} from "../domain/tempAPI"; |
|
8 | 9 |
|
9 | 10 |
|
10 | 11 |
@Injectable() |
11 | 12 |
export class HelpContentService { |
12 | 13 |
|
13 | 14 |
private _helpServiceUrl = process.env.FAQ_ENDPOINT; |
15 |
/*private _helpServiceUrl = helpServiceUrl;*/ |
|
14 | 16 |
|
15 | 17 |
constructor (private http: Http) { |
16 | 18 |
} |
17 | 19 |
|
18 |
readonly contents : Content = { |
|
19 |
_id: 'contId', |
|
20 |
page: 'register', |
|
21 |
placement: 'right', |
|
22 |
order: 1, |
|
23 |
content: ` |
|
24 |
<h3>Info / Help</h3><p>The OpenAIRE services provide you with an easy way to register your content provider, literature or data repository, OA Journal into the OpenAIRE network. Please join!</p> |
|
25 |
<p>1) Make your repository, CRIS or journal OpenAIRE compatible by implementing the OpenAIRE<a href="https://guidelines.openaire.eu/en/latest/" target="_blank">Guidelines</a>.</p> |
|
26 |
<p>2) After you have made some progress in implementing the guidelines you should run a Compatibility test using the validator tool.</p> |
|
27 |
<p>3) Register your literature repository in OpenDOAR or your data repositoriy in Re3Data (this step does not apply for journals or CRIS).</p>`, |
|
28 |
isActive: true |
|
29 |
}; |
|
30 |
|
|
31 |
readonly pageContent : PageContent = { |
|
32 |
content : { |
|
33 |
right : [this.contents], |
|
34 |
top : [], |
|
35 |
bottom : [], |
|
36 |
left : [] |
|
37 |
}, |
|
38 |
route : "hello", |
|
39 |
_id : "123", |
|
40 |
name : "123" |
|
41 |
}; |
|
42 |
|
|
43 |
|
|
44 |
|
|
45 | 20 |
cache : any = {}; |
46 | 21 |
|
47 | 22 |
getActivePageContent(route: string) : Observable<PageContent> { |
48 |
// if (!this.cache[route]) { |
|
49 |
// this.cache[route] = this.http.get(this._helpServiceUrl + "/page/route?q=" + route) |
|
50 |
// .map(res => <PageContent> res.json()) |
|
51 |
// .catch(this.handleError) |
|
52 |
// .share(); |
|
53 |
// } |
|
54 |
// return this.cache[route]; |
|
55 |
return Observable.of(this.pageContent).delay(50); |
|
23 |
if (!this.cache[route]) { |
|
24 |
this.cache[route] = this.http.get(this._helpServiceUrl + "/page/route?q=" + route) |
|
25 |
.map(res => <PageContent> res.json()) |
|
26 |
.catch(this.handleError) |
|
27 |
.share(); |
|
28 |
} |
|
29 |
return this.cache[route]; |
|
56 | 30 |
} |
57 | 31 |
|
58 | 32 |
private extractData(res: Response) { |
Also available in: Unified diff
all api methods work!