Revision 60866
Added by Konstantinos Triantafyllou about 3 years ago
home.component.ts | ||
---|---|---|
27 | 27 |
}) |
28 | 28 |
export class HomeComponent { |
29 | 29 |
public pageTitle = "OpenAIRE - Research Graph"; |
30 |
public publicationsSize: any = null; |
|
31 |
public datasetsSize: any = null; |
|
32 |
public datasetsLinkedSize: any = null; |
|
33 |
public softwareLinkedSize: any = null; |
|
34 |
public softwareSize: any = null; |
|
35 |
public otherSize: any = null; |
|
36 |
public fundersSize: any = null; |
|
37 |
public projectsSize: any = null; |
|
38 |
public datasourcesSize: any = null; |
|
39 | 30 |
public portals: any[] = portals; |
40 | 31 |
public state: number = 0; |
41 | 32 |
public properties: EnvProperties = properties; |
... | ... | |
45 | 36 |
constructor( |
46 | 37 |
private route: ActivatedRoute, |
47 | 38 |
private _router: Router, |
48 |
private _searchResearchResultsService: SearchResearchResultsService, |
|
49 |
private _searchDataprovidersService: SearchDataprovidersService, |
|
50 |
private _searchProjectsService: SearchProjectsService, |
|
51 |
private _searchOrganizationsService: SearchOrganizationsService, |
|
52 |
private _refineFieldResultsService: RefineFieldResultsService, |
|
53 | 39 |
private location: Location, private _piwikService: PiwikService, |
54 | 40 |
private config: ConfigurationService, private _meta: Meta, private _title: Title, private seoService: SEOService |
55 | 41 |
) { |
... | ... | |
70 | 56 |
if (this.properties.enablePiwikTrack && (typeof document !== 'undefined')) { |
71 | 57 |
this.subs.push(this._piwikService.trackView(this.properties, this.pageTitle).subscribe()); |
72 | 58 |
} |
73 |
this.getNumbers(); |
|
74 | 59 |
this.animation(); |
75 | 60 |
} |
76 | 61 |
} |
... | ... | |
105 | 90 |
}); |
106 | 91 |
this.state = 0; |
107 | 92 |
} |
108 |
|
|
109 |
private getNumbers() { |
|
110 |
this.subs.push(this._searchResearchResultsService.numOfSearchResults("publication", "", this.properties).subscribe( |
|
111 |
data => { |
|
112 |
if (data && data > 0) { |
|
113 |
this.publicationsSize = NumberUtils.roundNumber(data); |
|
114 |
|
|
115 |
} |
|
116 |
}, |
|
117 |
err => { |
|
118 |
this.handleError("Error getting number of publications", err); |
|
119 |
} |
|
120 |
)); |
|
121 |
this.subs.push(this._searchResearchResultsService.numOfSearchResults("dataset", "", this.properties).subscribe( |
|
122 |
data => { |
|
123 |
if (data && data > 0) { |
|
124 |
this.datasetsSize = NumberUtils.roundNumber(data); |
|
125 |
} |
|
126 |
}, |
|
127 |
err => { |
|
128 |
//console.log(err); |
|
129 |
this.handleError("Error getting number of research data", err); |
|
130 |
} |
|
131 |
)); |
|
132 |
this.subs.push(this._searchResearchResultsService.numOfSearchResultsLinkedToPub("dataset", this.properties).subscribe( |
|
133 |
data => { |
|
134 |
if (data && data > 0) { |
|
135 |
this.datasetsLinkedSize = NumberUtils.roundNumber(data); |
|
136 |
} |
|
137 |
}, |
|
138 |
err => { |
|
139 |
this.handleError("Error getting number of linkedresearch data", err); |
|
140 |
} |
|
141 |
)); |
|
142 |
this.subs.push(this._searchResearchResultsService.numOfSearchResults("software", "", this.properties).subscribe( |
|
143 |
data => { |
|
144 |
if (data && data > 0) { |
|
145 |
this.softwareSize = NumberUtils.roundNumber(data); |
|
146 |
} |
|
147 |
}, |
|
148 |
err => { |
|
149 |
this.handleError("Error getting number of software data", err); |
|
150 |
} |
|
151 |
)); |
|
152 |
this.subs.push(this._searchResearchResultsService.numOfSearchResultsLinkedToPub("software", this.properties).subscribe( |
|
153 |
data => { |
|
154 |
if (data && data > 0) { |
|
155 |
this.softwareLinkedSize = NumberUtils.roundNumber(data); |
|
156 |
} |
|
157 |
}, |
|
158 |
err => { |
|
159 |
this.handleError("Error getting number of linked software", err); |
|
160 |
} |
|
161 |
)); |
|
162 |
this.subs.push(this._searchResearchResultsService.numOfSearchResults("other", "", this.properties).subscribe( |
|
163 |
data => { |
|
164 |
if (data && data > 0) { |
|
165 |
this.otherSize = NumberUtils.roundNumber(data); |
|
166 |
} |
|
167 |
}, |
|
168 |
err => { |
|
169 |
this.handleError("Error getting number of software data", err); |
|
170 |
} |
|
171 |
)); |
|
172 |
this.subs.push(this._refineFieldResultsService.getRefineFieldsResultsByEntityName(["funder"], "project", this.properties).subscribe( |
|
173 |
data => { |
|
174 |
|
|
175 |
|
|
176 |
if (data[0] && data[0] > 0) { |
|
177 |
this.projectsSize = NumberUtils.roundNumber(data[0]); |
|
178 |
} |
|
179 |
if (data[1].length > 0 && data[1][0].filterId == "funder" && data[1][0].values) { |
|
180 |
this.fundersSize = NumberUtils.roundNumber(data[1][0].values.length); |
|
181 |
} |
|
182 |
|
|
183 |
}, |
|
184 |
err => { |
|
185 |
this.handleError("Error getting 'funder' field results of projects", err); |
|
186 |
}) |
|
187 |
); |
|
188 |
|
|
189 |
this.subs.push(this._searchDataprovidersService.numOfSearchDataproviders("", this.properties).subscribe( |
|
190 |
data => { |
|
191 |
if (data && data > 0) { |
|
192 |
this.datasourcesSize = NumberUtils.roundNumber(data); |
|
193 |
} |
|
194 |
|
|
195 |
}, |
|
196 |
err => { |
|
197 |
this.handleError("Error getting number of content providers", err); |
|
198 |
} |
|
199 |
)); |
|
200 |
} |
|
201 |
|
|
202 |
private handleError(message: string, error) { |
|
203 |
console.error("Home Page: " + message, error); |
|
204 |
} |
|
205 | 93 |
} |
Also available in: Unified diff
[Graph | Trunk]: Create Team and References pages. Change about architecture images