[Trunk | Library]:
1. result-preview.ts & resultLanding.service.ts & deletedByInference.service.ts: Add "icon" field in HostedByCollectedFrom interface. 2. availableOn.component.ts: Access mode icons set at parsing (not here). 3. result-preview.component.html: Add access mode icon & remove external link functionality for collected from (provider). 4. parsingFunctions.class.ts: a. When instance.hostedby has no name (or "Unknown Repository" or "other resources") and no name from "source" found, set url (first 30 chars) as name. b. Access mode icons set at parsing for HostedByCollectedFrom interface. git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@59038 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
parent
5157c3614c
commit
71c1206619
|
@ -1,6 +1,7 @@
|
||||||
import {Component, Input} from '@angular/core';
|
import {Component, Input} from '@angular/core';
|
||||||
import {HelperFunctions} from "../../utils/HelperFunctions.class";
|
import {HelperFunctions} from "../../utils/HelperFunctions.class";
|
||||||
import {EnvProperties} from "../../utils/properties/env-properties";
|
import {EnvProperties} from "../../utils/properties/env-properties";
|
||||||
|
import {HostedByCollectedFrom} from "../../utils/result-preview/result-preview";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'availableOn',
|
selector: 'availableOn',
|
||||||
|
@ -57,16 +58,17 @@ import {EnvProperties} from "../../utils/properties/env-properties";
|
||||||
})
|
})
|
||||||
|
|
||||||
export class AvailableOnComponent {
|
export class AvailableOnComponent {
|
||||||
@Input() availableOn: {
|
@Input() availableOn: HostedByCollectedFrom[];
|
||||||
"downloadName": string, "downloadUrl": string[],
|
// {
|
||||||
"collectedName": string, "collectedId": string,
|
// "downloadName": string, "downloadUrl": string[],
|
||||||
"accessMode": string[], "bestAccessMode": string,
|
// "collectedName": string, "collectedId": string,
|
||||||
"type": string, "year": string, icon: string
|
// "accessMode": string[], "bestAccessMode": string,
|
||||||
}[];
|
// "type": string, "year": string, icon: string
|
||||||
|
// }[];
|
||||||
@Input() properties: EnvProperties;
|
@Input() properties: EnvProperties;
|
||||||
public open = 'assets/common-assets/unlock.svg';
|
// public open = 'assets/common-assets/unlock.svg';
|
||||||
public closed = 'assets/common-assets/lock.svg';
|
// public closed = 'assets/common-assets/lock.svg';
|
||||||
public unknown = 'assets/common-assets/question.svg';
|
// public unknown = 'assets/common-assets/question.svg';
|
||||||
public threshold: number = 4;
|
public threshold: number = 4;
|
||||||
public showNum: number = 4;
|
public showNum: number = 4;
|
||||||
|
|
||||||
|
@ -74,20 +76,20 @@ export class AvailableOnComponent {
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.availableOn.forEach(available => {
|
// this.availableOn.forEach(available => {
|
||||||
if (available.bestAccessMode) {
|
// if (available.bestAccessMode) {
|
||||||
if (available.bestAccessMode.toLowerCase().indexOf('open') !== -1) {
|
// if (available.bestAccessMode.toLowerCase().indexOf('open') !== -1) {
|
||||||
available.icon = this.open;
|
// available.icon = this.open;
|
||||||
} else if (available.bestAccessMode.toLowerCase().indexOf('not available') !== -1) {
|
// } else if (available.bestAccessMode.toLowerCase().indexOf('not available') !== -1) {
|
||||||
available.icon = this.unknown;
|
// available.icon = this.unknown;
|
||||||
} else {
|
// } else {
|
||||||
available.icon = this.closed;
|
// available.icon = this.closed;
|
||||||
}
|
// }
|
||||||
} else {
|
// } else {
|
||||||
available.icon = this.unknown;
|
// available.icon = this.unknown;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
);
|
// );
|
||||||
}
|
}
|
||||||
|
|
||||||
public removeUnknown(value: string): string {
|
public removeUnknown(value: string): string {
|
||||||
|
|
|
@ -2,6 +2,9 @@ import {HostedByCollectedFrom, Journal, Project, RelationResult} from "../../uti
|
||||||
import {Reference} from "../../utils/entities/resultLandingInfo";
|
import {Reference} from "../../utils/entities/resultLandingInfo";
|
||||||
|
|
||||||
export class ParsingFunctions {
|
export class ParsingFunctions {
|
||||||
|
public open = 'assets/common-assets/unlock.svg';
|
||||||
|
public closed = 'assets/common-assets/lock.svg';
|
||||||
|
public unknown = 'assets/common-assets/question.svg';
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
}
|
}
|
||||||
|
@ -147,7 +150,8 @@ export class ParsingFunctions {
|
||||||
accessMode: null,
|
accessMode: null,
|
||||||
bestAccessMode: null,
|
bestAccessMode: null,
|
||||||
type: "",
|
type: "",
|
||||||
year: ""
|
year: "",
|
||||||
|
icon: ""
|
||||||
};
|
};
|
||||||
|
|
||||||
if (journal && journal.journal) {
|
if (journal && journal.journal) {
|
||||||
|
@ -162,6 +166,8 @@ export class ParsingFunctions {
|
||||||
available.accessMode = new Array<string>();
|
available.accessMode = new Array<string>();
|
||||||
|
|
||||||
available.downloadUrl.push(url);
|
available.downloadUrl.push(url);
|
||||||
|
|
||||||
|
available.icon = this.unknown;
|
||||||
/*
|
/*
|
||||||
if(title != undefined && title['url'] == "") {
|
if(title != undefined && title['url'] == "") {
|
||||||
title['url'] = url;
|
title['url'] = url;
|
||||||
|
@ -245,7 +251,8 @@ export class ParsingFunctions {
|
||||||
"accessMode": null,
|
"accessMode": null,
|
||||||
"bestAccessMode": null,
|
"bestAccessMode": null,
|
||||||
"type": "",
|
"type": "",
|
||||||
"year": ""
|
"year": "",
|
||||||
|
"icon": ""
|
||||||
};
|
};
|
||||||
|
|
||||||
if (instance['hostedby'].name && instance['hostedby'].name != "other resources" && instance['hostedby'].name != "Unknown Repository") {
|
if (instance['hostedby'].name && instance['hostedby'].name != "other resources" && instance['hostedby'].name != "Unknown Repository") {
|
||||||
|
@ -270,6 +277,10 @@ export class ParsingFunctions {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(!available.downloadName) {
|
||||||
|
available.downloadName = url.substring(0, 30) + '...'; // substring(from, to);
|
||||||
|
}
|
||||||
|
|
||||||
if (available.downloadName) {
|
if (available.downloadName) {
|
||||||
if (instance.hasOwnProperty("collectedfrom")) {
|
if (instance.hasOwnProperty("collectedfrom")) {
|
||||||
available.collectedId = instance['collectedfrom'].id;
|
available.collectedId = instance['collectedfrom'].id;
|
||||||
|
@ -318,6 +329,18 @@ export class ParsingFunctions {
|
||||||
available['accessMode'].push("");
|
available['accessMode'].push("");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (available.bestAccessMode) {
|
||||||
|
if (available.bestAccessMode.toLowerCase().indexOf('open') !== -1) {
|
||||||
|
available.icon = this.open;
|
||||||
|
} else if (available.bestAccessMode.toLowerCase().indexOf('not available') !== -1) {
|
||||||
|
available.icon = this.unknown;
|
||||||
|
} else {
|
||||||
|
available.icon = this.closed;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
available.icon = this.unknown;
|
||||||
|
}
|
||||||
|
|
||||||
hostedBy_collectedFrom.push(available);
|
hostedBy_collectedFrom.push(available);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,7 @@ import {ResultLandingInfo} from '../../../utils/entities/resultLandingInfo';
|
||||||
import {EnvProperties} from '../../../utils/properties/env-properties';
|
import {EnvProperties} from '../../../utils/properties/env-properties';
|
||||||
import {ParsingFunctions} from '../../landing-utils/parsingFunctions.class';
|
import {ParsingFunctions} from '../../landing-utils/parsingFunctions.class';
|
||||||
import {map} from "rxjs/operators";
|
import {map} from "rxjs/operators";
|
||||||
|
import {HostedByCollectedFrom} from "../../../utils/result-preview/result-preview";
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class DeletedByInferenceService {
|
export class DeletedByInferenceService {
|
||||||
|
@ -86,7 +87,7 @@ export class DeletedByInferenceService {
|
||||||
result.types = new Array<string>();
|
result.types = new Array<string>();
|
||||||
let types = new Set<string>();
|
let types = new Set<string>();
|
||||||
|
|
||||||
result.hostedBy_collectedFrom = new Array<{"downloadName": string, "downloadUrl": string[], "collectedName": string, "collectedId": string, "accessMode": string[], "bestAccessMode": string, "type": string, "year":string}>();
|
result.hostedBy_collectedFrom = new Array<HostedByCollectedFrom>();
|
||||||
|
|
||||||
let counter = 0;
|
let counter = 0;
|
||||||
let instance;
|
let instance;
|
||||||
|
|
|
@ -5,7 +5,7 @@ import {ResultLandingInfo} from '../../utils/entities/resultLandingInfo';
|
||||||
import {EnvProperties} from '../../utils/properties/env-properties';
|
import {EnvProperties} from '../../utils/properties/env-properties';
|
||||||
import {ParsingFunctions} from '../landing-utils/parsingFunctions.class';
|
import {ParsingFunctions} from '../landing-utils/parsingFunctions.class';
|
||||||
import {map, tap} from "rxjs/operators";
|
import {map, tap} from "rxjs/operators";
|
||||||
import {Organization} from "../../utils/result-preview/result-preview";
|
import {HostedByCollectedFrom, Organization} from "../../utils/result-preview/result-preview";
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class ResultLandingService {
|
export class ResultLandingService {
|
||||||
|
@ -161,7 +161,7 @@ export class ResultLandingService {
|
||||||
}
|
}
|
||||||
|
|
||||||
if(data[3].hasOwnProperty("instance")) {
|
if(data[3].hasOwnProperty("instance")) {
|
||||||
this.resultLandingInfo.hostedBy_collectedFrom = new Array<{"downloadName": string, "downloadUrl": string[], "collectedName": string, "collectedId": string, "accessMode": string[], "bestAccessMode": string, "type": string, "year":string}>();
|
this.resultLandingInfo.hostedBy_collectedFrom = new Array<HostedByCollectedFrom>();
|
||||||
|
|
||||||
|
|
||||||
this.resultLandingInfo.types = new Array<string>();
|
this.resultLandingInfo.types = new Array<string>();
|
||||||
|
|
|
@ -64,6 +64,11 @@
|
||||||
<span class="uk-text-muted">Project Code: </span>
|
<span class="uk-text-muted">Project Code: </span>
|
||||||
{{result.code}}
|
{{result.code}}
|
||||||
</span>
|
</span>
|
||||||
|
<!-- Currently not parsed -->
|
||||||
|
<!-- <span *ngIf="result.callIdentifier" [class.uk-margin-left]="(result.funderShortname || result.code)">-->
|
||||||
|
<!-- <span class="uk-text-muted">Call for proposal: </span>-->
|
||||||
|
<!-- {{result.callIdentifier}}-->
|
||||||
|
<!-- </span>-->
|
||||||
</div>
|
</div>
|
||||||
<!-- Funder Budget -->
|
<!-- Funder Budget -->
|
||||||
<div *ngIf="result.budget || result.contribution" class="uk-margin-small-bottom uk-text-small">
|
<div *ngIf="result.budget || result.contribution" class="uk-margin-small-bottom uk-text-small">
|
||||||
|
@ -209,7 +214,11 @@
|
||||||
<!-- Download from-->
|
<!-- Download from-->
|
||||||
<div *ngIf="result.hostedBy_collectedFrom && result.hostedBy_collectedFrom.length > 0"
|
<div *ngIf="result.hostedBy_collectedFrom && result.hostedBy_collectedFrom.length > 0"
|
||||||
class="uk-margin-small-bottom download-from">
|
class="uk-margin-small-bottom download-from">
|
||||||
<div *ngFor="let from of result.hostedBy_collectedFrom">
|
<div *ngFor="let from of result.hostedBy_collectedFrom"
|
||||||
|
[title]="from.bestAccessMode ? from.bestAccessMode : 'Not available'">
|
||||||
|
<span class="uk-margin-small-right">
|
||||||
|
<img [src]="from.icon">
|
||||||
|
</span>
|
||||||
<span class="uk-margin-right uk-display-inline-block">
|
<span class="uk-margin-right uk-display-inline-block">
|
||||||
<span class="uk-text-muted">Download from: </span>
|
<span class="uk-text-muted">Download from: </span>
|
||||||
<a *ngIf="from.downloadUrl && from.downloadUrl.length === 1"
|
<a *ngIf="from.downloadUrl && from.downloadUrl.length === 1"
|
||||||
|
@ -223,10 +232,11 @@
|
||||||
</span>
|
</span>
|
||||||
<span class="provider uk-display-inline-block">
|
<span class="provider uk-display-inline-block">
|
||||||
<span class="uk-text-muted">Provider: </span>
|
<span class="uk-text-muted">Provider: </span>
|
||||||
|
<!-- target="_blank"-->
|
||||||
<a *ngIf="from.collectedId" routerLink="/search/dataprovider" [queryParams]="{datasourceId: from.collectedId}"
|
<a *ngIf="from.collectedId" routerLink="/search/dataprovider" [queryParams]="{datasourceId: from.collectedId}"
|
||||||
[href]="from.downloadUrl[0]" target="_blank">
|
[href]="from.downloadUrl[0]" (click)="onClick();">
|
||||||
{{from.collectedName}}
|
{{from.collectedName}}
|
||||||
<span class="custom-external space"></span>
|
<!-- <span class="custom-external space"></span>-->
|
||||||
</a>
|
</a>
|
||||||
<span *ngIf="!from.collectedId">
|
<span *ngIf="!from.collectedId">
|
||||||
{{from.collectedName}}
|
{{from.collectedName}}
|
||||||
|
|
|
@ -11,6 +11,7 @@ export interface HostedByCollectedFrom {
|
||||||
bestAccessMode: string;
|
bestAccessMode: string;
|
||||||
type: string;
|
type: string;
|
||||||
year: string;
|
year: string;
|
||||||
|
icon: string
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface Journal {
|
export interface Journal {
|
||||||
|
@ -102,6 +103,7 @@ export class ResultPreview {
|
||||||
//projects:
|
//projects:
|
||||||
acronym: string;
|
acronym: string;
|
||||||
code: string;
|
code: string;
|
||||||
|
// callIdentifier: string; // currently not parsed
|
||||||
funderShortname: string;
|
funderShortname: string;
|
||||||
budget: string;
|
budget: string;
|
||||||
contribution: string;
|
contribution: string;
|
||||||
|
@ -154,6 +156,7 @@ export class ResultPreview {
|
||||||
resultPreview.organizations = result.organizations;
|
resultPreview.organizations = result.organizations;
|
||||||
resultPreview.acronym = result.acronym;
|
resultPreview.acronym = result.acronym;
|
||||||
resultPreview.code = result.code;
|
resultPreview.code = result.code;
|
||||||
|
// resultPreview.callIdentifier = result.callIdentifier; // currently not parsed
|
||||||
resultPreview.funderShortname = result.funderShortname;
|
resultPreview.funderShortname = result.funderShortname;
|
||||||
resultPreview.budget = result.budget;
|
resultPreview.budget = result.budget;
|
||||||
resultPreview.contribution = result.contribution;
|
resultPreview.contribution = result.contribution;
|
||||||
|
|
Loading…
Reference in New Issue