1 |
58354
|
argiro.kok
|
import {ChangeDetectorRef, Component, Input, ViewChild} 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 |
59074
|
konstantin
|
import {Observable, Subscription} from "rxjs";
|
29 |
58115
|
argiro.kok
|
import {AdvancedField, Filter} from "../searchUtils/searchHelperClasses.class";
|
30 |
58354
|
argiro.kok
|
import {SearchResearchResultsComponent} from "../searchResearchResults.component";
|
31 |
|
|
import {SearchProjectsComponent} from "../searchProjects.component";
|
32 |
|
|
import {SearchOrganizationsComponent} from "../searchOrganizations.component";
|
33 |
|
|
import {SearchDataProvidersComponent} from "../searchDataProviders.component";
|
34 |
58416
|
argiro.kok
|
import {NewSearchPageComponent} from "../searchUtils/newSearchPage.component";
|
35 |
50169
|
argiro.kok
|
|
36 |
|
|
@Component({
|
37 |
|
|
changeDetection: ChangeDetectionStrategy.Default,
|
38 |
|
|
encapsulation: ViewEncapsulation.Emulated,
|
39 |
58115
|
argiro.kok
|
selector: 'search-all',
|
40 |
|
|
templateUrl: 'searchAll.component.html'
|
41 |
50169
|
argiro.kok
|
})
|
42 |
58115
|
argiro.kok
|
export class SearchAllComponent {
|
43 |
|
|
// public reloadResults: boolean;
|
44 |
|
|
// public reloadPublications: boolean;
|
45 |
|
|
// public reloadDatasets: boolean;
|
46 |
|
|
// public reloadSoftware: boolean;
|
47 |
|
|
// public reloadOrps: boolean;
|
48 |
|
|
// public reloadProjects: boolean;
|
49 |
|
|
// public reloadDataproviders: boolean;
|
50 |
|
|
// public reloadOrganizations: boolean;
|
51 |
|
|
reload:{result:boolean, projects:boolean, datasources: boolean, organizations:boolean} = {result:true, projects:true, datasources: true, organizations:true};
|
52 |
50169
|
argiro.kok
|
|
53 |
|
|
public pageTitle = "Search in OpenAIRE"
|
54 |
56091
|
argiro.kok
|
public keyword: string = "";
|
55 |
|
|
public publications: string[];
|
56 |
|
|
public datasets: string[];
|
57 |
|
|
public software: string[];
|
58 |
|
|
public orps: string[];
|
59 |
|
|
public projectsTab: string[];
|
60 |
|
|
public dataproviders: string[];
|
61 |
|
|
public organizations: string[];
|
62 |
50169
|
argiro.kok
|
|
63 |
58115
|
argiro.kok
|
public activeEntity = null;
|
64 |
50169
|
argiro.kok
|
public linkToSearchPublications = "";
|
65 |
|
|
public linkToSearchProjects = "";
|
66 |
|
|
public linkToSearchDataproviders = "";
|
67 |
|
|
public linkToSearchOrganizations = "";
|
68 |
|
|
|
69 |
57027
|
konstantin
|
public fetchPublications: FetchResearchResults;
|
70 |
56091
|
argiro.kok
|
public fetchDataproviders: FetchDataproviders;
|
71 |
|
|
public fetchProjects: FetchProjects;
|
72 |
57027
|
konstantin
|
public fetchDatasets: FetchResearchResults;
|
73 |
|
|
public fetchSoftware: FetchResearchResults;
|
74 |
|
|
public fetchOrps: FetchResearchResults;
|
75 |
50169
|
argiro.kok
|
public fetchOrganizations: FetchOrganizations;
|
76 |
|
|
|
77 |
56091
|
argiro.kok
|
public searchFields: SearchFields = new SearchFields();
|
78 |
|
|
public errorCodes: ErrorCodes = new ErrorCodes();
|
79 |
|
|
public routerHelper: RouterHelper = new RouterHelper();
|
80 |
50169
|
argiro.kok
|
|
81 |
56091
|
argiro.kok
|
showPublications: boolean = false;
|
82 |
|
|
showDatasets: boolean = false;
|
83 |
|
|
showSoftware: boolean = false;
|
84 |
|
|
showOrps: boolean = false;
|
85 |
|
|
showProjects: boolean = false;
|
86 |
|
|
showDataProviders: boolean = false;
|
87 |
|
|
showOrganizations: boolean = false;
|
88 |
|
|
advancedSearchLink: string = "/search/advanced/publications";
|
89 |
50586
|
argiro.kok
|
properties: EnvProperties;
|
90 |
53724
|
argiro.kok
|
@Input() logoURL;
|
91 |
|
|
@Input() name;
|
92 |
58517
|
argiro.kok
|
@Input() customFilter: SearchCustomFilter = null;
|
93 |
53860
|
argiro.kok
|
@Input() piwikSiteId = null;
|
94 |
58697
|
argiro.kok
|
@Input() formPlaceholderText = "Search for research outcomes, projects, content providers & organizations in OpenAIRE";
|
95 |
53740
|
argiro.kok
|
|
96 |
59074
|
konstantin
|
subs: Subscription[] = [];
|
97 |
54206
|
argiro.kok
|
|
98 |
58115
|
argiro.kok
|
quickFilter: { filter: Filter, selected: boolean, filterId: string, value: string } = {
|
99 |
|
|
filter: null,
|
100 |
|
|
selected: true,
|
101 |
|
|
filterId: "resultbestaccessright",
|
102 |
|
|
value: "Open Access"
|
103 |
|
|
};
|
104 |
|
|
|
105 |
|
|
resultTypes = {publication: true, dataset: true, software: true, other: true};
|
106 |
|
|
|
107 |
|
|
//adv Search Form
|
108 |
|
|
public fieldIds: string[] = this.searchFields.RESULT_ADVANCED_FIELDS;
|
109 |
|
|
public fieldIdsMap = this.searchFields.RESULT_FIELDS;
|
110 |
|
|
public selectedFields: AdvancedField[] = [];
|
111 |
|
|
|
112 |
|
|
//new
|
113 |
|
|
parameters = {};
|
114 |
|
|
disableForms: boolean = true;
|
115 |
58354
|
argiro.kok
|
@ViewChild (SearchResearchResultsComponent) searchResearchResultsComponent : SearchResearchResultsComponent ;
|
116 |
|
|
@ViewChild (SearchProjectsComponent) searchProjectsComponent : SearchProjectsComponent ;
|
117 |
|
|
@ViewChild (SearchDataProvidersComponent) searchDataprovidersComponent : SearchDataProvidersComponent ;
|
118 |
|
|
@ViewChild (SearchOrganizationsComponent) searchOrganizationsComponent : SearchOrganizationsComponent ;
|
119 |
56091
|
argiro.kok
|
constructor(private route: ActivatedRoute,
|
120 |
|
|
private _router: Router,
|
121 |
57027
|
konstantin
|
private _searchResearchResultsService: SearchResearchResultsService,
|
122 |
56091
|
argiro.kok
|
private _searchDataprovidersService: SearchDataprovidersService,
|
123 |
|
|
private _searchProjectsService: SearchProjectsService,
|
124 |
|
|
private _searchOrganizationsService: SearchOrganizationsService,
|
125 |
|
|
private _refineFieldResultsService: RefineFieldResultsService,
|
126 |
|
|
private location: Location,
|
127 |
|
|
private _meta: Meta,
|
128 |
|
|
private _title: Title,
|
129 |
|
|
private _piwikService: PiwikService,
|
130 |
|
|
private config: ConfigurationService,
|
131 |
58115
|
argiro.kok
|
private seoService: SEOService, private router: Router, private cdr:ChangeDetectorRef) {
|
132 |
57027
|
konstantin
|
this.fetchPublications = new FetchResearchResults(this._searchResearchResultsService);
|
133 |
56091
|
argiro.kok
|
this.fetchDataproviders = new FetchDataproviders(this._searchDataprovidersService);
|
134 |
|
|
this.fetchProjects = new FetchProjects(this._searchProjectsService);
|
135 |
57027
|
konstantin
|
this.fetchDatasets = new FetchResearchResults(this._searchResearchResultsService);
|
136 |
|
|
this.fetchSoftware = new FetchResearchResults(this._searchResearchResultsService);
|
137 |
|
|
this.fetchOrps = new FetchResearchResults(this._searchResearchResultsService);
|
138 |
56091
|
argiro.kok
|
this.fetchOrganizations = new FetchOrganizations(this._searchOrganizationsService);
|
139 |
58115
|
argiro.kok
|
this.selectedFields.push(new AdvancedField(this.fieldIds[0], this.fieldIdsMap[this.fieldIds[0]].param, this.fieldIdsMap[this.fieldIds[0]].name, this.fieldIdsMap[this.fieldIds[0]].type, '', "and"));
|
140 |
56091
|
argiro.kok
|
|
141 |
50169
|
argiro.kok
|
}
|
142 |
|
|
|
143 |
|
|
public ngOnInit() {
|
144 |
59074
|
konstantin
|
this.subs.push(this.route.data
|
145 |
50586
|
argiro.kok
|
.subscribe((data: { envSpecific: EnvProperties }) => {
|
146 |
50169
|
argiro.kok
|
|
147 |
50586
|
argiro.kok
|
var description = "open access, research, scientific publication, European Commission, EC, FP7, ERC, Horizon 2020, H2020, search, projects ";
|
148 |
|
|
var title = "OpenAIRE | Search publications, research data, projects... | OpenAIRE";
|
149 |
|
|
this.properties = data.envSpecific;
|
150 |
56091
|
argiro.kok
|
var url = data.envSpecific.baseLink + this._router.url;
|
151 |
51835
|
sofia.balt
|
this._title.setTitle(title);
|
152 |
56091
|
argiro.kok
|
this._meta.updateTag({content: description}, "name='description'");
|
153 |
|
|
this._meta.updateTag({content: description}, "property='og:description'");
|
154 |
|
|
this._meta.updateTag({content: title}, "property='og:title'");
|
155 |
|
|
this._meta.updateTag({content: url}, "property='og:url'");
|
156 |
|
|
this.seoService.createLinkForCanonicalURL(this.properties.baseLink + this._router.url, false);
|
157 |
|
|
if (this.properties.enablePiwikTrack && (typeof document !== 'undefined')) {
|
158 |
59074
|
konstantin
|
this.subs.push(this._piwikService.trackView(this.properties, "OpenAIRE |Search publications, research data, projects...", this.piwikSiteId).subscribe());
|
159 |
50586
|
argiro.kok
|
|
160 |
|
|
}
|
161 |
|
|
|
162 |
|
|
|
163 |
58391
|
argiro.kok
|
if ((this.customFilter && this.customFilter.queryFieldName == "communityId") || this.properties.adminToolsCommunity) {
|
164 |
59074
|
konstantin
|
//this.config.getCommunityInformation(this.properties, (this.customFilter && this.customFilter.queryFieldName == "communityId") ? this.customFilter.valueId : this.properties.adminToolsCommunity).subscribe(data => {
|
165 |
|
|
this.subs.push(this.config.communityInformationState.subscribe(data => {
|
166 |
|
|
if(data) {
|
167 |
|
|
var showEntity = {};
|
168 |
|
|
for (var i = 0; i < data['entities'].length; i++) {
|
169 |
50586
|
argiro.kok
|
|
170 |
59074
|
konstantin
|
showEntity["" + data['entities'][i]["pid"] + ""] = data['entities'][i]["isEnabled"];
|
171 |
|
|
}
|
172 |
|
|
this.showPublications = showEntity["publication"];
|
173 |
|
|
this.showDatasets = showEntity["dataset"];
|
174 |
|
|
this.showProjects = showEntity["project"];
|
175 |
|
|
this.showOrganizations = showEntity["organization"];
|
176 |
|
|
this.showDataProviders = showEntity["datasource"];
|
177 |
|
|
this.showSoftware = showEntity["software"];
|
178 |
|
|
this.showOrps = showEntity["orp"];
|
179 |
|
|
if (this.customFilter && this.customFilter.queryFieldName == "communityId") {
|
180 |
|
|
this.showProjects = false;
|
181 |
|
|
this.showOrganizations = false;
|
182 |
|
|
this.showDataProviders = false;
|
183 |
|
|
}
|
184 |
|
|
this.loadAll();
|
185 |
56091
|
argiro.kok
|
}
|
186 |
59074
|
konstantin
|
}));
|
187 |
56091
|
argiro.kok
|
} else {
|
188 |
|
|
if ((this.customFilter && this.customFilter.queryFieldName == "country")) {
|
189 |
58115
|
argiro.kok
|
this.showPublications = true;
|
190 |
56091
|
argiro.kok
|
this.showDatasets = true;
|
191 |
|
|
this.showDataProviders = true;
|
192 |
58115
|
argiro.kok
|
this.showSoftware = true;
|
193 |
56091
|
argiro.kok
|
this.showOrps = true;
|
194 |
|
|
this.showProjects = true;
|
195 |
|
|
this.showOrganizations = true;
|
196 |
|
|
this.showDataProviders = true;
|
197 |
50169
|
argiro.kok
|
}
|
198 |
56059
|
argiro.kok
|
}
|
199 |
56091
|
argiro.kok
|
this.loadAll();
|
200 |
59074
|
konstantin
|
}));
|
201 |
56091
|
argiro.kok
|
}
|
202 |
52816
|
konstantin
|
|
203 |
56091
|
argiro.kok
|
loadAll() {
|
204 |
58115
|
argiro.kok
|
this.reloadTabs();
|
205 |
59074
|
konstantin
|
this.subs.push(this.route.queryParams.subscribe(params => {
|
206 |
58115
|
argiro.kok
|
this.parameters = Object.assign({}, params);
|
207 |
58348
|
argiro.kok
|
this.keyword = (params['keyword']) ? params['keyword'] : (params["q"] ? params["q"] : (params["f0"] && params["f0"] == "q" && params["fv0"]?params["fv0"]:""));
|
208 |
58497
|
konstantin
|
this.selectedFields[0].value = StringUtils.URIDecode(this.keyword);
|
209 |
58115
|
argiro.kok
|
this.quickFilter.selected = ((params['qf']== undefined || params["qf"] == "true") == true);
|
210 |
|
|
if (params["type"] && params["type"].length > 0) {
|
211 |
|
|
this.resultTypes['publication'] = (params["type"].split(",").indexOf("publications") != -1);
|
212 |
|
|
this.resultTypes['dataset'] = (params["type"].split(",").indexOf("datasets") != -1);
|
213 |
|
|
this.resultTypes['software'] = (params["type"].split(",").indexOf("software") != -1);
|
214 |
|
|
this.resultTypes['other'] = (params["type"].split(",").indexOf("other") != -1);
|
215 |
|
|
}
|
216 |
|
|
if(this.activeEntity == null && (!params["active"] || params["active"].length ==0)){
|
217 |
|
|
this.activeEntity = this.getDefaultEntityToShow();
|
218 |
|
|
}else if(params["active"] && params["active"].length >0 ){
|
219 |
|
|
this.activeEntity = ((["result","projects","organizations","datasources"]).indexOf(params["active"])!= -1)?params["active"]:this.getDefaultEntityToShow();
|
220 |
|
|
}else if (this.activeEntity !=null && (!params["active"] || params["active"].length ==0)){
|
221 |
|
|
this.parameters["active"]=this.activeEntity;
|
222 |
|
|
if(location.search && location.search.indexOf("active=") == -1){
|
223 |
|
|
this.location.go(location.pathname, ((location.search)?(location.search+"&"):("?")) +"active=" + this.activeEntity);
|
224 |
56091
|
argiro.kok
|
}
|
225 |
50586
|
argiro.kok
|
}
|
226 |
58115
|
argiro.kok
|
if (this.activeEntity == "result") {
|
227 |
|
|
this.searchResults();
|
228 |
|
|
} else if (this.activeEntity == "projects") {
|
229 |
|
|
this.searchProjects();
|
230 |
|
|
} else if (this.activeEntity == "datasources") {
|
231 |
|
|
this.searchDataProviders();
|
232 |
|
|
} else if (this.activeEntity == "organizations") {
|
233 |
|
|
this.searchOrganizations();
|
234 |
|
|
}
|
235 |
|
|
this.count();
|
236 |
59074
|
konstantin
|
}));
|
237 |
56091
|
argiro.kok
|
}
|
238 |
50169
|
argiro.kok
|
|
239 |
58115
|
argiro.kok
|
getDefaultEntityToShow(){
|
240 |
|
|
if (this.showPublications || this.showDatasets || this.showSoftware || this.showOrps) {
|
241 |
|
|
return "result";
|
242 |
|
|
} else if (this.showProjects) {
|
243 |
|
|
return "projects";
|
244 |
|
|
} else if (this.showDataProviders) {
|
245 |
|
|
return "content providers";
|
246 |
|
|
} else if (this.showOrganizations) {
|
247 |
|
|
return "organizations";
|
248 |
|
|
}
|
249 |
|
|
}
|
250 |
50586
|
argiro.kok
|
|
251 |
50169
|
argiro.kok
|
public ngOnDestroy() {
|
252 |
59074
|
konstantin
|
for (let sub of this.subs) {
|
253 |
|
|
sub.unsubscribe();
|
254 |
53026
|
argiro.kok
|
}
|
255 |
50169
|
argiro.kok
|
}
|
256 |
56091
|
argiro.kok
|
|
257 |
58115
|
argiro.kok
|
public searchResults() {
|
258 |
57084
|
konstantin
|
this.advancedSearchLink = this.properties.searchLinkToAdvancedPublications;//"/search/advanced/publications";
|
259 |
58115
|
argiro.kok
|
if (this.reload[this.activeEntity] &&
|
260 |
|
|
this.fetchPublications.searchUtils.status != this.errorCodes.NONE) {
|
261 |
|
|
this.reload[this.activeEntity] = false;
|
262 |
50586
|
argiro.kok
|
this.linkToSearchPublications = this.properties.searchLinkToPublications;// + "?keyword=" + this.keyword;
|
263 |
50169
|
argiro.kok
|
}
|
264 |
56091
|
argiro.kok
|
}
|
265 |
|
|
|
266 |
52816
|
konstantin
|
|
267 |
56091
|
argiro.kok
|
public searchProjects() {
|
268 |
57084
|
konstantin
|
this.advancedSearchLink = this.properties.searchLinkToAdvancedProjects;//"/search/advanced/projects";
|
269 |
58115
|
argiro.kok
|
if (this.reload[this.activeEntity] &&
|
270 |
|
|
this.fetchProjects.searchUtils.status != this.errorCodes.NONE ) {
|
271 |
|
|
this.reload[this.activeEntity] = false;
|
272 |
56091
|
argiro.kok
|
this.linkToSearchProjects = this.properties.searchLinkToProjects;// + "?keyword=" + this.keyword;
|
273 |
|
|
}
|
274 |
|
|
}
|
275 |
|
|
|
276 |
|
|
public searchDataProviders() {
|
277 |
57084
|
konstantin
|
this.advancedSearchLink = this.properties.searchLinkToAdvancedDataProviders;//"/search/advanced/dataproviders";
|
278 |
58115
|
argiro.kok
|
if ( this.reload[this.activeEntity] &&
|
279 |
|
|
this.fetchDataproviders.searchUtils.status != this.errorCodes.NONE) {
|
280 |
|
|
this.reload[this.activeEntity] = false;
|
281 |
56091
|
argiro.kok
|
this.linkToSearchDataproviders = this.properties.searchLinkToDataProviders;// + "?keyword=" + this.keyword;
|
282 |
|
|
}
|
283 |
|
|
}
|
284 |
|
|
|
285 |
|
|
public searchOrganizations() {
|
286 |
57084
|
konstantin
|
this.advancedSearchLink = this.properties.searchLinkToAdvancedOrganizations;//"/search/advanced/organizations";
|
287 |
58115
|
argiro.kok
|
if (this.reload[this.activeEntity] &&
|
288 |
|
|
this.fetchOrganizations.searchUtils.status != this.errorCodes.NONE) {
|
289 |
|
|
this.reload[this.activeEntity] = false;
|
290 |
56091
|
argiro.kok
|
this.linkToSearchOrganizations = this.properties.searchLinkToOrganizations;// + "?keyword=" + this.keyword;
|
291 |
|
|
}
|
292 |
|
|
}
|
293 |
58115
|
argiro.kok
|
private prepareKeywordParam(keyword){
|
294 |
58416
|
argiro.kok
|
if (this.parameters["q"]) {
|
295 |
58115
|
argiro.kok
|
delete this.parameters['q'];
|
296 |
|
|
delete this.parameters['op'];
|
297 |
58416
|
argiro.kok
|
}
|
298 |
|
|
if(keyword.length > 0){
|
299 |
58348
|
argiro.kok
|
this.parameters["fv0"] = keyword;
|
300 |
|
|
this.parameters["f0"] = "q";
|
301 |
58416
|
argiro.kok
|
}else if(keyword.length ==0 && this.parameters["f0"]=="q"){
|
302 |
|
|
delete this.parameters['f0'];
|
303 |
|
|
delete this.parameters['fv0'];
|
304 |
|
|
}
|
305 |
58115
|
argiro.kok
|
}
|
306 |
58525
|
argiro.kok
|
/*
|
307 |
|
|
//quickSelection moved inside the searchpage
|
308 |
58115
|
argiro.kok
|
private prepareResultParameters() {
|
309 |
|
|
//quickSelections
|
310 |
|
|
if (this.resultTypes && this.activeEntity == "result") {
|
311 |
|
|
let values = [];
|
312 |
|
|
if (this.resultTypes.publication) {
|
313 |
|
|
values.push("publications");
|
314 |
|
|
}
|
315 |
|
|
if (this.resultTypes.dataset) {
|
316 |
|
|
values.push("datasets");
|
317 |
|
|
}
|
318 |
|
|
if (this.resultTypes.software) {
|
319 |
|
|
values.push("software");
|
320 |
|
|
}
|
321 |
|
|
if (this.resultTypes.other) {
|
322 |
|
|
values.push("other");
|
323 |
|
|
}
|
324 |
|
|
if (values.length > 0) {
|
325 |
|
|
this.parameters["type"] = values.join(",");
|
326 |
|
|
}
|
327 |
50169
|
argiro.kok
|
}
|
328 |
58115
|
argiro.kok
|
if (this.quickFilter && this.activeEntity == "result") {
|
329 |
|
|
this.parameters["qf"] = this.quickFilter.selected;
|
330 |
50169
|
argiro.kok
|
}
|
331 |
58115
|
argiro.kok
|
}
|
332 |
50169
|
argiro.kok
|
|
333 |
58115
|
argiro.kok
|
public quickSelectionsChanged() {
|
334 |
|
|
this.prepareResultParameters();
|
335 |
58416
|
argiro.kok
|
this.parameters["page"] = 1;
|
336 |
58115
|
argiro.kok
|
this.reload[this.activeEntity] = true;
|
337 |
|
|
this.router.navigate([location.pathname], {queryParams: this.parameters});
|
338 |
58525
|
argiro.kok
|
}*/
|
339 |
50169
|
argiro.kok
|
|
340 |
58115
|
argiro.kok
|
|
341 |
|
|
public keywordChanged($event) {
|
342 |
|
|
this.prepareKeywordParam(this.selectedFields[0].value);
|
343 |
58416
|
argiro.kok
|
this.parameters["page"] = 1;
|
344 |
58115
|
argiro.kok
|
this.reloadTabs();
|
345 |
|
|
this.router.navigate([location.pathname], {queryParams: this.parameters});
|
346 |
|
|
}
|
347 |
|
|
|
348 |
56091
|
argiro.kok
|
private count() {
|
349 |
|
|
var refineParams = null;
|
350 |
|
|
if (this.customFilter) {
|
351 |
|
|
refineParams = (refineParams ? (refineParams + '&') : '') + "&fq=" + StringUtils.URIEncode(this.customFilter.queryFieldName + " exact " + StringUtils.quote((this.customFilter.valueId)));
|
352 |
|
|
}
|
353 |
58115
|
argiro.kok
|
if (this.activeEntity != "result" && this.reload["result"] && (this.showPublications || this.showSoftware || this.datasets || this.showOrps)) {
|
354 |
50169
|
argiro.kok
|
this.fetchPublications.searchUtils.status = this.errorCodes.LOADING;
|
355 |
58115
|
argiro.kok
|
this.reload["result"] = false;
|
356 |
50169
|
argiro.kok
|
this.fetchPublications.results = [];
|
357 |
58416
|
argiro.kok
|
//Add Open Access Filter
|
358 |
59074
|
konstantin
|
this.subs.push(this.numOfSearchResults(this.fetchPublications, (refineParams ? (refineParams + '&') : '') + "&fq=resultbestaccessright%20exact%20%22Open%20Access%22"));
|
359 |
58115
|
argiro.kok
|
}
|
360 |
53860
|
argiro.kok
|
|
361 |
58115
|
argiro.kok
|
if (this.activeEntity != "projects" && this.reload["projects"] && this.showProjects) {
|
362 |
50169
|
argiro.kok
|
this.fetchProjects.searchUtils.status = this.errorCodes.LOADING;
|
363 |
|
|
this.fetchProjects.results = [];
|
364 |
58115
|
argiro.kok
|
this.reload["projects"] = false;
|
365 |
59074
|
konstantin
|
this.subs.push(this._searchProjectsService.numOfSearchProjects2(this.keyword.length>0?NewSearchPageComponent.createKeywordQuery("project",this.keyword,"q","="):"", this.properties, refineParams).subscribe(
|
366 |
56091
|
argiro.kok
|
data => {
|
367 |
|
|
this.fetchProjects.searchUtils.totalResults = data;
|
368 |
|
|
this.fetchProjects.searchUtils.status = this.errorCodes.DONE;
|
369 |
|
|
if (this.fetchProjects.searchUtils.totalResults == 0) {
|
370 |
|
|
this.fetchProjects.searchUtils.status = this.errorCodes.NONE;
|
371 |
|
|
}
|
372 |
|
|
},
|
373 |
|
|
err => {
|
374 |
|
|
//console.log(err);
|
375 |
|
|
this.handleError("Error getting number of Projects", err);
|
376 |
|
|
this.fetchProjects.searchUtils.status = this.errorCodes.ERROR;
|
377 |
59003
|
argiro.kok
|
this.fetchProjects.searchUtils.totalResults = null;
|
378 |
56091
|
argiro.kok
|
}
|
379 |
59074
|
konstantin
|
));
|
380 |
56091
|
argiro.kok
|
}
|
381 |
58115
|
argiro.kok
|
if (this.activeEntity != "datasources" && this.reload["datasources"] && this.showDataProviders) {
|
382 |
56091
|
argiro.kok
|
this.fetchDataproviders.results = [];
|
383 |
58115
|
argiro.kok
|
this.reload["datasources"] = false;
|
384 |
58416
|
argiro.kok
|
// this.fetchDataproviders.getNumForSearch(this.keyword, this.properties, refineParams);
|
385 |
59074
|
konstantin
|
this.subs.push(this._searchDataprovidersService.numOfSearchDataproviders2(this.keyword.length>0?NewSearchPageComponent.createKeywordQuery("datasources",this.keyword,"q","="):"", this.properties, refineParams).subscribe(
|
386 |
58416
|
argiro.kok
|
data => {
|
387 |
|
|
this.fetchDataproviders.searchUtils.totalResults = data;
|
388 |
|
|
this.fetchDataproviders.searchUtils.status = this.errorCodes.DONE;
|
389 |
|
|
if (this.fetchDataproviders.searchUtils.totalResults == 0) {
|
390 |
|
|
this.fetchDataproviders.searchUtils.status = this.errorCodes.NONE;
|
391 |
|
|
}
|
392 |
|
|
},
|
393 |
|
|
err => {
|
394 |
|
|
//console.log(err);
|
395 |
|
|
this.handleError("Error getting number of Projects", err);
|
396 |
|
|
this.fetchDataproviders.searchUtils.status = this.errorCodes.ERROR;
|
397 |
59003
|
argiro.kok
|
this.fetchDataproviders.searchUtils.totalResults = null;
|
398 |
58416
|
argiro.kok
|
}
|
399 |
59074
|
konstantin
|
));
|
400 |
56091
|
argiro.kok
|
}
|
401 |
58115
|
argiro.kok
|
if (this.activeEntity != "organizations" && this.reload["organizations"] && this.showOrganizations) {
|
402 |
56091
|
argiro.kok
|
this.fetchOrganizations.searchUtils.status = this.errorCodes.LOADING;
|
403 |
|
|
this.fetchOrganizations.results = [];
|
404 |
58115
|
argiro.kok
|
this.reload["organizations"] = false;
|
405 |
59074
|
konstantin
|
this.subs.push(this._searchOrganizationsService.numOfSearchOrganizations2(this.keyword.length>0?NewSearchPageComponent.createKeywordQuery("organizations",this.keyword,"q","="):"", this.properties, refineParams).subscribe(
|
406 |
56091
|
argiro.kok
|
data => {
|
407 |
|
|
this.fetchOrganizations.searchUtils.totalResults = data;
|
408 |
|
|
this.fetchOrganizations.searchUtils.status = this.errorCodes.DONE;
|
409 |
|
|
if (this.fetchOrganizations.searchUtils.totalResults == 0) {
|
410 |
|
|
this.fetchOrganizations.searchUtils.status = this.errorCodes.NONE;
|
411 |
|
|
}
|
412 |
|
|
},
|
413 |
|
|
err => {
|
414 |
|
|
//console.log(err);
|
415 |
|
|
this.handleError("Error getting number of Organizations", err);
|
416 |
|
|
this.fetchOrganizations.searchUtils.status = this.errorCodes.ERROR;
|
417 |
59003
|
argiro.kok
|
this.fetchOrganizations.searchUtils.totalResults = null;
|
418 |
50169
|
argiro.kok
|
|
419 |
56091
|
argiro.kok
|
}
|
420 |
59074
|
konstantin
|
));
|
421 |
56091
|
argiro.kok
|
}
|
422 |
50169
|
argiro.kok
|
|
423 |
|
|
|
424 |
56091
|
argiro.kok
|
}
|
425 |
50169
|
argiro.kok
|
|
426 |
59074
|
konstantin
|
private numOfSearchResults(fetchClass: FetchResearchResults, refineParams): Subscription {
|
427 |
58416
|
argiro.kok
|
return this._searchResearchResultsService.numOfResearchOutcomes(this.keyword.length>0?NewSearchPageComponent.createKeywordQuery("result",this.keyword,"q","="):"", this.properties, refineParams).subscribe(
|
428 |
57084
|
konstantin
|
data => {
|
429 |
|
|
fetchClass.searchUtils.totalResults = data;
|
430 |
|
|
fetchClass.searchUtils.status = this.errorCodes.DONE;
|
431 |
|
|
if (fetchClass.searchUtils.totalResults == 0) {
|
432 |
|
|
fetchClass.searchUtils.status = this.errorCodes.NONE;
|
433 |
|
|
}
|
434 |
|
|
},
|
435 |
|
|
err => {
|
436 |
58115
|
argiro.kok
|
this.handleError("Error getting number of research results", err);
|
437 |
57084
|
konstantin
|
fetchClass.searchUtils.status = this.errorCodes.ERROR;
|
438 |
59003
|
argiro.kok
|
fetchClass.searchUtils.totalResults = null;
|
439 |
57084
|
konstantin
|
}
|
440 |
|
|
);
|
441 |
|
|
}
|
442 |
|
|
|
443 |
56091
|
argiro.kok
|
private reloadTabs() {
|
444 |
58115
|
argiro.kok
|
this.reload = {result:true, projects:true, datasources: true, organizations:true};
|
445 |
|
|
this.fetchOrganizations.searchUtils.status = this.errorCodes.LOADING;
|
446 |
|
|
this.fetchDataproviders.searchUtils.status = this.errorCodes.LOADING;
|
447 |
|
|
this.fetchProjects.searchUtils.status = this.errorCodes.LOADING;
|
448 |
|
|
this.fetchPublications.searchUtils.status = this.errorCodes.LOADING;
|
449 |
|
|
this.fetchDatasets.searchUtils.status = this.errorCodes.LOADING;
|
450 |
|
|
this.fetchSoftware.searchUtils.status = this.errorCodes.LOADING;
|
451 |
|
|
this.fetchOrps.searchUtils.status = this.errorCodes.LOADING;
|
452 |
56091
|
argiro.kok
|
}
|
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 |
58115
|
argiro.kok
|
activeEntityUpdate($event) {
|
459 |
|
|
this.disableForms = $event.disableForms;
|
460 |
59003
|
argiro.kok
|
let updated = true
|
461 |
|
|
console.debug($event)
|
462 |
58115
|
argiro.kok
|
if (this.activeEntity == "result") {
|
463 |
|
|
if($event.searchUtils.status!=this.errorCodes.LOADING) {
|
464 |
|
|
this.fetchPublications.searchUtils.totalResults = $event.searchUtils.totalResults;
|
465 |
|
|
}
|
466 |
|
|
this.fetchPublications.searchUtils.status = $event.searchUtils.status;
|
467 |
|
|
}else if (this.activeEntity == "projects"){
|
468 |
|
|
if($event.searchUtils.status!=this.errorCodes.LOADING) {
|
469 |
|
|
this.fetchProjects.searchUtils.totalResults = $event.searchUtils.totalResults;
|
470 |
|
|
}
|
471 |
|
|
this.fetchProjects.searchUtils.status = $event.searchUtils.status;
|
472 |
|
|
}else if (this.activeEntity == "datasources"){
|
473 |
|
|
if($event.searchUtils.status!=this.errorCodes.LOADING) {
|
474 |
|
|
this.fetchDataproviders.searchUtils.totalResults = $event.searchUtils.totalResults;
|
475 |
|
|
}
|
476 |
|
|
this.fetchDataproviders.searchUtils.status = $event.searchUtils.status;
|
477 |
|
|
}else if (this.activeEntity == "organizations") {
|
478 |
|
|
if($event.searchUtils.status!=this.errorCodes.LOADING) {
|
479 |
|
|
this.fetchOrganizations.searchUtils.totalResults = $event.searchUtils.totalResults;
|
480 |
|
|
}
|
481 |
|
|
this.fetchOrganizations.searchUtils.status = $event.searchUtils.status;
|
482 |
|
|
}else{
|
483 |
|
|
updated = false;
|
484 |
|
|
}
|
485 |
|
|
if(updated) {
|
486 |
|
|
this.cdr.detectChanges();
|
487 |
|
|
}
|
488 |
|
|
}
|
489 |
|
|
|
490 |
|
|
entityChanged(entity){
|
491 |
58354
|
argiro.kok
|
if(this.activeEntity == "result") {
|
492 |
|
|
this.resultTypes = {publication: true, dataset: true, software: true, other: true};
|
493 |
|
|
}
|
494 |
|
|
if(this.activeEntity == "result" && this.searchResearchResultsComponent){
|
495 |
|
|
this.searchResearchResultsComponent.ngOnDestroy();
|
496 |
|
|
}else if(this.activeEntity == "projects" && this.searchProjectsComponent){
|
497 |
|
|
this.searchProjectsComponent.ngOnDestroy();
|
498 |
|
|
}else if(this.activeEntity == "datasources" && this.searchDataprovidersComponent){
|
499 |
|
|
this.searchDataprovidersComponent.ngOnDestroy();
|
500 |
|
|
}else if(this.activeEntity == "organizations" && this.searchOrganizationsComponent){
|
501 |
|
|
this.searchOrganizationsComponent.ngOnDestroy();
|
502 |
|
|
}
|
503 |
58115
|
argiro.kok
|
this.activeEntity = entity;
|
504 |
|
|
this.parameters = {};
|
505 |
|
|
this.reload[entity]= true;
|
506 |
|
|
this.parameters["active"] = entity;
|
507 |
|
|
if ( this.keyword.length > 0) {
|
508 |
58416
|
argiro.kok
|
this.parameters["fv0"] = this.keyword;
|
509 |
|
|
this.parameters["f0"] = "q";
|
510 |
58115
|
argiro.kok
|
}
|
511 |
58287
|
argiro.kok
|
this.router.navigate(["/search/find"], {queryParams: this.parameters});
|
512 |
58115
|
argiro.kok
|
}
|
513 |
|
|
|
514 |
50169
|
argiro.kok
|
}
|