Adding claim software functionality

git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-portal/trunk@49866 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
argiro.kokogiannaki 2017-11-09 14:53:02 +00:00
parent f948b954ba
commit 2483d7599e
17 changed files with 192 additions and 56 deletions

View File

@ -20,7 +20,7 @@ declare var UIkit:any;
<tr><td >
<select class="" [(ngModel)]="selectedFunderId" name="select_funder" >
<option value="0" (click)="funderChanged('0','Select funder:')">Select funder:</option>
<option *ngFor="let funder of funders" [value]="funder.id" (click)="funderChanged(funder.id,funder.name)">{{funder.name}}</option>
<option *ngFor="let funder of funders" [value]="funder.id" (click)="funderChanged(funder.id,funder.name)">{{(funder.name.split("||").length > 0)?(funder.name.split("||")[0]+" ("+funder.name.split("||")[1]+")"):(funder.name)}}</option>
</select></td><td >
<entities-autocomplete entityType="project" [funderId]="selectedFunderId" [allowDuplicates]=true [showSelected]=false [placeHolderMessage] = "'Type Keywords..'" title = "Projects:" [multipleSelections]=true (addItem) = "select($event)" ></entities-autocomplete>
</td></tr></table>

View File

@ -16,6 +16,7 @@
<ul class="uk-tab" uk-tab="animation: uk-animation-fade">
<li *ngIf="searchSource == 'all' || searchSource == 'openaire'" (click)="clickTab('openairePub')" ><a>Publications <span class="uk-badge uk-badge-notification">{{ (openairePubsNum)?openairePubsNum:0 }}</span></a></li>
<li *ngIf="searchSource == 'all' || searchSource == 'openaire'" (click)="clickTab('openaireData')" ><a>Research Data <span class="uk-badge uk-badge-notification">{{(openaireDataNum==null)?'0':openaireDataNum}}</span></a></li>
<li *ngIf="searchSource == 'all' || searchSource == 'openaire'" (click)="clickTab('openaireSoftware')" ><a>Software <span class="uk-badge uk-badge-notification">{{(openaireSoftwareNum==null)?'0':openaireSoftwareNum}}</span></a></li>
<li *ngIf="searchSource == 'all' || searchSource == 'crossref'" (click)="clickTab('crossref')" ><a>Crossref <span class="uk-badge uk-badge-notification">{{(crossrefResultsNum)?crossrefResultsNum:0}}</span></a></li>
<li *ngIf="searchSource == 'all' || searchSource == 'datacite'" (click)="clickTab('datacite')"><a>Datacite <span class="uk-badge uk-badge-notification">{{(dataciteResultsNum==null)?'0':dataciteResultsNum}}</span></a></li>
<li *ngIf="searchSource == 'all' || searchSource == 'orcid'" (click)="clickTab('orcid')"><a>Orcid <span class="uk-badge uk-badge-notification">{{(orcidResultsNum)?orcidResultsNum:0}}</span></a></li>
@ -174,7 +175,8 @@
<a class="uk-button-default uk-align-right" *ngIf="!isSelected(result.id)"
(click)="add(result, result.id, 'openaire','dataset', result['title'].url, result['title'].name, result.year, result['title'].accessMode)" class="uk-icon-button"><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="plus" ratio="1"><rect x="9" y="1" width="1" height="17"></rect><rect x="1" y="9" width="17" height="1"></rect></svg></a>
(click)="add(result, result.id, 'openaire','dataset', result['title'].url, result['title'].name, result.year, result['title'].accessMode)" class="uk-icon-button"><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="plus" ratio="1"><rect x="9" y="1" width="1" height="17"></rect>
<rect x="1" y="9" width="17" height="1"></rect></svg></a>
</div>
<span *ngIf="result.publisher" class="uk-article-meta">Publisher: {{result.publisher}}</span><span *ngIf="(result.year)" class="uk-article-meta">({{result.year}})</span>
<div *ngIf="result.authors && result.authors.length >0 " class="uk-article-meta">Authors: <span *ngFor="let author of result.authors.slice(0,10) let i = index">{{author}}{{(i < (result.authors.slice(0,10).length-1))?"; ":""}}{{(i == result.authors.slice(0,10).length-1 && result.authors.length > 10)?"...":""}}</span></div>
@ -185,4 +187,35 @@
</div>
</div>
</div>
<div *ngIf="activeTab == 'openaireSoftware'" id="openaireSoftware" class="uk-animation-fade">
<div *ngIf="openaireSoftwareStatus == errorCodes.LOADING" class="uk-animation-fade uk-margin-top uk-width-1-1" role="alert"><img src="./assets/loading.gif" class="uk-align-center" alt="Loading"></div>
<div *ngIf="openaireSoftwareStatus == errorCodes.NONE" class="uk-alert uk-alert-primary" role="alert">No Results found</div>
<div *ngIf="openaireSoftwareStatus == errorCodes.ERROR" class="uk-alert uk-alert-warning" role="alert">An Error Occured</div>
<div *ngIf="openaireSoftwareStatus == errorCodes.NOT_AVAILABLE" class="uk-alert uk-alert-danger" role="alert">Service not available</div>
<div class = "uk-margin-top">
<div *ngIf="openaireSoftwareNum != null && openaireSoftwareNum > 0" class="uk-clearfix">
<div class="uk-float-right">
<paging-no-load [currentPage]="openaireSoftwarePage" [totalResults]="openaireSoftwareNum" [term]="keyword" [size]="size" (pageChange)="openaireSoftwarePageChange($event)"> </paging-no-load>
</div>
</div>
<div >
<ul *ngIf="openaireSoftware.length > 0 " class="uk-list uk-list-divider">
<li *ngFor=" let result of openaireSoftware " [class]="(isSelected(result.id))?'uk-block-muted':''">
<div >
<a *ngIf="result['title'].url" target="_blank" [href]="result['title'].url" >{{result['title'].name}}</a>
<span *ngIf="!result['title'].url" >{{result['title'].name}}</span>
<a class="uk-button-default uk-align-right" *ngIf="!isSelected(result.id)"
(click)="add(result, result.id, 'openaire','software', result['title'].url, result['title'].name, result.year, result['title'].accessMode)" class="uk-icon-button"><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="plus" ratio="1"><rect x="9" y="1" width="1" height="17"></rect>
<rect x="1" y="9" width="17" height="1"></rect></svg></a>
</div>
<span *ngIf="result.publisher" class="uk-article-meta">Publisher: {{result.publisher}}</span><span *ngIf="(result.year)" class="uk-article-meta">({{result.year}})</span>
<div *ngIf="result.authors && result.authors.length >0 " class="uk-article-meta">Authors: <span *ngFor="let author of result.authors.slice(0,10) let i = index">{{author}}{{(i < (result.authors.slice(0,10).length-1))?"; ":""}}{{(i == result.authors.slice(0,10).length-1 && result.authors.length > 10)?"...":""}}</span></div>
</li>
</ul>
</div>
</div>
</div>
</div>

