1
|
import {Component} from '@angular/core';
|
2
|
import {Subscription} from 'rxjs';
|
3
|
import {ActivatedRoute, Router} from '@angular/router';
|
4
|
import {Location} from '@angular/common';
|
5
|
import "rxjs/add/observable/zip";
|
6
|
import {Title, Meta} from '@angular/platform-browser';
|
7
|
import {ConfigurationService} from '../openaireLibrary/utils/configuration/configuration.service';
|
8
|
import {SearchDataprovidersService} from '../openaireLibrary/services/searchDataproviders.service';
|
9
|
import {SearchProjectsService} from '../openaireLibrary/services/searchProjects.service';
|
10
|
import {SearchOrganizationsService} from '../openaireLibrary/services/searchOrganizations.service';
|
11
|
import {RefineFieldResultsService} from '../openaireLibrary/services/refineFieldResults.service';
|
12
|
import {NumberUtils} from '../openaireLibrary/utils/number-utils.class';
|
13
|
|
14
|
import {RouterHelper} from '../openaireLibrary/utils/routerHelper.class';
|
15
|
import {EnvProperties} from '../openaireLibrary/utils/properties/env-properties';
|
16
|
import {ErrorCodes} from '../openaireLibrary/utils/properties/errorCodes';
|
17
|
import {PiwikService} from '../openaireLibrary/utils/piwik/piwik.service';
|
18
|
import {SEOService} from '../openaireLibrary/sharedComponents/SEO/SEO.service';
|
19
|
import {SearchResearchResultsService} from "../openaireLibrary/services/searchResearchResults.service";
|
20
|
import {properties} from "../../environments/environment";
|
21
|
import {portals} from "./portals";
|
22
|
|
23
|
@Component({
|
24
|
selector: 'home',
|
25
|
templateUrl: 'home.component.html',
|
26
|
styleUrls: ['home.component.css']
|
27
|
})
|
28
|
export class HomeComponent {
|
29
|
public pageTitle = "OpenAIRE - Research Graph";
|
30
|
public portals: any[] = portals;
|
31
|
public state: number = 0;
|
32
|
public properties: EnvProperties = properties;
|
33
|
private timeouts: any[] = [];
|
34
|
private subs: Subscription[] = [];
|
35
|
|
36
|
constructor(
|
37
|
private route: ActivatedRoute,
|
38
|
private _router: Router,
|
39
|
private location: Location, private _piwikService: PiwikService,
|
40
|
private config: ConfigurationService, private _meta: Meta, private _title: Title, private seoService: SEOService
|
41
|
) {
|
42
|
|
43
|
let description = "OpenAIRE Research Graph is an open resource that aggregates a collection of research data properties (metadata, links) available within the OpenAIRE Open Science infrastructure for funders, organizations, researchers, research communities and publishers to interlink information by using a semantic graph database approach.";
|
44
|
|
45
|
this._title.setTitle(this.pageTitle);
|
46
|
this._meta.updateTag({content: description}, "name='description'");
|
47
|
this._meta.updateTag({content: description}, "property='og:description'");
|
48
|
this._meta.updateTag({content: this.pageTitle}, "property='og:title'");
|
49
|
}
|
50
|
|
51
|
public ngOnInit() {
|
52
|
if (this.properties) {
|
53
|
let url = this.properties.domain + this.properties.baseLink + this._router.url;
|
54
|
this.seoService.createLinkForCanonicalURL(url, false);
|
55
|
this._meta.updateTag({content: url}, "property='og:url'");
|
56
|
if (this.properties.enablePiwikTrack && (typeof document !== 'undefined')) {
|
57
|
this.subs.push(this._piwikService.trackView(this.properties, this.pageTitle).subscribe());
|
58
|
}
|
59
|
this.animation();
|
60
|
}
|
61
|
}
|
62
|
|
63
|
public ngOnDestroy() {
|
64
|
for (let sub of this.subs) {
|
65
|
sub.unsubscribe();
|
66
|
}
|
67
|
this.clearTimeouts();
|
68
|
}
|
69
|
|
70
|
private animation() {
|
71
|
this.timeouts.push(setTimeout(() => {
|
72
|
this.animation();
|
73
|
if (this.state === (this.portals.length -1)) {
|
74
|
this.state = 0
|
75
|
} else {
|
76
|
this.state++;
|
77
|
}
|
78
|
}, 4000));
|
79
|
}
|
80
|
|
81
|
private changeSlide(slide: number) {
|
82
|
this.clearTimeouts();
|
83
|
this.state = slide;
|
84
|
this.animation();
|
85
|
}
|
86
|
|
87
|
private clearTimeouts() {
|
88
|
this.timeouts.forEach(timeout => {
|
89
|
clearTimeout(timeout);
|
90
|
});
|
91
|
this.state = 0;
|
92
|
}
|
93
|
}
|