Revision 44732
Added by Konstantina Galouni over 7 years ago
modules/uoa-services-portal/trunk/portal-2/src/app/services/searchDataproviders.service.ts | ||
---|---|---|
173 | 173 |
}); |
174 | 174 |
} |
175 | 175 |
|
176 |
searchEntityRegistriesCSV (params: string,refineParams:string, page: number, size: number):any { |
|
177 |
let url = OpenaireProperties.getSearchResourcesAPIURL(); |
|
178 |
url += "?query=((oaftype exact datasource) and(datasourcetypeuiid = other))" |
|
179 |
if(params!= null && params != '' ) { |
|
180 |
url += params; |
|
181 |
} |
|
182 |
if(refineParams!= null && refineParams != '' ) { |
|
183 |
url += refineParams; |
|
184 |
} |
|
185 |
url += "&page="+page+"&size="+size; |
|
186 |
let key = url; |
|
187 |
if (this._cache.has(key)) { |
|
188 |
return Observable.of(this._cache.get(key)); |
|
189 |
} |
|
190 |
return this.http.get(url) |
|
191 |
.map(res => <any> res.json()) |
|
192 |
//.do(res => console.info(res)) |
|
193 |
.map(res => this.parseResultsCSV(res['results'])) |
|
194 |
.do(res => { |
|
195 |
this._cache.set(key, res); |
|
196 |
}); |
|
197 |
} |
|
198 |
|
|
199 |
searchCompatibleDataprovidersCSV (params: string,refineParams:string, page: number, size: number):any { |
|
200 |
let url = OpenaireProperties.getSearchResourcesAPIURL(); |
|
201 |
url += "?query=((oaftype exact datasource) not(datasourcecompatibilityid = UNKNOWN) not(datasourcecompatibilityid = hostedBy) not(datasourcecompatibilityid = notCompatible) not(datasourcetypeuiid = other))" |
|
202 |
if(params!= null && params != '' ) { |
|
203 |
url += params; |
|
204 |
} |
|
205 |
if(refineParams!= null && refineParams != '' ) { |
|
206 |
url += refineParams; |
|
207 |
} |
|
208 |
url += "&page="+page+"&size="+size; |
|
209 |
let key = url; |
|
210 |
if (this._cache.has(key)) { |
|
211 |
return Observable.of(this._cache.get(key)); |
|
212 |
} |
|
213 |
return this.http.get(url) |
|
214 |
.map(res => <any> res.json()) |
|
215 |
//.do(res => console.info(res)) |
|
216 |
.map(res => this.parseResultsCSV(res['results'])) |
|
217 |
.do(res => { |
|
218 |
this._cache.set(key, res); |
|
219 |
}); |
|
220 |
} |
|
221 |
|
|
176 | 222 |
parseResults(data: any): SearchResult[] { |
177 | 223 |
let results: SearchResult[] = []; |
178 | 224 |
|
... | ... | |
190 | 236 |
result['title'].url = OpenaireProperties.getsearchLinkToDataProvider(); |
191 | 237 |
result['title'].url += Array.isArray(data) ? data[i]['result']['header']['dri:objIdentifier'] : data['result']['header']['dri:objIdentifier']; |
192 | 238 |
|
193 |
if(resData['datasourcetype'].hasOwnProperty("classname")) { |
|
194 |
result['type'] = resData['datasourcetype'].classname; |
|
195 |
} |
|
239 |
result['type'] = this.getDataproviderType(resData); |
|
196 | 240 |
|
197 | 241 |
if(resData.hasOwnProperty('accessinfopackage')) { |
198 | 242 |
let OAIPMHURL: string; |
... | ... | |
209 | 253 |
|
210 | 254 |
result['websiteURL'] = resData.websiteurl; |
211 | 255 |
|
212 |
if(resData['rels'].hasOwnProperty("rel")) { |
|
213 |
let countriesSet: Set<string> = new Set<string>(); |
|
256 |
let res:[string[], {"name":string, "url":string}[]] = this.getDataproviderCountriesOrganizations(resData, true, true); |
|
257 |
result['organizations'] = res[1]; |
|
258 |
result['countries'] = res[0]; |
|
214 | 259 |
|
215 |
let counter = 0; |
|
216 |
let relLength = Array.isArray(resData['rels']['rel']) ? resData['rels']['rel'].length : 1; |
|
260 |
result['compatibility'] = this.getDataproviderCompatibility(resData) |
|
217 | 261 |
|
218 |
for(let i=0; i<relLength; i++) { |
|
219 |
let relation = Array.isArray(resData['rels']['rel']) ? resData['rels']['rel'][i] : resData['rels']['rel']; |
|
220 |
|
|
221 |
if(relation.hasOwnProperty("to")) { |
|
222 |
if(relation['to'].class == "provides" && relation['to'].type == "organization") { |
|
223 |
if(result['organizations'] == undefined) { |
|
224 |
result['organizations'] = new Array<{"name": string, "url": string}>(); |
|
225 |
} |
|
226 |
|
|
227 |
result['organizations'][counter] = {"name": "", "url": ""}; |
|
228 |
result['organizations'][counter]['name'] = relation.legalname; |
|
229 |
result['organizations'][counter]['url'] = OpenaireProperties.getsearchLinkToOrganization()+relation['to'].content; |
|
230 |
|
|
231 |
if(relation.hasOwnProperty('country') && |
|
232 |
relation.country.hasOwnProperty('classname')) { |
|
233 |
if(result['countries'] == undefined) { |
|
234 |
result['countries'] = []; |
|
235 |
} |
|
236 |
|
|
237 |
if(!countriesSet.has(relation.country.classname)) { |
|
238 |
countriesSet.add(relation.country.classname); |
|
239 |
result['countries'].push(relation.country.classname); |
|
240 |
} |
|
241 |
} |
|
242 |
|
|
243 |
counter++; |
|
244 |
} |
|
245 |
} |
|
246 |
} |
|
247 |
} |
|
248 |
|
|
249 |
if(resData.hasOwnProperty('openairecompatibility')) { |
|
250 |
result['compatibility'] = resData['openairecompatibility'].classname; |
|
251 |
} |
|
252 |
|
|
253 | 262 |
results.push(result); |
254 | 263 |
|
255 | 264 |
} |
... | ... | |
257 | 266 |
return results; |
258 | 267 |
} |
259 | 268 |
|
269 |
getDataproviderType(resData: any): string { |
|
270 |
if(resData['datasourcetype'].hasOwnProperty("classname")) { |
|
271 |
return resData['datasourcetype'].classname; |
|
272 |
} else { |
|
273 |
return ''; |
|
274 |
} |
|
275 |
} |
|
260 | 276 |
|
261 |
parseResultsCSV(data: any): any { |
|
262 |
let results: any = []; |
|
277 |
getDataproviderCompatibility(resData: any): string { |
|
278 |
if(resData.hasOwnProperty('openairecompatibility')) { |
|
279 |
return resData['openairecompatibility'].classname; |
|
280 |
} else { |
|
281 |
return ''; |
|
282 |
} |
|
283 |
} |
|
263 | 284 |
|
264 |
let length = Array.isArray(data) ? data.length : 1; |
|
285 |
getDataproviderCountriesOrganizations(resData: any, getCountries: boolean, getOrganizations: boolean): [string[], {"name": string, "url": string}[]] { |
|
286 |
let countries: string[] = []; |
|
287 |
let organizations: {"name": string, "url": string}[] = []; |
|
265 | 288 |
|
266 |
for(let i=0; i<length; i++) {
|
|
267 |
let resData = Array.isArray(data) ? data[i]['result']['metadata']['oaf:entity']['oaf:datasource'] : data['result']['metadata']['oaf:entity']['oaf:datasource'];
|
|
289 |
if(resData['rels'].hasOwnProperty("rel")) {
|
|
290 |
let countriesSet: Set<string> = new Set<string>();
|
|
268 | 291 |
|
269 |
var result: any = [];
|
|
292 |
let relLength = Array.isArray(resData['rels']['rel']) ? resData['rels']['rel'].length : 1;
|
|
270 | 293 |
|
271 |
result.push(this.quote(resData.officialname)); |
|
294 |
for(let i=0; i<relLength; i++) { |
|
295 |
let relation = Array.isArray(resData['rels']['rel']) ? resData['rels']['rel'][i] : resData['rels']['rel']; |
|
272 | 296 |
|
273 |
if(resData['datasourcetype'].hasOwnProperty("classname")) { |
|
274 |
result.push(this.quote(resData['datasourcetype'].classname)); |
|
275 |
} else { |
|
276 |
result.push(''); |
|
277 |
} |
|
297 |
if(relation.hasOwnProperty("to")) { |
|
298 |
if(relation['to'].class == "provides" && relation['to'].type == "organization") { |
|
299 |
if(getOrganizations) { |
|
300 |
let item: {"name":string, "url":string} = {"name": "", "url": ""}; |
|
301 |
item['name'] = relation.legalname; |
|
302 |
item['url'] = OpenaireProperties.getsearchLinkToOrganization()+relation['to'].content; |
|
303 |
organizations.push(item); |
|
304 |
} |
|
278 | 305 |
|
279 |
if(resData['rels'].hasOwnProperty("rel")) { |
|
280 |
let countries = []; |
|
281 |
let countriesSet: Set<string> = new Set<string>(); |
|
282 |
|
|
283 |
let relLength = Array.isArray(resData['rels']['rel']) ? resData['rels']['rel'].length : 1; |
|
284 |
|
|
285 |
for(let i=0; i<relLength; i++) { |
|
286 |
let relation = Array.isArray(resData['rels']['rel']) ? resData['rels']['rel'][i] : resData['rels']['rel']; |
|
287 |
|
|
288 |
if(relation.hasOwnProperty("to")) { |
|
289 |
if(relation['to'].class == "provides" && relation['to'].type == "organization") { |
|
306 |
if(getCountries) { |
|
290 | 307 |
if(relation.hasOwnProperty('country') && |
291 | 308 |
relation.country.hasOwnProperty('classname')) { |
292 | 309 |
if(!countriesSet.has(relation.country.classname)) { |
... | ... | |
297 | 314 |
} |
298 | 315 |
} |
299 | 316 |
} |
300 |
result.push(this.quote(countries)); |
|
301 |
} else { |
|
302 |
result.push(''); |
|
303 | 317 |
} |
318 |
} |
|
319 |
return [countries, organizations]; |
|
320 |
} |
|
304 | 321 |
|
305 |
if(resData.hasOwnProperty('openairecompatibility')) { |
|
306 |
result.push(this.quote(resData['openairecompatibility'].classname)); |
|
307 |
} else { |
|
308 |
result.push(''); |
|
309 |
} |
|
322 |
parseResultsCSV(data: any): any { |
|
323 |
let results: any = []; |
|
324 |
let length = Array.isArray(data) ? data.length : 1; |
|
310 | 325 |
|
326 |
for(let i=0; i<length; i++) { |
|
327 |
let resData = Array.isArray(data) ? data[i]['result']['metadata']['oaf:entity']['oaf:datasource'] : data['result']['metadata']['oaf:entity']['oaf:datasource']; |
|
328 |
|
|
329 |
var result: any = []; |
|
330 |
|
|
331 |
result.push(this.quote(resData.officialname)); |
|
332 |
result.push(this.quote(this.getDataproviderType(resData))); |
|
333 |
result.push(this.quote(this.getDataproviderCountriesOrganizations(resData, true, false)[0])); |
|
334 |
result.push(this.quote(this.getDataproviderCompatibility(resData))); |
|
311 | 335 |
results.push(result); |
312 |
|
|
313 | 336 |
} |
314 |
|
|
315 | 337 |
return results; |
316 | 338 |
} |
317 | 339 |
|
318 | 340 |
numOfDataproviders(params: string):any { |
319 | 341 |
console.info("getOfDataproviders : Dataproviders Service + params="+params); |
320 | 342 |
|
321 |
//OpenaireProperties.getSearchAPIURL() |
|
322 |
//"http://rudie.di.uoa.gr:8080/dnet-functionality-services-2.0.0-SNAPSHOT/rest/v2/api/" |
|
323 | 343 |
let url = OpenaireProperties.getSearchAPIURL()+params; |
324 | 344 |
let key = url; |
325 | 345 |
if (this._cache.has(key)) { |
modules/uoa-services-portal/trunk/portal-2/src/app/services/searchPublications.service.ts | ||
---|---|---|
99 | 99 |
}); |
100 | 100 |
} |
101 | 101 |
|
102 |
searchPublicationsCSV (params: string, refineParams:string, page: number, size: number):any { |
|
102 | 103 |
|
104 |
let link = OpenaireProperties.getSearchAPIURL()+"publications"; |
|
105 |
|
|
106 |
let url = link+"?"; |
|
107 |
if(params!= null && params != '' ) { |
|
108 |
url += params; |
|
109 |
} |
|
110 |
if(refineParams!= null && refineParams != '' ) { |
|
111 |
url += refineParams; |
|
112 |
} |
|
113 |
url += "&page="+page+"&size="+size; |
|
114 |
|
|
115 |
let key = url; |
|
116 |
if (this._cache.has(key)) { |
|
117 |
return Observable.of(this._cache.get(key)); |
|
118 |
} |
|
119 |
|
|
120 |
return this.http.get(url) |
|
121 |
.map(res => <any> res.json()) |
|
122 |
//.do(res => console.info(res)) |
|
123 |
.map(res => this.parseResultsCSV(res['results'])) |
|
124 |
.do(res => { |
|
125 |
this._cache.set(key, res); |
|
126 |
}); |
|
127 |
} |
|
128 |
|
|
129 |
|
|
103 | 130 |
parseResults(data: any): SearchResult[] { |
104 | 131 |
let results: SearchResult[] = []; |
105 | 132 |
|
106 | 133 |
let length = Array.isArray(data) ? data.length : 1; |
107 |
console.info(Array.isArray(data)); |
|
134 |
|
|
108 | 135 |
for(let i=0; i<length; i++) { |
109 | 136 |
let resData = Array.isArray(data) ? data[i]['result']['metadata']['oaf:entity']['oaf:result'] : data['result']['metadata']['oaf:entity']['oaf:result']; |
110 | 137 |
|
... | ... | |
202 | 229 |
return results; |
203 | 230 |
} |
204 | 231 |
|
232 |
parseResultsCSV(data: any): any { |
|
233 |
let results: any = []; |
|
234 |
|
|
235 |
|
|
236 |
let length = Array.isArray(data) ? data.length : 1; |
|
237 |
|
|
238 |
for(let i=0; i<length; i++) { |
|
239 |
let resData = Array.isArray(data) ? data[i]['result']['metadata']['oaf:entity']['oaf:result'] : data['result']['metadata']['oaf:entity']['oaf:result']; |
|
240 |
|
|
241 |
var result: any = []; |
|
242 |
|
|
243 |
if(Array.isArray(resData['title'])) { |
|
244 |
result.push(this.quote(resData['title'][0].content)); |
|
245 |
} else { |
|
246 |
result.push(this.quote(resData['title'].content)); |
|
247 |
} |
|
248 |
|
|
249 |
var authors: string[] = []; |
|
250 |
var projects: string[] = []; |
|
251 |
var funder: string = ""; |
|
252 |
if(resData['rels'].hasOwnProperty("rel")) { |
|
253 |
let relLength = Array.isArray(resData['rels']['rel']) ? resData['rels']['rel'].length : 1; |
|
254 |
|
|
255 |
for(let j=0; j<relLength; j++) { |
|
256 |
let relation = Array.isArray(resData['rels']['rel']) ? resData['rels']['rel'][j] : resData['rels']['rel']; |
|
257 |
|
|
258 |
if(relation.hasOwnProperty("to")) { |
|
259 |
if(relation['to'].class == "hasAuthor") { |
|
260 |
authors.push(relation.fullname); |
|
261 |
} else if(relation['to'].class == "isProducedBy") { |
|
262 |
if(relation.code != "") { |
|
263 |
projects.push(relation.title+" ("+relation.code+")"); |
|
264 |
} else { |
|
265 |
projects.push(relation.title); |
|
266 |
} |
|
267 |
|
|
268 |
if(relation.hasOwnProperty("funding")) { |
|
269 |
let fundingLength = Array.isArray(relation['funding']) ? relation['funding'].length : 1; |
|
270 |
|
|
271 |
for(let z=0; z<fundingLength; z++) { |
|
272 |
let fundingData = Array.isArray(relation['funding']) ? relation['funding'][z] : relation['funding']; |
|
273 |
|
|
274 |
if(fundingData.hasOwnProperty("funder")) { |
|
275 |
funder = fundingData['funder'].shortname; |
|
276 |
} |
|
277 |
} |
|
278 |
} |
|
279 |
|
|
280 |
} |
|
281 |
} |
|
282 |
} |
|
283 |
result.push(this.quote(authors)); |
|
284 |
var year: string = ""; |
|
285 |
if(resData.hasOwnProperty("dateofacceptance")) { |
|
286 |
year = resData.dateofacceptance; |
|
287 |
} |
|
288 |
result.push(year); |
|
289 |
var id:string = Array.isArray(data) ? data[i]['result']['header']['dri:objIdentifier'] : data['result']['header']['dri:objIdentifier']; |
|
290 |
result.push(this.quote(id)); |
|
291 |
result.push(funder); |
|
292 |
result.push(this.quote(projects)); |
|
293 |
} else { |
|
294 |
result.push(this.quote('')); |
|
295 |
var year: string = ""; |
|
296 |
if(resData.hasOwnProperty("dateofacceptance")) { |
|
297 |
year = resData.dateofacceptance; |
|
298 |
} |
|
299 |
result.push(year); |
|
300 |
var id:string = Array.isArray(data) ? data[i]['result']['header']['dri:objIdentifier'] : data['result']['header']['dri:objIdentifier']; |
|
301 |
result.push(this.quote(id)); |
|
302 |
result.push(funder); |
|
303 |
result.push(""); |
|
304 |
} |
|
305 |
|
|
306 |
|
|
307 |
//result.push(resData.embargoenddate); |
|
308 |
|
|
309 |
if(resData['bestlicense'].hasOwnProperty("classid")) { |
|
310 |
result.push(this.quote(resData['bestlicense'].classid)); |
|
311 |
} else { |
|
312 |
result.push(""); |
|
313 |
} |
|
314 |
|
|
315 |
results.push(result); |
|
316 |
} |
|
317 |
|
|
318 |
return results; |
|
319 |
} |
|
320 |
|
|
205 | 321 |
numOfEntityPublications(id: string, entity: string):any { |
206 | 322 |
|
207 | 323 |
//OpenaireProperties.getSearchAPIURL() |
... | ... | |
233 | 349 |
this._cache.set(key, res); |
234 | 350 |
}); |
235 | 351 |
} |
352 |
|
|
353 |
private quote(word: any): string { |
|
354 |
return '"'+word+'"'; |
|
355 |
} |
|
236 | 356 |
} |
modules/uoa-services-portal/trunk/portal-2/src/app/searchPages/searchUtils/searchResult.component.ts | ||
---|---|---|
75 | 75 |
</span> |
76 | 76 |
</div> |
77 | 77 |
<span *ngIf="result.startYear && result.endYear"> ({{result.startYear}} - {{result.endYear}})</span> |
78 |
<div *ngIf="result['organizations'] != undefined"> |
|
78 |
<div *ngIf="result['organizations'] != undefined && result['organizations'].length > 0">
|
|
79 | 79 |
<span> Organizations: </span> |
80 | 80 |
<span *ngFor="let organization of result['organizations'] let i=index"> |
81 | 81 |
<a *ngIf="organization.url != undefined" href="{{organization.url}}"> |
... | ... | |
110 | 110 |
Compatibility: {{result.compatibility}} |
111 | 111 |
</div> |
112 | 112 |
|
113 |
<div *ngIf="result['countries'] != undefined"> |
|
113 |
<div *ngIf="result['countries'] != undefined && result['countries'].length > 0">
|
|
114 | 114 |
Countries: {{result.countries}} |
115 | 115 |
</div> |
116 | 116 |
|
modules/uoa-services-portal/trunk/portal-2/src/app/searchPages/dataProviders/entityRegistries.component.ts | ||
---|---|---|
9 | 9 |
import {SearchFields} from '../../utils/properties/searchFields'; |
10 | 10 |
import {SearchPageComponent } from '../searchUtils/searchPage.component'; |
11 | 11 |
import {SearchUtilsClass } from '../searchUtils/searchUtils.class'; |
12 |
import {ExportCSVComponent} from '../../utils/exportCSV.component'; |
|
12 | 13 |
|
13 |
|
|
14 | 14 |
@Component({ |
15 | 15 |
selector: 'search-entity-registries', |
16 | 16 |
template: ` |
17 | 17 |
|
18 | 18 |
<search-page pageTitle="Entity Registries" type="datasource" [(filters)] = "filters" |
19 | 19 |
[(results)] = "results" [(searchUtils)] = "searchUtils" |
20 |
[baseUrl] = "baseUrl" [showResultCount]=false (queryChange)="queryChanged($event)" > |
|
20 |
[baseUrl] = "baseUrl" [showResultCount]=false (queryChange)="queryChanged($event)" |
|
21 |
(downloadClick)="downloadClicked($event)"> |
|
21 | 22 |
</search-page> |
22 | 23 |
|
23 | 24 |
` |
... | ... | |
38 | 39 |
{field:"type",opName:"tp",opValue:"and",values: ["other"]}]; |
39 | 40 |
// ["entityregistry","entityregistry::projects","entityregistry::repositories"]}]; |
40 | 41 |
private _prefixQuery: string = ""; |
42 |
|
|
43 |
private CSV: any = { "columnNames": [ "Title", "Type", "Coutries", "Compatibility" ], |
|
44 |
"export":[] |
|
45 |
}; |
|
46 |
private CSVDownloaded = false; |
|
47 |
|
|
41 | 48 |
@ViewChild (SearchPageComponent) searchPage : SearchPageComponent ; |
42 | 49 |
|
43 | 50 |
constructor (private route: ActivatedRoute, private _searchDataprovidersService: SearchDataprovidersService ) { |
... | ... | |
136 | 143 |
return filters; |
137 | 144 |
} |
138 | 145 |
|
146 |
|
|
147 |
|
|
148 |
private downloadClicked($event) { |
|
149 |
if(!this.CSVDownloaded) { |
|
150 |
this.CSVDownloaded = false; |
|
151 |
|
|
152 |
var parameters = $event.value; |
|
153 |
|
|
154 |
//this.getResultsCSV(parameters, false, 1, 1000); |
|
155 |
|
|
156 |
this._searchDataprovidersService.searchEntityRegistriesCSV(parameters, this.searchPage.getRefineFieldsQuery(), 1, 1000).subscribe( |
|
157 |
data => { |
|
158 |
this.CSV.export = data; |
|
159 |
ExportCSVComponent.downloadCSV(this.CSV, "etityRegistries.csv"); |
|
160 |
|
|
161 |
var errorCodes:ErrorCodes = new ErrorCodes(); |
|
162 |
this.searchUtils.status = errorCodes.DONE; |
|
163 |
}, |
|
164 |
err => { |
|
165 |
console.error(err); |
|
166 |
//TODO check erros (service not available, bad request) |
|
167 |
// if( ){ |
|
168 |
// this.searchUtils.status = ErrorCodes.ERROR; |
|
169 |
// } |
|
170 |
var errorCodes:ErrorCodes = new ErrorCodes(); |
|
171 |
this.searchUtils.status = errorCodes.ERROR; |
|
172 |
} |
|
173 |
); |
|
174 |
} |
|
175 |
} |
|
139 | 176 |
} |
modules/uoa-services-portal/trunk/portal-2/src/app/searchPages/dataProviders/compatibleDataProviders.component.ts | ||
---|---|---|
9 | 9 |
import {SearchFields} from '../../utils/properties/searchFields'; |
10 | 10 |
import {SearchPageComponent } from '../searchUtils/searchPage.component'; |
11 | 11 |
import {SearchUtilsClass } from '../searchUtils/searchUtils.class'; |
12 |
import {ExportCSVComponent} from '../../utils/exportCSV.component'; |
|
12 | 13 |
|
13 | 14 |
@Component({ |
14 | 15 |
selector: 'search-dataproviders', |
... | ... | |
16 | 17 |
|
17 | 18 |
<search-page pageTitle="Compatible Dataproviders" type="datasource" [(filters)] = "filters" |
18 | 19 |
[(results)] = "results" [(searchUtils)] = "searchUtils" |
19 |
[baseUrl] = "baseUrl" [showResultCount]=false (queryChange)="queryChanged($event)" > |
|
20 |
[baseUrl] = "baseUrl" [showResultCount]=false (queryChange)="queryChanged($event)" |
|
21 |
(downloadClick)="downloadClicked($event)"> |
|
20 | 22 |
</search-page> |
21 | 23 |
<!--table-view [(datasources)] = results></table-view--> |
22 | 24 |
|
... | ... | |
38 | 40 |
private _prefixQueryFields: {field:string,opName:string,opValue:string,values:string[]}[] =[{field:"compatibility",opName:"cm",opValue:"not", values:["UNKNOWN","hostedBy","notCompatible"]},{field:"type",opName:"tp",opValue:"not",values: ["other"]}]; |
39 | 41 |
// ["entityregistry","entityregistry::projects","entityregistry::repositories"]}]; |
40 | 42 |
private _prefixQuery: string = ""; |
43 |
|
|
44 |
private CSV: any = { "columnNames": [ "Title", "Type", "Coutries", "Compatibility" ], |
|
45 |
"export":[] |
|
46 |
}; |
|
47 |
private CSVDownloaded = false; |
|
48 |
|
|
41 | 49 |
@ViewChild (SearchPageComponent) searchPage : SearchPageComponent ; |
42 | 50 |
|
43 | 51 |
constructor (private route: ActivatedRoute, private _searchDataprovidersService: SearchDataprovidersService ) { |
... | ... | |
140 | 148 |
return filters; |
141 | 149 |
} |
142 | 150 |
|
151 |
private downloadClicked($event) { |
|
152 |
if(!this.CSVDownloaded) { |
|
153 |
this.CSVDownloaded = false; |
|
154 |
|
|
155 |
var parameters = $event.value; |
|
156 |
|
|
157 |
//this.getResultsCSV(parameters, false, 1, 1000); |
|
158 |
|
|
159 |
this._searchDataprovidersService.searchCompatibleDataprovidersCSV(parameters,this.searchPage.getRefineFieldsQuery(), 1, 1000).subscribe( |
|
160 |
data => { |
|
161 |
this.CSV.export = data; |
|
162 |
ExportCSVComponent.downloadCSV(this.CSV, "compatibleDataproviders.csv"); |
|
163 |
|
|
164 |
var errorCodes:ErrorCodes = new ErrorCodes(); |
|
165 |
this.searchUtils.status = errorCodes.DONE; |
|
166 |
}, |
|
167 |
err => { |
|
168 |
console.error(err); |
|
169 |
//TODO check erros (service not available, bad request) |
|
170 |
// if( ){ |
|
171 |
// this.searchUtils.status = ErrorCodes.ERROR; |
|
172 |
// } |
|
173 |
var errorCodes:ErrorCodes = new ErrorCodes(); |
|
174 |
this.searchUtils.status = errorCodes.ERROR; |
|
175 |
} |
|
176 |
); |
|
177 |
} |
|
178 |
} |
|
179 |
|
|
143 | 180 |
} |
modules/uoa-services-portal/trunk/portal-2/src/app/searchPages/simple/searchPublications.component.ts | ||
---|---|---|
10 | 10 |
import {SearchFields} from '../../utils/properties/searchFields'; |
11 | 11 |
import {SearchPageComponent } from '../searchUtils/searchPage.component'; |
12 | 12 |
import {SearchUtilsClass} from '../searchUtils/searchUtils.class'; |
13 |
import {ExportCSVComponent} from '../../utils/exportCSV.component'; |
|
13 | 14 |
|
14 | 15 |
@Component({ |
15 | 16 |
selector: 'search-publications', |
... | ... | |
17 | 18 |
|
18 | 19 |
<search-page pageTitle="Search Publications" type="publication" [(filters)] = "filters" |
19 | 20 |
[(results)] = "results" |
20 |
[(searchUtils)] = "searchUtils" [(baseUrl)] = baseUrl (queryChange)="queryChanged($event)" > |
|
21 |
[(searchUtils)] = "searchUtils" [(baseUrl)] = baseUrl |
|
22 |
(queryChange)="queryChanged($event)" (downloadClick)="downloadClicked($event)"> |
|
21 | 23 |
</search-page> |
22 | 24 |
|
23 | 25 |
` |
... | ... | |
39 | 41 |
@ViewChild (SearchPageComponent) searchPage : SearchPageComponent ; |
40 | 42 |
private _location:Location; |
41 | 43 |
|
44 |
private CSV: any = { "columnNames": ["Title", "Authors", "Publication Year", "DOI", |
|
45 |
/*"Download From", "Publication type", "Journal",*/ |
|
46 |
"Funder", "Project Name (GA Number)", "Access"], |
|
47 |
"export":[] |
|
48 |
}; |
|
49 |
private CSVDownloaded = false; |
|
50 |
|
|
42 | 51 |
constructor (private route: ActivatedRoute, private _searchPublicationsService: SearchPublicationsService ) { |
43 | 52 |
var errorCodes:ErrorCodes = new ErrorCodes(); |
44 | 53 |
this.searchUtils.status =errorCodes.LOADING; |
... | ... | |
211 | 220 |
this._getResults(parameters, true, this.searchUtils.page, this.searchUtils.size); |
212 | 221 |
} |
213 | 222 |
|
223 |
private downloadClicked($event) { |
|
224 |
if(!this.CSVDownloaded) { |
|
225 |
this.CSVDownloaded = false; |
|
214 | 226 |
|
227 |
var parameters = $event.value; |
|
228 |
|
|
229 |
//this.getResultsCSV(parameters, false, 1, 1000); |
|
230 |
|
|
231 |
this._searchPublicationsService.searchPublicationsCSV(parameters, this.searchPage.getRefineFieldsQuery(), 1, 1000).subscribe( |
|
232 |
data => { |
|
233 |
this.CSV.export = data; |
|
234 |
ExportCSVComponent.downloadCSV(this.CSV, "publications.csv"); |
|
235 |
|
|
236 |
var errorCodes:ErrorCodes = new ErrorCodes(); |
|
237 |
this.searchUtils.status = errorCodes.DONE; |
|
238 |
}, |
|
239 |
err => { |
|
240 |
console.error(err); |
|
241 |
//TODO check erros (service not available, bad request) |
|
242 |
// if( ){ |
|
243 |
// this.searchUtils.status = ErrorCodes.ERROR; |
|
244 |
// } |
|
245 |
var errorCodes:ErrorCodes = new ErrorCodes(); |
|
246 |
this.searchUtils.status = errorCodes.ERROR; |
|
247 |
} |
|
248 |
); |
|
249 |
|
|
250 |
} |
|
251 |
} |
|
252 |
|
|
215 | 253 |
} |
modules/uoa-services-portal/trunk/portal-2/src/app/landingPages/dataProvider/tabs.component.ts | ||
---|---|---|
9 | 9 |
@Component({ |
10 | 10 |
selector: 'tabs', |
11 | 11 |
template: ` |
12 |
<ul class="nav nav-tabs"> |
|
12 |
<ul *ngIf="tabs != undefined" class="nav nav-tabs">
|
|
13 | 13 |
<li *ngIf="tabs.length>0" class="active"> |
14 | 14 |
<a *ngIf="tabs[0].content=='publicationsTab' || tabs[0].content=='datasetsTab'" |
15 | 15 |
data-toggle="tab" href="#{{tabs[0].content}}"> |
... | ... | |
37 | 37 |
</li> |
38 | 38 |
</ul> |
39 | 39 |
|
40 |
<div class="tab-content"> |
|
40 |
<div *ngIf="tabs != undefined" class="tab-content">
|
|
41 | 41 |
<div *ngIf="tabs.length>0" id="{{tabs[0].content}}" class="tab-pane fade in active panel-body"> |
42 | 42 |
<div *ngIf="tabs[0].content=='publicationsTab' || tabs[0].content=='datasetsTab'"> |
43 | 43 |
|
... | ... | |
111 | 111 |
} |
112 | 112 |
|
113 | 113 |
ngOnInit() { |
114 |
if(this.tabs != []) {
|
|
114 |
if(this.tabs != undefined && this.tabs.length > 0) {
|
|
115 | 115 |
this.search(this.tabs[0].content); |
116 | 116 |
} |
117 | 117 |
|
modules/uoa-services-portal/trunk/portal-2/src/app/deposit/depositResult.component.ts | ||
---|---|---|
40 | 40 |
<search-result [(results)]="searchDataprovidersComponent.results" [(status)]= "searchDataprovidersComponent.status"></search-result> |
41 | 41 |
</div> |
42 | 42 |
|
43 |
<div *ngIf="(searchDataprovidersComponent.status == errorCodes.NONE && status == errorCodes.DONE)
|
|
44 |
|| status == errorCodes.NONE" class = "alert alert-warning"> |
|
43 |
<div *ngIf="(searchDataprovidersComponent.searchUtils.totalResults == 0 && status == errorCodes.DONE)
|
|
44 |
|| status == errorCodes.NONE || status == errorCodes.ERROR" class = "alert alert-warning">
|
|
45 | 45 |
<div *ngIf="organization != undefined"> |
46 | 46 |
No data providers found |
47 | 47 |
<span *ngIf="organization != undefined"> |
... | ... | |
53 | 53 |
</span> |
54 | 54 |
. |
55 | 55 |
</div> |
56 |
<div *ngIf="organization == undefined"> |
|
56 |
<div *ngIf="organization == undefined && organizationId != ''">
|
|
57 | 57 |
No organization with ID: {{organizationId}} found. |
58 | 58 |
</div> |
59 |
<div *ngIf="organizationId == ''"> |
|
60 |
No ID for organization. |
|
61 |
</div> |
|
59 | 62 |
|
60 | 63 |
You can still deposit your publications and/or research data in |
61 | 64 |
<a href="{{zenodo}}">OpenAIRE's Zenodo catch-all repository </a> |
... | ... | |
67 | 70 |
|
68 | 71 |
export class DepositResultComponent { |
69 | 72 |
private organization: {"name": string, "url": string}; |
70 |
private organizationId: string; |
|
73 |
private organizationId: string = "";
|
|
71 | 74 |
|
72 | 75 |
private status: number; |
73 | 76 |
private errorCodes:ErrorCodes = new ErrorCodes(); |
... | ... | |
105 | 108 |
}); |
106 | 109 |
} |
107 | 110 |
|
111 |
ngDoCheck() { |
|
112 |
if(this.organizationId == "" || this.organizationId == undefined) { |
|
113 |
this.organizationId = ""; |
|
114 |
this.status = this.errorCodes.ERROR; |
|
115 |
} |
|
116 |
} |
|
117 |
|
|
108 | 118 |
ngOnDestroy() { |
109 | 119 |
this.sub.unsubscribe(); |
110 | 120 |
if(this.subDataproviders != undefined) { |
Also available in: Unified diff
Deposit Results Page: messages fixed | compatibility, countries info added in Search Dataproviders Page | Dataproviders landing page: no tabs for unknown types | CSV (problem with double quotes) added in Compatible Dataproviders, Entity Registries, Search Publications pages