openaire-library/utils/result-preview/result-preview.ts

285 lines
8.6 KiB
TypeScript
Raw Normal View History

import {SearchResult} from "../entities/searchResult";
import {ResultLandingInfo} from "../entities/resultLandingInfo";
import {OrganizationInfo} from "../entities/organizationInfo";
export interface HostedByCollectedFrom {
downloadNames: string[];
downloadUrl: string;
collectedNamesAndIds: Map<string, string>;
accessRight: string;
types: string[];
years: string[];
accessRightIcon: string;
[Explore & Library & openaire-theme | new-theme]: Updated parsing of classified subjects by using a vocabulary | Added parsing of instance.license in Download from | Added feedback functionality for fos and sdgs in landing | #7509 Parsing both citations and references fields | In "view all/less" links added chervon-right icon with class "view-more-less-link". 1. fos.component.ts & sdg.component.ts: Added method "urlEncodeAndQuote()" to encode and then quote a string. 2. fos.component.html & sdg.component.html: a. "Beta" badge was updated to yellow uk-text-large. b. Link to the simple search page instead of the advanced and urlEncodeAndQuote the parameter used in url. 3. link.css: Added class "view-more-less-link" to set on ::after "chevron_right" icon (not underlined on hover) - used in "view all/more/less" links. 4. dataProvider.component.html & project.component.html & fundedBy.component.ts & relatedTo.component.ts & showIdentifiers.component.ts & showAuthors.component.ts: In "view all/less" links added class "view-more-less-link" | Renamed "view more" to "view all". 5. feedback.component.html: Rename wording to be more positive: issues -> feedback, issue -> comment, report -> feedback. 6. feedback.component.ts: Added @Input() preSelectedField: string = ""; and set with it "field" on "addIssue()" (fos/sdg preselected for feedback). 7. availableOn.component.ts: a. In "view all/less" links added class "view-more-less-link". b. #7833 - Show instance.license information (as link when recognized as url, string otherwise). 8. landing-utils/fos.component.ts & landing-utils/sdg.component.ts: a. "Beta" word was updated to yellow uk-text-xsmall. b. In "view all/less" links added class "view-more-less-link". c. Added feedback functionality: link to feedback form. 9. showSubjects.component.ts: a. In "view all/less" links added class "view-more-less-link". b. Added "view all" functionality for classified subjects too. 10. resultLanding.component.html: a. In "view all/less" links added class "view-more-less-link" | Renamed "view more" to "view all" b. Added feedback functionality: link to feedback form - preselect in feedback form fos/sdg. 11. resultLanding.component.ts: a. Added public feedbackPreSelectedField: string = ""; field. b. Added method "feedbackClicked()". c. [Bug fix] In hasPrimaryInfo() added check for classifiedSubjects. d. Renamed getProvenanceVocabularyAndResultLandingInfo() to getVocabulariesAndResultLandingInfo() and call also this._vocabulariesService.getSubjectsVocabulary(). 12. parsingFunctions.class.ts: a. #7196 - Updated parsing of subjects in method "parseAllSubjects()". b. #7833 - In method "parseHostedBy_collectedFrom()", added parsing for "license" field. 13. orcid-work.component.ts: On calling method "this.resultLandingService.getResultLandingInfo()", added null parameter for subject vocabulary. 14. searchFilter.module.ts: Import IconsModule. 15. searchFilter.component.html: Removed +/- form "view all/less" links and added class "view-more-less-link". 16. result-preview.ts: Added "licence?: string" in HostedByCollectedFrom. 17. ISVocabularies.service.ts: a. Added "private subjectsVocabulary: BehaviorSubject<any> = new BehaviorSubject<any>(null);" field and methods "getSubjectsVocabulary()", "getSubjectsVocabularyFromService()". b. Commented this.clearSubscriptions() from "getProvenanceActionVocabularyFromServiceAsync()". 18. resultLanding.service.ts: a. On subjects parsing, use subjectsVocabulary. b. #7509- Added if/then/else case for parsing citations (new name: references).
2022-06-09 15:45:39 +02:00
license?: string;
}
export interface Journal {
journal?: string;
issn?: string;
lissn: string;
eissn?: string;
issue?: string;
volume?: string;
start_page?: string;
end_page?: string;
}
export interface RelationResult {
name: string;
id: string;
date: string;
percentage: number;
percentageName?: string;
class: string
provenanceAction?: string;
relationName?: string;
}
export interface Project {
id: string;
acronym: string;
title: string;
funderShortname: string;
funderName: string;
funding?: string;
code: string;
validated?: boolean;
budget?: string;
contribution?: string;
currency?: string;
provenanceAction?: string;
}
export interface Author {
fullName: string;
orcid: string;
orcid_pending: string;
}
export interface ResultTitle {
name: string;
accessMode: string;
// sc39: string;
}
export interface Organization {
id: string;
name: string;
shortname?: string;
websiteUrl?: string;
country?: string;
trust?: number;
}
export class ResultPreview {
objId: string;
relcanId: string;
id: string;
title: string;
accessMode: string;
// sc39: string;
countries: string[];
//Impact factor
DOI:string;
measure: Array<string>;
//publications & datasets & orp & software & organizations:
projects: Project[];
//datasets & orp & publications & software
description: string;
year: string;
embargoEndDate: Date | string;
authors: Author[];
languages: string[];
identifiers: Map<string, string[]>; //key is the classname
hostedBy_collectedFrom: HostedByCollectedFrom[];
[Trunk | Library]: 1. error-interceptor.service.ts: Add "properties.orcidAPIURL" in UNAUTHORIZED_WHITELIST. 2. resultLanding.component.html: If result has identifiers and user is logged in, call <orcid-work>. 3. resultLanding.module.ts: Import OrcidModule. 4. searchResult.component.ts: If user is logged in, call "orcidService.getPutCodes()" and set orcidPutCodes of previewResults. 5. searchResults.module.ts: Add "OrcidService" in providers. 6. searchResearchResults.service.ts: In method "parseResults()", call "this.parsingFunctions.parseIdentifiers(resData['pid'])" to set identifiers. 7. customOptions.class.ts: Change method return type: "public static registryOptions(): any" --> public static registryOptions(): {}". (caused problem in return type of services (e.g. HttpEvent<string> instead of string). 8. searchResult.ts: Add field "identifiers: Map<string, string[]>". 9. env-properties.ts: Add field "orcidAPIURL". 10. result-preview.component.html: a. If result has identifiers and user is logged in, call <orcid-work>. b. In bottom line with impact factors and orcid, add class "result-preview-bottom" (set color to #747474 (like muted text) when not on hover). 11. result-preview.component.ts: Add field "loggedIn" and check on init if user is logged in (via Session). 12. result-preview.module.ts: Import OrcidModule. 13. result-preview.ts: Add field "orcidPutCodes" | In method "searchResultConvert()", set resultPreview.identifiers with all identifiers (not only dois). git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@60231 d315682c-612b-4755-9ff5-7f18f6832af3
2021-01-13 19:30:25 +01:00
orcidPutCodes: string[];
orcidUpdateDates: string [];
orcidCreationDates: string [];
//datasets & orp & software:
publisher: string;
//software
programmingLanguages: string[];
//dataproviders & projects:
organizations: Organization[];
//projects:
acronym: string;
code: string;
// callIdentifier: string; // currently not parsed
funderShortname: string;
budget: string;
contribution: string;
currency: string;
startYear: number;
endYear: number;
openAccessMandatePublications: boolean;
openAccessMandateDatasets: boolean;
//organizations:
country: string;
//dataproviders:
englishname: string;
websiteURL: string;
OAIPMHURL: string;
compatibility: string;
compatibilityUNKNOWN: boolean;
subjects: string[];
resultType: string;
types: string[];
// Relation result
relationName: string;
relation: string;
percentage: number;
provenanceAction: string;
//enermaps id - image
enermapsId:string;
public static searchResultConvert(result: SearchResult, type: string): ResultPreview {
let resultPreview: ResultPreview = new ResultPreview();
resultPreview.id = result.id;
resultPreview.relcanId = result.relcanId;
resultPreview.objId = result.objId;
resultPreview.title = result.title.name;
resultPreview.accessMode = result.title.accessMode;
// resultPreview.sc39 = result.title.sc39;
if(result.countriesForResults) {
resultPreview.countries = result.countriesForResults;
} else if(result.country) {
resultPreview.countries = [result.country];
} else {
resultPreview.countries = result.countries;
}
resultPreview.projects = result.projects;
resultPreview.description = result.description;
resultPreview.year = result.year;
resultPreview.embargoEndDate = result.embargoEndDate;
resultPreview.authors = result.authors;
resultPreview.languages = result.languages;
resultPreview.publisher = result.publisher;
resultPreview.programmingLanguages = result.programmingLanguages;
resultPreview.organizations = result.organizations;
resultPreview.acronym = result.acronym;
resultPreview.code = result.code;
// resultPreview.callIdentifier = result.callIdentifier; // currently not parsed
resultPreview.funderShortname = result.funderShortname;
resultPreview.budget = result.budget;
resultPreview.contribution = result.contribution;
resultPreview.currency = result.currency;
resultPreview.startYear = result.startYear;
resultPreview.endYear = result.endYear;
resultPreview.openAccessMandatePublications = result.openAccessMandatePublications;
resultPreview.openAccessMandateDatasets = result.openAccessMandateDatasets;
resultPreview.englishname = result.englishname;
if(result.type) {
resultPreview.types = [result.type];
} else {
resultPreview.types = result.types;
}
resultPreview.websiteURL = result.websiteURL;
resultPreview.OAIPMHURL = result.OAIPMHURL;
resultPreview.compatibility = result.compatibility;
resultPreview.compatibilityUNKNOWN = result.compatibilityUNKNOWN;
resultPreview.subjects = result.subjects;
resultPreview.resultType = type;
//impact factor;
[Trunk | Library]: 1. error-interceptor.service.ts: Add "properties.orcidAPIURL" in UNAUTHORIZED_WHITELIST. 2. resultLanding.component.html: If result has identifiers and user is logged in, call <orcid-work>. 3. resultLanding.module.ts: Import OrcidModule. 4. searchResult.component.ts: If user is logged in, call "orcidService.getPutCodes()" and set orcidPutCodes of previewResults. 5. searchResults.module.ts: Add "OrcidService" in providers. 6. searchResearchResults.service.ts: In method "parseResults()", call "this.parsingFunctions.parseIdentifiers(resData['pid'])" to set identifiers. 7. customOptions.class.ts: Change method return type: "public static registryOptions(): any" --> public static registryOptions(): {}". (caused problem in return type of services (e.g. HttpEvent<string> instead of string). 8. searchResult.ts: Add field "identifiers: Map<string, string[]>". 9. env-properties.ts: Add field "orcidAPIURL". 10. result-preview.component.html: a. If result has identifiers and user is logged in, call <orcid-work>. b. In bottom line with impact factors and orcid, add class "result-preview-bottom" (set color to #747474 (like muted text) when not on hover). 11. result-preview.component.ts: Add field "loggedIn" and check on init if user is logged in (via Session). 12. result-preview.module.ts: Import OrcidModule. 13. result-preview.ts: Add field "orcidPutCodes" | In method "searchResultConvert()", set resultPreview.identifiers with all identifiers (not only dois). git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@60231 d315682c-612b-4755-9ff5-7f18f6832af3
2021-01-13 19:30:25 +01:00
// if(result.DOIs && result.DOIs.length > 0) {
// resultPreview.identifiers = new Map();
// resultPreview.identifiers.set("doi", result.DOIs);
// }
resultPreview.identifiers = result.identifiers;
resultPreview.enermapsId = result.enermapsId;
resultPreview.measure = result.measure;
return resultPreview;
}
public static resultLandingInfoConvert(result: ResultLandingInfo, type: string): ResultPreview {
let resultPreview: ResultPreview = new ResultPreview();
resultPreview.title = result.title;
resultPreview.accessMode = result.accessMode;
resultPreview.countries = result.countries;
resultPreview.projects = result.fundedByProjects;
[Library | EOSC Explore]: Updated styles | Updated link to Marketplace for EOSC::RO-crate | Bug fix in description of results versions | Removed timeout from reports.service.ts. 1. home.component.html: Added blue banner, white logo, aligned search form to the center and updated fonts according the new EOSC Marketplace. 2. parsingFunctions.class.ts: Updated link to Marketplace for eosc subject EOSC::RO-crate. 3. resultLanding.component.html: Updated how links to Compatible EOSC Services are displayed. 4. searchAll.component.html: Updated paddings and margins in search form of Search all page. 5. navigationBar.component.html: Set burger menu icon to light color if dark background. 6. advancedSearchDataProviders.component.ts & advancedSearchOrganizations.component.ts & advancedSearchProjects.component.ts & advancedSearchServices.component.ts & searchResearchResults.component.ts & searchDataproviders.component.ts & searchOrganizations.component.ts & searchProjects.component.ts & searchResearchResults.component.ts & searchServices.component.ts & search.component.ts: Set in searchForm, dark=true. 7. aggregators.ts: In eoscInfo, updated logoUrl and removed customCss of AggregatorInfo. 8. app.component.ts: Set header.darkBg: true. 9. Added eosc-custom.less file. 10. styles.less: import eosc-custom less file, instead of portal-custom.css. 11. deletedByInference.service.ts & result-preview.ts: [Bug fix] Parse description of versions properly. 12. reports.service.ts: Copy fix from angular-14 branch - do not timeout to 10000.
2022-11-28 13:37:37 +01:00
resultPreview.description = result.description;//.length > 0 ? result.description[0] : "";
if(result.dateofacceptance) {
resultPreview.year = new Date(result.dateofacceptance).getFullYear().toString();
}
resultPreview.embargoEndDate = result.embargoEndDate;
resultPreview.authors = result.authors;
resultPreview.languages = result.languages;
resultPreview.publisher = result.publisher;
resultPreview.programmingLanguages = result.programmingLanguages;
resultPreview.organizations = result.organizations;
resultPreview.types = result.types;
resultPreview.subjects = result.subjects;
resultPreview.resultType = type;
resultPreview.identifiers = result.identifiers;
resultPreview.hostedBy_collectedFrom = result.hostedBy_collectedFrom;
return resultPreview;
}
public static relationResultConvert(result: RelationResult): ResultPreview {
let resultPreview: ResultPreview = new ResultPreview();
resultPreview.id = result.id;
resultPreview.title = result.name;
resultPreview.resultType = result.class;
if(result.date) {
resultPreview.year = result.date.toString();
}
resultPreview.relationName = result.relationName;
resultPreview.relation = result.percentageName;
resultPreview.percentage = result.percentage;
resultPreview.provenanceAction = result.provenanceAction;
return resultPreview;
}
public static organizationConvert(result: Organization, relation: string = 'trust'): ResultPreview {
let resultPreview: ResultPreview = new ResultPreview();
resultPreview.id = result.id;
if(result.name) {
resultPreview.title = result.name;
if(result.shortname) {
resultPreview.title += ' (' + result.shortname + ')';
}
} else if(result.shortname) {
resultPreview.title = result.shortname;
}
if(result.country) {
resultPreview.countries = [result.country];
}
resultPreview.relation = relation;
resultPreview.percentage = result.trust;
resultPreview.websiteURL = result.websiteUrl;
resultPreview.resultType = 'organization';
return resultPreview;
}
public static organizationInfoConvert(result: OrganizationInfo): ResultPreview {
let resultPreview: ResultPreview = new ResultPreview();
if(result.title && result.title.name) {
resultPreview.title = result.title.name;
if(result.name) {
resultPreview.title += ' (' + result.name + ')';
}
} else if(result.name) {
resultPreview.title = result.name;
}
if(result.country) {
resultPreview.countries = [result.country];
}
if(result.title && result.title.url) {
resultPreview.websiteURL = result.title.url;
}
resultPreview.resultType = 'organization';
return resultPreview;
}
}