Revision 60869
Added by Konstantinos Triantafyllou almost 3 years ago
home.component.ts | ||
---|---|---|
2 | 2 |
import {Subscription} from 'rxjs'; |
3 | 3 |
import {ActivatedRoute, Router} from '@angular/router'; |
4 | 4 |
import {Location} from '@angular/common'; |
5 |
import "rxjs/add/observable/zip";
|
|
6 |
import {Title, Meta} from '@angular/platform-browser';
|
|
5 |
import 'rxjs/add/observable/zip';
|
|
6 |
import {Meta, Title} from '@angular/platform-browser';
|
|
7 | 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 | 8 |
import {EnvProperties} from '../openaireLibrary/utils/properties/env-properties'; |
16 |
import {ErrorCodes} from '../openaireLibrary/utils/properties/errorCodes'; |
|
17 | 9 |
import {PiwikService} from '../openaireLibrary/utils/piwik/piwik.service'; |
18 | 10 |
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"; |
|
11 |
import {properties} from '../../environments/environment'; |
|
12 |
import {portals} from './portals'; |
|
13 |
import {Filter} from '../openaireLibrary/searchPages/searchUtils/searchHelperClasses.class'; |
|
14 |
import {RouterHelper} from '../openaireLibrary/utils/routerHelper.class'; |
|
22 | 15 |
|
23 | 16 |
@Component({ |
24 | 17 |
selector: 'home', |
... | ... | |
26 | 19 |
styleUrls: ['home.component.css'] |
27 | 20 |
}) |
28 | 21 |
export class HomeComponent { |
29 |
public pageTitle = "OpenAIRE - Research Graph";
|
|
22 |
public pageTitle = 'OpenAIRE - Research Graph';
|
|
30 | 23 |
public portals: any[] = portals; |
31 | 24 |
public state: number = 0; |
32 | 25 |
public properties: EnvProperties = properties; |
26 |
public selectedEntity = 'all'; |
|
27 |
public url: string; |
|
28 |
public routerHelper: RouterHelper = new RouterHelper(); |
|
29 |
public resultTypes: Filter = { |
|
30 |
values: [ |
|
31 |
{name: 'Publications', id: 'publications', selected: true, number: 0}, |
|
32 |
{name: "Research data", id: "datasets", selected: true, number: 0}, |
|
33 |
{name: "Software", id: "software", selected: true, number: 0}, |
|
34 |
{name: "Other research products", id: "other", selected: true, number: 0} |
|
35 |
], |
|
36 |
filterId: 'type', |
|
37 |
countSelectedValues: 0, |
|
38 |
filterType: 'checkbox', |
|
39 |
originalFilterId: '', |
|
40 |
valueIsExact: true, |
|
41 |
title: 'Result Types', |
|
42 |
filterOperator: 'or' |
|
43 |
}; |
|
44 |
public resultsQuickFilter: { filter: Filter, selected: boolean, filterId: string, value: string } = { |
|
45 |
filter: null, |
|
46 |
selected: true, |
|
47 |
filterId: 'resultbestaccessright', |
|
48 |
value: 'Open Access' |
|
49 |
}; |
|
50 |
public keyword: string = ''; |
|
33 | 51 |
private timeouts: any[] = []; |
34 | 52 |
private subs: Subscription[] = []; |
35 | 53 |
|
... | ... | |
40 | 58 |
private config: ConfigurationService, private _meta: Meta, private _title: Title, private seoService: SEOService |
41 | 59 |
) { |
42 | 60 |
|
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.";
|
|
61 |
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 | 62 |
|
45 | 63 |
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'");
|
|
64 |
this._meta.updateTag({content: description}, 'name=\'description\'');
|
|
65 |
this._meta.updateTag({content: description}, 'property=\'og:description\'');
|
|
66 |
this._meta.updateTag({content: this.pageTitle}, 'property=\'og:title\'');
|
|
49 | 67 |
} |
50 | 68 |
|
51 | 69 |
public ngOnInit() { |
52 | 70 |
if (this.properties) { |
53 | 71 |
let url = this.properties.domain + this.properties.baseLink + this._router.url; |
54 | 72 |
this.seoService.createLinkForCanonicalURL(url, false); |
55 |
this._meta.updateTag({content: url}, "property='og:url'");
|
|
73 |
this._meta.updateTag({content: url}, 'property=\'og:url\'');
|
|
56 | 74 |
if (this.properties.enablePiwikTrack && (typeof document !== 'undefined')) { |
57 | 75 |
this.subs.push(this._piwikService.trackView(this.properties, this.pageTitle).subscribe()); |
58 | 76 |
} |
... | ... | |
70 | 88 |
private animation() { |
71 | 89 |
this.timeouts.push(setTimeout(() => { |
72 | 90 |
this.animation(); |
73 |
if (this.state === (this.portals.length -1)) { |
|
74 |
this.state = 0 |
|
91 |
if (this.state === (this.portals.length - 1)) {
|
|
92 |
this.state = 0;
|
|
75 | 93 |
} else { |
76 | 94 |
this.state++; |
77 | 95 |
} |
78 | 96 |
}, 4000)); |
79 | 97 |
} |
80 | 98 |
|
99 |
entityChanged($event) { |
|
100 |
this.selectedEntity = $event.entity; |
|
101 |
this.url = $event.simpleUrl; |
|
102 |
} |
|
103 |
|
|
81 | 104 |
private changeSlide(slide: number) { |
82 | 105 |
this.clearTimeouts(); |
83 | 106 |
this.state = slide; |
... | ... | |
90 | 113 |
}); |
91 | 114 |
this.state = 0; |
92 | 115 |
} |
116 |
|
|
117 |
goTo() { |
|
118 |
let url = 'https://explore.openaire.eu' + this.url; |
|
119 |
let parameterNames = []; |
|
120 |
let parameterValues = []; |
|
121 |
if (this.selectedEntity == 'result') { |
|
122 |
if (this.resultTypes) { |
|
123 |
let values = []; |
|
124 |
for (let value of this.resultTypes.values) { |
|
125 |
if (value.selected) { |
|
126 |
values.push(value.id); |
|
127 |
} |
|
128 |
} |
|
129 |
if (values.length > 0 && values.length != 4) { |
|
130 |
parameterNames.push('type'); |
|
131 |
parameterValues.push(values.join(',')); |
|
132 |
} |
|
133 |
if (this.resultsQuickFilter) { |
|
134 |
parameterNames.push('qf'); |
|
135 |
parameterValues.push('' + this.resultsQuickFilter.selected); |
|
136 |
} |
|
137 |
} |
|
138 |
} else if (this.selectedEntity == 'all') { |
|
139 |
if (this.resultsQuickFilter) { |
|
140 |
parameterNames.push('qf'); |
|
141 |
parameterValues.push('true'); |
|
142 |
} |
|
143 |
} |
|
144 |
if (this.keyword.length > 0) { |
|
145 |
parameterNames.push('fv0'); |
|
146 |
parameterValues.push(this.keyword); |
|
147 |
parameterNames.push('f0'); |
|
148 |
parameterValues.push('q'); |
|
149 |
} |
|
150 |
window.open(url + this.routerHelper.createQueryParamsString(parameterNames, parameterValues), '_blank').focus(); |
|
151 |
} |
|
93 | 152 |
} |
Also available in: Unified diff
[Graph | Trunk]: Add explore and cases section in home page