Adding claim functionality with project - changes in layout

git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-portal/trunk@42800 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
argiro.kokogiannaki 2016-06-09 14:23:05 +00:00
parent 25a5c89ed2
commit 992fa2be27
21 changed files with 425 additions and 127 deletions

View File

@ -1,13 +1,13 @@
<h1>Claims</h1>
<h3>Filter claims by type:</h3>
<select [(ngModel)]="fetchBy">
<option *ngFor="let type of types" [value]="type">{{type}}</option>
</select>
<input type="text" [(ngModel)]="fetchId" />
<button (click)="goTo()">Fetch</button>
<form>
<select [(ngModel)]="fetchBy">
<option *ngFor="let type of types" [value]="type">{{type}}</option>
</select>
<input type="text" [(ngModel)]="fetchId" />
<button class="btn btn-default" type = "submit" (click)="goTo()">Fetch</button>
</form>
<!--<div class="col-md-4">
<input type="text" #listFilter (keyup)="0" />
</div>-->
@ -33,8 +33,10 @@
<div>
<div class="col-md-2">Filter Results by:</div>
<div class="col-md-4">
<input type="text" [(ngModel)]="inputkeyword" />
<button class="btn btn-primary" (click)="changekeyword()">Filter</button>
<form>
<input type="text" [(ngModel)]="inputkeyword" />
<button type = "submit" class="btn btn-primary" (click)="changekeyword()">Filter</button>
</form>
</div>
<div class="col-md-4" >
<label>
@ -75,7 +77,7 @@
<tbody>
<!--<tr *ngFor="let claim of claims | claimTextFilter:textFilter | claimTypeFilter:publicationCB:datasetCB:projectCB:contextCB " >-->
<tr *ngFor="let claim of claims " >
<td><input [id]="claim.id" type="checkbox" (click)="select(claim,$event)" [ngModel]="selectClaims"/></td>
<td><input [id]="claim.id" type="checkbox" (click)="select(claim,$event)" [ngModel]="selectAllClaims"/></td>
<!--<td><a (click)="goToClaim((claim.id))">{{claim.id}}</a></td>
<td>{{claim.sourceType}}</td> -->
<td><claim-entity [entity]="claim.source" [type]="claim.sourceType" > </claim-entity></td>

View File

