Show results in Deposit Result Page (organization is currently hardcoded: name+url or id) | array checks in services corrected (length > 1 was not the right way)
git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-portal/trunk@44084 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
parent
f888c6937d
commit
a6db6539f8
|
@ -65,6 +65,7 @@ export class DepositComponent {
|
|||
|
||||
keywordChanged() {
|
||||
console.info("keywordChanged: "+this.keyword);
|
||||
|
||||
this._router.navigate( ['deposit-results'] );//, {"name": this.keyword}] );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,12 +7,17 @@ import { UtilsModule} from '../utils/utils.module'
|
|||
import { DepositComponent } from './deposit.component';
|
||||
import {DepositResultComponent} from './depositResult.component';
|
||||
|
||||
import {ServicesModule} from '../services/services.module';
|
||||
import {SearchModule} from '../searchPages/search.module';
|
||||
|
||||
//helpers
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
CommonModule, FormsModule,
|
||||
UtilsModule,
|
||||
ServicesModule,
|
||||
SearchModule
|
||||
],
|
||||
declarations: [
|
||||
DepositComponent,
|
||||
|
|
|
@ -2,6 +2,11 @@ import {Component, Input} from '@angular/core';
|
|||
import {Observable} from 'rxjs/Observable';
|
||||
import {OpenaireProperties} from '../utils/properties/openaireProperties';
|
||||
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
import { SearchDataprovidersComponent } from '../searchPages/searchDataproviders.component';
|
||||
import { SearchDataprovidersService } from '../services/searchDataproviders.service';
|
||||
import { SearchResultComponent } from '../searchPages/searchUtils/searchResult.component';
|
||||
|
||||
@Component({
|
||||
selector: 'depositResult',
|
||||
template: `
|
||||
|
@ -10,23 +15,43 @@ import {OpenaireProperties} from '../utils/properties/openaireProperties';
|
|||
<h2>Deposit Publications</h2>
|
||||
</div>
|
||||
|
||||
<div *ngIf="organization!=undefined">
|
||||
<h2>
|
||||
<div *ngIf="searchDataprovidersComponent.totalResults > 0">
|
||||
<h2 *ngIf="organization != undefined">
|
||||
<span>Data providers for institution: </span>
|
||||
<a *ngIf="organization['url']!=''">
|
||||
<a *ngIf="organization['url']!=''" href="{{organization.url}}">
|
||||
<span>{{organization['name']}}</span>
|
||||
</a>
|
||||
<span *ngIf="organization['url']==''">{{organization['name']}}</span>
|
||||
</h2>
|
||||
<h2 *ngIf="organization == undefined && organizationId != undefined">
|
||||
<span>Data providers for institution with ID: </span>
|
||||
<a href="{{url}}">{{organizationId}}</a>
|
||||
</h2>
|
||||
</div>
|
||||
|
||||
<div *ngIf="dataProviders != undefined">
|
||||
<div *ngIf="searchDataprovidersComponent.totalResults > 0">
|
||||
<p>Please use the information/contacts shown below to deposit your publications.</p>
|
||||
<showDataProviders [dataProviders]=dataProviders></showDataProviders>
|
||||
<!--showDataProviders [dataProviders]=dataProviders></showDataProviders-->
|
||||
<div class = "text-right" *ngIf = "searchDataprovidersComponent.totalResults > 10" ><a [href] = "linkToSearchDataproviders" >View all {{searchDataprovidersComponent.totalResults}} results</a></div>
|
||||
<search-result [(results)]="searchDataprovidersComponent.results" [(status)]= "searchDataprovidersComponent.status"></search-result>
|
||||
</div>
|
||||
|
||||
<div *ngIf="dataProviders == undefined" class = "alert alert-warning">
|
||||
No data providers found.
|
||||
<div *ngIf="searchDataprovidersComponent.totalResults == 0" class = "alert alert-warning">
|
||||
No data providers found
|
||||
<span *ngIf="organization != undefined">
|
||||
for institution:
|
||||
<a *ngIf="organization['url']!=''" href="{{organization.url}}">
|
||||
<span>{{organization['name']}}</span>
|
||||
</a>
|
||||
<span *ngIf="organization['url']==''">{{organization['name']}}</span>
|
||||
</span>
|
||||
<span *ngIf="organization == undefined && organizationId != undefined">
|
||||
for institution with ID:
|
||||
<a href="{{url}}">
|
||||
<span>{{organizationId}}</span>
|
||||
</a>
|
||||
</span>
|
||||
.
|
||||
<br>
|
||||
You can still deposit your publications and/or research data in
|
||||
<a href="{{zenodo}}">OpenAIRE's Zenodo catch-all repository </a>
|
||||
|
@ -37,12 +62,47 @@ import {OpenaireProperties} from '../utils/properties/openaireProperties';
|
|||
})
|
||||
|
||||
export class DepositResultComponent {
|
||||
@Input() organization: {"name": string, "url": string};
|
||||
private dataProviders: { "name": string, "url": string, "type": string, "websiteUrl": string,
|
||||
"organizations": {"name": string, "url": string}[]}[];
|
||||
@Input() organization: {"name": string, "url": string};// = {"name": "NTUA", "url": OpenaireProperties.getsearchLinkToOrganization()+"dedup_wf_001%3A%3A44cb3a714d104139c37beb7580070b96"};
|
||||
@Input() organizationId: string;// = "dedup_wf_001%3A%3A44cb3a714d104139c37beb7580070b96";
|
||||
url: string;
|
||||
|
||||
subDataproviders: any;
|
||||
|
||||
private searchDataprovidersComponent : SearchDataprovidersComponent;
|
||||
private linkToSearchDataproviders = "";
|
||||
|
||||
private zenodo: string;
|
||||
|
||||
constructor () {
|
||||
constructor (private route: ActivatedRoute,
|
||||
private _searchDataprovidersService: SearchDataprovidersService) {
|
||||
console.info("depositResult constructor");
|
||||
|
||||
this.zenodo = OpenaireProperties.getZenodoURL();
|
||||
this.searchDataprovidersComponent = new SearchDataprovidersComponent(this.route, this._searchDataprovidersService);
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
console.info('depositResult init');
|
||||
|
||||
if(this.organizationId != undefined) {
|
||||
this.url = OpenaireProperties.getsearchLinkToOrganization()+this.organizationId;
|
||||
}
|
||||
|
||||
this.subDataproviders = this.route.queryParams.subscribe(params => {
|
||||
this.searchDataproviders();
|
||||
});
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
this.subDataproviders.unsubscribe();
|
||||
}
|
||||
|
||||
private searchDataproviders() {
|
||||
if(this.organization != undefined) {
|
||||
this.searchDataprovidersComponent.getResults(this.organization.name, 1, 10, "searchPage");
|
||||
} else if(this.organizationId != undefined) {
|
||||
this.searchDataprovidersComponent.getResults(this.organizationId, 1, 10, "organizationPage");
|
||||
}
|
||||
this.linkToSearchDataproviders = OpenaireProperties.getLinkToSearchDataProviders();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -109,7 +109,7 @@ export class DatasetService {
|
|||
|
||||
for(let j=0; j<length1; j++) {
|
||||
let funding;
|
||||
let mydata1 = length1 > 1 ? mydata['funding'][j] : mydata['funding'];
|
||||
let mydata1 = Array.isArray(mydata['funding']) ? mydata['funding'][j] : mydata['funding'];
|
||||
|
||||
if(mydata1.hasOwnProperty("funder")) {
|
||||
this.datasetInfo.fundedByProjects[counter]['funderShortname'] = mydata1['funder'].shortname;
|
||||
|
|
|
@ -110,7 +110,7 @@ export class PublicationService {
|
|||
|
||||
for(let j=0; j<length1; j++) {
|
||||
let funding;
|
||||
let mydata1 = length1 > 1 ? mydata['funding'][j] : mydata['funding'];
|
||||
let mydata1 = Array.isArray(mydata['funding']) ? mydata['funding'][j] : mydata['funding'];
|
||||
|
||||
if(mydata1.hasOwnProperty("funder")) {
|
||||
this.publicationInfo.fundedByProjects[counter]['funderShortname'] = mydata1['funder'].shortname;
|
||||
|
|
|
@ -42,7 +42,7 @@ export class SearchDataprovidersService {
|
|||
let length = Array.isArray(data) ? data.length : 1;
|
||||
|
||||
for(let i=0; i<length; i++) {
|
||||
let resData = length > 1 ? data[i]['result']['metadata']['oaf:entity']['oaf:datasource'] : data['result']['metadata']['oaf:entity']['oaf:datasource'];
|
||||
let resData = Array.isArray(data) ? data[i]['result']['metadata']['oaf:entity']['oaf:datasource'] : data['result']['metadata']['oaf:entity']['oaf:datasource'];
|
||||
|
||||
var result: SearchResult = new SearchResult();
|
||||
|
||||
|
@ -51,7 +51,7 @@ export class SearchDataprovidersService {
|
|||
result['title'].name = resData.officialname;
|
||||
|
||||
result['title'].url = OpenaireProperties.getsearchLinkToDataProvider();
|
||||
result['title'].url += length > 1 ? data[i]['result']['header']['dri:objIdentifier'] : data['result']['header']['dri:objIdentifier'];
|
||||
result['title'].url += Array.isArray(data) ? data[i]['result']['header']['dri:objIdentifier'] : data['result']['header']['dri:objIdentifier'];
|
||||
|
||||
if(resData['datasourcetype'].hasOwnProperty("classname")) {
|
||||
result['type'] = resData['datasourcetype'].classname;
|
||||
|
@ -72,7 +72,7 @@ export class SearchDataprovidersService {
|
|||
let relLength = Array.isArray(resData['rels']['rel']) ? resData['rels']['rel'].length : 1;
|
||||
|
||||
for(let i=0; i<relLength; i++) {
|
||||
let relation = relLength > 1 ? resData['rels']['rel'][i] : resData['rels']['rel'];
|
||||
let relation = Array.isArray(resData['rels']['rel']) ? resData['rels']['rel'][i] : resData['rels']['rel'];
|
||||
|
||||
if(relation.hasOwnProperty("to")) {
|
||||
if(relation['to'].class == "provides" && relation['to'].type == "organization") {
|
||||
|
|
|
@ -58,7 +58,7 @@ export class SearchOrganizationsService {
|
|||
let relLength = Array.isArray(resData['rels']['rel']) ? resData['rels']['rel'].length : 1;
|
||||
|
||||
for(let j=0; j<relLength; j++) {
|
||||
let relation = relLength > 1 ? resData['rels']['rel'][j] : resData['rels']['rel'];
|
||||
let relation = Array.isArray(resData['rels']['rel']) ? resData['rels']['rel'][j] : resData['rels']['rel'];
|
||||
|
||||
if(relation.hasOwnProperty("to")) {
|
||||
if(relation['to'].class == "isParticipant") {
|
||||
|
@ -88,7 +88,7 @@ export class SearchOrganizationsService {
|
|||
let fundingLength = Array.isArray(relation['funding']) ? relation['funding'].length : 1;
|
||||
|
||||
for(let z=0; z<fundingLength; z++) {
|
||||
let fundingData = fundingLength > 1 ? relation['funding'][z] : relation['funding'];
|
||||
let fundingData = Array.isArray(relation['funding']) ? relation['funding'][z] : relation['funding'];
|
||||
|
||||
if(fundingData.hasOwnProperty("funder")) {
|
||||
result['projects'][countProjects]['funderShortname'] = fundingData['funder'].shortname;
|
||||
|
|
|
@ -37,7 +37,7 @@ export class SearchPeopleService {
|
|||
let length = Array.isArray(data) ? data.length : 1;
|
||||
|
||||
for(let i=0; i<length; i++) {
|
||||
let resData = length > 1 ? data[i]['result']['metadata']['oaf:entity']['oaf:person'] : data['result']['metadata']['oaf:entity']['oaf:person'];
|
||||
let resData = Array.isArray(data) ? data[i]['result']['metadata']['oaf:entity']['oaf:person'] : data['result']['metadata']['oaf:entity']['oaf:person'];
|
||||
|
||||
var result: SearchResult = new SearchResult();
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ export class SearchProjectsService {
|
|||
let length = Array.isArray(data) ? data.length : 1;
|
||||
|
||||
for(let i=0; i<length; i++) {
|
||||
let resData = length > 1 ? data[i]['result']['metadata']['oaf:entity']['oaf:project'] : data['result']['metadata']['oaf:entity']['oaf:project'];
|
||||
let resData = Array.isArray(data) ? data[i]['result']['metadata']['oaf:entity']['oaf:project'] : data['result']['metadata']['oaf:entity']['oaf:project'];
|
||||
|
||||
var result: SearchResult = new SearchResult();
|
||||
|
||||
|
@ -63,7 +63,7 @@ export class SearchProjectsService {
|
|||
let relLength = Array.isArray(resData['rels']['rel']) ? resData['rels']['rel'].length : 1;
|
||||
|
||||
for(let j=0; j<relLength; j++) {
|
||||
let relation = relLength > 1 ? resData['rels']['rel'][j] : resData['rels']['rel'];
|
||||
let relation = Array.isArray(resData['rels']['rel']) ? resData['rels']['rel'][j] : resData['rels']['rel'];
|
||||
|
||||
if(relation.hasOwnProperty("to")) {
|
||||
if(relation['to'].class == "hasParticipant") {
|
||||
|
@ -96,7 +96,7 @@ export class SearchProjectsService {
|
|||
let fundingLength = Array.isArray(resData['fundingtree']) ? resData['fundingtree'].length : 1;
|
||||
|
||||
for(let z=0; z<fundingLength; z++) {
|
||||
let fundingData = fundingLength > 1 ? resData['fundingtree'][z] : resData['fundingtree'];
|
||||
let fundingData = Array.isArray(resData['fundingtree']) ? resData['fundingtree'][z] : resData['fundingtree'];
|
||||
let countFunders = result['funders'].length;
|
||||
if(fundingData.hasOwnProperty("funder")) {
|
||||
result['funders'][countFunders] = {"funderShortname": "", "funderName": ""};
|
||||
|
|
|
@ -47,7 +47,7 @@ export class SearchPublicationsService {
|
|||
let length = Array.isArray(data) ? data.length : 1;
|
||||
|
||||
for(let i=0; i<length; i++) {
|
||||
let resData = length > 1 ? data[i]['result']['metadata']['oaf:entity']['oaf:result'] : data['result']['metadata']['oaf:entity']['oaf:result'];
|
||||
let resData = Array.isArray(data) ? data[i]['result']['metadata']['oaf:entity']['oaf:result'] : data['result']['metadata']['oaf:entity']['oaf:result'];
|
||||
|
||||
var result: SearchResult = new SearchResult();
|
||||
|
||||
|
@ -64,7 +64,7 @@ export class SearchPublicationsService {
|
|||
}
|
||||
|
||||
result['title'].url = OpenaireProperties.getsearchLinkToPublication();
|
||||
result['title'].url += length > 1 ? data[i]['result']['header']['dri:objIdentifier'] : data['result']['header']['dri:objIdentifier'];
|
||||
result['title'].url += Array.isArray(data) ? data[i]['result']['header']['dri:objIdentifier'] : data['result']['header']['dri:objIdentifier'];
|
||||
if(resData['bestlicense'].hasOwnProperty("classid")) {
|
||||
result['title'].accessMode = resData['bestlicense'].classid;
|
||||
}
|
||||
|
@ -73,7 +73,7 @@ export class SearchPublicationsService {
|
|||
let relLength = Array.isArray(resData['rels']['rel']) ? resData['rels']['rel'].length : 1;
|
||||
|
||||
for(let j=0; j<relLength; j++) {
|
||||
let relation = relLength > 1 ? resData['rels']['rel'][j] : resData['rels']['rel'];
|
||||
let relation = Array.isArray(resData['rels']['rel']) ? resData['rels']['rel'][j] : resData['rels']['rel'];
|
||||
|
||||
if(relation.hasOwnProperty("to")) {
|
||||
if(relation['to'].class == "hasAuthor") {
|
||||
|
@ -109,7 +109,7 @@ export class SearchPublicationsService {
|
|||
let fundingLength = Array.isArray(relation['funding']) ? relation['funding'].length : 1;
|
||||
|
||||
for(let z=0; z<fundingLength; z++) {
|
||||
let fundingData = fundingLength > 1 ? relation['funding'][z] : relation['funding'];
|
||||
let fundingData = Array.isArray(relation['funding']) ? relation['funding'][z] : relation['funding'];
|
||||
|
||||
if(fundingData.hasOwnProperty("funder")) {
|
||||
result['projects'][countProjects]['funderShortname'] = fundingData['funder'].shortname;
|
||||
|
|
Loading…
Reference in New Issue