Deposit Data:search via classifications | use properties file for urls |clean files| add subjects in datasource results (optional)

git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-portal/trunk@47343 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
argiro.kokogiannaki 2017-05-24 11:52:25 +00:00
parent 3e74bc8d16
commit e3fcb87e9a
31 changed files with 510 additions and 297 deletions

View File

@ -29,7 +29,10 @@ export function getDepositDatasetsResultsModule() {
return System.import('./deposit/datasets/depositDatasetsResults.module' + (process.env.AOT ? '.ngfactory' : '')) return System.import('./deposit/datasets/depositDatasetsResults.module' + (process.env.AOT ? '.ngfactory' : ''))
.then(mod => mod[(process.env.AOT ? 'DepositDatasetsResultsModuleNgFactory' : 'DepositDatasetsResultsModule')]); .then(mod => mod[(process.env.AOT ? 'DepositDatasetsResultsModuleNgFactory' : 'DepositDatasetsResultsModule')]);
} }
export function getDepositBySubjectResultsModule() {
return System.import('./deposit/datasets/depositBySubjectResults.module' + (process.env.AOT ? '.ngfactory' : ''))
.then(mod => mod[(process.env.AOT ? 'DepositBySubjectResultsModuleNgFactory' : 'DepositBySubjectResultsModule')]);
}
export function getDepositPublicationsModule() { export function getDepositPublicationsModule() {
return System.import('./deposit/publications/depositPublications.module' + (process.env.AOT ? '.ngfactory' : '')) return System.import('./deposit/publications/depositPublications.module' + (process.env.AOT ? '.ngfactory' : ''))
.then(mod => mod[(process.env.AOT ? 'DepositPublicationsModuleNgFactory' : 'DepositPublicationsModule')]); .then(mod => mod[(process.env.AOT ? 'DepositPublicationsModuleNgFactory' : 'DepositPublicationsModule')]);
@ -146,6 +149,7 @@ export function getUserModule() {
{ path: 'search/dataprovider', loadChildren: getDataProviderModule }, { path: 'search/dataprovider', loadChildren: getDataProviderModule },
{ path: 'participate/deposit-datasets', loadChildren: getDepositDatasetsModule }, { path: 'participate/deposit-datasets', loadChildren: getDepositDatasetsModule },
{ path: 'participate/deposit-datasets-result', loadChildren: getDepositDatasetsResultsModule }, { path: 'participate/deposit-datasets-result', loadChildren: getDepositDatasetsResultsModule },
{ path: 'participate/deposit-subject-result', loadChildren: getDepositBySubjectResultsModule },
{ path: 'participate/deposit-publications', loadChildren: getDepositPublicationsModule }, { path: 'participate/deposit-publications', loadChildren: getDepositPublicationsModule },
{ path: 'participate/deposit-publications-result', loadChildren: getDepositPublicationsResultsModule }, { path: 'participate/deposit-publications-result', loadChildren: getDepositPublicationsResultsModule },
{ path: 'search/find', loadChildren: getMainSearchModule }, { path: 'search/find', loadChildren: getMainSearchModule },
@ -171,6 +175,8 @@ export function getUserModule() {
{ path: 'claims-project-manager', loadChildren: getClaimsByTokenModule }, { path: 'claims-project-manager', loadChildren: getClaimsByTokenModule },
{ path: 'user-info', loadChildren: getUserModule }, { path: 'user-info', loadChildren: getUserModule },
]) ])
], ],
}) })

View File

@ -23,7 +23,7 @@
<div *ngIf="crossrefStatus == errorCodes.NOT_AVAILABLE" class="uk-alert uk-alert-danger" role="alert">Service not available</div> <div *ngIf="crossrefStatus == errorCodes.NOT_AVAILABLE" class="uk-alert uk-alert-danger" role="alert">Service not available</div>
<div *ngIf="crossrefResultsNum != null && crossrefResultsNum > 0" class="uk-clearfix"> <div *ngIf="crossrefResultsNum != null && crossrefResultsNum > 0" class="uk-clearfix">
<div class="uk-float-right"> <div class="uk-float-right">
<paging-no-load [currentPage]="crossrefPage" [totalResults]="crossrefResultsNum" [navigateTo]="navigateTo" [term]="keyword" [size]="size" (pageChange)="crossrefPageChange($event)"> </paging-no-load> <paging-no-load [currentPage]="crossrefPage" [totalResults]="crossrefResultsNum" [term]="keyword" [size]="size" (pageChange)="crossrefPageChange($event)"> </paging-no-load>
</div> </div>
</div> </div>
<div > <div >
@ -50,7 +50,7 @@
<div *ngIf="openairePubsStatus == errorCodes.NOT_AVAILABLE" class="uk-alert uk-alert-danger" role="alert">Service not available</div> <div *ngIf="openairePubsStatus == errorCodes.NOT_AVAILABLE" class="uk-alert uk-alert-danger" role="alert">Service not available</div>
<div *ngIf="openairePubsNum != null && openairePubsNum > 0" class="uk-clearfix"> <div *ngIf="openairePubsNum != null && openairePubsNum > 0" class="uk-clearfix">
<div class="uk-float-right"> <div class="uk-float-right">
<paging-no-load [currentPage]="openairePubsPage" [totalResults]="openairePubsNum" [navigateTo]="navigateTo" [term]="keyword" [size]="size" (pageChange)="openairePubsPageChange($event)"> </paging-no-load> <paging-no-load [currentPage]="openairePubsPage" [totalResults]="openairePubsNum" [term]="keyword" [size]="size" (pageChange)="openairePubsPageChange($event)"> </paging-no-load>
</div> </div>
</div> </div>
<div > <div >
@ -95,7 +95,7 @@
<div *ngIf=" ((orcidResultsNum >0) && (totalPages > 1) && ( 0 < page && page <= totalPages )) " class="uk-clearfix"> <div *ngIf=" ((orcidResultsNum >0) && (totalPages > 1) && ( 0 < page && page <= totalPages )) " class="uk-clearfix">
<div class="uk-float-right"> <div class="uk-float-right">
<paging-no-load [currentPage]="orcidPage" [totalResults]="orcidResultsNum" [navigateTo]="navigateTo" [term]="keyword" [size]="size" (pageChange)="orcidPageChange($event)"> </paging-no-load> <paging-no-load [currentPage]="orcidPage" [totalResults]="orcidResultsNum" [term]="keyword" [size]="size" (pageChange)="orcidPageChange($event)"> </paging-no-load>
</div> </div>
</div> </div>
@ -124,7 +124,7 @@
<div class = "uk-margin-top"> <div class = "uk-margin-top">
<div *ngIf="dataciteResultsNum != null && dataciteResultsNum > 0" class="uk-clearfix"> <div *ngIf="dataciteResultsNum != null && dataciteResultsNum > 0" class="uk-clearfix">
<div class="uk-float-right"> <div class="uk-float-right">
<paging-no-load [currentPage]="datacitePage" [totalResults]="dataciteResultsNum" [navigateTo]="navigateTo" [term]="keyword" [size]="size" (pageChange)="datacitePageChange($event)"> </paging-no-load> <paging-no-load [currentPage]="datacitePage" [totalResults]="dataciteResultsNum" [term]="keyword" [size]="size" (pageChange)="datacitePageChange($event)"> </paging-no-load>
</div> </div>
</div> </div>
<div > <div >
@ -154,7 +154,7 @@
<div class = "uk-margin-top"> <div class = "uk-margin-top">
<div *ngIf="openaireDataNum != null && openaireDataNum > 0" class="uk-clearfix"> <div *ngIf="openaireDataNum != null && openaireDataNum > 0" class="uk-clearfix">
<div class="uk-float-right"> <div class="uk-float-right">
<paging-no-load [currentPage]="openaireDataPage" [totalResults]="openaireDataNum" [navigateTo]="navigateTo" [term]="keyword" [size]="size" (pageChange)="openaireDataPageChange($event)"> </paging-no-load> <paging-no-load [currentPage]="openaireDataPage" [totalResults]="openaireDataNum" [term]="keyword" [size]="size" (pageChange)="openaireDataPageChange($event)"> </paging-no-load>
</div> </div>
</div> </div>
<div > <div >

View File

@ -16,7 +16,7 @@
<div class="searchPaging uk-panel uk-margin-top" data-uk-grid-margin=""> <div class="searchPaging uk-panel uk-margin-top" data-uk-grid-margin="">
<div *ngIf="resultsNum" class="uk-float-right"> <div *ngIf="resultsNum" class="uk-float-right">
<paging-no-load [currentPage]="page" [totalResults]="resultsNum" [navigateTo]="navigateTo" [params]="getParameters()" [size]="size" (pageChange)="pageChange($event)"> </paging-no-load> <paging-no-load [currentPage]="page" [totalResults]="resultsNum" [size]="size" (pageChange)="pageChange($event)"> </paging-no-load>
</div> </div>
<div *ngIf="resultsNum>0" class="uk-width-1-2"> <div *ngIf="resultsNum>0" class="uk-width-1-2">