@ -118,7 +118,7 @@ export class ClaimsComponent {
err => console.error(err)
);
}
}
}
goToClaim(claimId: number){
this._router.navigate( ['Claim', { id: claimId}] );
@ -278,18 +278,18 @@ export class ClaimsComponent {
}
delete(){
console.warn("Deleting...");
for (var i = 0; i < this.selected.length; i++){
for (var i = 0; i < this.selected.length; i++){
var id =this.selected[i].id;
var selected =this.selected[i].id;
console.warn("Deleting claim with id:"+id);
// this._claimService.deleteClaimById(id);
this._claimService.deleteClaimById(id).subscribe(
this._claimService.deleteClaimById(id,selected).subscribe(
res => {
console.info('Delete response'+res.code );
var index:number =this.claims.indexOf(this.selected[i]);
console.warn("Deleted claim with id:"+ id);
var index:number =this.claims.indexOf(selected);
console.info('Index'+index );
this.selected.splice(i, 1);
if (index > -1) {
this.claims.splice(index, 1);
}

View File

@ -21,8 +21,7 @@ import {Router, ROUTER_DIRECTIVES} from '@angular/router-deprecated';
<li *ngIf=" (currentPage -2 <= 0)&&(currentPage +3 <= getTotalPages()) "><a (click)="onPage((currentPage +3))">{{currentPage +3}}</a></li>
<li *ngIf=" (currentPage -1 <= 0)&&(currentPage +4 <= getTotalPages()) "><a (click)="onPage((currentPage +4))">{{currentPage +4}}</a></li>
<!--<li *ngIf=" getTotalPages() > currentPage "><a (click)="onPage((currentPage+1))">\></a></li>-->
<li *ngIf="getTotalPages() > currentPage"><a (click)="onPage((getTotalPages()))" aria-label="Next">
<li *ngIf="getTotalPages() > currentPage"><a (click)="onPage((getTotalPages()))" aria-label="Next">
<span aria-hidden="true">&raquo;</span>
</a></li>
@ -50,7 +49,8 @@ export class PagingFormatter {
console.info("In paging -- CurrentPage:"+this.currentPage+" "+"total Pages = "+this.getTotalPages() +" Results num:"+this.totalResults);
}
getTotalPages(){
return parseInt(''+(this.totalResults/this.size+1));
var i:number =parseInt(''+(this.totalResults/this.size));
return (((this.totalResults/this.size) == i )? i :(i+1)) ;
}
onPrev(){
if(this.params){

View File

@ -49,7 +49,7 @@ export class pagingFormatterNoLoad {
}
ngOnInit() {
console.debug("In paging -- CurrentPage:"+this.currentPage+" "+"total Pages = "+this.getTotalPages() +" Results num:"+this.totalResults);
console.info("In paging -- CurrentPage:"+this.currentPage+" "+"total Pages = "+this.getTotalPages() +" Results num:"+this.totalResults);
}
getTotalPages(){
return parseInt(''+(this.totalResults/this.size+1));

View File

@ -1,13 +1,13 @@
<div class="container">
<div class="row ">
<input #term type="text" class="form-control col-xs-5" placeholder="Search for...">
<span class="input-group-btn col-xs-2">
<button class="btn btn-default" type="button" (click)="searchTerm(term.value)" >
Go!
</button>
</span>
<form>
<input #term type="text" class="form-control col-xs-5" placeholder="Search for...">
<span class="input-group-btn col-xs-2">
<button class="btn btn-default" type="submit" (click)="searchTerm(term.value)" >Go!</button>
</span>
</form>
</div>
<autocomplete></autocomplete>
</div>

View File

@ -9,23 +9,45 @@ import {ContextsService} from '../../services/contexts.service';
selector: 'claim-contexts',
template: `
<div class="container" >
<div class="input-field col s12">
<div class="input-field col s12">
</div>
<h3>Select Community and Category:</h3>
<select [(ngModel)]="selectedCommunity" (ngModelChange)="communityChanged()" >
<div class="dropdown">
<button class="btn btn-default dropdown-toggle" type="button" id="communityDropDown" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
{{selectedCommunityLabel}}
<span class="caret"></span>
</button>
<ul class="dropdown-menu" aria-labelledby="communityDropDown">
<li (click)="communityChanged('0','Community:')"><a >Community:</a></li>
<li *ngIf="communities" (click)="communityChanged(communities.id, communities.label)" ><a >{{communities.label}}</a></li>
</ul>
</div>
<div class="dropdown">
<button class="btn btn-default dropdown-toggle" type="button" id="categoryDropDown" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
{{selectedCategoryLabel}}
<span class="caret"></span>
</button>
<ul class="dropdown-menu" aria-labelledby="categoryDropDown">
<li (click)="categoryChanged('0','Category:')"><a >Category:</a></li>
<li *ngFor="let category of categories" (click)="categoryChanged(category.id, category.label)" ><a >{{category.label}}</a></li>
</ul>
</div>
<!-- <select [(ngModel)]="selectedCommunity" (ngModelChange)="communityChanged()" >
<option [ngValue]="'0'">Community:</option>
<option *ngIf="communities" [ngValue]="communities.id">{{communities.label}}</option>
</select>
<select *ngIf="categories" [(ngModel)]="selectedCategory" (ngModelChange)="categoryChanged()" >
<select [(ngModel)]="selectedCategory" (ngModelChange)="categoryChanged()" >
<option [ngValue]="'0'">Category:</option>
<option *ngFor="let category of categories" [ngValue]="category.id">{{category.label}}</option>
</select>
</select>-->
<h4>Select concepts:</h4>
<input id="community" type="text" class="validate filter-input" [(ngModel)]=query (keyup)=filter() >
<div class="suggestions" *ngIf="filteredList.length > 0">
<ul class="list-group" *ngFor=" let item of filteredList" >
<li class="list-group-item" >
<ul class="list-group" >
<li class="list-group-item" *ngFor=" let item of filteredList">
<a (click)="select(item)">{{item.label}}</a>
</li>
</ul>
@ -54,11 +76,13 @@ public elementRef;
@Output() contextsChange = new EventEmitter();
public communities:string[];
@Input() public selectedCommunity:string ="0";
@Input() public selectedCommunityId:string = "0";
selectedCommunityLabel:string = "Community:";
@Output() cselectedCommunityChange = new EventEmitter();
public categories:string[];
@Input() public selectedCategory:string ="0";
@Input() public selectedCategoryId:string ="0";
selectedCategoryLabel:string ="Category:";
@Output() selectedCategoryChange = new EventEmitter();
public concepts:string[];
@ -81,7 +105,7 @@ select(item){
this.filteredList = [];
var index:number =this.selectedList.indexOf(item);
if (index == -1) {
var context= { community: this.selectedCommunity, category: this.selectedCategory, concept: item };
var context= { community: this.selectedCommunityId, category: this.selectedCategoryId, concept: item };
this.selectedList.push(context);
this.contextsChange.emit({
value: this.selectedList
@ -121,8 +145,8 @@ getCommunities () {
}
getCategories () {
this.categories=[];
if(this.selectedCommunity != '0'){
this._contextService.getCategories(this.selectedCommunity).subscribe(
if(this.selectedCommunityId != '0'){
this._contextService.getCategories(this.selectedCommunityId).subscribe(
data => {
this.categories = data.category;
this.concepts = [];
@ -133,20 +157,24 @@ getCommunities () {
}
}
getConcepts () {
if(this.selectedCategory != '0'){
this._contextService.getConcepts(this.selectedCategory, "").subscribe(
if(this.selectedCategoryId != '0'){
this._contextService.getConcepts(this.selectedCategoryId, "").subscribe(
data => {
this.concepts = data.concept;
},
err => console.error(err)
);
}
}
communityChanged(){
communityChanged(communityId:string, communityLabel:string){
this.selectedCommunityId= communityId;
this.selectedCommunityLabel= communityLabel;
this.getCategories();
}
categoryChanged(){
categoryChanged(categoryId:string, categoryLabel:string){
this.selectedCategoryId = categoryId;
this.selectedCategoryLabel = categoryLabel;
this.getConcepts();
}

View File

@ -16,8 +16,10 @@ import {SearchDataciteService} from '../../services/searchDatacite.service';
<p *ngFor=" let item of selectedDatasets "> <publication-title [title]="item.result.title" [url]="'http://dx.doi.org/'+item.result.doi" > </publication-title> {{item.result.doi}} --{{item.result.publisher}}<button type="button" class="close" (click)="remove(item)" aria-label="Close"> <span aria-hidden="true">&times;</span></button> </p>
</div>
<p><i>Fetches from Datacite </i></p>
<input #term [(ngModel)]="keyword"/>
<button (click)="searchDatacite(term.value,10,1)" type="button" class="btn btn-default">Search</button>
<form>
<input #term [(ngModel)]="keyword"/>
<button (click)="searchDatacite(term.value,10,1)" type="submit" class="btn btn-default">Search</button>
</form>
<ul class="nav nav-tabs">
<li class="active"><a data-toggle="tab" href="#datacite">Datacite ({{resultsNum}})</a></li>
<li><a data-toggle="tab" href="#openaire">Openaire</a></li>

View File

@ -0,0 +1,180 @@
import {Component, Input,Output, ElementRef, EventEmitter} from '@angular/core';
import {JSONP_PROVIDERS} from '@angular/http';
import {Observable} from 'rxjs/Observable';
import { RouteParams, ROUTER_DIRECTIVES} from '@angular/router-deprecated';
import {OpenaireProjectsService} from '../../services/openaireProjects.service';
@Component({
selector: 'claim-projects',
template: `
<div class="container" >
<h3>Select Funder:</h3>
<!-- <select [(ngModel)]="selectedFunderId" (ngModelChange)="funderChanged()" >
<option [ngValue]="'0'">Funder:</option>
<option *ngFor="let funder of funders" [ngValue]="funder.field.field[1]['@value_original']">{{funder.field.field[1]['@value']}}</option>
</select> -->
<div class="dropdown">
<button class="btn btn-default dropdown-toggle" type="button" id="dropdownMenu1" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
{{selectedFunderName}}
<span class="caret"></span>
</button>
<ul class="dropdown-menu" aria-labelledby="dropdownMenu1">
<li (click)="funderChanged('0','Select funder:')"><a >Select funder:</a></li>
<li *ngFor="let funder of funders" (click)="funderChanged(funder.field.field[1]['@value_original'],funder.field.field[1]['@value'])" ><a >{{funder.field.field[1]['@value']}}</a></li>
</ul>
</div>
<h4>Select projects:</h4>
<input id="community" type="text" class="validate filter-input" [(ngModel)]=query (keyup)=filter() >
<div class="suggestions" *ngIf="filteredList.length > 0">
<ul class="list-group" >
<li *ngFor=" let item of filteredList" class="list-group-item" >
<a (click)="select(item)">{{item.field[0]['@value']}} - {{item.field[1]['@value']}}- {{item.field[3]['@value']}}</a>
</li>
</ul>
</div>
<div class="selections" *ngIf="selectedProjects.length > 0">
<label for="selecteditems">Selected: </label>
<ul id ="selecteditems" class="nav nav-pills" >
<li *ngFor="let item of selectedProjects" role="presentation" (click)="remove(item)">{{item.projectId}} - {{item.projectAcronym}} - {{item.projectName}} <span class="badge">X</span>
</li>
</ul>
</div>
<!--<select [(ngModel)]="selectedCategory" (ngModelChange)="categoryChanged()" >
<option [ngValue]="'0'">Category:</option>
<option *ngFor="let category of categories" [ngValue]="category.id">{{category.label}}</option>
</select>
<h4>Select concepts:</h4>
<input id="community" type="text" class="validate filter-input" [(ngModel)]=query (keyup)=filter() >
<div class="suggestions" *ngIf="filteredList.length > 0">
<ul class="list-group" *ngFor=" let item of filteredList" >
<li class="list-group-item" >
<a (click)="select(item)">{{item.label}}</a>
</li>
</ul>
</div>
<div class="selections" *ngIf="selectedProjects.length > 0">
<label for="selecteditems">Selected: </label>
<ul id ="selecteditems" class="nav nav-pills" *ngFor="let item of selectedProjects" >
<li role="presentation" (click)="remove(item)">{{item.concept.label}} <span class="badge">X</span>
</li>
</ul>
</div>-->
</div>
`,
providers:[ OpenaireProjectsService ]
})
export class ClaimProjectsComponent {
ngOnInit() {
console.info("Claim projects - init ....");
this.getFunders();
}
public query = '';
public filteredList = [];
@Input() public selectedProjects=[] ;
public elementRef;
@Output() projectsChange = new EventEmitter();
public funders:string[];
@Input() public selectedFunderId:string ="0";
selectedFunderName:string ="Select funder:";
@Output() cselectedFunderChange = new EventEmitter();
public projects:string[];
constructor(private _projectService: OpenaireProjectsService,myElement: ElementRef) {
this.elementRef = myElement;
}
filter() {
if(this.selectedFunderId != '0' && this.query !== "" && this.query.length >= 3 ){
this._projectService.searchForProjects(this.query, this.selectedFunderId).subscribe(
data => {
this.filteredList = data;
},
err => console.error(err)
);
}
// if (this.query !== ""){
// this.filteredList = this.concepts.filter(function(el){
// return el.label.toLowerCase().indexOf(this.query.toLowerCase()) > -1;
// }.bind(this));
// }else{
// this.filteredList = [];
// }
}
select(item){
this.query = "";
this.filteredList = [];
var index:number =this.selectedProjects.indexOf(item);
if (index == -1) {
//{{item.field[0]['@value']}} - {{item.field[1]['@value']}}
var project= { funderId: this.selectedFunderId, projectId: item.field[0]['@value'], projectName: item.field[3]['@value'] , projectAcronym: item.field[1]['@value'] };
this.selectedProjects.push(project);
this.projectsChange.emit({
value: this.selectedProjects
});
}
}
remove(item){
var index:number =this.selectedProjects.indexOf(item);
if (index > -1) {
this.selectedProjects.splice(index, 1);
}
this.projectsChange.emit({
value: this.selectedProjects
});
}
handleClick(event){
var clickedComponent = event.target;
var inside = false;
do {
if (clickedComponent === this.elementRef.nativeElement) {
inside = true;
}
clickedComponent = clickedComponent.parentNode;
} while (clickedComponent);
if(!inside){
this.filteredList = [];
}
}
getFunders () {
console.info("Getting Funders....");
this._projectService.getFunders().subscribe(
data => {
this.funders = data;
},
err => console.error(err)
);
}
getProjects () {
if(this.selectedFunderId != '0'){
// this._contextService.getConcepts(this.selectedCategory, "").subscribe(
// data => {
// this.concepts = data.concept;
//
// },
// err => console.error(err)
// );
}
}
funderChanged(funderId:string, funderName:string){
this.selectedFunderId = funderId;
this.selectedFunderName = funderName;
console.info("Selected funder:"+this.selectedFunderId+ ' name:'+funderName );
this.selectedProjects = [];
}
// categoryChanged(){
// this.getConcepts();
// }
}

View File

@ -5,8 +5,10 @@
</div>
<p><i>Fetches from crossref </i></p>
<!-- (keyup)="searchCrossref(term.value)" -->
<input #term [(ngModel)]="keyword"/>
<button (click)="search(term.value,10,1)" type="button" class="btn btn-default">Search</button>
<form>
<input #term [(ngModel)]="keyword"/>
<button type="submit" (click)="search(term.value,10,1)" class="btn btn-default">Search</button>
</form>
<ul class="nav nav-tabs">
<li class="active"><a data-toggle="tab" href="#crossref">Crossref ({{crossrefResultsNum}})</a></li>
<li><a data-toggle="tab" href="#openaire">Openaire ({{openaireResultsNum}})</a></li>
@ -35,15 +37,15 @@
<div *ngIf="orcidResultsNum != null">
<p> Not the right author? Choose one of these: </p>
<li class="dropdown">
<a href="" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Selected: {{authorGivenName}} {{authorFamilyName}}<span class="caret"></span></a>
<ul class="dropdown-menu">
<div class="dropdown">
<button class=" btn btn-default dropdown-toggle" type= "button" data-toggle="dropdown" id="orcidDropDown" role="button" aria-haspopup="true" aria-expanded="true">Selected: {{authorGivenName}} {{authorFamilyName}}<span class="caret"></span></button>
<ul class="dropdown-menu" aria-labelledby="orcidDropDown">
<li *ngFor=" let item of authorIds let i = index" (click)="getOrcidResultsById(i)" role="button">
{{authorGivenNames[i]}} {{authorFamilyNames[i]}} : {{item}}
</li>
</ul>
</li>
</div>
<div>
<br/>

View File

@ -171,7 +171,7 @@ search(term: string, size : number, page : number){
add(item, itemSource, itemType, itemUrl, itemTitle){
var result ={id: item.DOI, type :itemType, source : itemSource, title: itemTitle,url: itemUrl, result: item};
var result ={id: item.DOI, type :itemType, source : itemSource, title: itemTitle,url: itemUrl, result: item, accessRights: 'OPEN', embargoEndDate:''};
console.info("Add result:"+result.id+" "+result.source+" "+item);
this.selectedPublications.push(result);
var index:number =this.crossrefResults.indexOf(item);

View File

@ -12,7 +12,7 @@ import {ClaimsService} from '../../services/claims.service';
template: `
<button *ngIf="claiming == false" (click)="insert()">Claim</button>
<div *ngIf="error == true"> {{errorMessage}}
<div *ngIf="error == true"> <div class="alert alert-warning" role="alert">{{errorMessage}}</div>
</div>
`,
@ -34,10 +34,6 @@ export class ClaimInsertComponent {
error = false;
errorMessage = "";
/*
curl -H "Content-Type: application/json" -X POST -d '{ "claimedBy" : "katerina@di.uoa.gr", "sourceId" : "corda_______::2c37878a0cede85dbbd1081bb9b4a2f8", "sourceType" : "project", "sourceCollectedFrom":"openaire", "targetId" : "dedup_wf_001::092c0354ef18384b6fb3e7224bd32b76", "targetType" : "publication", "targetCollectedFrom":"openaire"}'
*/
insert(){
this.claiming = true;
var user="argirok@di.uoa.gr"
@ -51,45 +47,45 @@ insert(){
for (var i = 0; i < this.publications.length; i++) {
var result=this.publications[i];
for (var j = 0; j < this.contexts.length; j++) {
var context=this.contexts[j];
var claim = { claimedBy : user, sourceId : context.concept.id, sourceType : "context", sourceCollectedFrom:"openaire", targetId : result.id , targetType : result.type,
targetCollectedFrom: result.source};
console.info("Trying to insert..... " + claim.targetId );
/*
'{ "claimedBy" : "katerina@di.uoa.gr", "sourceId" : "corda_______::2c37878a0cede85dbbd1081bb9b4a2f8", "sourceType" : "project", "sourceCollectedFrom":"openaire",
"targetId" : "dedup_wf_001::092c0354ef18384b6fb3e7224bd32b76", "targetType" : "publication", "targetCollectedFrom":"openaire"}'
*/
this.claimService.insertClaim(claim).subscribe(
data => {
},
err => console.error(err)
);
}
var result=this.publications[i];
this.insertClaim(result,user);
}
for (var i = 0; i < this.datasets.length; i++) {
var result=this.datasets[i];
for (var j = 0; j < this.contexts.length; j++) {
var context=this.contexts[j];
var claim = { claimedBy : user, sourceId : context.concept.id, sourceType : "context", sourceCollectedFrom:"openaire", targetId : result.id , targetType : result.type, targetCollectedFrom: result.source};
this.claimService.insertClaim(claim).subscribe(
data => {
},
err => console.error(err)
);
}
this.insertClaim(result,user);
}
// claimService
}
}
insertClaim(result:any, user:any){
for (var j = 0; j < this.contexts.length; j++) {
var context=this.contexts[j];
var claim = { claimedBy : user, sourceId : context.concept.id, sourceType : "context", sourceCollectedFrom:"openaire", sourceAccessRights:"OPEN", sourceEmbargoEndDate:"", targetId : result.id , targetType : result.type,
targetCollectedFrom: result.source, targetAccessRights:result.accessRights, targetEmbargoEndDate:result.embargoEndDate};
console.info("Trying to insert context - result relation: contextId: "+claim.sourceId +" resultId : " + claim.targetId );
this.claimService.insertClaim(claim).subscribe(
data => {
},
err => console.error(err)
);
}
for (var j = 0; j < this.projects.length; j++) {
var project=this.projects[j];
var claim = { claimedBy : user, sourceId : project.projectId, sourceType : "project", sourceCollectedFrom:"openaire", sourceAccessRights:"OPEN", sourceEmbargoEndDate:"", targetId : result.id , targetType : result.type,
targetCollectedFrom: result.source, targetAccessRights:result.accessRights, targetEmbargoEndDate:result.embargoEndDate};
console.info("Trying to insert project - result relation: projectId: "+claim.sourceId +" resultId : " + claim.targetId );
this.claimService.insertClaim(claim).subscribe(
data => {
},
err => console.error(err)
);
}
}
}

View File

@ -7,21 +7,24 @@ import {ClaimPublicationComponent} from './claimPublication/claimPublication.com
import {ClaimDatasetComponent} from './claimDataset/claimDataset.component';
import {ClaimSelectedComponent} from './selected/selected.component';
import {ClaimInsertComponent} from './insertClaim/insertClaim.component';
import {ClaimProjectsComponent} from './claimProject/claimProject.component';
@Component({
selector: 'linking',
directives: [ROUTER_DIRECTIVES, ClaimContextComponent, ClaimPublicationComponent, ClaimSelectedComponent, ClaimInsertComponent,ClaimDatasetComponent],
directives: [ROUTER_DIRECTIVES, ClaimContextComponent, ClaimPublicationComponent, ClaimSelectedComponent, ClaimInsertComponent,ClaimDatasetComponent, ClaimProjectsComponent],
template: `
<h1>Linking...</h1>
<div class="row" >
<div *ngIf=" show != 'claim'" class="row" >
<div class="col-sm-6">
<div *ngIf=" show=='result' " >
<form>
<input [(ngModel)]="keyword"/>
<button (click)="search()" type="button" class="btn btn-default">Search</button>
<button (click)="search()" type="submit" class="btn btn-default">Search</button>
<div class="resultType">
<input #publication name="searchType" type="radio" [checked]="searchType === 'publication'" value="publication" (click)="searchType = publication.value" />Publication
<input #dataset name="searchType" [checked]="searchType === 'dataset'" type="radio" value="dataset" (click)="searchType = dataset.value" />Dataset
</div>
</form>
</div>
<div *ngIf=" show=='publication' ">
<claim-publication [keyword]="keyword" [selectedPublications]="publications" (publicationsCahnge)="publicationsChange($event)" > </claim-publication>
@ -29,27 +32,35 @@ import {ClaimInsertComponent} from './insertClaim/insertClaim.component';
<div *ngIf=" show=='dataset' " >
<claim-dataset [keyword]="keyword" [selectedDatasets]="datasets" (datasetsCahnge)="datasetsChange($event)" > </claim-dataset>
</div>
<div *ngIf=" show=='project' " >
<claim-projects [selectedProjects]="projects" (projectsChange)="projectsChange($event)" > </claim-projects>
</div>
<div *ngIf=" show == 'context'" >
<claim-contexts [selectedList]="contexts" (contextsChange)="contextsChange($event)" > </claim-contexts>
</div>
<div *ngIf=" show == 'claim'" >
<!-- <div *ngIf=" show == 'claim'" >
<claim-insert [contexts]="contexts" [publications]="publications" [datasets]="datasets" [projects]="projects" ></claim-insert>
</div>
</div>-->
</div>
<div class="col-sm-6">
<claim-selected [contexts]="contexts" [publications]="publications" [datasets]="datasets" [projects]="projects" > </claim-selected>
</div>
</div>
<button *ngIf="show != 'result'" (click)="prev()">Prev</button>
<div *ngIf=" show == 'claim'" >
<claim-selected [contexts]="contexts" [publications]="publications" [datasets]="datasets" [projects]="projects" [showAccessRights]="'true'" > </claim-selected>
<claim-insert [contexts]="contexts" [publications]="publications" [datasets]="datasets" [projects]="projects"></claim-insert>
</div>
<button *ngIf="show != 'claim'" (click)="next()">Next</button>
<button class="btn btn-primary" *ngIf="show != 'project'" (click)="prev()">Prev</button>
<button class="btn btn-primary" *ngIf="show != 'claim'" (click)="next()">Next</button>
`
`
})
//[(ngModel)]="date"
export class LinkingComponent {
constructor ( private _router: Router ) {
}
@ -60,15 +71,18 @@ export class LinkingComponent {
projects=[];
publications=[];
datasets=[];
show = "result";
show = "project";
searchType="publication";
date='8-6-2016';
keyword: string = "";
ngOnInit() {
}
next(){
if((this.show == 'result' && this.keyword == '')||(this.show == 'dataset' || this.show == 'publication')){
if((this.show == 'project' )){
this.show='result';
}else if((this.show == 'result' && this.keyword == '')||(this.show == 'dataset' || this.show == 'publication')){
this.show='context';
}else if(this.show == 'result' ){
if(this.searchType == 'publication' ){
@ -81,7 +95,9 @@ export class LinkingComponent {
}
}
prev(){
if(this.show == 'context'){
if(this.show == 'result'){
this.show='project';
}else if(this.show == 'context'){
this.show='result';
}else if(this.show == 'dataset' || this.show == 'publication'){
this.show='result';
@ -120,4 +136,7 @@ publicationsChange($event) {
datasetsChange($event) {
this.datasets=$event.value;
}
projectsChange($event) {
this.projects=$event.value;
}
}

View File

@ -5,7 +5,22 @@ import {Component, Input,Output} from '@angular/core';
template: `
<div *ngIf="publications.length > 0 " class="publications" >
<h5>Selected Publications:</h5>
<i *ngFor="let pub of publications" >Source: {{pub.source}} - Title: <publication-title [title]="pub.title" [url]="pub.url" > </publication-title> </i>
<i *ngFor="let pub of publications" >Source: {{pub.source}} - Title: <publication-title [title]="pub.title" [url]="pub.url" > </publication-title>
<p *ngIf="showAccessRights== 'true'" >
<select [(ngModel)]="pub.accessRights">
<option *ngFor="let type of accessTypes" [value]="type">{{type}}</option>
</select>
<!--<div class="dropdown">
<button class="btn btn-default dropdown-toggle" type="button" id="dropdownMenu1" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
{{pub.accessRights}}
<span class="caret"></span>
</button>
<ul class="dropdown-menu" aria-labelledby="dropdownMenu1">
<li *ngFor="let type of accessTypes" ><a href="#" (click)="pub.accessRights = type " >{{type}} </a></li>
</ul>
</div>-->
</p>
</i>
</div>
<div *ngIf="contexts.length > 0 " class="concepts" >
<h5>Selected Concepts:</h5>
@ -13,7 +28,7 @@ import {Component, Input,Output} from '@angular/core';
</div>
<div *ngIf="projects.length > 0 " class="conprojectscepts" >
<h5>Selected projects:</h5>
<i *ngFor="let projects of projects" >Project: </i>
<i *ngFor="let project of projects" >{{project.projectAcronym}} - {{project.projectName}} </i>
</div>
<div *ngIf="datasets.length > 0 " class="datasets" >
<h5>Selected datasets:</h5>
@ -27,7 +42,7 @@ import {Component, Input,Output} from '@angular/core';
})
export class ClaimSelectedComponent {
ngOnInit() {
console.info("Show accessRights selection? :"+this.showAccessRights);
}
@ -35,8 +50,10 @@ export class ClaimSelectedComponent {
@Input() projects=[];
@Input() publications=[];
@Input() datasets=[];
@Input() showAccessRights=false;
accessTypes = ["OPEN","CLOSED","EMBARGO","RESTRICTED"];

View File

@ -6,7 +6,7 @@ import {Pipe, PipeTransform} from '@angular/core';
export class ClaimTextFilterPipe implements PipeTransform {
transform(value: any, filter: string): any {
console.debug('ClaimTextFilterPipe word to filter : '+filter);
console.info('ClaimTextFilterPipe word to filter : '+filter);
filter = filter?filter.toLocaleLowerCase():'';
return filter ? value.filter(claim=> (
claim.sourceType.toLocaleLowerCase().indexOf(filter)!=-1|| //sourceType

View File

@ -5,7 +5,7 @@ import {Pipe, PipeTransform} from '@angular/core';
export class ClaimTypeFilterPipe implements PipeTransform {
transform(value: any, publication:boolean,dataset:boolean,project:boolean,context:boolean) : any {
let filter = publication;
console.debug('ClaimTypeFilterPipe types to show : '+(publication?'publication ':' ')+(dataset?'dataset ':' ')+(project?'project ':' ')+(context?'context ':' '));
console.info('ClaimTypeFilterPipe types to show : '+(publication?'publication ':' ')+(dataset?'dataset ':' ')+(project?'project ':' ')+(context?'context ':' '));
return (value)?value.filter((claim) =>{
let filter =publication;
if(publication||dataset||project||context) {

View File

@ -14,13 +14,15 @@ import {SearchAllComponent} from '../searchAll/searchAll.component';
template: `
<h1>Search Demo</h1>
<p><i>Fetches from crossref </i></p>
<input #term [(ngModel)]="keyword"/>
<button (click)="search(term.value,10,1)" type="button" class="btn btn-default">Click</button>
<form>
<input #term [(ngModel)]="keyword"/>
<button (click)="search(term.value,10,1)" type="submit" class="btn btn-default">Search</button>
</form>
<div>
<div *ngIf="resultsNum != null && resultsNum > 0">
<p > {{resultsNum }} Total Results </p>
<paging [currentPage]="page" [totalResults]="resultsNum" [navigateTo]="navigateTo" [term]="keyword" [size]="size"> </paging>
</div>
</div>
<div >
<p *ngFor=" let item of results "> <publication-title [title]="item.title" [url]="item.URL" > </publication-title> {{item.DOI}} --{{item.publisher}} </p>
</div>

View File

@ -20,9 +20,10 @@ import {PublicationTitleFormatter} from '../common/publicationTitleFormatter.com
</div>
<h1>Search</h1>
<input #term [(ngModel)]="keyword"/>
<button (click)="search(term)" type="button" class="btn btn-default">Search</button>
<form>
<input #term [(ngModel)]="keyword"/>
<button (click)="search(term)" type="submit" class="btn btn-default">Search</button>
</form>
<div>
<div *ngIf="resultsNum != null && resultsNum > 0">
<p > {{resultsNum }} Total Results </p>

View File

@ -13,44 +13,44 @@ export class ClaimsService {
}
private getClaimRequest(size : number, page : number, url :string):any {
console.debug('ClaimsService: Claims request: '+url);
console.info('ClaimsService: Claims request: '+url);
return this.http.get( url)
.map(request => <any> request.json())
.do(request => console.info("Get claims: offset = "+(size*(page-1)) + " limit ="+size ))
.catch(this.handleError);
}
getClaims( size : number, page : number, keyword:string, sortby: string, descending: boolean, types: string):any {
console.debug('ClaimsService: getClaims ' );
console.debug('ClaimsService: Types : '+types );
console.info('ClaimsService: getClaims ' );
console.info('ClaimsService: Types : '+types );
let url = this.baseUrl +"claims"+"?offset="+(size*(page-1) + "&limit="+size)+"&keyword="+keyword+"&sortby="+sortby+"&descending="+descending+"&types="+types;
return this.getClaimRequest(size,page,url);
}
getClaimsByUser( size : number, page : number, user:string, keyword:string, sortby: string, descending: boolean, types: string):any {
console.debug('ClaimsService: getClaims for user : '+user);
console.info('ClaimsService: getClaims for user : '+user);
let url = this.baseUrl +"users/"+user+"/claims"+"?offset="+(size*(page-1) + "&limit="+size)+"&keyword="+keyword+"&sortby="+sortby+"&descending="+descending+"&types="+types;
return this.getClaimRequest(size,page,url);
}
getClaimsBycontext( size : number, page : number, contextId:string, keyword:string, sortby: string, descending: boolean, types: string):any {
console.debug('ClaimsService: getClaims for context : '+contextId);
console.info('ClaimsService: getClaims for context : '+contextId);
let url = this.baseUrl +"contexts/"+contextId+"/claims"+"?offset="+(size*(page-1) + "&limit="+size)+"&keyword="+keyword+"&sortby="+sortby+"&descending="+descending+"&types="+types;
return this.getClaimRequest(size,page,url);
}
getClaimsByResult( size : number, page : number, resultId:string, keyword:string, sortby: string, descending: boolean, types: string):any {
console.debug('ClaimsService: getClaims for result : '+resultId);
console.info('ClaimsService: getClaims for result : '+resultId);
let url = this.baseUrl +"results/"+resultId+"/claims"+"?offset="+(size*(page-1) + "&limit="+size)+"&keyword="+keyword+"&sortby="+sortby+"&descending="+descending+"&types="+types;
return this.getClaimRequest(size,page,url);
}
getClaimsByProject( size : number, page : number, projectId:string, keyword:string, sortby: string, descending: boolean, types: string):any {
console.debug('ClaimsService: getClaims for project : '+projectId);
console.info('ClaimsService: getClaims for project : '+projectId);
let url = this.baseUrl +"projects/"+projectId+"/claims"+"?offset="+(size*(page-1) + "&limit="+size)+"&keyword="+keyword+"&sortby="+sortby+"&descending="+descending+"&types="+types;
return this.getClaimRequest(size,page,url);
}
deleteClaimById(claimId:string):any{
deleteClaimById(claimId:string, claim:any):any{
console.warn('Trying to delete claim with id : '+claimId);
let url = this.baseUrl +"claims/"+claimId;
console.warn('Delete url: '+url);

View File

@ -17,14 +17,14 @@ export class ContextsService {
public getCommunities():any {
let url = this.baseUrl + 'communities';
console.debug('ContextsService: request communities '+url);
console.info('ContextsService: request communities '+url);
return this.http.get( url)
.map(request => <any> request.json().data)
.do(request => console.info("Get claims: offset = "))
.catch(this.handleError);
}
public getCategories(communityId :string):any {
console.debug('ContextsService: request categories for community with id '+communityId);
console.info('ContextsService: request categories for community with id '+communityId);
let url= this.baseUrl + 'communities/' + communityId + '/categories';
return this.http.get( url)
.map(request => <any> request.json().data)
@ -32,7 +32,7 @@ export class ContextsService {
.catch(this.handleError);
}
public getConcepts(categoryId :string, keyword: string):any {
console.debug('ContextsService: request concept for category with id '+categoryId + ' and keyword '+ keyword);
console.info('ContextsService: request concept for category with id '+categoryId + ' and keyword '+ keyword);
let url= this.baseUrl + 'categories/' + categoryId+ "/concepts";
return this.http.get( url)
.map(request => <any> request.json().data)

View File

@ -0,0 +1,49 @@
import {Injectable} from '@angular/core';
// import {Http, Response, Headers} from '@angular/http';
import {Http, Response} from '@angular/http';
import {Observable} from 'rxjs/Observable';
// import {Publication} from '../entities/publication';
@Injectable()
export class OpenaireProjectsService {
constructor( private http: Http) {}
// searchUrl="http://services.openaire.eu:8380/search/";
searchUrl="http://rudie.di.uoa.gr:8080/dnet-functionality-services-2.0.0-SNAPSHOT/";
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';
////"&rows=".$size."&offset=".($page-1)*$size
return this.http.get( url)
.map(request => <any> request.json().response.browseResults.result)
.do(funders => console.log("getFunders : "+funders))
.catch(this.handleError);
}
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';
////"&rows=".$size."&offset=".($page-1)*$size
return this.http.get( url)
.map(request => <any> request.json().response.results.result)
.do(funders => console.log("getFunders : "+funders))
.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.error(error);
return Observable.throw(error || 'Server error');
}
}
/*
http://services.openaire.eu:8380/search/search?action=search&sTransformer=projects_openaire&query=%28oaftype+exact+project%29+and+%28%28projecttitle+%3D+%22ope%22%29+or+%28projectacronym+%3D+%22ope%22%29+or+%28projectcode+%3D+%22ope%22%29%29+and+%28funderid+exact+ec__________%3A%3AEC%29&size=10&locale=en_GB&format=json
http://services.openaire.eu:8380/search/search?action=refine&rTransformer=results_openaire_browse&fields=funderid&query=%28oaftype+exact+project%29&locale=en_GB&format=json
*/

View File

@ -40,7 +40,7 @@ function ngApp(req, res) {
let config: ExpressEngineConfig = {
directives: [ App ],
platformProviders: [
provide(ORIGIN_URL, {useValue: 'http://localhost:3000'}),
provide(ORIGIN_URL, {useValue: 'http://localhost:5000'}),
provide(BASE_URL, {useValue: baseUrl}),
],
providers: [
@ -74,6 +74,6 @@ app.use('/', ngApp);
app.use('/home', ngApp);
app.use('/search', ngApp);
// Server
app.listen(3000, () => {
console.log('Listening on: http://localhost:3000');
app.listen(5000, () => {
console.log('Listening on: http://localhost:5000');
});