Production release July 2024 [EXPLORE] #47

Merged
konstantina.galouni merged 21 commits from develop into master 2024-07-12 10:03:51 +02:00
4 changed files with 113 additions and 35 deletions
Showing only changes of commit 85657ceb61 - Show all commits

View File

@ -8,33 +8,36 @@ import {RouterHelper} from '../../../utils/routerHelper.class';
import {ErrorCodes} from '../../../utils/properties/errorCodes';
import {DeletedByInferenceService} from './deletedByInference.service';
import {ResultPreview} from "../../../utils/result-preview/result-preview";
import {HostedByCollectedFrom, ResultPreview} from "../../../utils/result-preview/result-preview";
import {AlertModal} from "../../../utils/modal/alert";
import {Subscriber} from "rxjs";
import {properties} from "../../../../../environments/environment";
import {HelperFunctions} from "../../../utils/HelperFunctions.class";
import {Dates, StringUtils} from "../../../utils/string-utils.class";
import {ParsingFunctions} from "../../landing-utils/parsingFunctions.class";
@Component({
selector: 'deletedByInference',
template: `
<div id="versions_container">
<errorMessages [status]="[status]" [type]="type" tab_error_class=true></errorMessages>
<no-load-paging *ngIf="results.length > pageSize" [type]="type"
<no-load-paging *ngIf="resultsPreview.length > pageSize" [type]="type"
(pageChange)="updatePage($event)"
[page]="page" [pageSize]="pageSize"
[totalResults]="results.length">
[totalResults]="resultsPreview.length">
</no-load-paging>
<ul class="uk-list uk-margin">
<li *ngFor="let result of results.slice((page-1)*pageSize, page*pageSize)">
<result-preview [modal]="modal" [properties]="properties" [hasLink]="false" [result]="getResultPreview(result)"
[showOrcid]="false" [prevPath]="prevPath" [showInline]="true"
<li *ngFor="let result of resultsPreview.slice((page-1)*pageSize, page*pageSize)">
<result-preview [modal]="modal" [properties]="properties" [hasLink]="false" [result]="result"
[showOrcid]="false" [prevPath]="prevPath" [showInline]="true"
[isDeletedByInferenceModal]="true" [isMobile]="isMobile"></result-preview>
</li>
</ul>
<no-load-paging *ngIf="results.length > pageSize" [type]="type"
<no-load-paging *ngIf="resultsPreview.length > pageSize" [type]="type"
(pageChange)="updatePage($event)"
[page]="page" [pageSize]="pageSize"
[totalResults]="results.length">
[totalResults]="resultsPreview.length">
</no-load-paging>
</div>
`
@ -42,7 +45,8 @@ import {HelperFunctions} from "../../../utils/HelperFunctions.class";
export class DeletedByInferenceComponent {
@Input() isMobile: boolean = false;
@Input() prevPath: string = "";
public results: ResultLandingInfo[] = [];
public resultsPreview: ResultPreview[] = [];
@Input() children = [];
@Input() id: string;
@Input() ids: string[] = [];
@Input() type: string;
@ -74,7 +78,7 @@ export class DeletedByInferenceComponent {
this.errorCodes = new ErrorCodes();
this.status = this.errorCodes.LOADING;
this.getDeletedByInference();
this.parseDeletedByInference();
}));
}
@ -85,25 +89,89 @@ export class DeletedByInferenceComponent {
}
});
}
getDeletedByInference() {
this.results = [];
this.status = this.errorCodes.LOADING;
this.subscriptions.push(this._deletedByInferenceService.getDeletedByInferenceResults(this.id, String(this.ids.length), this.properties).subscribe(
data => {
this.results = data;
this.status = this.errorCodes.DONE;
},
error => {
if (error.status == '404') {
this.status = this.errorCodes.NOT_FOUND;
} else if (error.status == '500') {
this.status = this.errorCodes.ERROR;
} else {
this.status = this.errorCodes.NOT_AVAILABLE;
public parseDeletedByInference() {
let parsingFunctions: ParsingFunctions = new ParsingFunctions();
let length = Array.isArray(this.children) ? this.children.length : 1;
for (let i = 0; i < length; i++) {
let result = Array.isArray(this.children) ? this.children[i] : this.children;
let preview = new ResultPreview();
if(result.hasOwnProperty("creator")) {
preview.authors = [];
let authorsLength = Array.isArray(result.creator) ? result.creator.length : 1;
for (let j = 0; j < authorsLength; j++) {
let author = {"fullName": Array.isArray(result.creator) ? result.creator[j] : result.creator, "orcid": null, "orcid_pending": null};
preview.authors.push(author);
}
}
));
if(result.hasOwnProperty("dateofacceptance")) {
preview.year = new Date(result.dateofacceptance).getFullYear().toString();
}
if(result.hasOwnProperty("title")) {
let titleLength = Array.isArray(result.title) ? result.title.length : 1;
for (let j = 0; j < titleLength; j++) {
let title = Array.isArray(result.title) ? result.title[j] : result.title;
if (!preview.title || title.classid == "main title") {
preview.title = StringUtils.HTMLToString(String(title.content));
}
}
}
if(result.hasOwnProperty("description")) {
preview.description = result.description;
}
preview.resultType = result?.resulttype?.classid ? result.resulttype.classid : this.resultType;
if (result.hasOwnProperty("instance")) {
preview.hostedBy_collectedFrom = new Array<HostedByCollectedFrom>();
preview.types = new Array<string>();
let types = new Set<string>();
let counter = 0;
let instance;
let instanesLength = Array.isArray(result['instance']) ? result['instance'].length : 1;
for (let j = 0; j < instanesLength; j++) {
instance = Array.isArray(result['instance']) ? result['instance'][j] : result['instance'];
if(result.hasOwnProperty('collectedfrom')) {
if(Array.isArray(result['collectedfrom'])) {
// not sure if this is correct mapping
instance['collectedfrom'] = result['collectedfrom'].length >= j ? result['collectedfrom'][j] : result['collectedfrom'][result['collectedfrom'].length - 1];
} else {
instance['collectedfrom'] = result['collectedfrom'];
}
}
parsingFunctions.parseTypes(preview.types, types, instance);
if (instance.hasOwnProperty("webresource")) {
let url;
if (!Array.isArray(instance['webresource'])) {
url = instance['webresource'].url;
} else {
url = instance['webresource'][0].url;
}
if (url.includes('&amp;')) {
url = url.replace(/&amp;/gmu, '&');
}
/**********************************************************/
if (instance.hasOwnProperty("hostedby")) {
parsingFunctions.parseHostedBy_collectedFrom(preview.hostedBy_collectedFrom, instance, url, null);
}
/**********************************************************/
}
}
// /* Order Download from via openness*/
preview.hostedBy_collectedFrom.sort(parsingFunctions.compareHostedByCollectedFrom);
}
this.resultsPreview.push(preview);
}
this.status = this.errorCodes.DONE;
}
public getResultPreview(result: ResultLandingInfo): ResultPreview {

View File

@ -724,22 +724,26 @@
[id]="resultLandingInfo.record['result']['header']['dri:objIdentifier']"
[ids]="resultLandingInfo.deletedByInferenceIds"
[modal]="AlertModalDeletedByInference"
[resultType]="type" [type]="openaireEntities.PUBLICATIONS" [prevPath]="prevPath"></deletedByInference>
[resultType]="type" [type]="openaireEntities.PUBLICATIONS" [prevPath]="prevPath"
[children]="resultLandingInfo.children"></deletedByInference>
<deletedByInference *ngIf="type == 'dataset' && deleteByInferenceOpened"
[id]="resultLandingInfo.record['result']['header']['dri:objIdentifier']"
[ids]="resultLandingInfo.deletedByInferenceIds"
[modal]="AlertModalDeletedByInference"
[resultType]="'dataset'" [type]="openaireEntities.DATASETS" [prevPath]="prevPath"></deletedByInference>
[resultType]="'dataset'" [type]="openaireEntities.DATASETS" [prevPath]="prevPath"
[children]="resultLandingInfo.children"></deletedByInference>
<deletedByInference *ngIf="type == 'software' && deleteByInferenceOpened"
[id]="resultLandingInfo.record['result']['header']['dri:objIdentifier']"
[ids]="resultLandingInfo.deletedByInferenceIds"
[modal]="AlertModalDeletedByInference"
[resultType]="type" [type]="openaireEntities.SOFTWARE" [prevPath]="prevPath"></deletedByInference>
[resultType]="type" [type]="openaireEntities.SOFTWARE" [prevPath]="prevPath"
[children]="resultLandingInfo.children"></deletedByInference>
<deletedByInference *ngIf="type == 'orp' && deleteByInferenceOpened"
[id]="resultLandingInfo.record['result']['header']['dri:objIdentifier']"
[ids]="resultLandingInfo.deletedByInferenceIds"
[modal]="AlertModalDeletedByInference"
[resultType]="'other'" [type]="openaireEntities.OTHER" [prevPath]="prevPath"></deletedByInference>
[resultType]="'other'" [type]="openaireEntities.OTHER" [prevPath]="prevPath"
[children]="resultLandingInfo.children"></deletedByInference>
</modal-alert>
<modal-alert *ngIf="resultLandingInfo" #citeModal>
<citeThis *ngIf="citeThisClicked" [result]="resultLandingInfo" [id]="id"
@ -1195,25 +1199,29 @@
[ids]="resultLandingInfo.deletedByInferenceIds"
[resultType]="type" [type]="openaireEntities.PUBLICATIONS"
[isMobile]="isMobile"
[modal]="alertModalDeletedByInferenceFS"></deletedByInference>
[modal]="alertModalDeletedByInferenceFS"
[children]="resultLandingInfo.children"></deletedByInference>
<deletedByInference *ngIf="type == 'dataset' && deleteByInferenceOpened"
[id]="resultLandingInfo.record['result']['header']['dri:objIdentifier']"
[ids]="resultLandingInfo.deletedByInferenceIds"
[resultType]="'dataset'" [type]="openaireEntities.DATASETS"
[isMobile]="isMobile"
[modal]="alertModalDeletedByInferenceFS"></deletedByInference>
[modal]="alertModalDeletedByInferenceFS"
[children]="resultLandingInfo.children"></deletedByInference>
<deletedByInference *ngIf="type == 'software' && deleteByInferenceOpened"
[id]="resultLandingInfo.record['result']['header']['dri:objIdentifier']"
[ids]="resultLandingInfo.deletedByInferenceIds"
[resultType]="type" [type]="openaireEntities.SOFTWARE"
[isMobile]="isMobile"
[modal]="alertModalDeletedByInferenceFS"></deletedByInference>
[modal]="alertModalDeletedByInferenceFS"
[children]="resultLandingInfo.children"></deletedByInference>
<deletedByInference *ngIf="type == 'orp' && deleteByInferenceOpened"
[id]="resultLandingInfo.record['result']['header']['dri:objIdentifier']"
[ids]="resultLandingInfo.deletedByInferenceIds"
[resultType]="'other'" [type]="openaireEntities.OTHER"
[isMobile]="isMobile"
[modal]="alertModalDeletedByInferenceFS"></deletedByInference>
[modal]="alertModalDeletedByInferenceFS"
[children]="resultLandingInfo.children"></deletedByInference>
</fs-modal>
<fs-modal *ngIf="resultLandingInfo" #citeFsModal classTitle="uk-tile-default uk-border-bottom">

View File

@ -238,6 +238,7 @@ export class ResultLandingService {
let result = Array.isArray(data[3]['result']) ? data[3]['result'][i] : data[3]['result'];
this.resultLandingInfo.deletedByInferenceIds.push(result.objidentifier);
}
this.resultLandingInfo.children = data[3]['result'];
}

View File

@ -185,6 +185,7 @@ export class ResultLandingInfo {
contexts: Context[];
deletedByInferenceIds: string[];
children;
// PUBLICATION, DATASET, ORP
references: Reference[];