View File

@ -345,7 +345,7 @@ export class DisplayClaimsComponent {
this.deleteMessage=""; this.deleteMessage="";
} }
} }
isSelected(id:string){ isSelected(id:string){
for (var _i = 0; _i < this.selected.length; _i++) { for (var _i = 0; _i < this.selected.length; _i++) {
let claim = this.selected[_i]; let claim = this.selected[_i];

View File

@ -1,39 +0,0 @@
import {Injectable} from '@angular/core';
import {Jsonp, URLSearchParams,ResponseOptions, RequestOptions, Headers} from '@angular/http';
import {Http, Response} from '@angular/http';
import {Observable} from 'rxjs/Observable';
import {OpenaireProperties} from '../../../utils/properties/openaireProperties';
import 'rxjs/add/observable/of';
import 'rxjs/add/operator/do';
import 'rxjs/add/operator/share';
@Injectable()
export class DirectIndexClaimService {
private baseUrl;
constructor(private jsonp: Jsonp, private http: Http) {
this.baseUrl = OpenaireProperties.getClaimsAPIURL();
}
public directClaim(record:any):any {
console.log("in direct claim service");
let url = "http://beta.services.openaire.eu:8280/is/mvc/api/publications/feedObject";
// let body = JSON.stringify( record );
// console.warn('Direct Json body: : '+body);
console.warn('Direct Json record: : '+record);
let headers = new Headers({ 'Content-Type': 'application/json' });
let options = new RequestOptions({ headers: headers });
return this.http.post(url, record, options)
.map(res => res.json())
.do(request => console.info("DirectClaim Response:"+request) )
.catch(this.handleError);
}
private handleError (error: Response) {
// in a real world app, we may send the error to some remote logging infrastructure
// instead of just logging it to the console
console.log(error);
return Observable.throw(error || 'Server error');
}
}

View File

@ -3,6 +3,7 @@ import {Observable} from 'rxjs/Observable';
import {SearchCrossrefService} from '../../claim-utils/service/searchCrossref.service'; import {SearchCrossrefService} from '../../claim-utils/service/searchCrossref.service';
import {ModalLoading} from '../../../utils/modal/loading.component'; import {ModalLoading} from '../../../utils/modal/loading.component';
import {Dates, DOI} from '../../../utils/string-utils.class'; import {Dates, DOI} from '../../../utils/string-utils.class';
import {OpenaireProperties} from '../../../utils/properties/openaireProperties';
@Component({ @Component({
@ -96,7 +97,7 @@ export class BulkClaimComponent {
} }
this.loading.open(); this.loading.open();
this.makeFileRequest("http://localhost:8000/upload", [], this.filesToUpload).then((result) => { this.makeFileRequest(OpenaireProperties.getUploadServiceUrl(), [], this.filesToUpload).then((result) => {
var rows = (result as any).split('\n'); // I have used space, you can use any thing. var rows = (result as any).split('\n'); // I have used space, you can use any thing.
var i = 0; var i = 0;
this.duplicateIds = []; this.duplicateIds = [];
@ -206,7 +207,7 @@ export class BulkClaimComponent {
} }
endOfFetching(){ endOfFetching(){
if(this.allIds.length == this.foundIds.length+this.notFoundIds.length+ this.duplicateIds.length+this.noValidIds.length ){ if(this.allIds.length == this.foundIds.length+this.notFoundIds.length+ this.duplicateIds.length ){
this.showReport = true; this.showReport = true;
this.enableUpload = true; this.enableUpload = true;
this.loading.close(); this.loading.close();

View File

@ -2,8 +2,7 @@ import {Component, Input, Output, EventEmitter, ViewChild} from '@angular/core';
import {Observable} from 'rxjs/Observable'; import {Observable} from 'rxjs/Observable';
import {Router} from '@angular/router'; import {Router} from '@angular/router';
import {ClaimsService} from '../../claim-utils/service/claims.service'; import {ClaimsService} from '../../claim-utils/service/claims.service';
import {DirectIndexClaimService} from '../../claim-utils/service/directIndexClaim.service';
import {ModalLoading} from '../../../utils/modal/loading.component'; import {ModalLoading} from '../../../utils/modal/loading.component';
import {AlertModal} from '../../../utils/modal/alert'; import {AlertModal} from '../../../utils/modal/alert';
import {Md5} from 'ts-md5/dist/md5'; import {Md5} from 'ts-md5/dist/md5';
@ -29,7 +28,7 @@ import {ErrorCodes} from '../../../login/utils/guardHelper.class';
` `
}) })
export class ClaimInsertComponent { export class ClaimInsertComponent {
constructor (private claimService: ClaimsService,private directIndexClaimService:DirectIndexClaimService, private _router:Router) {} constructor (private claimService: ClaimsService, private _router:Router) {}
ngOnInit() { ngOnInit() {
// console.info("Inlineentity:" +(this.inlineEntity)?this.inlineEntity+(this.inlineEntity.id)?this.inlineEntity.id:"no id":"null"+ + " show "+ (!this.claiming && this.showButton) ); // console.info("Inlineentity:" +(this.inlineEntity)?this.inlineEntity+(this.inlineEntity.id)?this.inlineEntity.id:"no id":"null"+ + " show "+ (!this.claiming && this.showButton) );
} }
@ -62,13 +61,13 @@ public validateInsertions(){
// console.info("Inlineentity:" +(this.inlineEntity)?this.inlineEntity+(this.inlineEntity.id)?this.inlineEntity.id:"no id":"null"+ + " show "+ (!this.claiming && this.showButton) ); // console.info("Inlineentity:" +(this.inlineEntity)?this.inlineEntity+(this.inlineEntity.id)?this.inlineEntity.id:"no id":"null"+ + " show "+ (!this.claiming && this.showButton) );
if(this.validate()){ if(this.validate()){
if(this.validateDates()){ if(this.validateDates()){
this.insert(); this.insertActions();
return true; return true;
} }
} }
return return
} }
private insert(){ private insertActions(){
this.servicesRespond = 0; this.servicesRespond = 0;
this.insertedClaims=[]; this.insertedClaims=[];
this.errorInClaims=[]; this.errorInClaims=[];
@ -86,81 +85,86 @@ private insert(){
this._router.navigate(['/user-info'], { queryParams: { "errorCode": ErrorCodes.NOT_VALID, "redirectUrl": this._router.url} }); this._router.navigate(['/user-info'], { queryParams: { "errorCode": ErrorCodes.NOT_VALID, "redirectUrl": this._router.url} });
}else{ }else{
this.claiming = true; this.claiming = true;
var user=Session.getUserEmail(); var user=Session.getUserEmail();
var token=Session.getUserJwt(); var token=Session.getUserJwt();
this.loading.open(); this.loading.open();
var claims = []; var claims = [];
var directclaims = []; var directclaims = [];
if(this.results){ if(this.results){
console.info("results: "+this.results.length); console.info("results: "+this.results.length);
for (var i = 0; i < this.results.length; i++) {
var result=this.results[i];
if(["crossref","datacite","orcid"].indexOf(result.source) != -1){
directclaims.push({"id":result.id, "record":this.createDirectClaim(result,this.projects,this.contexts)});
}
if(this.contexts){
for (var j = 0; j < this.contexts.length; j++) {
var context = this.contexts[j];
var claim = this.createContextClaim(result, context, user);
claims.push(claim);
}
}
if(this.projects){
for (var k = 0; k < this.projects.length; k++) {
var project = this.projects[k];
var projectClaim = this.createProjectClaim(result, project, user);
claims.push(projectClaim);
}
}
if(this.inlineEntity != null){
var resultClaim = this.createResultClaim(this.inlineEntity, result, user);
claims.push(resultClaim);
}
for (var i = 0; i < this.results.length; i++) {
var result=this.results[i];
if(["crossref","datacite","orcid"].indexOf(result.source) != -1){
directclaims.push({"id":result.id, "record":this.createDirectClaim(result,this.projects,this.contexts)});
} }
if(this.contexts){ }
for (var j = 0; j < this.contexts.length; j++) { //first call direct index service - when call is done (success or error) call isertBulkClaims method to insert claims in DB
var context = this.contexts[j]; console.info("\n\ndirectclaims: "+directclaims.length+"\n\n");
var claim = this.createContextClaim(result, context, user); this.claimService.insertDirectRecords(directclaims,token).subscribe(
claims.push(claim); data => {
this.insertedRecords = data.insertedIds;
this.errorInRecords = data.errorInClaims;
this.isertBulkClaims(claims,token);
},
err => {
err=err.json();
if(err.insertedIds && err.insertedIds.length >0){
this.insertedRecords = err.insertedIds;
} }
} if(err.errorInClaims && err.errorInClaims.length >0){
if(this.projects){ this.errorInRecords = err.errorInClaims;
for (var k = 0; k < this.projects.length; k++) {
var project = this.projects[k];
var projectClaim = this.createProjectClaim(result, project, user);
claims.push(projectClaim);
} }
this.isertBulkClaims(claims,token);
} }
if(this.inlineEntity != null){ );
var resultClaim = this.createResultClaim(this.inlineEntity, result, user);
claims.push(resultClaim);
}
}
}
console.info("\n\ndirectclaims: "+directclaims.length+"\n\n");
this.claimService.insertDirectRecords(directclaims,token).subscribe(
data => {
this.insertedRecords = data.insertedIds;
this.errorInRecords = data.errorInClaims;
this.afterclaimsInsertion();
},
err => {
err=err.json();
if(err.insertedIds && err.insertedIds.length >0){
this.insertedRecords = err.insertedIds;
}
if(err.errorInClaims && err.errorInClaims.length >0){
this.errorInRecords = err.errorInClaims;
}
this.afterclaimsInsertion();
}
);
console.info("try to insert "+claims.length+" claims");
this.claimService.insertBulkClaims(claims,token).subscribe(
data => {
this.insertedClaims = data.insertedIds;
this.errorInClaims = data.errorInClaims;
this.afterclaimsInsertion();
},
err => {
err=err.json();
if(err.insertedIds && err.insertedIds.length >0){
this.insertedClaims = err.insertedIds;
}
if(err.errorInClaims && err.errorInClaims.length >0){
this.errorInClaims = err.errorInClaims;
}
this.afterclaimsInsertion();
}
);
} }
} }
private isertBulkClaims(claims,token){
console.info("try to insert "+claims.length+" claims");
this.claimService.insertBulkClaims(claims,token).subscribe(
data => {
this.insertedClaims = data.insertedIds;
this.errorInClaims = data.errorInClaims;
this.afterclaimsInsertion();
},
err => {
err=err.json();
if(err.insertedIds && err.insertedIds.length >0){
this.insertedClaims = err.insertedIds;
}
if(err.errorInClaims && err.errorInClaims.length >0){
this.errorInClaims = err.errorInClaims;
}
this.afterclaimsInsertion();
}
);
}
private validate(){ private validate(){
this.warningMessage = ""; this.warningMessage = "";
this.errorMessage = ""; this.errorMessage = "";
@ -214,8 +218,8 @@ private validateDates(){
} }
private afterclaimsInsertion(){ private afterclaimsInsertion(){
this.servicesRespond++; // this.servicesRespond++;
if(this.servicesRespond == 2){ // if(this.servicesRespond == 2){
this.loading.close(); this.loading.close();
this.claiming = false; this.claiming = false;
@ -228,7 +232,7 @@ private afterclaimsInsertion(){
}else{ }else{
this.errorsInClaimsInsertion(); this.errorsInClaimsInsertion();
} }
} // }
} }
private errorsInClaimsInsertion(){ private errorsInClaimsInsertion(){
this.errorMessage = ""; this.errorMessage = "";
@ -360,6 +364,6 @@ createDirectClaim(result, projects, contexts){
this.alert.open(); this.alert.open();
} }
confirmClose(data){ confirmClose(data){
this.insert(); this.insertActions();
} }
} }

View File

@ -5,14 +5,12 @@ import {AlertModalModule} from '../../../utils/modal/alertModal.module';
import {LoadingModalModule} from '../../../utils/modal/loadingModal.module'; import {LoadingModalModule} from '../../../utils/modal/loadingModal.module';
import {ClaimInsertComponent} from './insertClaim.component'; import {ClaimInsertComponent} from './insertClaim.component';
import {ClaimServiceModule} from '../../claim-utils/service/claimsService.module'; import {ClaimServiceModule} from '../../claim-utils/service/claimsService.module';
import {DirectIndexClaimService} from '../../claim-utils/service/directIndexClaim.service';
@NgModule({ @NgModule({
imports: [ imports: [
SharedModule, AlertModalModule, LoadingModalModule, ClaimServiceModule SharedModule, AlertModalModule, LoadingModalModule, ClaimServiceModule
], ],
declarations: [ClaimInsertComponent], declarations: [ClaimInsertComponent],
providers:[DirectIndexClaimService],
exports:[ ClaimInsertComponent] exports:[ ClaimInsertComponent]
}) })
export class InsertClaimsModule { } export class InsertClaimsModule { }

View File

@ -0,0 +1,50 @@
import {Component, Input} from '@angular/core';
import {Observable} from 'rxjs/Observable';
import { Router } from '@angular/router';
import {OpenaireProperties, ErrorCodes} from '../../utils/properties/openaireProperties';
@Component({
selector: 'deposit-by-subject',
template: `
<div class="container uk-margin-top">
<h3>Or search for Data providers via Classifications</h3>
<form class= "uk-grid">
<input type="text" [(ngModel)]="subjectKeyword" class=" uk-input uk-width-1-2" name="subject" placeholder="Search for classifications..." />
<button class=" uk-button uk-button-default" type="submit" (click)="search()" >
Search
</button>
</form>
</div>
`
})
export class DepositBySubjectComponent {
@Input() subjectKeyword: string='';
@Input() compatibility: string = '';
@Input() requestFor: string = "Publications";
public status: number;
public errorCodes:ErrorCodes = new ErrorCodes();
public selectedId: string = "";
public warningMessage: string = "";
constructor (private _router: Router) {
}
search(id: string) {
this._router.navigate( ['participate/deposit-subject-result'], { queryParams: { "q": this.subjectKeyword } } );
}
}

View File

@ -0,0 +1,15 @@
import { NgModule } from '@angular/core';
import { RouterModule } from '@angular/router';
import { DepositBySubjectResultComponent } from './depositBySubjectResult.component';
import {FreeGuard} from'../../login/freeGuard.guard';
@NgModule({
imports: [
RouterModule.forChild([
{ path: '', component: DepositBySubjectResultComponent, canActivate: [FreeGuard] }
])
]
})
export class DepositBySubjectResultsRoutingModule { }

View File

@ -0,0 +1,169 @@
import {Component, Input} from '@angular/core';
import {Observable} from 'rxjs/Observable';
import {OpenaireProperties, ErrorCodes} from '../../utils/properties/openaireProperties';
import { Router } from '@angular/router';
import { ActivatedRoute } from '@angular/router';
import { FetchDataproviders } from '../../utils/fetchEntitiesClasses/fetchDataproviders.class';
import { SearchDataprovidersService } from '../../services/searchDataproviders.service';
import {OrganizationService} from '../../services/organization.service';
import { Meta} from '../../../angular2-meta';
import {RouterHelper} from '../../utils/routerHelper.class';
@Component({
selector: 'deposit-by-subject-result',
template: `
<div class="container uk-margin-top">
<div class="page-header" >
<h2>Deposit {{requestFor}}</h2>
</div>
<div class="uk-width-1-1 uk-margin uk-padding uk-panel uk-background-muted">
<form class= "uk-margin uk-text-center uk-margin-top">
<input type="text" [(ngModel)]="subjectKeyword" class=" uk-input uk-width-1-2" name="subject" placeholder="Search for classifications..." />
<button class=" uk-button uk-button-default" type="submit" (click)="searchDataproviders()" >
Search
</button>
</form>
<div *ngIf="subject.lenght > 0" class=" uk-text-center ">
<span>Keywords: <span><a class="uk-icon-button" (click) = "subject = ''"><span aria-hidden="true" class=" clickable "><span uk-icon="icon: close" class="uk-icon"></span></span></a></span>
</span>
</div>
</div>
<div *ngIf="fetchDataproviders.searchUtils.status == errorCodes.LOADING"
class="uk-alert uk-alert-primary" role="alert">
Loading...
</div>
<div *ngIf="fetchDataproviders.searchUtils.totalResults > 0">
<p>Please use the information/contacts shown below to deposit your {{requestFor}}.</p>
<!--showDataProviders [dataProviders]=dataProviders></showDataProviders-->
<div *ngIf="fetchDataproviders.searchUtils.totalResults" class="">
<paging-no-load [currentPage]="page" [totalResults]="fetchDataproviders.searchUtils.totalResults" size=10 (pageChange)="pageChange($event)"> </paging-no-load>
</div>
<div class="" *ngIf="fetchDataproviders.results && fetchDataproviders.searchUtils.totalResults > 0">
{{fetchDataproviders.searchUtils.totalResults}} data providers, page {{fetchDataproviders.searchUtils.page}} of {{(totalPages())}}
</div>
<search-result [(results)]="fetchDataproviders.results"
type="dataprovider" urlParam="datasourceId" [showSubjects]=true >
</search-result>
</div>
<div *ngIf="fetchDataproviders.searchUtils.status == errorCodes.NONE && subject != ''" class = "uk-alert uk-alert-primary">
No Data providers found with classification "{{subject}}".
</div>
<div *ngIf="fetchDataproviders.searchUtils.status == errorCodes.ERROR && subject != ''" class = "uk-alert uk-alert-danger">
An error occured.
</div>
<div *ngIf="(fetchDataproviders.searchUtils.totalResults == 0 && fetchDataproviders.searchUtils.status == errorCodes.DONE)
|| fetchDataproviders.searchUtils.status == errorCodes.NONE || fetchDataproviders.searchUtils.status == errorCodes.ERROR" class = "uk-alert ">
You can still deposit your {{requestFor}} in
<a href="{{zenodo}}" target="_blank">OpenAIRE's Zenodo catch-all repository (<i class="custom-external"></i>)</a>
hosted by CERN.
</div>
<button class=" uk-button uk-button-default" type="submit" (click)="goToDeposit()">
<span uk-icon="icon: chevron-left"></span> Back
</button>
</div>
`
})
export class DepositBySubjectResultComponent {
public status: number;
public errorCodes:ErrorCodes = new ErrorCodes();
sub: any;
subDataproviders: any;
public fetchDataproviders : FetchDataproviders;
public routerHelper:RouterHelper = new RouterHelper();
public linkToSearchDataproviders = "";
public zenodo: string;
public page: number = 1;
@Input() compatibility: string = '';
@Input() requestFor: string = "Research Data";
@Input() subject: string = "";
constructor (private _router: Router,
private route: ActivatedRoute,
private _searchDataprovidersService: SearchDataprovidersService, private _meta: Meta) {
this.zenodo = OpenaireProperties.getZenodoURL();
this.fetchDataproviders = new FetchDataproviders(this._searchDataprovidersService);
this.status = this.errorCodes.LOADING;
this.updateTitle("Deposit "+this.requestFor);
this.updateDescription("Openaire, repositories, open access, data provider, compatibility, organization, deposit "+ this.requestFor);
}
updateDescription(description:string){
this._meta.updateMeta("description", description);
this._meta.updateMeta("og:description", description);
}
updateTitle(title:string){
var _suffix ="| OpenAIRE";
var _title = ((title.length> 50 ) ?title.substring(0,50):title) + _suffix;
this._meta.setTitle(_title );
this._meta.updateMeta("og:title",_title);
}
ngOnInit() {
console.info('depositResult init');
this.sub = this.route.queryParams.subscribe(params => {
this.subject = params['q'];
this.searchDataproviders();
});
}
totalPages(): number {
let totalPages:any = this.fetchDataproviders.searchUtils.totalResults/(this.fetchDataproviders.searchUtils.size);
if(!(Number.isInteger(totalPages))) {
totalPages = (parseInt(totalPages, 10) + 1);
}
return totalPages;
}
// ngDoCheck() {
// if(this.organizationId == "" || this.organizationId == undefined) {
// this.organizationId = "";
// this.status = this.errorCodes.ERROR;
// }
// }
ngOnDestroy() {
this.sub.unsubscribe();
if(this.subDataproviders != undefined) {
this.subDataproviders.unsubscribe();
}
}
private searchDataproviders() {
this.fetchDataproviders.getResultsBySubjectsForDeposit( (this.subject =="")?"*":this.subject, this.requestFor, this.page, 10);
this.linkToSearchDataproviders = OpenaireProperties.getLinkToSearchDataProviders();
}
goToDeposit() {
if(this.requestFor == "Publications") {
this._router.navigate( ['participate/deposit-publications'] );
} else if(this.requestFor == "Research Data") {
this._router.navigate( ['participate/deposit-datasets'] );
}
}
pageChange($event) {
this.page = +$event.value;
this.searchDataproviders();
}
}

View File

@ -0,0 +1,36 @@
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { DepositBySubjectResultComponent } from './depositBySubjectResult.component';
import {DepositBySubjectResultsRoutingModule} from './depositBySubjectResult-routing.module';
import {DepoditModule} from '../deposit.module';
import {FreeGuard} from'../../login/freeGuard.guard';
import {PagingModule } from '../../utils/paging.module';
import {DataProvidersServiceModule} from '../../services/dataProvidersService.module';
import {SearchResultsModule } from '../../searchPages/searchUtils/searchResults.module';
@NgModule({
imports: [
CommonModule, FormsModule,
DepoditModule,
DepositBySubjectResultsRoutingModule, SearchResultsModule, DataProvidersServiceModule, PagingModule
],
declarations: [
DepositBySubjectResultComponent,
],
exports: [
DepositBySubjectResultComponent,
],
providers: [FreeGuard ]
})
export class DepositBySubjectResultsModule { }

View File

@ -1,9 +1,10 @@
import {Component} from '@angular/core'; import {Component} from '@angular/core';
@Component({ @Component({
selector: 'deposit-datasets', selector: 'deposit-datasets',
template: ` template: `
<deposit [compatibility]="'openaire____::21f8a223b9925c2f87c404096080b046||Registry of Research Data Repository'" [requestFor]="'Research Data'"></deposit> <deposit [compatibility]="'openaire____::21f8a223b9925c2f87c404096080b046||Registry of Research Data Repository'" [requestFor]="'Research Data'"></deposit>
<deposit-by-subject [compatibility]="'openaire____::21f8a223b9925c2f87c404096080b046||Registry of Research Data Repository'" [requestFor]="'Research Data'" ></deposit-by-subject>
` `
}) })

View File

@ -3,6 +3,8 @@ import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms'; import { FormsModule } from '@angular/forms';
import { DepositDatasetsComponent } from './depositDatasets.component'; import { DepositDatasetsComponent } from './depositDatasets.component';
import { DepositBySubjectComponent } from './depositBySubject.component';
import { DepositDatasetsResultComponent } from './depositDatasetsResult.component'; import { DepositDatasetsResultComponent } from './depositDatasetsResult.component';
import {DepositDatasetsRoutingModule} from './depositDatasets-routing.module'; import {DepositDatasetsRoutingModule} from './depositDatasets-routing.module';
@ -17,7 +19,7 @@ import {FreeGuard} from'../../login/freeGuard.guard';
], ],
declarations: [ declarations: [
DepositDatasetsComponent, DepositDatasetsComponent, DepositBySubjectComponent
], ],
exports: [ exports: [

View File

@ -33,13 +33,13 @@ import { Meta} from '../../angular2-meta';
<h3>Locate data provider via your institution</h3> <h3>Locate data provider via your institution</h3>
<form class= ""> <form class= "uk-grid">
<span class="uk-width-1-2 "> <div class="uk-width-1-2 ">
<entities-autocomplete fieldId="organization" (click)="warningMessage = ''" [entityType]="'organization'" [depositType]=compatibility [selectedValue]=selectedId [showSelected]=true <entities-autocomplete fieldId="organization" (click)="warningMessage = ''" [entityType]="'organization'" [depositType]=compatibility [selectedValue]=selectedId [showSelected]=true
[placeHolderMessage] = "'Search for Organizations'" [title] = "'Organizations'" [multipleSelections]=false [placeHolderMessage] = "'Search for Organizations'" [title] = "'Organizations'" [multipleSelections]=false
(selectedValueChanged)="valueChanged($event)"> (selectedValueChanged)="valueChanged($event)">
</entities-autocomplete> </entities-autocomplete>
</span> </div>
<button class=" uk-button uk-button-default" type="submit" (click)="organizationSelected(selectedId)" > <button class=" uk-button uk-button-default" type="submit" (click)="organizationSelected(selectedId)" >
Locate Locate
</button> </button>

View File

@ -130,9 +130,8 @@
<dl class="uk-description-list-line"> <dl class="uk-description-list-line">
<dt class="title">Download from</dt> <dt class="title">Download from</dt>
<dd class="line" <dd class="line"
*ngFor="let key of datasetInfo.downloadFrom.keys() let i=index" *ngFor="let key of datasetInfo.downloadFrom.keys() let i=index" >
> <span *ngIf="i<5 || showAllDownloadFrom"
<div *ngIf="i<5 || showAllDownloadFrom"
class="{{datasetInfo.downloadFrom.get(key)['bestAccessMode']}}"> class="{{datasetInfo.downloadFrom.get(key)['bestAccessMode']}}">
<span class="custom-external custom-icon" data-uk-tooltip="pos:right; delay:10" <span class="custom-external custom-icon" data-uk-tooltip="pos:right; delay:10"
[title]="datasetInfo.downloadFrom.get(key)['accessMode']"> [title]="datasetInfo.downloadFrom.get(key)['accessMode']">
@ -143,7 +142,7 @@
[{{i+1}}] [{{i+1}}]
</a> </a>
</span> </span>
</div> </span>
<a *ngIf="datasetInfo.downloadFrom.get(key)['url'].length == 1" <a *ngIf="datasetInfo.downloadFrom.get(key)['url'].length == 1"
href="{{datasetInfo.downloadFrom.get(key)['url']}}" href="{{datasetInfo.downloadFrom.get(key)['url']}}"
target="_blank"> target="_blank">

View File

@ -26,6 +26,7 @@ import {ProjectService} from '../project/project.service';
export class HtmlProjectReportComponent{ export class HtmlProjectReportComponent{
public projectId: string; public projectId: string;
public totalResults: number; public totalResults: number;
public resultsType: string = "publication";
public header1: string; public header1: string;
public header2: string; public header2: string;
@ -46,6 +47,9 @@ export class HtmlProjectReportComponent{
this.sub = this.route.queryParams.subscribe(params => { this.sub = this.route.queryParams.subscribe(params => {
this.projectId = params['projectId']; this.projectId = params['projectId'];
this.totalResults = params['size']; this.totalResults = params['size'];
if(params['type'] && (params['type'] == "dataset" || params['type'] == "publication")){
this.resultsType = params['type'];
}
this.createHeaders(); this.createHeaders();
this.createClipboard(); this.createClipboard();
@ -64,7 +68,7 @@ export class HtmlProjectReportComponent{
} }
); );
this.header2 = this.totalResults+" publications"; this.header2 = this.totalResults+((this.resultsType == "publication")?" publications":" datasets");
} }
createClipboard() { createClipboard() {
@ -76,7 +80,7 @@ export class HtmlProjectReportComponent{
intro += '<body>'; intro += '<body>';
if (typeof window !== 'undefined') { if (typeof window !== 'undefined') {
this.htmlService.getHTML(this.projectId, this.totalResults).subscribe( this.htmlService.getHTML(this.projectId, this.totalResults, this.resultsType).subscribe(
data => { data => {
let body: string = intro+'<body><h1>'+this.header1+'</h1><h2>'+this.header2+'</h2>'+data+'</body></html>'; let body: string = intro+'<body><h1>'+this.header1+'</h1><h2>'+this.header2+'</h2>'+data+'</body></html>';
@ -103,7 +107,7 @@ export class HtmlProjectReportComponent{
createHeader1(data: {"title": string, "acronym": string, "callIdentifier": string}) { createHeader1(data: {"title": string, "acronym": string, "callIdentifier": string}) {
console.info(data); console.info(data);
this.header1 = "Publications of Project "; this.header1 = ((this.resultsType == "publication")?"Publications":"Datasets") + " of Project ";
if(data != undefined) { if(data != undefined) {
if(data.title != undefined && data.title != "") { if(data.title != undefined && data.title != "") {

View File

@ -9,11 +9,11 @@ export class HtmlProjectReportService {
constructor(private http: Http, public _cache: CacheService) {} constructor(private http: Http, public _cache: CacheService) {}
getHTML(id: string, size: number):any { getHTML(id: string, size: number, type:string):any {
console.info("getHTML in service"); console.info("getHTML in service");
//let url = OpenaireProperties. getSearchAPIURLLast() + 'publications/' +id+"?format=json"; //let url = OpenaireProperties. getSearchAPIURLLast() + 'publications/' +id+"?format=json";
let url = OpenaireProperties.getCsvAPIURL(); let url = OpenaireProperties.getCsvAPIURL();
url += 'resources?format=html&page=0&size='+size+'&type=publications&query=(((oaftype exact result) and (resulttypeid exact publication)) and (relprojectid exact "'+id+'"))'; url += 'resources?format=html&page=0&size='+size+'&type=publications&query=(((oaftype exact result) and (resulttypeid exact '+type+')) and (relprojectid exact "'+id+'"))';
let key = url; let key = url;
if (this._cache.has(key)) { if (this._cache.has(key)) {
return Observable.of(this._cache.get(key)); return Observable.of(this._cache.get(key));

View File

@ -174,11 +174,18 @@
</dl> </dl>
</li> </li>
<li *ngIf="fetchPublications.searchUtils.totalResults > 10"> <li *ngIf="fetchPublications.searchUtils.totalResults > 10">
<a [queryParams]="routerHelper.createQueryParams(['projectId', 'pr'], [projectId, 'and'])" View all Project <a [queryParams]="routerHelper.createQueryParams(['projectId', 'pr'], [projectId, 'and'])"
routerLinkActive="router-link-active" [routerLink]="linkToSearchPublications"> routerLinkActive="router-link-active" [routerLink]="linkToSearchPublications">
View all Project Publications Publications
</a> </a>
<span *ngIf="fetchDatasets.searchUtils.totalResults > 10">
/ <a [queryParams]="routerHelper.createQueryParams(['projectId', 'pr'], [projectId, 'and'])"
routerLinkActive="router-link-active" [routerLink]="linkToSearchDatasets">
Datasets
</a>
</span>
</li> </li>
<li> <li>
<div class="clickable" uk-toggle="target: #publications_dynamic; animation:uk-animation-fade">Dynamically incorporate publications in your site (HTML)</div> <div class="clickable" uk-toggle="target: #publications_dynamic; animation:uk-animation-fade">Dynamically incorporate publications in your site (HTML)</div>
@ -206,30 +213,40 @@
<!--li (click)="showHTML()"--> <!--li (click)="showHTML()"-->
<li> <li>
<a target="_blank" View {{projectInfo.funder}} progress report (HTML) for <a target="_blank"
href="/project-report?projectId={{projectId}}&size={{fetchPublications.searchUtils.totalResults}}"> href="/project-report?projectId={{projectId}}&size={{fetchPublications.searchUtils.totalResults}}">
View {{projectInfo.funder}} progress report (HTML) publications
</a>/ <a target="_blank"
href="/project-report?projectId={{projectId}}&size={{fetchDatasets.searchUtils.totalResults}}&type=dataset">
datasets
</a> </a>
</li> </li>
<li> <li>
<!--export <!--export
[linkname]="'Download '+ projectInfo.funder +' progress report (CSV)'" [linkname]="'Download '+ projectInfo.funder +' progress report (CSV)'"
[filename]="'publications.csv'"> [filename]="'publications.csv'">
</export--> </export-->
<span class="clickable" (click)="downloadfile(downloadURLAPI+'resources?'+csvParams+fetchPublications.searchUtils.totalResults)"> <span aria-hidden="true" uk-icon="icon: download"></span>{{projectInfo.funder}} progress report (CSV) for
<span aria-hidden="true" class="glyphicon glyphicon-download"></span> <a class="clickable" (click)="downloadfile(downloadURLAPI+'resources?'+csvParams+fetchPublications.searchUtils.totalResults)">
<span uk-icon="icon: download"></span>
<span>{{projectInfo.funder}} progress report (CSV)</span> publications
</span> </a>/ <a class="clickable" (click)="downloadfile(downloadURLAPI+'resources?'+csvParamsDatasets+fetchDatasets.searchUtils.totalResults)">
datasets
</a>
</li> </li>
<li> <li>
<a [queryParams]="routerHelper.createQueryParams(['id','type','linkTo'],[projectId,'project','result'])" routerLinkActive="router-link-active" routerLink="/participate/direct-claim" > <span uk-icon="icon: link"></span> <a [queryParams]="routerHelper.createQueryParams(['id','type','linkTo'],[projectId,'project','result'])" routerLinkActive="router-link-active" routerLink="/participate/direct-claim" > <span uk-icon="icon: link"></span>
Link to research results Link to research results
</a> </a>
</li> </li>
<li> <li>
<a routerLinkActive="router-link-active" routerLink="/participate/deposit-publications"> Deposit <a routerLinkActive="router-link-active" routerLink="/participate/deposit-publications">
Deposit Publications Publications
</a>/
<a routerLinkActive="router-link-active" routerLink="/participate/deposit-datasets">
Datasets
</a> </a>
</li> </li>

View File

@ -44,6 +44,7 @@ export class ProjectComponent{
public downloadURLAPI: string; public downloadURLAPI: string;
public csvParams: string; public csvParams: string;
public csvParamsDatasets: string;
public warningMessage = ""; public warningMessage = "";
public errorMessage = ""; public errorMessage = "";
@ -124,6 +125,7 @@ export class ProjectComponent{
this.createClipboard(); this.createClipboard();
this.csvParams = "format=csv-special&page=0&type=publications&query=(((oaftype exact result) and (resulttypeid exact publication)) and (relprojectid exact "+this.projectId+"))&size="; this.csvParams = "format=csv-special&page=0&type=publications&query=(((oaftype exact result) and (resulttypeid exact publication)) and (relprojectid exact "+this.projectId+"))&size=";
this.csvParamsDatasets = "format=csv-special&page=0&type=publications&query=(((oaftype exact result) and (resulttypeid exact dataset)) and (relprojectid exact "+this.projectId+"))&size=";
if (typeof document !== 'undefined') { if (typeof document !== 'undefined') {
this.element.nativeElement.scrollIntoView(); this.element.nativeElement.scrollIntoView();

View File

@ -389,14 +389,14 @@
class="{{publicationInfo.downloadFrom.get(key)['bestAccessMode']}}"> class="{{publicationInfo.downloadFrom.get(key)['bestAccessMode']}}">
<span class="custom-external custom-icon" data-uk-tooltip="pos:right; delay:10" <span class="custom-external custom-icon" data-uk-tooltip="pos:right; delay:10"
[title]="publicationInfo.downloadFrom.get(key)['accessMode']"> [title]="publicationInfo.downloadFrom.get(key)['accessMode']">
<div *ngIf="publicationInfo.downloadFrom.get(key)['url'].length > 1"> <span *ngIf="publicationInfo.downloadFrom.get(key)['url'].length > 1">
{{key}} {{key}}
<span *ngFor="let url of publicationInfo.downloadFrom.get(key)['url']; let i=index;"> <span *ngFor="let url of publicationInfo.downloadFrom.get(key)['url']; let i=index;">
<a href="{{url}}" target="_blank"> <a href="{{url}}" target="_blank">
[{{i+1}}] [{{i+1}}]
</a> </a>
</span> </span>
</div> </span>
<a *ngIf="publicationInfo.downloadFrom.get(key)['url'].length == 1" <a *ngIf="publicationInfo.downloadFrom.get(key)['url'].length == 1"
href="{{publicationInfo.downloadFrom.get(key)['url']}}" href="{{publicationInfo.downloadFrom.get(key)['url']}}"
target="_blank"> target="_blank">

View File

@ -10,17 +10,16 @@ import {RouterHelper} from '../utils/routerHelper.class';
template: ` template: `
<div *ngIf="!server" class="uk-margin-top uk-container uk-container-small uk-position-relative"> <div *ngIf="!server" class="uk-margin-top uk-container uk-container-small uk-position-relative">
<div *ngIf="errorCode == '1'" class="uk-alert uk-alert-warning">
The requested page requires authentication. Please login.
</div>
<div *ngIf="errorCode == '2'" class="uk-alert uk-alert-warning">
You are not authorized to use the requested page
</div>
<div *ngIf="errorCode == '3'" class="uk-alert uk-alert-warning">
The session has expired. Please log in again or continue <a (click)="redirect();">browsing as a guest</a>.
</div>
<form *ngIf="!loggedIn" class=" "> <form *ngIf="!loggedIn" class=" ">
<h3>Welcome to OpenAIRE's Discover/ Share Portal</h3>
<p>This service uses the same ldap sign-in as the OpenAIRE services so you can use the same
credentials.</p>
<p>Login in. To see it in action.</p>
<div class="uk-margin"> <div class="uk-margin">
<input class="uk-input uk-form-width-medium" placeholder="Username" type="text" name="username" [(ngModel)]="username"> <input class="uk-input uk-form-width-medium" placeholder="Username" type="text" name="username" [(ngModel)]="username">
</div> </div>
@ -32,7 +31,15 @@ import {RouterHelper} from '../utils/routerHelper.class';
<button (click)="login()" class=" uk-button uk-button-primary">Login</button> <button (click)="login()" class=" uk-button uk-button-primary">Login</button>
</div> </div>
</form> </form>
<div *ngIf="errorCode == '1'" class="uk-alert uk-alert-warning">
The requested page requires authentication. Please login.
</div>
<div *ngIf="errorCode == '2'" class="uk-alert uk-alert-warning">
You are not authorized to use the requested page
</div>
<div *ngIf="errorCode == '3'" class="uk-alert uk-alert-warning">
The session has expired. Please log in again or continue <a (click)="redirect();">browsing as a guest</a>.
</div>
<div *ngIf="!loggedIn && errorMessage.length > 0" class="uk-alert uk-alert-danger">{{errorMessage}}</div> <div *ngIf="!loggedIn && errorMessage.length > 0" class="uk-alert uk-alert-danger">{{errorMessage}}</div>
<div *ngIf="loggedIn"> <div *ngIf="loggedIn">

View File

@ -121,8 +121,12 @@ import {RouterHelper} from '../../utils/routerHelper.class';
</div> </div>
<div *ngIf="result['countries'] && result['countries'].length > 0"> <div *ngIf="result['countries'] && result['countries'].length > 0">
Countries: {{result.countries}} Countries: <span *ngFor="let country of result['countries'].slice(0,10) let i = index">{{country}}{{(i < ( result['countries'].slice(0,10).length-1))?", ":""}}{{(i == result['countries'].slice(0,10).length-1 && result['countries'].length > 10)?"...":""}}</span>
</div> </div>
<div *ngIf="showSubjects && result['subjects'] && result['subjects'].length > 0">
Subjects <span *ngFor="let subject of result['subjects'].slice(0,10) let i = index">{{subject}}{{(i < ( result['subjects'].slice(0,10).length-1))?", ":""}}{{(i == result['subjects'].slice(0,10).length-1 && result['subjects'].length > 10)?"...":""}}</span>
</div>
</li> </li>
</ul> </ul>
@ -135,6 +139,7 @@ export class SearchResultComponent {
@Input() type: string; @Input() type: string;
@Input() urlParam: string; @Input() urlParam: string;
@Input() showLoading: boolean = false; @Input() showLoading: boolean = false;
@Input() showSubjects: boolean = false;
public errorCodes:ErrorCodes = new ErrorCodes(); public errorCodes:ErrorCodes = new ErrorCodes();
public routerHelper:RouterHelper = new RouterHelper(); public routerHelper:RouterHelper = new RouterHelper();

View File

@ -1,92 +0,0 @@
import {Injectable} from '@angular/core';
import {Http, Response} from '@angular/http';
import {Observable} from 'rxjs/Observable';
import {OpenaireProperties} from '../utils/properties/openaireProperties';
import 'rxjs/add/observable/of';
import 'rxjs/add/operator/do';
import 'rxjs/add/operator/share';
import { CacheService } from '../shared/cache.service';
@Injectable()
export class OpenaireProjectsService {
private searchUrl;
constructor( private http: Http, public _cache: CacheService) {
this.searchUrl = OpenaireProperties.getSearchServiceURL();
}
getFunders():any {
let url = this.searchUrl+'search?action=refine&rTransformer=results_openaire_browse&fields=funderid&query=%28oaftype+exact+project%29&locale=en_GB&format=json';
let key = url;
if (this._cache.has(key)) {
return Observable.of(this._cache.get(key));
}
return this.http.get( url)
.map(request => <any> request.json().response.browseResults.result)
.do(funders => console.log("getFunders : "+funders))
.catch(this.handleError)
.do(res => {
this._cache.set(key, res);
});
}
searchForProjects(keyword:string, funderId:string):any {
let url = this.searchUrl+'search?action=search&sTransformer=projects_openaire&query='+
'%28oaftype+exact+project%29+and+%28%28projecttitle+%3D+%22'+keyword+'%22%29+or+%28projectacronym+%3D+%22'+keyword+'%22%29+or+%28projectcode+%3D+%22'+keyword+'%22%29%29+and+%28funderid+exact+'+funderId+'%29&size=10&locale=en_GB&format=json';
let key = url;
if (this._cache.has(key)) {
return Observable.of(this._cache.get(key));
}
return this.http.get( url)
.map(request => <any> (request.json().response.results)?request.json().response.results.result:request.json().response.results)
.do(funders => console.log("getFunders : "+funders))
.catch(this.handleError)
.do(res => {
this._cache.set(key, res);
});
}
searchForProjectsObs(keyword:string, funderId:string):any {
let url = this.searchUrl+'search?action=search&sTransformer=projects_openaire&query='+
'%28oaftype+exact+project%29+and+%28%28projecttitle+%3D+%22'+keyword+'%22%29+or+%28projectacronym+%3D+%22'+keyword+'%22%29+or+%28projectcode+%3D+%22'+keyword+'%22%29%29+and+%28funderid+exact+'+funderId+'%29&size=10&locale=en_GB&format=json';
let key = url;
if (this._cache.has(key)) {
return Observable.of(this._cache.get(key));
}
return this.http.get(url).toPromise()
.then(request =>{
var valid:boolean= this.isJsonString(request);
if(valid==true){
return (request.json().response.results)?request.json().response.results.result:request.json().response.result;
}else{
return [];
}
})
}
private handleError (error: Response) {
// in a real world app, we may send the error to some remote logging infrastructure
// instead of just logging it to the console
console.log(error);
return Observable.throw(error || 'Server error');
}
private isJsonString(str) {
console.info("Check jsooon");
if(str instanceof Array || str instanceof Object) {
try {
str.json();
} catch (e) {
console.info("INValid");
return false;
}
console.info("valid");
return true
}
console.info("INValid");
return false
}
}

View File

@ -110,8 +110,8 @@ export class SearchDataprovidersService {
searchDataprovidersForDeposit (id: string,type:string, page: number, size: number):any { searchDataprovidersForDeposit (id: string,type:string, page: number, size: number):any {
let link = OpenaireProperties.getSearchResourcesAPIURL(); let link = OpenaireProperties.getSearchResourcesAPIURL();
var compatibilities = ""; var compatibilities = "";
if(type == "Datasets"){ if(type == "Research Data"){
compatibilities = " and (datasourcecompatibilityid = openaire2.0_data)" compatibilities = " and (datasourcecompatibilityid <> UNKNOWN) and (datasourcecompatibilityid = openaire2.0_data)"
}else if(type == "Publications"){ }else if(type == "Publications"){
compatibilities = " and (datasourcecompatibilityid <> UNKNOWN) and (datasourcecompatibilityid <> openaire2.0_data)" compatibilities = " and (datasourcecompatibilityid <> UNKNOWN) and (datasourcecompatibilityid <> openaire2.0_data)"
} }
@ -132,14 +132,14 @@ export class SearchDataprovidersService {
searchDataProvidersBySubjects(keyword:string, type:string, page: number, size: number):any { searchDataProvidersBySubjects(keyword:string, type:string, page: number, size: number):any {
let link = OpenaireProperties.getSearchResourcesAPIURL(); let link = OpenaireProperties.getSearchResourcesAPIURL();
var compatibilities = ""; var compatibilities = "";
if(type == "Datasets"){ if(type == "Research Data"){
compatibilities = " and (datasourcecompatibilityid = openaire2.0_data)" compatibilities = " and (datasourcecompatibilityid <> UNKNOWN) and (datasourcecompatibilityid = openaire2.0_data)"
}else if(type == "Publications"){ }else if(type == "Publications"){
compatibilities = " and (datasourcecompatibilityid <> UNKNOWN) and (datasourcecompatibilityid <> openaire2.0_data)" compatibilities = " and (datasourcecompatibilityid <> UNKNOWN) and (datasourcecompatibilityid <> openaire2.0_data)"
} }
let url = link+"?query=(((deletedbyinference = false) AND (oaftype exact datasource)) "+((compatibilities && compatibilities.length > 0)?" "+ let url = link+"?query=(((deletedbyinference = false) AND (oaftype exact datasource)) "+((compatibilities && compatibilities.length > 0)?" "+
compatibilities+" ":"")+") "+ compatibilities+" ":"")+") "+
" and (datasourcesubjects all "+'"'+keyword+'"'+") " ; " and (datasourcesubject all "+'"'+keyword+'"'+") " ;
url += "&page="+(page-1)+"&size="+size+"&format=json"; url += "&page="+(page-1)+"&size="+size+"&format=json";
let key = url; let key = url;
@ -154,7 +154,7 @@ export class SearchDataprovidersService {
.map(res => [res['meta'].total, this.parseResults(res['results'])]); .map(res => [res['meta'].total, this.parseResults(res['results'])]);
} }
getDataProvidersforEntityRegistry(datasourceId: string, page: number, size: number ):any { getDataProvidersforEntityRegistry(datasourceId: string, page: number, size: number ):any {
let url = OpenaireProperties.getSearchResourcesAPIURL(); let url = OpenaireProperties.getSearchResourcesAPIURL();
var basicQuery = "(oaftype exact datasource) " var basicQuery = "(oaftype exact datasource) "
@ -310,13 +310,23 @@ export class SearchDataprovidersService {
let res:[string[], {"name":string, "id":string}[]] = this.getDataproviderCountriesOrganizations(resData, true, true); let res:[string[], {"name":string, "id":string}[]] = this.getDataproviderCountriesOrganizations(resData, true, true);
result['organizations'] = res[1]; result['organizations'] = res[1];
result['countries'] = res[0]; result['countries'] = res[0];
result['subjects'] = this.getDataproviderSubjects(resData);
console.log(result['subjects']);
results.push(result); results.push(result);
} }
return results; return results;
} }
getDataproviderSubjects(resData: any): string [] {
var subjects:string [] = [];
let length = Array.isArray(resData['subjects']) ? resData['subjects'].length : 1;
for(let i=0; i<length; i++) {
let subject = Array.isArray(resData['subjects']) ? resData['subjects'][i] :resData['subjects'];
subjects.push(subject.content);
}
return subjects;
}
getDataproviderType(resData: any): string { getDataproviderType(resData: any): string {
if(resData['datasourcetype'].hasOwnProperty("classname")) { if(resData['datasourcetype'].hasOwnProperty("classname")) {
return resData['datasourcetype'].classname; return resData['datasourcetype'].classname;

View File

@ -10,7 +10,6 @@ import { CacheService } from '../../shared/cache.service';
import {StringUtils} from '../string-utils.class'; import {StringUtils} from '../string-utils.class';
@Injectable() @Injectable()
export class EntitiesSearchService { export class EntitiesSearchService {
private api ="https://beta.services.openaire.eu/provision/mvc/vocabularies/";
public ready:boolean = false; public ready:boolean = false;
constructor(private http: Http, public _cache: CacheService) {} constructor(private http: Http, public _cache: CacheService) {}
@ -60,7 +59,7 @@ export class EntitiesSearchService {
return [{id:'-2',label:'Error'}];; return [{id:'-2',label:'Error'}];;
}); });
} }
searchByType(keyword:string,type:string){ searchByType(keyword:string,type:string){
if (type == "project"){ if (type == "project"){
return this.searchEntity(keyword,"projects","oaf:project","project"); return this.searchEntity(keyword,"projects","oaf:project","project");
@ -234,8 +233,6 @@ private fetch (link,id,oafEntityType,type){
return array; return array;
} }
// http://scoobydoo.di.uoa.gr:8181/dnet-functionality-services-2.0.0-SNAPSHOT/rest/v2/api/projects?refine=true&fields=funderid&page=1&size=0
private handleError (error: Response) { private handleError (error: Response) {
// in a real world app, we may send the error to some remote logging infrastructure // in a real world app, we may send the error to some remote logging infrastructure
// instead of just logging it to the console // instead of just logging it to the console

View File

@ -143,6 +143,33 @@ public getResultsForDeposit(id:string, type:string, page: number, size: number)
} }
); );
} }
}
public getResultsBySubjectsForDeposit(subject:string, type:string, page: number, size: number){
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.LOADING;
this._searchDataprovidersService.searchDataProvidersBySubjects(subject,type, page, size).subscribe(
data => {
this.searchUtils.totalResults = data[0];
console.info("search Dataproviders forDeposit: [subject:"+subject+", type:"+type+" ] [total results:"+this.searchUtils.totalResults+"]");
this.results = data[1];
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.DONE;
if(this.searchUtils.totalResults == 0 ){
this.searchUtils.status = errorCodes.NONE;
}
},
err => {
console.log(err);
//TODO check erros (service not available, bad request)
// if( ){
// this.searchUtils.status = ErrorCodes.ERROR;
// }
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.ERROR;
}
);
} }
public getResultsForEntity(entity:string, id:string, page: number, size: number){ public getResultsForEntity(entity:string, id:string, page: number, size: number){
var errorCodes:ErrorCodes = new ErrorCodes(); var errorCodes:ErrorCodes = new ErrorCodes();

View File

@ -1,7 +1,7 @@
import {Component, Input, Output, EventEmitter} from '@angular/core'; import {Component, Input, Output, EventEmitter} from '@angular/core';
//Usage Example <paging [currentPage]="page" [totalResults]="resultsNum" [navigateTo]="Search" [term]="keyword"> </paging> //Usage Example <paging [currentPage]="page" [totalResults]="resultsNum" [term]="keyword"> </paging>
@Component({ @Component({
selector: 'paging-no-load', selector: 'paging-no-load',
@ -30,11 +30,11 @@ import {Component, Input, Output, EventEmitter} from '@angular/core';
export class pagingFormatterNoLoad { export class pagingFormatterNoLoad {
@Input() public currentPage: number = 1; @Input() public currentPage: number = 1;
@Input() public navigateTo: string; // @Input() public navigateTo: string;
@Input() public term: string=''; @Input() public term: string='';
@Input() public size: number=10; @Input() public size: number=10;
@Input() public totalResults: number = 10; @Input() public totalResults: number = 10;
@Input() public params; // @Input() public params;
@Output() pageChange = new EventEmitter(); @Output() pageChange = new EventEmitter();

View File

@ -24,37 +24,23 @@ export class OpenaireProperties {
public static searchLinkToAdvancedOrganizations = "search/advanced/organizations"; public static searchLinkToAdvancedOrganizations = "search/advanced/organizations";
public static searchLinkToAdvancedPeople = "search/advanced/people"; public static searchLinkToAdvancedPeople = "search/advanced/people";
//http://beta.services.openaire.eu:8480/search/
//http://rudie.di.uoa.gr:6081/dnet-functionality-services-2.0.0-SNAPSHOT
// Services - APIs
private static metricsAPIURL = "https://beta.services.openaire.eu/usagestats/"; private static metricsAPIURL = "https://beta.services.openaire.eu/usagestats/";
private static framesAPIURL = "https://beta.openaire.eu/stats3/"; private static framesAPIURL = "https://beta.openaire.eu/stats3/";
//private static loginAPIURL = "http://mpagasas.di.uoa.gr:8080/uoa-user-management-1.0.0-SNAPSHOT/api/users/authenticates"; // private static loginAPIURL = "http://scoobydoo.di.uoa.gr:8080/uoa-user-management-1.0.0-SNAPSHOT/api/users/authenticates";
private static loginAPIURL = "http://scoobydoo.di.uoa.gr:8080/uoa-user-management-1.0.0-SNAPSHOT/api/users/authenticates"; private static loginAPIURL = "http://scoobydoo.di.uoa.gr:8080/uoa-user-management-1.0.0-SNAPSHOT/api/users/authenticates";
// private static claimsAPIURL = "http://scoobydoo.di.uoa.gr:8080/dnet-openaire-connector-service-1.0.0-SNAPSHOT/rest/claimsService/";
private static claimsAPIURL = "http://beta.services.openaire.eu/claims/rest/claimsService/";
// public claimsAPIURL = "http://rudie.di.uoa.gr:8080/dnet-openaire-connector-service-1.0.0-SNAPSHOT/rest/claimsService/" private static searchAPIURLLAst = "https://beta.services.openaire.eu/search/v2/api/";
private static claimsAPIURL = "http://scoobydoo.di.uoa.gr:8080/dnet-openaire-connector-service-1.0.0-SNAPSHOT/rest/claimsService/"; // private static searchAPIURLLAst = "http://scoobydoo.di.uoa.gr:8080/dnet-functionality-services-2.0.0-SNAPSHOT/rest/v2/api/";
// private static searchAPIURL = " https://beta.services.openaire.eu/search/v2/api/";
// private searchAPIURL = "http://beta.services.openaire.eu/search/v2.0/api/";
private static searchAPIURL = "https://beta.services.openaire.eu/search/v2/api/";
//"http://scoobydoo.di.uoa.gr:8080/dnet-functionality-services-2.0.0-SNAPSHOT/rest/v2/api/";
// private static searchAPIURLLAst = " https://beta.services.openaire.eu/search/v2/api/";
private static searchAPIURLLAst = "https://beta.services.openaire.eu/search/v2/api/";
//private static searchAPIURLLAst = "http://scoobydoo.di.uoa.gr:8080/dnet-functionality-services-2.0.0-SNAPSHOT/rest/v2/api/";
//private static searchAPIURLLAst = "http://rudie.di.uoa.gr:8080/dnet-functionality-services-2.0.0-SNAPSHOT/rest/v2/api/";
// private static searchResourcesAPIURL = " https://beta.services.openaire.eu/search/v2/api/resources";
private static searchResourcesAPIURL = "https://beta.services.openaire.eu/search/v2/api/resources"; private static searchResourcesAPIURL = "https://beta.services.openaire.eu/search/v2/api/resources";
// private static searchResourcesAPIURL = "http://scoobydoo.di.uoa.gr:8080/dnet-functionality-services-2.0.0-SNAPSHOT/rest/v2/api/resources";
//private static searchServiveURL = "http://astero.di.uoa.gr:8080/dnet-functionality-services-2.0.0-SNAPSHOT/";
private static searchServiveURL = "http://beta.services.openaire.eu:8480/search/rest/"; private static searchServiveURL = "http://beta.services.openaire.eu:8480/search/rest/";
// private static searchServiveURL = "http://services.openaire.eu:8380/search/";
// private static searchServiveURL = "http://beta.services.openaire.eu:8480/search/";
private static csvAPIURL = "https://beta.services.openaire.eu/search/v2/api/";//publications?format=csv private static csvAPIURL = "https://beta.services.openaire.eu/search/v2/api/";//publications?format=csv
@ -85,7 +71,9 @@ export class OpenaireProperties {
// helpdesk link // helpdesk link
private static helpdesk = "https://www.openaire.eu/support/helpdesk"; private static helpdesk = "https://www.openaire.eu/support/helpdesk";
private static uploadService = "http://localhost:8000/upload";
private static vocabulariesAPI ="https://beta.services.openaire.eu/provision/mvc/vocabularies/";
//landing Pages' getters //landing Pages' getters
public static getsearchLinkToPublication():string{ public static getsearchLinkToPublication():string{
return this.baseSearchLink + this.searchLinkToPublication; return this.baseSearchLink + this.searchLinkToPublication;
@ -197,9 +185,7 @@ export class OpenaireProperties {
} }
return this.searchAPIURLLAst + suffix; return this.searchAPIURLLAst + suffix;
} }
public static getSearchServiceURL():string{
return this.searchServiveURL;
}
public static getClaimsAPIURL():string{ public static getClaimsAPIURL():string{
return this.claimsAPIURL; return this.claimsAPIURL;
} }
@ -255,6 +241,15 @@ export class OpenaireProperties {
public static getHelpdesk():string{ public static getHelpdesk():string{
return this.helpdesk; return this.helpdesk;
} }
//upload service for bulk claim - upload csv file
public static getUploadServiceUrl():string{
return this.uploadService;
}
//vocabularies API
public static getVocabulariesAPI():string{
return this.vocabulariesAPI;
}
} }
export class ErrorCodes { export class ErrorCodes {
public LOADING = 0; public LOADING = 0;

View File

@ -6,12 +6,11 @@ import 'rxjs/add/observable/of';
import 'rxjs/add/operator/do'; import 'rxjs/add/operator/do';
import 'rxjs/add/operator/share'; import 'rxjs/add/operator/share';
import { CacheService } from '../../shared/cache.service'; import { CacheService } from '../../shared/cache.service';
import {OpenaireProperties} from '../../utils/properties/openaireProperties';
@Injectable() @Injectable()
export class ISVocabulariesService { export class ISVocabulariesService {
// private api ="https://beta.services.openaire.eu/provision/mvc/vocabularies/"; private api =OpenaireProperties.getVocabulariesAPI();
// private api = "http://api.openaire.eu/vocabularies/"
private api = "http://dev.openaire.research-infrastructures.eu/vocabularies/";
constructor(private http: Http, public _cache: CacheService) {} constructor(private http: Http, public _cache: CacheService) {}
getVocabularyByType(field:string,entity:string):any{ getVocabularyByType(field:string,entity:string):any{

View File

@ -14,7 +14,7 @@ export const routes: string[] = [
'search/person','search/publication','search/project','search/dataset','search/dataprovider','search/organization', 'search/person','search/publication','search/project','search/dataset','search/dataprovider','search/organization',
'search/find/people','search/find/publications','search/find/projects','search/find/datasets','search/find/dataproviders','search/find/organizations', 'search/find/people','search/find/publications','search/find/projects','search/find/datasets','search/find/dataproviders','search/find/organizations',
'search/advanced/people','search/advanced/publications','search/advanced/projects','search/advanced/datasets','search/advanced/dataproviders','search/advanced/organizations', 'search/advanced/people','search/advanced/publications','search/advanced/projects','search/advanced/datasets','search/advanced/dataproviders','search/advanced/organizations',
'participate/deposit-publications','participate/deposit-datasets','participate/deposit-publications-result','participate/deposit-datasets-result', 'participate/deposit-publications','participate/deposit-datasets','participate/deposit-publications-result','participate/deposit-datasets-result', 'participate/deposit-subject-result',
'search/data-providers','search/entity-registries', 'project-report', 'search/data-providers','search/entity-registries', 'project-report',
'claims','myclaims','participate/claim', 'participate/direct-claim', 'claims-project-manager', 'claims','myclaims','participate/claim', 'participate/direct-claim', 'claims-project-manager',
'test', 'user-info', 'test', 'user-info',