View File

@ -5,6 +5,7 @@ import {SearchOrcidService} from '../claim-utils/service/searchOrcid.service';
import {SearchPublicationsService} from '../../services/searchPublications.service';
import { SearchDataciteService } from '../claim-utils/service/searchDatacite.service';
import {SearchDatasetsService} from '../../services/searchDatasets.service';
import {SearchSoftwareService} from '../../services/searchSoftware.service';
import { ErrorCodes} from '../../utils/properties/openaireProperties';
import {ClaimResult} from '../claim-utils/claimEntities.class';
@ -17,7 +18,7 @@ declare var UIkit:any;
})
export class ClaimResultSearchFormComponent {
constructor (private _searchDataciteService: SearchDataciteService, private _searchDatasetsService:SearchDatasetsService,
constructor (private _searchDataciteService: SearchDataciteService, private _searchDatasetsService:SearchDatasetsService, private _searchSoftwareService:SearchSoftwareService,
private _searchCrossrefService: SearchCrossrefService,private _searchOrcidService: SearchOrcidService, private _searchPublicationsService: SearchPublicationsService,
private route: ActivatedRoute) {
var myDate = new Date();
@ -59,6 +60,10 @@ export class ClaimResultSearchFormComponent {
openaireDataNum:number = 0 ;
openaireDataStatus = this.errorCodes.NONE;
openaireDataPage : number = 1;
openaireSoftware=[];
openaireSoftwareNum:number = 0 ;
openaireSoftwareStatus = this.errorCodes.NONE;
openaireSoftwarePage : number = 1;
public warningMessage = "";
public infoMessage = "";
@ -119,6 +124,7 @@ export class ClaimResultSearchFormComponent {
if((this.searchSource == "all" || this.searchSource == "openaire") && this.reloadOpenaire){
this.searchOpenairePubs(this.keyword, this.size, 1);
this.searchOpenaireData(this.keyword,this.size,1);
this.searchOpenaireSoftware(this.keyword,this.size,1);
this.reloadOpenaire = false;
}
if((this.searchSource == "all" || this.searchSource == "crossref")&&this.reloadCrossref){
@ -440,7 +446,14 @@ openaireDataPageChange($event) {
this.infoMessage = "";
}
openaireSoftwarePageChange($event) {
this.openaireSoftwarePage=$event.value;
this.openaireSoftware=[];
this.searchOpenaireSoftware(this.keyword,10,this.openaireSoftwarePage);
this.warningMessage = "";
this.infoMessage = "";
}
private isSelected(id:string){
@ -519,6 +532,49 @@ openaireDataPageChange($event) {
this.infoMessage = "";
}
private searchOpenaireSoftware (term: string, size : number, page : number) {
if(this.DOIs.length > 0 ){
this.openaireSoftwareStatus = this.errorCodes.LOADING;
this._searchSoftwareService.searchSoftwareByDois(this.DOIs, null, page, size, []).subscribe(
data => {
if(data != null) {
this.openaireSoftwarePage=page;
this.openaireSoftwareNum = data[0];
this.openaireSoftware = data[1];
this.openaireSoftwareStatus = this.errorCodes.DONE;
if(this.openaireSoftwareNum == 0){
this.openaireSoftwareStatus = this.errorCodes.NONE;
}
}
},
err => {
this.openaireSoftwareStatus = this.errorCodes.ERROR;
console.log(err.status);
}
);
}else{
this._searchSoftwareService.searchSoftware('q='+term+'', null, page, size, []).subscribe(
data => {
if(data != null) {
this.openaireSoftwarePage=page;
this.openaireSoftwareNum = data[0];
this.openaireSoftware = data[1];
this.openaireSoftwareStatus = this.errorCodes.DONE;
if(this.openaireSoftwareNum == 0){
this.openaireSoftwareStatus = this.errorCodes.NONE;
}
}
},
err => {
this.openaireSoftwareStatus = this.errorCodes.ERROR;
console.log(err.status);
}
);
}
this.warningMessage = "";
this.infoMessage = "";
}
private getDataciteResults (term: string, size : number, page : number) {
this._searchDataciteService.searchDataciteResults(term, size, page).subscribe(
data => {

View File

@ -11,12 +11,12 @@ import {SearchOrcidService} from './service/searchOrcid.service';
import {PublicationsServiceModule} from '../../services/publicationsService.module';
import {DatasetsServiceModule} from '../../services/datasetsService.module';
import {SoftwareServiceModule} from '../../services/softwareService.module';
import {PagingModule } from '../../utils/paging.module';
@NgModule({
imports: [
SharedModule, CommonModule, PublicationsServiceModule, DatasetsServiceModule, PagingModule, SearchCrossrefServiceModule, SearchDataciteServiceModule
],
imports: [SharedModule, CommonModule, PublicationsServiceModule, DatasetsServiceModule, PagingModule, SearchCrossrefServiceModule,
SearchDataciteServiceModule,SoftwareServiceModule],
providers:[
SearchOrcidService
],

View File

@ -21,6 +21,11 @@
<label> <input [(ngModel)]="datasetCB" type="checkbox" (ngModelChange)="changeType()" name="dataset" />
<span class="uk-margin-small-right uk-icon" ><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" ratio="1"><ellipse fill="none" stroke="#000" cx="10" cy="4.64" rx="7.5" ry="3.14"></ellipse><path fill="none" stroke="#000" d="M17.5,8.11 C17.5,9.85 14.14,11.25 10,11.25 C5.86,11.25 2.5,9.84 2.5,8.11"></path><path fill="none" stroke="#000" d="M17.5,11.25 C17.5,12.99 14.14,14.39 10,14.39 C5.86,14.39 2.5,12.98 2.5,11.25"></path><path fill="none" stroke="#000" d="M17.49,4.64 L17.5,14.36 C17.5,16.1 14.14,17.5 10,17.5 C5.86,17.5 2.5,16.09 2.5,14.36 L2.5,4.64"></path></svg></span>
Research Data </label>
<label> <input [(ngModel)]="softwareCB" type="checkbox" (ngModelChange)="changeType()" name="software" />
<span class="uk-margin-small-right uk-icon" >
<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" ratio="1"> <circle fill="none" stroke="#000" cx="9.997" cy="10" r="3.31"></circle> <path fill="none" stroke="#000" d="M18.488,12.285 L16.205,16.237 C15.322,15.496 14.185,15.281 13.303,15.791 C12.428,16.289 12.047,17.373 12.246,18.5 L7.735,18.5 C7.938,17.374 7.553,16.299 6.684,15.791 C5.801,15.27 4.655,15.492 3.773,16.237 L1.5,12.285 C2.573,11.871 3.317,10.999 3.317,9.991 C3.305,8.98 2.573,8.121 1.5,7.716 L3.765,3.784 C4.645,4.516 5.794,4.738 6.687,4.232 C7.555,3.722 7.939,2.637 7.735,1.5 L12.263,1.5 C12.072,2.637 12.441,3.71 13.314,4.22 C14.206,4.73 15.343,4.516 16.225,3.794 L18.487,7.714 C17.404,8.117 16.661,8.988 16.67,10.009 C16.672,11.018 17.415,11.88 18.488,12.285 L18.488,12.285 Z"></path></svg>
</span>
Software </label>
<label> <input [(ngModel)]="contextCB" type="checkbox" (ngModelChange)="changeType()" name="context" />
<span class="uk-margin-small-right uk-icon" ><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" ratio="1"><circle fill="none" stroke="#000" stroke-width="1.1" cx="7.7" cy="8.6" r="3.5"></circle><path fill="none" stroke="#000" stroke-width="1.1" d="M1,18.1 C1.7,14.6 4.4,12.1 7.6,12.1 C10.9,12.1 13.7,14.8 14.3,18.3"></path><path fill="none" stroke="#000" stroke-width="1.1" d="M11.4,4 C12.8,2.4 15.4,2.8 16.3,4.7 C17.2,6.6 15.7,8.9 13.6,8.9 C16.5,8.9 18.8,11.3 19.2,14.1"></path></svg></span>
Context </label>

View File

@ -75,6 +75,7 @@ export class DisplayClaimsComponent {
//checkboxes:
publicationCB = false;
datasetCB = false;
softwareCB = false;
contextCB = false;
projectCB = false;
entityTypes : string[] =[] ;
@ -225,6 +226,7 @@ handleErrors(err){
this.publicationCB = false;
this.projectCB = false;
this.datasetCB = false;
this.softwareCB = false;
this.contextCB = false;
this.entityTypes = [];
this.goTo();
@ -282,6 +284,9 @@ handleErrors(err){
if(this.datasetCB){
this.entityTypes.push('dataset');
}
if(this.softwareCB){
this.entityTypes.push('software');
}
if(this.projectCB){
this.entityTypes.push('project');
}
@ -305,6 +310,10 @@ handleErrors(err){
this.datasetCB = true;
this.entityTypes.push("dataset");
}
if(types.indexOf("software")!=-1){
this.softwareCB = true;
this.entityTypes.push("software");
}
if(types.indexOf("project")!=-1){
this.projectCB = true;
this.entityTypes.push("project");
@ -314,7 +323,7 @@ handleErrors(err){
this.entityTypes.push("context");
}
}
if(this.publicationCB && this.datasetCB && this.contextCB && this.projectCB){
if(this.publicationCB && this.datasetCB && this.softwareCB && this.contextCB && this.projectCB){
this.entityTypes=[];
}
}

View File

@ -14,6 +14,12 @@ import {Component, Input} from '@angular/core';
<span class="uk-margin-small-right uk-icon" ><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" ratio="1"><ellipse fill="none" stroke="#000" cx="10" cy="4.64" rx="7.5" ry="3.14"></ellipse><path fill="none" stroke="#000" d="M17.5,8.11 C17.5,9.85 14.14,11.25 10,11.25 C5.86,11.25 2.5,9.84 2.5,8.11"></path><path fill="none" stroke="#000" d="M17.5,11.25 C17.5,12.99 14.14,14.39 10,14.39 C5.86,14.39 2.5,12.98 2.5,11.25"></path><path fill="none" stroke="#000" d="M17.49,4.64 L17.5,14.36 C17.5,16.1 14.14,17.5 10,17.5 C5.86,17.5 2.5,16.09 2.5,14.36 L2.5,4.64"></path></svg></span>
<publication-title [title]="entity.title" [url]="entity.externalUrl" ></publication-title>
</div>
<div *ngIf="type == 'software'" title="Software">
<span class="uk-margin-small-right uk-icon" >
<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" ratio="1"> <circle fill="none" stroke="#000" cx="9.997" cy="10" r="3.31"></circle> <path fill="none" stroke="#000" d="M18.488,12.285 L16.205,16.237 C15.322,15.496 14.185,15.281 13.303,15.791 C12.428,16.289 12.047,17.373 12.246,18.5 L7.735,18.5 C7.938,17.374 7.553,16.299 6.684,15.791 C5.801,15.27 4.655,15.492 3.773,16.237 L1.5,12.285 C2.573,11.871 3.317,10.999 3.317,9.991 C3.305,8.98 2.573,8.121 1.5,7.716 L3.765,3.784 C4.645,4.516 5.794,4.738 6.687,4.232 C7.555,3.722 7.939,2.637 7.735,1.5 L12.263,1.5 C12.072,2.637 12.441,3.71 13.314,4.22 C14.206,4.73 15.343,4.516 16.225,3.794 L18.487,7.714 C17.404,8.117 16.661,8.988 16.67,10.009 C16.672,11.018 17.415,11.88 18.488,12.285 L18.488,12.285 Z"></path></svg>
</span>
<publication-title [title]="entity.title" [url]="entity.externalUrl" ></publication-title>
</div>
<div *ngIf="type == 'project' " title="Project">
<span class="uk-margin-small-right uk-icon" ><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" ratio="1"><rect x="5" y="2" width="10" height="1"></rect><rect x="3" y="4" width="14" height="1"></rect><rect fill="none" stroke="#000" x="1.5" y="6.5" width="17" height="11"></rect></svg></span>
<project-title [project]="entity"></project-title>
@ -32,7 +38,10 @@ export class ClaimEntityFormatter {
constructor () {}
ngOnInit() {
if(this.type && this.type == "software"){
console.log(this.entity);
}
}

View File

@ -14,7 +14,7 @@ export class SearchCrossrefService {
let url = OpenaireProperties.getSearchCrossrefAPIURL()+'?query='+term+'&rows='+size+'&offset='+(size*(page-1));
let key = url;
return this.http.get( (OpenaireProperties.isCacheEnabled())? (OpenaireProperties.getCacheUrl()+encodeURIComponent(url)): url)
return this.http.get(url)
.map(request => <any> request.json().message)
.do(items => console.log("Crossref Results: total results = "+items['total-results']+" keyword = "+term));
//.catch(this.handleError);
@ -35,7 +35,7 @@ export class SearchCrossrefService {
let key = url;
return this.http.get( (OpenaireProperties.isCacheEnabled())? (OpenaireProperties.getCacheUrl()+encodeURIComponent(url)): url)
return this.http.get(url)
.map(request => <any> request.json().message)
.do(items => console.log("Crossref Results: total results = "+items['total-results']+" for doi = "+doisParams));
//.catch(this.handleError);
@ -50,7 +50,7 @@ export class SearchCrossrefService {
let key = url;
return this.http.get( (OpenaireProperties.isCacheEnabled())? (OpenaireProperties.getCacheUrl()+encodeURIComponent(url)): url)
return this.http.get(url)
.map(request => <any> request.json().message)
.do(items => console.log("Crossref Results: total results = "+items['total-results']));
//.catch(this.handleError);

View File

@ -23,7 +23,7 @@ export class SearchOrcidService {
let url = OpenaireProperties.getSearchOrcidURL()+term+'/orcid-bio';
let key = url;
return this.http.get((OpenaireProperties.isCacheEnabled())? (OpenaireProperties.getCacheUrl()+encodeURIComponent(url)): url, { headers: headers })
return this.http.get(url, { headers: headers })
.map(res => res.json()['orcid-profile'])
.map(res => [res['orcid-bio']['personal-details']['given-names'],
res['orcid-bio']['personal-details']['family-name'],
@ -41,7 +41,7 @@ export class SearchOrcidService {
let url = OpenaireProperties.getSearchOrcidURL()+'search/orcid-bio?defType=edismax&q='+term+'&qf=given-name^1.0+family-name^2.0+other-names^1.0+credit-name^1.0&start=0&rows=10';
let key = url;
return this.http.get((OpenaireProperties.isCacheEnabled())? (OpenaireProperties.getCacheUrl()+encodeURIComponent(url)): url, { headers: headers })
return this.http.get(url, { headers: headers })
.map(res => res.json()['orcid-search-results']['orcid-search-result'])
.map(res => this.parseOrcidAuthors(res, authorIds, authorGivenNames, authorFamilyNames));
@ -56,7 +56,7 @@ export class SearchOrcidService {
let url = OpenaireProperties.getSearchOrcidURL()+id+'/orcid-works';
let key = url;
return this.http.get((OpenaireProperties.isCacheEnabled())? (OpenaireProperties.getCacheUrl()+encodeURIComponent(url)): url, { headers: headers })
return this.http.get(url, { headers: headers })
.map(res => res.json()['orcid-profile']['orcid-activities']['orcid-works']);
//.map(res => res['orcid-work']);
}

View File

@ -64,7 +64,7 @@
<!--start-over [results]="results" [contexts]="contexts" [projects]="projects" [linkTo]="linkTo" [type]="type" ></start-over-->
</div>
<!-- inline result -->
<div *ngIf="displayedResult != null && (type =='publication' || type =='dataset' )" class="uk-padding uk-panel uk-background-muted">
<div *ngIf="displayedResult != null && (type =='publication' || type =='dataset' || type=='software' )" class="uk-padding uk-panel uk-background-muted">
<div class="uk-width-1-1" >
<div>
<a *ngIf="displayedResult.url" target="_blank" href="{{displayedResult.url}}" > <span class="custom-external"></span> {{displayedResult.title}}</a>

View File

@ -5,6 +5,8 @@ import {EntitiesSearchService} from '../../utils/entitiesAutoComplete/entitySear
import {ClaimProject, ClaimResult} from '../claim-utils/claimEntities.class';
import {SearchPublicationsService} from '../../services/searchPublications.service';
import {SearchDatasetsService} from '../../services/searchDatasets.service';
import {SearchSoftwareService} from '../../services/searchSoftware.service';
import { Meta} from '../../../angular2-meta';
@Component({
@ -23,14 +25,14 @@ export class DirectLinkingComponent {
type:string = null; // entity type (publication or dataset)
linkTo:string = null; // entity type (project or context or result)
entityTypes=["dataset", "publication", "project","context"];
entityTypes=["dataset", "publication","software", "project","context"];
inlineResult:ClaimResult =null;
displayedResult:ClaimResult =null;
sub:any =null;
show:string="claim"; //{claim,result}
validInput:boolean = null;//'true;
constructor ( private _router: Router, private route: ActivatedRoute, private entitySearch:EntitiesSearchService,
private publicationsSearch:SearchPublicationsService, private datasetsSearch:SearchDatasetsService, private _meta: Meta) {
private publicationsSearch:SearchPublicationsService, private datasetsSearch:SearchDatasetsService, private softwareSearch:SearchSoftwareService, private _meta: Meta) {
this._meta.setTitle("OpenAIRE | Direct Linking");
}
ngOnInit() {
@ -43,9 +45,6 @@ export class DirectLinkingComponent {
if(localStorage.getItem("results")){
this.results = JSON.parse(localStorage.getItem("results"));
}
if(localStorage.getItem("results")){
this.results = JSON.parse(localStorage.getItem("results"));
}
if(localStorage.getItem("inlineEntity")){
this.inlineResult = JSON.parse(localStorage.getItem("inlineEntity"));
}
@ -65,7 +64,7 @@ export class DirectLinkingComponent {
this.show = (this.linkTo != "result")?"claim":"result";
this.linkType = this.linkTo;
var isInlineResult:boolean = false; // is a link result - result
if((this.type == "publication" || this.type == "dataset") && ((this.linkTo == "publication" || this.linkTo == "dataset") || this.linkTo == "result" )){
if((this.type == "publication" || this.type == "dataset" || this.type == "software") && ((this.linkTo == "publication" || this.linkTo == "dataset" || this.linkTo == "software") || this.linkTo == "result" )){
isInlineResult = true;
}
if(this.type == "project"){
@ -75,7 +74,9 @@ export class DirectLinkingComponent {
this.getPublicationById(this.id,isInlineResult);
}else if(this.type == "dataset"){
this.getDatasetById(this.id,isInlineResult);
}else{
}else if(this.type == "software"){
this.getSoftwareById(this.id,isInlineResult);
}else{
this.validInput = this.isValidInput(null);
}
@ -91,9 +92,9 @@ export class DirectLinkingComponent {
return false;
}else if(this.type == "project" && this.linkTo != "result"){
return false;
}else if(["dataset","publication"].indexOf(this.type) != -1 && (["project","context","result"].indexOf(this.linkTo) == -1)){
}else if(["dataset","publication","software"].indexOf(this.type) != -1 && (["project","context","result"].indexOf(this.linkTo) == -1)){
return false;
}else if(["project","dataset","publication"].indexOf(this.type) == -1){
}else if(["project","dataset","publication","software"].indexOf(this.type) == -1){
return false;
}else{
return true;
@ -164,7 +165,8 @@ export class DirectLinkingComponent {
result.url= item['title'].url;
result.result = item;
result.accessRights = item['title'].accessMode;
result.date = item.year; this.displayedResult = result;
result.date = item.year;
this.displayedResult = result;
if(isInlineResult){
this.inlineResult = result;
}else{
@ -176,13 +178,31 @@ export class DirectLinkingComponent {
this.validInput = this.isValidInput(null);
console.log("An error occured")
});
}
getSoftwareById(id:string, isInlineResult:boolean){
this.sub = this.softwareSearch.searchSoftwareById(id).subscribe(
data => {
var item =data[0];
var result: ClaimResult = new ClaimResult();
result.id=id;
result.type="software";
result.source="openaire";
result.title = item['title'].name;
result.url= item['title'].url;
result.result = item;
result.accessRights = item['title'].accessMode;
result.date = item.year;
this.displayedResult = result;
if(isInlineResult){
this.inlineResult = result;
}else{
this.results.push( result);
}
this.validInput = this.isValidInput(result);
},
err => {
this.validInput = this.isValidInput(null);
console.log("An error occured")
});
}
}

View File

@ -13,6 +13,7 @@ import {StartOverModule} from '../claim-utils/startOver.module';
import {EntitySearchServiceModule} from '../../utils/entitiesAutoComplete/entitySearchService.module';
import {PublicationsServiceModule} from '../../services/publicationsService.module';
import {DatasetsServiceModule} from '../../services/datasetsService.module';
import {SoftwareServiceModule} from '../../services/softwareService.module';
import {LoginGuard} from'../../login/loginGuard.guard';
import {PreviousRouteRecorder} from '../../utils/piwik/previousRouteRecorder.guard';
import {HelperModule} from '../../utils/helper/helper.module';

View File

@ -121,25 +121,28 @@ private insertActions(){
}
//first call direct index service - when call is done (success or error) call isertBulkClaims method to insert claims in DB
console.info("\n\ndirectclaims: "+directclaims.length+"\n\n");
this.claimService.insertDirectRecords(directclaims).subscribe(
data => {
this.insertedRecords = data.insertedIds;
if(directclaims.length > 0){
this.claimService.insertDirectRecords(directclaims).subscribe(
data => {
this.insertedRecords = data.insertedIds;
this.errorInRecords = data.errorInClaims;
this.errorInRecords = data.errorInClaims;
this.isertBulkClaims(claims);
},
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.isertBulkClaims(claims);
},
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.isertBulkClaims(claims);
}
);
);
}else{
this.isertBulkClaims(claims);
}
}
}
@ -217,8 +220,6 @@ private validateDates(){
}
private afterclaimsInsertion(){
// this.servicesRespond++;
// if(this.servicesRespond == 2){
this.loading.close();
this.claiming = false;
@ -231,7 +232,6 @@ private afterclaimsInsertion(){
}else{
this.errorsInClaimsInsertion();
}
// }
}
private errorsInClaimsInsertion(){
this.errorMessage = "";
@ -319,8 +319,10 @@ createDirectClaim(result, projects, contexts){
}
if(result.type =="publication"){
entity["resourceType"]="0001";
}else{
}else if(result.type =="dataset"){
entity["resourceType"]="0021";
}else if(result.type =="software"){
entity["resourceType"]="0029";
}
entity["url"]=result.url;
entity["hostedById"]="openaire____::1256f046-bf1f-4afc-8b47-d0b147148b18";

View File

@ -77,6 +77,7 @@ import {Dates} from '../../../utils/string-utils.class';
<select [(ngModel)]="pub.type" name="{{'select_type_'+pub.id}}" >
<option [value]="'publication'" (click)="onTypeChanged('publication',pub)" >Publication</option>
<option [value]="'dataset'" (click)="onTypeChanged('dataset',pub)" >Research Data</option>
<option [value]="'software'" (click)="onTypeChanged('software',pub)" >Software</option>
</select>
<select [(ngModel)]="pub.accessRights" name="{{'select_rights_'+pub.id}}" >

View File

@ -51,7 +51,7 @@
{{softwareInfo.description}}
</div>
<!--div class="uk-clearfix"><div class="uk-button-group uk-float-right uk-margin-top">
<div class="uk-clearfix"><div class="uk-button-group uk-float-right uk-margin-top">
<button class="uk-button uk-button-small uk-button-action">
<span class="uk-icon" >
<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="link" ratio="1"><path fill="none" stroke="#000" stroke-width="1.1" d="M10.625,12.375 L7.525,15.475 C6.825,16.175 5.925,16.175 5.225,15.475 L4.525,14.775 C3.825,14.074 3.825,13.175 4.525,12.475 L7.625,9.375"></path><path fill="none" stroke="#000" stroke-width="1.1" d="M9.325,7.375 L12.425,4.275 C13.125,3.575 14.025,3.575 14.724,4.275 L15.425,4.975 C16.125,5.675 16.125,6.575 15.425,7.275 L12.325,10.375"></path><path fill="none" stroke="#000" stroke-width="1.1" d="M7.925,11.875 L11.925,7.975"></path></svg></span>
@ -74,7 +74,7 @@
</div>
</div>
</div></div-->
</div></div>
<ul class="uk-tab uk-visible@m" uk-tab="connect: #tab-content">

View File

@ -68,7 +68,7 @@ export class SoftwareService {
this.softwareInfo.embargoEndDate = data[0].embargoenddate;
}
this.softwareInfo.title = {"name": "", "url": "", "accessMode": ""};
if(data[0]['bestaccessright'].hasOwnProperty("classid")) {
if(data[0]['bestaccessright'] && data[0]['bestaccessright'].hasOwnProperty("classid")) {
this.softwareInfo.title.accessMode = data[0]['bestaccessright'].classid;
}
if(data[1] != null) {

View File

@ -142,7 +142,7 @@ export class SearchSoftwareService {
//result['title'].url = OpenaireProperties.getsearchLinkToSoftware();
//result['title'].url += Array.isArray(data) ? data[i]['result']['header']['dri:objIdentifier'] : data['result']['header']['dri:objIdentifier'];
result['id'] = Array.isArray(data) ? data[i]['result']['header']['dri:objIdentifier'] : data['result']['header']['dri:objIdentifier'];
if(resData['bestaccessright'].hasOwnProperty("classid")) {
if(resData['bestaccessright'] && resData['bestaccessright'].hasOwnProperty("classid")) {
result['title'].accessMode = resData['bestaccessright'].classid;
}