1 |
57027
|
konstantin
|
import {Component, Input} from '@angular/core';
|
2 |
56091
|
argiro.kok
|
import {ChangeDetectionStrategy} from '@angular/core';
|
3 |
|
|
import {ViewEncapsulation} from '@angular/core';
|
4 |
|
|
import {ActivatedRoute, Router} from '@angular/router';
|
5 |
|
|
import {Location} from '@angular/common';
|
6 |
|
|
import {Title, Meta} from '@angular/platform-browser';
|
7 |
50169
|
argiro.kok
|
|
8 |
57027
|
konstantin
|
import {FetchResearchResults} from '../../utils/fetchEntitiesClasses/fetchResearchResults.class';
|
9 |
56091
|
argiro.kok
|
import {FetchDataproviders} from '../../utils/fetchEntitiesClasses/fetchDataproviders.class';
|
10 |
|
|
import {FetchProjects} from '../../utils/fetchEntitiesClasses/fetchProjects.class';
|
11 |
|
|
import {FetchOrganizations} from '../../utils/fetchEntitiesClasses/fetchOrganizations.class';
|
12 |
50169
|
argiro.kok
|
|
13 |
57027
|
konstantin
|
import {SearchResearchResultsService} from '../../services/searchResearchResults.service';
|
14 |
56091
|
argiro.kok
|
import {SearchDataprovidersService} from '../../services/searchDataproviders.service';
|
15 |
|
|
import {SearchProjectsService} from '../../services/searchProjects.service';
|
16 |
|
|
import {SearchOrganizationsService} from '../../services/searchOrganizations.service';
|
17 |
50169
|
argiro.kok
|
|
18 |
57027
|
konstantin
|
import {SearchFields} from '../../utils/properties/searchFields';
|
19 |
56091
|
argiro.kok
|
import {ErrorCodes} from '../../utils/properties/errorCodes';
|
20 |
|
|
import {RouterHelper} from '../../utils/routerHelper.class';
|
21 |
|
|
import {RefineFieldResultsService} from '../../services/refineFieldResults.service';
|
22 |
|
|
import {PiwikService} from '../../utils/piwik/piwik.service';
|
23 |
|
|
import {ConfigurationService} from '../../utils/configuration/configuration.service';
|
24 |
|
|
import {EnvProperties} from '../../utils/properties/env-properties';
|
25 |
|
|
import {SEOService} from '../../sharedComponents/SEO/SEO.service';
|
26 |
|
|
import {StringUtils} from '../../utils/string-utils.class';
|
27 |
56059
|
argiro.kok
|
import {SearchCustomFilter} from "../searchUtils/searchUtils.class";
|
28 |
58275
|
k.triantaf
|
import {Observable, Subscription} from "rxjs";
|
29 |
50169
|
argiro.kok
|
|
30 |
|
|
@Component({
|
31 |
|
|
changeDetection: ChangeDetectionStrategy.Default,
|
32 |
|
|
encapsulation: ViewEncapsulation.Emulated,
|
33 |
56091
|
argiro.kok
|
selector: 'search-find',
|
34 |
|
|
templateUrl: 'search.component.html'
|
35 |
50169
|
argiro.kok
|
})
|
36 |
|
|
export class SearchComponent {
|
37 |
59074
|
konstantin
|
subs: Subscription[] = [];
|
38 |
|
|
|
39 |
50169
|
argiro.kok
|
public reloadPublications: boolean;
|
40 |
|
|
public reloadDatasets: boolean;
|
41 |
|
|
public reloadSoftware: boolean;
|
42 |
52816
|
konstantin
|
public reloadOrps: boolean;
|
43 |
50169
|
argiro.kok
|
public reloadProjects: boolean;
|
44 |
|
|
public reloadDataproviders: boolean;
|
45 |
|
|
public reloadOrganizations: boolean;
|
46 |
|
|
|
47 |
|
|
|
48 |
|
|
public pageTitle = "Search in OpenAIRE"
|
49 |
56091
|
argiro.kok
|
public keyword: string = "";
|
50 |
|
|
public publications: string[];
|
51 |
|
|
public datasets: string[];
|
52 |
|
|
public software: string[];
|
53 |
|
|
public orps: string[];
|
54 |
|
|
public projectsTab: string[];
|
55 |
|
|
public dataproviders: string[];
|
56 |
|
|
public organizations: string[];
|
57 |
50169
|
argiro.kok
|
|
58 |
|
|
public activeTab = "publications";
|
59 |
|
|
public linkToSearchPublications = "";
|
60 |
|
|
public linkToSearchProjects = "";
|
61 |
|
|
public linkToSearchDataproviders = "";
|
62 |
|
|
public linkToSearchDatasets = "";
|
63 |
|
|
public linkToSearchSoftware = "";
|
64 |
52816
|
konstantin
|
public linkToSearchOrps = "";
|
65 |
50169
|
argiro.kok
|
public linkToSearchOrganizations = "";
|
66 |
|
|
|
67 |
57027
|
konstantin
|
public fetchPublications: FetchResearchResults;
|
68 |
56091
|
argiro.kok
|
public fetchDataproviders: FetchDataproviders;
|
69 |
|
|
public fetchProjects: FetchProjects;
|
70 |
57027
|
konstantin
|
public fetchDatasets: FetchResearchResults;
|
71 |
|
|
public fetchSoftware: FetchResearchResults;
|
72 |
|
|
public fetchOrps: FetchResearchResults;
|
73 |
50169
|
argiro.kok
|
public fetchOrganizations: FetchOrganizations;
|
74 |
|
|
|
75 |
56091
|
argiro.kok
|
public searchFields: SearchFields = new SearchFields();
|
76 |
|
|
public errorCodes: ErrorCodes = new ErrorCodes();
|
77 |
|
|
public routerHelper: RouterHelper = new RouterHelper();
|
78 |
50169
|
argiro.kok
|
|
79 |
56091
|
argiro.kok
|
public publicationsSize: any = null;
|
80 |
|
|
public datasetsSize: any = null;
|
81 |
|
|
public softwareSize: any = null;
|
82 |
|
|
public oprsSize: any = null;
|
83 |
|
|
public fundersSize: any = null;
|
84 |
|
|
public projectsSize: any = null;
|
85 |
|
|
public datasourcesSize: any = null;
|
86 |
|
|
showPublications: boolean = false;
|
87 |
|
|
showDatasets: boolean = false;
|
88 |
|
|
showSoftware: boolean = false;
|
89 |
|
|
showOrps: boolean = false;
|
90 |
|
|
showProjects: boolean = false;
|
91 |
|
|
showDataProviders: boolean = false;
|
92 |
|
|
showOrganizations: boolean = false;
|
93 |
|
|
advancedSearchLink: string = "/search/advanced/publications";
|
94 |
50586
|
argiro.kok
|
properties: EnvProperties;
|
95 |
53724
|
argiro.kok
|
@Input() logoURL;
|
96 |
|
|
@Input() name;
|
97 |
56091
|
argiro.kok
|
@Input() customFilter: SearchCustomFilter = null;
|
98 |
53860
|
argiro.kok
|
@Input() piwikSiteId = null;
|
99 |
58697
|
argiro.kok
|
@Input() formPlaceholderText = "Search for research outcomes, projects, content providers & organizations in OpenAIRE";
|
100 |
53740
|
argiro.kok
|
|
101 |
56091
|
argiro.kok
|
constructor(private route: ActivatedRoute,
|
102 |
|
|
private _router: Router,
|
103 |
57027
|
konstantin
|
private _searchResearchResultsService: SearchResearchResultsService,
|
104 |
56091
|
argiro.kok
|
private _searchDataprovidersService: SearchDataprovidersService,
|
105 |
|
|
private _searchProjectsService: SearchProjectsService,
|
106 |
|
|
private _searchOrganizationsService: SearchOrganizationsService,
|
107 |
|
|
private _refineFieldResultsService: RefineFieldResultsService,
|
108 |
|
|
private location: Location,
|
109 |
|
|
private _meta: Meta,
|
110 |
|
|
private _title: Title,
|
111 |
|
|
private _piwikService: PiwikService,
|
112 |
|
|
private config: ConfigurationService,
|
113 |
|
|
private seoService: SEOService) {
|
114 |
57027
|
konstantin
|
this.fetchPublications = new FetchResearchResults(this._searchResearchResultsService);
|
115 |
56091
|
argiro.kok
|
this.fetchDataproviders = new FetchDataproviders(this._searchDataprovidersService);
|
116 |
|
|
this.fetchProjects = new FetchProjects(this._searchProjectsService);
|
117 |
57027
|
konstantin
|
this.fetchDatasets = new FetchResearchResults(this._searchResearchResultsService);
|
118 |
|
|
this.fetchSoftware = new FetchResearchResults(this._searchResearchResultsService);
|
119 |
|
|
this.fetchOrps = new FetchResearchResults(this._searchResearchResultsService);
|
120 |
56091
|
argiro.kok
|
this.fetchOrganizations = new FetchOrganizations(this._searchOrganizationsService);
|
121 |
|
|
|
122 |
50169
|
argiro.kok
|
}
|
123 |
|
|
|
124 |
|
|
public ngOnInit() {
|
125 |
59074
|
konstantin
|
this.subs.push(this.route.data
|
126 |
50586
|
argiro.kok
|
.subscribe((data: { envSpecific: EnvProperties }) => {
|
127 |
50169
|
argiro.kok
|
|
128 |
50586
|
argiro.kok
|
var description = "open access, research, scientific publication, European Commission, EC, FP7, ERC, Horizon 2020, H2020, search, projects ";
|
129 |
|
|
var title = "OpenAIRE | Search publications, research data, projects... | OpenAIRE";
|
130 |
|
|
this.properties = data.envSpecific;
|
131 |
56091
|
argiro.kok
|
var url = data.envSpecific.baseLink + this._router.url;
|
132 |
51835
|
sofia.balt
|
this._title.setTitle(title);
|
133 |
56091
|
argiro.kok
|
this._meta.updateTag({content: description}, "name='description'");
|
134 |
|
|
this._meta.updateTag({content: description}, "property='og:description'");
|
135 |
|
|
this._meta.updateTag({content: title}, "property='og:title'");
|
136 |
|
|
this._meta.updateTag({content: url}, "property='og:url'");
|
137 |
|
|
this.seoService.createLinkForCanonicalURL(this.properties.baseLink + this._router.url, false);
|
138 |
|
|
if (this.properties.enablePiwikTrack && (typeof document !== 'undefined')) {
|
139 |
59074
|
konstantin
|
this.subs.push(this._piwikService.trackView(this.properties, "OpenAIRE |Search publications, research data, projects...", this.piwikSiteId).subscribe());
|
140 |
50586
|
argiro.kok
|
|
141 |
|
|
}
|
142 |
|
|
|
143 |
|
|
|
144 |
58391
|
argiro.kok
|
if ((this.customFilter && this.customFilter.queryFieldName == "communityId") || this.properties.adminToolsCommunity) {
|
145 |
59074
|
konstantin
|
//this.subs.push(this.config.getCommunityInformation(this.properties, (this.customFilter && this.customFilter.queryFieldName == "communityId") ? this.customFilter.valueId : this.properties.adminToolsCommunity).subscribe(data => {
|
146 |
|
|
this.subs.push(this.config.communityInformationState.subscribe(data => {
|
147 |
|
|
if(data) {
|
148 |
|
|
var showEntity = {};
|
149 |
|
|
for (var i = 0; i < data['entities'].length; i++) {
|
150 |
50586
|
argiro.kok
|
|
151 |
59074
|
konstantin
|
showEntity["" + data['entities'][i]["pid"] + ""] = data['entities'][i]["isEnabled"];
|
152 |
|
|
}
|
153 |
|
|
this.showPublications = showEntity["publication"];
|
154 |
|
|
this.showDatasets = showEntity["dataset"];
|
155 |
|
|
this.showProjects = showEntity["project"];
|
156 |
|
|
this.showOrganizations = showEntity["organization"];
|
157 |
|
|
this.showDataProviders = showEntity["datasource"];
|
158 |
|
|
this.showSoftware = showEntity["software"];
|
159 |
|
|
this.showOrps = showEntity["orp"];
|
160 |
|
|
if (this.customFilter && this.customFilter.queryFieldName == "communityId") {
|
161 |
|
|
this.showProjects = false;
|
162 |
|
|
this.showOrganizations = false;
|
163 |
|
|
this.showDataProviders = false;
|
164 |
|
|
}
|
165 |
|
|
this.loadAll();
|
166 |
56091
|
argiro.kok
|
}
|
167 |
59074
|
konstantin
|
}));
|
168 |
56091
|
argiro.kok
|
} else {
|
169 |
|
|
if ((this.customFilter && this.customFilter.queryFieldName == "country")) {
|
170 |
|
|
this.showPublications =true;
|
171 |
|
|
this.showDatasets = true;
|
172 |
|
|
this.showDataProviders = true;
|
173 |
|
|
this.showSoftware = true;
|
174 |
|
|
this.showOrps = true;
|
175 |
|
|
this.showProjects = true;
|
176 |
|
|
this.showOrganizations = true;
|
177 |
|
|
this.showDataProviders = true;
|
178 |
50169
|
argiro.kok
|
}
|
179 |
56059
|
argiro.kok
|
}
|
180 |
56091
|
argiro.kok
|
this.loadAll();
|
181 |
59074
|
konstantin
|
}));
|
182 |
56091
|
argiro.kok
|
}
|
183 |
52816
|
konstantin
|
|
184 |
56091
|
argiro.kok
|
loadAll() {
|
185 |
59074
|
konstantin
|
this.subs.push(this.route.queryParams.subscribe(params => {
|
186 |
50586
|
argiro.kok
|
|
187 |
56091
|
argiro.kok
|
this.reloadTabs();
|
188 |
|
|
this.keyword = (params['keyword']) ? params['keyword'] : "";
|
189 |
|
|
if (this.keyword != null && this.keyword.length > 0) {
|
190 |
|
|
//if showPublications == false will setValues another entity as the first
|
191 |
|
|
if (this.showPublications) {
|
192 |
|
|
this.activeTab = "publications";
|
193 |
|
|
this.searchPublications();
|
194 |
|
|
} else if (this.showDatasets) {
|
195 |
|
|
this.activeTab = "research data";
|
196 |
|
|
this.searchDatasets();
|
197 |
|
|
} else if (this.showSoftware) {
|
198 |
|
|
this.activeTab = "software";
|
199 |
|
|
this.searchSoftware();
|
200 |
|
|
} else if (this.showOrps) {
|
201 |
|
|
this.activeTab = "other research products";
|
202 |
|
|
this.searchOrps();
|
203 |
|
|
} else if (this.showProjects) {
|
204 |
|
|
this.activeTab = "projects";
|
205 |
|
|
this.searchProjects();
|
206 |
|
|
} else if (this.showDataProviders) {
|
207 |
|
|
this.activeTab = "content providers";
|
208 |
|
|
this.searchDataProviders();
|
209 |
|
|
} else if (this.showOrganizations) {
|
210 |
|
|
this.activeTab = "organizations";
|
211 |
|
|
this.searchOrganizations();
|
212 |
|
|
}
|
213 |
|
|
this.count();
|
214 |
50586
|
argiro.kok
|
}
|
215 |
59074
|
konstantin
|
}));
|
216 |
56091
|
argiro.kok
|
}
|
217 |
50169
|
argiro.kok
|
|
218 |
50586
|
argiro.kok
|
|
219 |
50169
|
argiro.kok
|
public ngOnDestroy() {
|
220 |
59074
|
konstantin
|
for (let sub of this.subs) {
|
221 |
|
|
sub.unsubscribe();
|
222 |
53026
|
argiro.kok
|
}
|
223 |
50169
|
argiro.kok
|
}
|
224 |
56091
|
argiro.kok
|
|
225 |
50169
|
argiro.kok
|
public searchPublications() {
|
226 |
|
|
this.activeTab = "publications";
|
227 |
57084
|
konstantin
|
this.advancedSearchLink = this.properties.searchLinkToAdvancedPublications;//"/search/advanced/publications";
|
228 |
56091
|
argiro.kok
|
if (this.reloadPublications &&
|
229 |
|
|
this.fetchPublications.searchUtils.status != this.errorCodes.NONE /*&&
|
230 |
57200
|
konstantin
|
this.fetchPublications.searchUtils.status != this.errorCodes.ERROR*/
|
231 |
|
|
&& (this.keyword != null && this.keyword.length > 0)) {
|
232 |
50169
|
argiro.kok
|
this.reloadPublications = false;
|
233 |
57027
|
konstantin
|
this.fetchPublications.getResultsByKeyword("publication", this.keyword, 1, 10, this.properties, this.customFilter);
|
234 |
50586
|
argiro.kok
|
this.linkToSearchPublications = this.properties.searchLinkToPublications;// + "?keyword=" + this.keyword;
|
235 |
50169
|
argiro.kok
|
}
|
236 |
56091
|
argiro.kok
|
}
|
237 |
|
|
|
238 |
|
|
public searchDatasets() {
|
239 |
|
|
this.activeTab = "research data";
|
240 |
57084
|
konstantin
|
this.advancedSearchLink = this.properties.searchLinkToAdvancedDatasets;//"/search/advanced/datasets";
|
241 |
56091
|
argiro.kok
|
if (this.reloadDatasets &&
|
242 |
|
|
this.fetchDatasets.searchUtils.status != this.errorCodes.NONE /*&&
|
243 |
57200
|
konstantin
|
this.fetchDatasets.searchUtils.status != this.errorCodes.ERROR*/
|
244 |
|
|
&& (this.keyword != null && this.keyword.length > 0)) {
|
245 |
56091
|
argiro.kok
|
this.reloadDatasets = false;
|
246 |
57027
|
konstantin
|
this.fetchDatasets.getResultsByKeyword("dataset", this.keyword, 1, 10, this.properties, this.customFilter);
|
247 |
56091
|
argiro.kok
|
this.linkToSearchDatasets = this.properties.searchLinkToDatasets;// + "?keyword=" + this.keyword;
|
248 |
|
|
}
|
249 |
|
|
}
|
250 |
52816
|
konstantin
|
|
251 |
56091
|
argiro.kok
|
public searchSoftware() {
|
252 |
|
|
|
253 |
|
|
this.activeTab = "software";
|
254 |
57084
|
konstantin
|
this.advancedSearchLink = this.properties.searchLinkToAdvancedSoftware;//"/search/advanced/software";
|
255 |
56091
|
argiro.kok
|
if (this.reloadSoftware
|
256 |
|
|
&& this.fetchSoftware.searchUtils.status != this.errorCodes.NONE/* &&
|
257 |
50169
|
argiro.kok
|
( this.fetchSoftware.searchUtils.status == this.errorCodes.LOADING ||
|
258 |
57200
|
konstantin
|
this.fetchSoftware.searchUtils.status == this.errorCodes.DONE )*/
|
259 |
|
|
&& (this.keyword != null && this.keyword.length > 0)) {
|
260 |
56091
|
argiro.kok
|
this.reloadSoftware = false;
|
261 |
57027
|
konstantin
|
this.fetchSoftware.getResultsByKeyword("software", this.keyword, 1, 10, this.properties, this.customFilter);
|
262 |
56091
|
argiro.kok
|
this.linkToSearchSoftware = this.properties.searchLinkToSoftware;// + "?keyword=" + this.keyword;
|
263 |
|
|
}
|
264 |
|
|
}
|
265 |
|
|
|
266 |
|
|
public searchOrps() {
|
267 |
|
|
this.activeTab = "other research products";
|
268 |
57084
|
konstantin
|
this.advancedSearchLink = this.properties.searchLinkToAdvancedOrps;//"/search/advanced/other";
|
269 |
56091
|
argiro.kok
|
if (this.reloadOrps &&
|
270 |
|
|
this.fetchOrps.searchUtils.status != this.errorCodes.NONE /*&&
|
271 |
57200
|
konstantin
|
this.fetchOrps.searchUtils.status != this.errorCodes.ERROR*/
|
272 |
|
|
&& (this.keyword != null && this.keyword.length > 0)) {
|
273 |
56091
|
argiro.kok
|
this.reloadOrps = false;
|
274 |
57027
|
konstantin
|
this.fetchOrps.getResultsByKeyword("other", this.keyword, 1, 10, this.properties, this.customFilter);
|
275 |
56091
|
argiro.kok
|
this.linkToSearchOrps = this.properties.searchLinkToOrps;
|
276 |
|
|
}
|
277 |
|
|
}
|
278 |
|
|
|
279 |
|
|
public searchProjects() {
|
280 |
|
|
this.activeTab = "projects";
|
281 |
57084
|
konstantin
|
this.advancedSearchLink = this.properties.searchLinkToAdvancedProjects;//"/search/advanced/projects";
|
282 |
56091
|
argiro.kok
|
if (this.reloadProjects &&
|
283 |
|
|
this.fetchProjects.searchUtils.status != this.errorCodes.NONE /*&&
|
284 |
57200
|
konstantin
|
this.fetchProjects.searchUtils.status != this.errorCodes.ERROR*/
|
285 |
|
|
&& (this.keyword != null && this.keyword.length > 0)) {
|
286 |
56091
|
argiro.kok
|
this.reloadProjects = false;
|
287 |
|
|
this.fetchProjects.getResultsByKeyword(this.keyword, 1, 10, this.properties, this.customFilter);
|
288 |
|
|
this.linkToSearchProjects = this.properties.searchLinkToProjects;// + "?keyword=" + this.keyword;
|
289 |
|
|
}
|
290 |
|
|
}
|
291 |
|
|
|
292 |
|
|
public searchDataProviders() {
|
293 |
|
|
this.activeTab = "content providers";
|
294 |
57084
|
konstantin
|
this.advancedSearchLink = this.properties.searchLinkToAdvancedDataProviders;//"/search/advanced/dataproviders";
|
295 |
56091
|
argiro.kok
|
if (this.reloadDataproviders &&
|
296 |
|
|
this.fetchDataproviders.searchUtils.status != this.errorCodes.NONE /*&&
|
297 |
57200
|
konstantin
|
this.fetchDataproviders.searchUtils.status != this.errorCodes.ERROR*/
|
298 |
|
|
&& (this.keyword != null && this.keyword.length > 0)) {
|
299 |
56091
|
argiro.kok
|
this.reloadDataproviders = false;
|
300 |
|
|
this.fetchDataproviders.getResultsByKeyword(this.keyword, 1, 10, this.properties, this.customFilter);
|
301 |
|
|
this.linkToSearchDataproviders = this.properties.searchLinkToDataProviders;// + "?keyword=" + this.keyword;
|
302 |
|
|
}
|
303 |
|
|
}
|
304 |
|
|
|
305 |
|
|
public searchOrganizations() {
|
306 |
|
|
this.activeTab = "organizations";
|
307 |
57084
|
konstantin
|
this.advancedSearchLink = this.properties.searchLinkToAdvancedOrganizations;//"/search/advanced/organizations";
|
308 |
56091
|
argiro.kok
|
if (this.reloadOrganizations &&
|
309 |
|
|
this.fetchOrganizations.searchUtils.status != this.errorCodes.NONE /*&&
|
310 |
57200
|
konstantin
|
this.fetchOrganizations.searchUtils.status != this.errorCodes.ERROR*/
|
311 |
|
|
&& (this.keyword != null && this.keyword.length > 0)) {
|
312 |
56091
|
argiro.kok
|
this.reloadOrganizations = false;
|
313 |
|
|
this.fetchOrganizations.getResultsByKeyword(this.keyword, 1, 10, this.properties, this.customFilter);
|
314 |
|
|
this.linkToSearchOrganizations = this.properties.searchLinkToOrganizations;// + "?keyword=" + this.keyword;
|
315 |
|
|
}
|
316 |
|
|
}
|
317 |
50169
|
argiro.kok
|
|
318 |
|
|
|
319 |
56091
|
argiro.kok
|
public keywordChanged($event) {
|
320 |
50169
|
argiro.kok
|
|
321 |
|
|
this.keyword = $event.value;
|
322 |
54775
|
konstantin
|
//console.info("Search Find: search with keyword \"" + this.keyword + "\"" );
|
323 |
56091
|
argiro.kok
|
this.location.go(location.pathname, "?keyword=" + this.keyword);
|
324 |
50169
|
argiro.kok
|
this.reloadTabs();
|
325 |
56091
|
argiro.kok
|
if (this.activeTab == "publications") {
|
326 |
50169
|
argiro.kok
|
this.searchPublications();
|
327 |
|
|
}
|
328 |
56091
|
argiro.kok
|
if (this.activeTab == "projects") {
|
329 |
50169
|
argiro.kok
|
this.searchProjects();
|
330 |
|
|
}
|
331 |
56091
|
argiro.kok
|
if (this.activeTab == "content providers") {
|
332 |
50169
|
argiro.kok
|
this.searchDataProviders();
|
333 |
|
|
}
|
334 |
56091
|
argiro.kok
|
if (this.activeTab == "research data") {
|
335 |
50169
|
argiro.kok
|
this.searchDatasets();
|
336 |
|
|
}
|
337 |
56091
|
argiro.kok
|
if (this.activeTab == "software") {
|
338 |
50169
|
argiro.kok
|
this.searchSoftware();
|
339 |
|
|
}
|
340 |
56091
|
argiro.kok
|
if (this.activeTab == "other research products") {
|
341 |
52816
|
konstantin
|
this.searchOrps();
|
342 |
|
|
}
|
343 |
56091
|
argiro.kok
|
if (this.activeTab == "organizations") {
|
344 |
50169
|
argiro.kok
|
this.searchOrganizations();
|
345 |
|
|
}
|
346 |
|
|
|
347 |
|
|
this.count();
|
348 |
56091
|
argiro.kok
|
}
|
349 |
50169
|
argiro.kok
|
|
350 |
56091
|
argiro.kok
|
private count() {
|
351 |
|
|
var refineParams = null;
|
352 |
|
|
if (this.customFilter) {
|
353 |
|
|
refineParams = (refineParams ? (refineParams + '&') : '') + "&fq=" + StringUtils.URIEncode(this.customFilter.queryFieldName + " exact " + StringUtils.quote((this.customFilter.valueId)));
|
354 |
|
|
}
|
355 |
|
|
if (this.activeTab != "publications" && this.showPublications) {
|
356 |
50169
|
argiro.kok
|
this.fetchPublications.searchUtils.status = this.errorCodes.LOADING;
|
357 |
|
|
this.fetchPublications.results = [];
|
358 |
53860
|
argiro.kok
|
|
359 |
59074
|
konstantin
|
this.subs.push(this.numOfSearchResults("publication", this.fetchPublications, refineParams));
|
360 |
50169
|
argiro.kok
|
}
|
361 |
56091
|
argiro.kok
|
if (this.activeTab != "research data" && this.showDatasets) {
|
362 |
|
|
this.fetchDatasets.searchUtils.status = this.errorCodes.LOADING;
|
363 |
|
|
this.fetchDatasets.results = [];
|
364 |
59074
|
konstantin
|
this.subs.push(this.numOfSearchResults("dataset", this.fetchDatasets, refineParams));
|
365 |
50169
|
argiro.kok
|
}
|
366 |
56091
|
argiro.kok
|
if (this.activeTab != "software" && this.showSoftware) {
|
367 |
|
|
this.fetchSoftware.searchUtils.status = this.errorCodes.LOADING;
|
368 |
|
|
this.fetchSoftware.results = [];
|
369 |
59074
|
konstantin
|
this.subs.push(this.numOfSearchResults("software", this.fetchSoftware, refineParams));
|
370 |
50169
|
argiro.kok
|
}
|
371 |
56091
|
argiro.kok
|
if (this.activeTab != "other research products" && this.showOrps) {
|
372 |
|
|
this.fetchOrps.searchUtils.status = this.errorCodes.LOADING;
|
373 |
|
|
this.fetchOrps.results = [];
|
374 |
59074
|
konstantin
|
this.subs.push(this.numOfSearchResults("other", this.fetchOrps, refineParams));
|
375 |
52816
|
konstantin
|
}
|
376 |
56091
|
argiro.kok
|
if (this.activeTab != "projects" && this.showProjects) {
|
377 |
50169
|
argiro.kok
|
this.fetchProjects.searchUtils.status = this.errorCodes.LOADING;
|
378 |
|
|
this.fetchProjects.results = [];
|
379 |
59074
|
konstantin
|
this.subs.push(this._searchProjectsService.numOfSearchProjects(this.keyword, this.properties, refineParams).subscribe(
|
380 |
56091
|
argiro.kok
|
data => {
|
381 |
|
|
this.fetchProjects.searchUtils.totalResults = data;
|
382 |
|
|
this.fetchProjects.searchUtils.status = this.errorCodes.DONE;
|
383 |
|
|
if (this.fetchProjects.searchUtils.totalResults == 0) {
|
384 |
|
|
this.fetchProjects.searchUtils.status = this.errorCodes.NONE;
|
385 |
|
|
}
|
386 |
|
|
},
|
387 |
|
|
err => {
|
388 |
|
|
//console.log(err);
|
389 |
|
|
this.handleError("Error getting number of Projects", err);
|
390 |
|
|
this.fetchProjects.searchUtils.status = this.errorCodes.ERROR;
|
391 |
|
|
}
|
392 |
59074
|
konstantin
|
));
|
393 |
56091
|
argiro.kok
|
}
|
394 |
|
|
if (this.activeTab != "content providers" && this.showDataProviders) {
|
395 |
|
|
this.fetchDataproviders.results = [];
|
396 |
|
|
this.fetchDataproviders.getNumForSearch(this.keyword, this.properties, refineParams);
|
397 |
|
|
}
|
398 |
|
|
if (this.activeTab != "organizations" && this.showOrganizations) {
|
399 |
|
|
this.fetchOrganizations.searchUtils.status = this.errorCodes.LOADING;
|
400 |
|
|
this.fetchOrganizations.results = [];
|
401 |
59074
|
konstantin
|
this.subs.push(this._searchOrganizationsService.numOfSearchOrganizations(this.keyword, this.properties, refineParams).subscribe(
|
402 |
56091
|
argiro.kok
|
data => {
|
403 |
|
|
this.fetchOrganizations.searchUtils.totalResults = data;
|
404 |
|
|
this.fetchOrganizations.searchUtils.status = this.errorCodes.DONE;
|
405 |
|
|
if (this.fetchOrganizations.searchUtils.totalResults == 0) {
|
406 |
|
|
this.fetchOrganizations.searchUtils.status = this.errorCodes.NONE;
|
407 |
|
|
}
|
408 |
|
|
},
|
409 |
|
|
err => {
|
410 |
|
|
//console.log(err);
|
411 |
|
|
this.handleError("Error getting number of Organizations", err);
|
412 |
|
|
this.fetchOrganizations.searchUtils.status = this.errorCodes.ERROR;
|
413 |
50169
|
argiro.kok
|
|
414 |
56091
|
argiro.kok
|
}
|
415 |
59074
|
konstantin
|
));
|
416 |
56091
|
argiro.kok
|
}
|
417 |
50169
|
argiro.kok
|
|
418 |
|
|
|
419 |
56091
|
argiro.kok
|
}
|
420 |
50169
|
argiro.kok
|
|
421 |
58275
|
k.triantaf
|
private numOfSearchResults(resultType: string, fetchClass: FetchResearchResults, refineParams) {
|
422 |
57084
|
konstantin
|
return this._searchResearchResultsService.numOfSearchResults(resultType, this.keyword, this.properties, refineParams).subscribe(
|
423 |
|
|
data => {
|
424 |
|
|
fetchClass.searchUtils.totalResults = data;
|
425 |
|
|
fetchClass.searchUtils.status = this.errorCodes.DONE;
|
426 |
|
|
if (fetchClass.searchUtils.totalResults == 0) {
|
427 |
|
|
fetchClass.searchUtils.status = this.errorCodes.NONE;
|
428 |
|
|
}
|
429 |
|
|
},
|
430 |
|
|
err => {
|
431 |
|
|
this.handleError("Error getting number of "+this.getEntityName(resultType, true, true), err);
|
432 |
|
|
fetchClass.searchUtils.status = this.errorCodes.ERROR;
|
433 |
|
|
}
|
434 |
|
|
);
|
435 |
|
|
}
|
436 |
|
|
|
437 |
56091
|
argiro.kok
|
private reloadTabs() {
|
438 |
|
|
this.reloadPublications = true;
|
439 |
|
|
this.reloadDatasets = true;
|
440 |
|
|
this.reloadSoftware = true;
|
441 |
|
|
this.reloadOrps = true;
|
442 |
|
|
this.reloadProjects = true;
|
443 |
|
|
this.reloadDataproviders = true;
|
444 |
|
|
this.reloadOrganizations = true;
|
445 |
|
|
this.fetchOrganizations.searchUtils.status = null;
|
446 |
|
|
this.fetchDataproviders.searchUtils.status = null;
|
447 |
|
|
this.fetchProjects.searchUtils.status = null;
|
448 |
|
|
this.fetchPublications.searchUtils.status = null;
|
449 |
|
|
this.fetchDatasets.searchUtils.status = null;
|
450 |
|
|
this.fetchSoftware.searchUtils.status = null;
|
451 |
|
|
this.fetchOrps.searchUtils.status = null;
|
452 |
|
|
}
|
453 |
50169
|
argiro.kok
|
|
454 |
56091
|
argiro.kok
|
private handleError(message: string, error) {
|
455 |
|
|
console.error("General Search Page: " + message, error);
|
456 |
|
|
}
|
457 |
57084
|
konstantin
|
|
458 |
|
|
private getEntityName (entityType:string, plural:boolean, full:boolean): string {
|
459 |
|
|
if(entityType == "publication") {
|
460 |
|
|
return "publication" + (plural ? "s" : "");
|
461 |
|
|
} else if(entityType == "dataset") {
|
462 |
|
|
return (full ? "research data" : ("dataset" + (plural ? "s" : "")));
|
463 |
|
|
} else if(entityType == "software") {
|
464 |
|
|
return "software";
|
465 |
|
|
} else if(entityType == "other") {
|
466 |
|
|
return (full ? ("other research product" + (plural ? "s" : "")) : "other");
|
467 |
|
|
}
|
468 |
|
|
}
|
469 |
50169
|
argiro.kok
|
}
|