[develop | DONE]: Add belongs to all entities and add message in html.
This commit is contained in:
parent
ea5275da2d
commit
df2516f8f7
|
@ -2,7 +2,9 @@
|
|||
<schema2jsonld *ngIf="dataProviderInfo"
|
||||
[data]=dataProviderInfo [URL]="canonicalUrl" type="datasource"
|
||||
[otherURL]="(dataProviderInfo.provenance)?provenanceUrls:null"></schema2jsonld>
|
||||
|
||||
<div *ngIf="dataProviderInfo && !dataProviderInfo.belongsTo" [innerHTML]="dataProviderInfo.message"
|
||||
class="uk-alert uk-alert-warning uk-position-fixed uk-position-bottom-center uk-text-small" style="z-index: 1000;">
|
||||
</div>
|
||||
<!-- Desktop view -->
|
||||
<div class="uk-visible@m landing uk-section uk-padding-remove tm-middle">
|
||||
<div *ngIf="!isMobile" class="tm-main">
|
||||
|
|
|
@ -389,6 +389,7 @@ export class DataProviderComponent {
|
|||
this.dataProviderInfo = data;
|
||||
this.getProvenanceUrls();
|
||||
this.datasourceId = this.dataProviderInfo.objIdentifier;
|
||||
this.dataProviderInfo.setBelongsTo(this.datasourceId);
|
||||
let pid:Identifier = Identifier.getPIDFromIdentifiers(this.dataProviderInfo.identifiers);
|
||||
this.canonicalUrl = this.properties.domain+ properties.baseLink + ( pid ? (this.linkToLandingPage.split("?")[0] + "?pid=" + encodeURIComponent(pid.id)):
|
||||
(this.linkToLandingPage + this.dataProviderInfo.relcanId));
|
||||
|
|
|
@ -3,7 +3,9 @@
|
|||
[URL]="properties.domain + properties.baseLink+this.properties.searchLinkToOrganization+organizationInfo.relcanId"
|
||||
type="organization">
|
||||
</schema2jsonld>
|
||||
|
||||
<div *ngIf="organizationInfo && !organizationInfo.belongsTo" [innerHTML]="organizationInfo.message"
|
||||
class="uk-alert uk-alert-warning uk-position-fixed uk-position-bottom-center uk-text-small" style="z-index: 1000;">
|
||||
</div>
|
||||
<!-- Desktop view -->
|
||||
<div id="tm-main" class="uk-visible@m landing uk-section uk-padding-remove tm-middle">
|
||||
<div *ngIf="!isMobile" class="tm-main">
|
||||
|
|
|
@ -401,6 +401,7 @@ export class OrganizationComponent {
|
|||
} else {
|
||||
this.organizationInfo = data;
|
||||
this.organizationId = this.organizationInfo.objIdentifier; // reset in case the parameter was a canonical url. The related queries and reports should have the dedup id
|
||||
this.organizationInfo.setBelongsTo(this.organizationId);
|
||||
this.csvParamsTail = '" and relorganizationid exact "' + this.organizationId + '" ))';
|
||||
this.seoService.createLinkForCanonicalURL(this.properties.domain + this.properties.baseLink + this.properties.searchLinkToOrganization + this.organizationInfo.relcanId);
|
||||
this.updateTitle((this.organizationInfo.title.name?this.organizationInfo.title.name:(this.organizationInfo.name?this.organizationInfo.name:'No title available')));
|
||||
|
|
|
@ -2,7 +2,9 @@
|
|||
<schema2jsonld *ngIf="projectInfo"
|
||||
[data]=projectInfo [URL]="properties.domain+properties.baseLink+properties.searchLinkToProject+projectId"
|
||||
type="project"></schema2jsonld>
|
||||
|
||||
<div *ngIf="projectInfo && !projectInfo.belongsTo" [innerHTML]="projectInfo.message"
|
||||
class="uk-alert uk-alert-warning uk-position-fixed uk-position-bottom-center uk-text-small" style="z-index: 1000;">
|
||||
</div>
|
||||
<!-- Desktop view -->
|
||||
<div class=" uk-visible@m landing uk-section uk-padding-remove tm-middle">
|
||||
<div *ngIf="!isMobile" class="tm-main">
|
||||
|
|
|
@ -466,6 +466,8 @@ export class ProjectComponent {
|
|||
this.subscriptions.push(this._projectService.getProjectInfo(id, this.properties).subscribe(
|
||||
data => {
|
||||
this.projectInfo = data;
|
||||
this.projectInfo.setBelongsTo(id);
|
||||
console.log(this.projectInfo);
|
||||
this.projectInfo.id = this.projectId;
|
||||
|
||||
this.actionsAfterGettingProjectInfo();
|
||||
|
|
|
@ -4,7 +4,6 @@ import {throwError} from 'rxjs';
|
|||
import {ProjectInfo} from '../../utils/entities/projectInfo';
|
||||
|
||||
|
||||
|
||||
import {EnvProperties} from '../../utils/properties/env-properties';
|
||||
|
||||
import {ParsingFunctions} from '../landing-utils/parsingFunctions.class';
|
||||
|
@ -54,6 +53,7 @@ export class ProjectService {
|
|||
.pipe(map(res => this.parseProjectInfo(res, properties)));
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
get project strtDate and endDate
|
||||
*/
|
||||
|
@ -98,8 +98,10 @@ export class ProjectService {
|
|||
|
||||
parseProjectInfo(data: any, properties: EnvProperties): any {
|
||||
this.projectInfo = new ProjectInfo();
|
||||
this.projectInfo.funding = {funderName: "", funderShortName: "", code: "", callIdentifier: "",
|
||||
fundingStream: "", budget: "", contribution: "", currency: ""};
|
||||
this.projectInfo.funding = {
|
||||
funderName: "", funderShortName: "", funderJurisdiction: "", code: "", callIdentifier: "",
|
||||
fundingStream: "", budget: "", contribution: "", currency: ""
|
||||
};
|
||||
|
||||
// ['result']['header']['dri:objIdentifier']
|
||||
if (data[3] != null) {
|
||||
|
@ -108,7 +110,7 @@ export class ProjectService {
|
|||
|
||||
// ['result']['metadata']['oaf:entity']['oaf:project']['fundingtree']
|
||||
if (data[1] != null) {
|
||||
let funding: {"funderName": string, "funderShortname": string, "stream": string};
|
||||
let funding: { "funderName": string, "funderShortname": string, "funderJurisdiction": string, "stream": string };
|
||||
funding = this.parsingFunctions.parseFundingTrees(data[1]);
|
||||
if (funding.funderName) {
|
||||
this.projectInfo.funding.funderName = funding.funderName;
|
||||
|
@ -116,6 +118,9 @@ export class ProjectService {
|
|||
if (funding.funderShortname) {
|
||||
this.projectInfo.funding.funderShortName = funding.funderShortname;
|
||||
}
|
||||
if (funding.funderJurisdiction) {
|
||||
this.projectInfo.funding.funderJurisdiction = funding.funderJurisdiction;
|
||||
}
|
||||
if (funding.stream) {
|
||||
this.projectInfo.funding.fundingStream = funding.stream;
|
||||
}
|
||||
|
@ -181,13 +186,17 @@ export class ProjectService {
|
|||
|
||||
// ['result']['metadata']['oaf:entity']['oaf:project']['rels']['rel']
|
||||
if (data[2] != null) {
|
||||
this.projectInfo.organizations = [];//new Map<string, string>();
|
||||
this.projectInfo.organizations = [];
|
||||
|
||||
if (!Array.isArray(data[2])) {
|
||||
if (data[2].hasOwnProperty("to") && data[2]['to'].class && data[2]['to'].class.toLowerCase() == "hasparticipant") {
|
||||
let country: string = "";
|
||||
let acronym: string = "";
|
||||
let name: string = "";
|
||||
let id: string = "";
|
||||
if(data[2].hasOwnProperty("country")) {
|
||||
country = data[2].country.classname;
|
||||
}
|
||||
if (data[2].hasOwnProperty("legalshortname")) {
|
||||
acronym = data[2].legalshortname;
|
||||
}
|
||||
|
@ -203,14 +212,18 @@ export class ProjectService {
|
|||
id = data[2]['to'].content;
|
||||
}
|
||||
|
||||
this.projectInfo.organizations.push({"acronym": acronym, "name": name, "id": id});
|
||||
this.projectInfo.organizations.push({"country": country, "acronym": acronym, "name": name, "id": id});
|
||||
}
|
||||
} else {
|
||||
for (let i = 0; i < data[2].length; i++) {
|
||||
let country: string = "";
|
||||
let acronym: string = "";
|
||||
let name: string = "";
|
||||
let id: string = "";
|
||||
if (data[2][i].hasOwnProperty("to") && data[2][i]['to'].class && data[2][i]['to'].class.toLowerCase() == "hasparticipant") {
|
||||
if(data[2][i].hasOwnProperty("country")) {
|
||||
country = data[2][i].country.classname;
|
||||
}
|
||||
if (data[2][i].hasOwnProperty("legalshortname")) {
|
||||
acronym = data[2][i].legalshortname;
|
||||
}
|
||||
|
@ -225,7 +238,7 @@ export class ProjectService {
|
|||
id = data[2][i]['to'].content;
|
||||
}
|
||||
|
||||
this.projectInfo.organizations.push({"acronym": acronym, "name": name, "id": id});
|
||||
this.projectInfo.organizations.push({"country": country, "acronym": acronym, "name": name, "id": id});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -202,4 +202,15 @@ export class DataProviderInfo {
|
|||
|
||||
//relatedDatasources: Map<string, {"name": string, "countPublications": string, "countDatasets": string, "countSoftware": string, "countOrps": string}>;
|
||||
relatedDatasources: { "id": string, "name": string, "count": number }[] = [];
|
||||
|
||||
belongsTo: boolean = true;
|
||||
message: string;
|
||||
|
||||
setBelongsTo(id: string) {
|
||||
this.belongsTo = !BelongsTo.datasource || BelongsTo.datasource.fields.findIndex(field => BelongsTo.check(this, field)) != -1;
|
||||
this.message = !this.belongsTo ? BelongsTo.datasource.message : null;
|
||||
if (this.message) {
|
||||
this.message = this.message.replace('((id))', id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,4 +29,14 @@ export class OrganizationInfo {
|
|||
|
||||
deletedByInferenceIds: string[];
|
||||
identifiers: Map<string, string[]>; //key is the classname
|
||||
belongsTo: boolean = true;
|
||||
message: string;
|
||||
|
||||
setBelongsTo(id: string) {
|
||||
this.belongsTo = !BelongsTo.organization || BelongsTo.organization.fields.findIndex(field => BelongsTo.check(this, field)) != -1;
|
||||
this.message = !this.belongsTo ? BelongsTo.organization.message : null;
|
||||
if (this.message) {
|
||||
this.message = this.message.replace('((id))', id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,12 +1,29 @@
|
|||
import {BelongsTo, Measure} from "./resultLandingInfo";
|
||||
import {StringUtils} from "../string-utils.class";
|
||||
|
||||
export interface Funding {
|
||||
funderName: string,
|
||||
funderShortName: string,
|
||||
funderJurisdiction: string,
|
||||
code: string,
|
||||
callIdentifier: string,
|
||||
fundingStream: string,
|
||||
budget: string,
|
||||
contribution: string,
|
||||
currency: string
|
||||
}
|
||||
|
||||
export interface ProjectOrganization {
|
||||
acronym: string,
|
||||
country: string,
|
||||
name: string,
|
||||
id: string
|
||||
}
|
||||
|
||||
export class ProjectInfo {
|
||||
id: string;
|
||||
acronym: string;
|
||||
title: string;
|
||||
funding: {funderName: string, funderShortName: string, code: string, callIdentifier: string,
|
||||
fundingStream: string, budget: string, contribution: string, currency: string};
|
||||
funding: Funding;
|
||||
startDate: number;
|
||||
endDate: number;
|
||||
currentDate: number;
|
||||
|
@ -14,7 +31,7 @@ export class ProjectInfo {
|
|||
openAccessMandatePublications: string;
|
||||
openAccessMandateDatasets: string;
|
||||
// specialClause39: string;
|
||||
organizations: { "acronym": string, "name": string, "id": string }[];//Map<string, string>;
|
||||
organizations: ProjectOrganization[];
|
||||
url: string;
|
||||
urlInfo: string;
|
||||
description: string;
|
||||
|
|
|
@ -79,7 +79,6 @@ export class BelongsTo {
|
|||
return BelongsTo.check(json, field);
|
||||
}
|
||||
}
|
||||
console.log(json, field.value)
|
||||
return json == field.value;
|
||||
}
|
||||
return false;
|
||||
|
|
Loading…
Reference in New Issue