[develop-16-deposit | WIP ]

This commit is contained in:
argirok 2024-10-08 14:18:09 +03:00
parent 63046639cc
commit 53a8f5dde7
1 changed files with 46 additions and 33 deletions

View File

@ -49,23 +49,30 @@ declare var UIkit: any;
<ng-container *ngIf="space && space.metadata">
<!-- <div><a [href]="space.links.html" target="_blank">{{space.metadata.title}}</a></div>-->
<div class="uk-text-center">Your file has been uploaded in Zenodo in <b>draft</b> mode. <br>You can
view, edit and publish the record <a [href]="space.links.html" target="_blank">here</a>.
<div class="uk-text-center">
<span class="uk-text-large">Your file has been uploaded to Zenodo in <b class="uk-text-warning">draft mode</b>.<br>
Please visit Zenodo to review the metadata, make any necessary edits, and publish the record.</span><br>
Note that it has been uploaded with license
<span class="uk-text-warning">{{space.metadata.license}}</span>, classified as
<span class="uk-text-warning">{{space.metadata.upload_type}}</span>, and is set with
<span class="uk-text-warning">{{space.metadata.access_right}}</span> access rights.
<br>
<div>The preserved DOI is {{space.metadata.prereserve_doi.doi}}.</div>
</div>
<div class="uk-flex uk-flex-center uk-text-success"><icon name="file_download_done" [ratio]="3"></icon></div>
<div *ngIf="space.metadata" class="uk-text-center">
<table class="uk-table-striped uk-text-small uk-grid-small uk-border uk-padding-xsmall uk-width-1-1" >
<tr><td>Title</td><td>{{space.metadata.title}} </td></tr>
<table class="uk-table-striped uk-text-small uk-grid-small uk-border uk-padding-xsmall uk-width-1-1 uk-text-left" >
<tr><td class="uk-width-small">Title</td><td>{{space.metadata.title}} </td></tr>
<tr><td>Publication date</td><td>{{space.metadata.publication_date}} </td></tr>
<tr *ngIf="space.metadata.description.length >0"><td>Description</td><td>{{space.metadata.description.substring(0,250)}}<span *ngIf="space.metadata.description.length > 247">...</span> </td></tr>
<tr class="uk-text-bold"><td>Access right</td><td>{{space.metadata.access_right}} </td></tr>
<tr><td>Creators</td><td><span *ngFor="let creator of space.metadata.creators; let i = index">{{creator.name}}<span *ngIf="i< space.metadata.creators.length -1">{{', '}}</span></span> </td></tr>
<tr class="uk-text-bold"><td>License</td><td>{{space.metadata.license}} </td></tr>
<tr class="uk-text-bold"><td>Upload type</td><td class="uk-text-bold">{{space.metadata.upload_type}} </td></tr>
<tr *ngIf="space.metadata.description && space.metadata.description.length >0"><td>Description</td><td>{{space.metadata.description.substring(0,250)}}<span *ngIf="space.metadata.description.length > 247">...</span> </td></tr>
<tr class="uk-text-bold uk-text-warning"><td>Access right</td><td>{{space.metadata.access_right}} </td></tr>
<tr *ngIf="space.metadata.creators && space.metadata.creators.length > 0"><td>Creators</td><td><span *ngFor="let creator of space.metadata.creators; let i = index">{{creator.name}}<span *ngIf="i< space.metadata.creators.length -1">{{', '}}</span></span> </td></tr>
<tr class="uk-text-bold uk-text-warning"><td>License</td><td>{{space.metadata.license}} </td></tr>
<tr class="uk-text-bold uk-text-warning"><td>Upload type</td><td class="uk-text-bold">{{space.metadata.upload_type}} </td></tr>
<tr *ngIf="space.metadata['related_identifiers']"><td>Related identifiers</td><td >
<span *ngFor="let identifier of space.metadata['related_identifiers']; let i = index">{{identifier.identifier}} - {{identifier.relation}} -{{identifier.resource_type}}
<span *ngFor="let identifier of space.metadata['related_identifiers']; let i = index">{{identifier.identifier}} - <span class="uk-text-warning">{{identifier.relation}}</span> -{{identifier.resource_type}}
<span *ngIf="i< space.metadata['related_identifiers'] -1">{{', '}}</span></span> </td></tr>
<tr *ngIf="space.metadata.journal_title"><td>Journal</td><td>{{space.metadata.journal_title}}
<span *ngIf="space.metadata.journal_volume"> {{',volume '+ space.metadata.journal_volume}} </span>
@ -77,7 +84,8 @@ declare var UIkit: any;
</div>
<a (click)="promtToDelete()"
class="uk-button uk-button-danger uk-margin-top">Undo</a>
class="uk-button uk-button-danger uk-margin-top">Cancel</a> <a (click)="this.depositInfoModal.cancel()" [href]="space.links.html" target="_blank"
class="uk-button uk-button-default uk-margin-top uk-float-right">Continue to Zenodo</a>
</ng-container>
<div *ngIf="errorMessage" class="uk-alert uk-alert-danger">{{errorMessage}}</div>
@ -85,24 +93,25 @@ declare var UIkit: any;
<div *ngIf="showLoading" class="uk-animation-fade uk-margin-top uk-width-1-1" role="alert">
<loading></loading>
</div>
<modal-alert #grantModal [overflowBody]=false (alertOutput)="authorize()">
<!--<modal-alert #grantModal [overflowBody]=false (alertOutput)="authorize()">
<div>
<!-- <div>{{requestGrantMessage}}</div>-->
&lt;!&ndash; <div>{{requestGrantMessage}}</div>&ndash;&gt;
</div>
</modal-alert>
<modal-alert #depositInfoModal>
<ng-container *ngIf="space && space.metadata">
<!-- <div><a [href]="space.links.html" target="_blank">{{space.metadata.title}}</a></div>-->
&lt;!&ndash; <div><a [href]="space.links.html" target="_blank">{{space.metadata.title}}</a></div>&ndash;&gt;
<div>Your file has been deposited in Zenodo with the main metadata of this record. You can view the new record
<a [href]="space.links.html" target="_blank">here</a>, edit and publish it.
</div>
<div>The preserved DOI is {{space.metadata.prereserve_doi.doi}}.</div>
</ng-container>
</modal-alert>
</modal-alert>-->
<modal-alert #deleteModal [overflowBody]="false" (alertOutput)="deleteSpace()"
classTitle="uk-background-primary uk-light"></modal-alert>
<!-- <a (click)="getAccessByRefresh(null)">get new Access by Refreh</a>-->
<modal-alert #depositInfoModal>
</modal-alert>
`
})
@ -135,7 +144,7 @@ export class DepositionComponent {
user//: User;
userTokens;
@ViewChild('grantModal') grantModal;
// @ViewChild('grantModal') grantModal;
@ViewChild('depositInfoModal') depositInfoModal;
constructor(private route: ActivatedRoute,
@ -148,22 +157,23 @@ export class DepositionComponent {
this.subscriptions.push(this.userManagementService.getUserInfo().subscribe(user => {
//testing
/* this.space = {};
/* this.space = {};
this.space.links = []
this.space.metadata = this.resultInfoToZenodoRecord();
this.space.metadata.prereserve_doi = {doi:"123"}
this.space.files = [];*/
this.user = user;
//TODO remove later
// this.user = {};
// this.user.id = "034130792470362";
// this.user.firstname = "Argiro";
// this.user.lastname = "Kokogiannaki";
// this.user.email = "argirok@di.uoa.gr"
if (this.user) {
console.log(this.user)
this.isAuthorizedBefore();
}else if(properties.environment == 'development'){
//TODO remove later
this.user = {};
this.user.id = "034130792470362";
this.user.firstname = "Argiro";
this.user.lastname = "Kokogiannaki";
this.user.email = "argirok@di.uoa.gr"
this.isAuthorizedBefore();
} else {
this.authorized = false;
}
@ -196,7 +206,7 @@ export class DepositionComponent {
this.window = window.open(this.authorizeUrl, '_blank',
'location=yes,height=700,width=540,left=500,top=100,scrollbars=yes,status=yes');
// this.requestGrant = false;
this.closeGrantModal();
// this.closeGrantModal();
let self = this;
window.onmessage = function (ev) {
@ -228,7 +238,7 @@ export class DepositionComponent {
}
}
openGrantModal(title: string) {
/* openGrantModal(title: string) {
this.grantModal.cancelButton = true;
this.grantModal.okButton = true;
this.grantModal.okButtonText = "Grant OpenAIRE";
@ -239,7 +249,7 @@ export class DepositionComponent {
closeGrantModal() {
this.grantModal.cancel();
}
}*/
public getInfo(func) {
if (this.userTokens.zenodoToken) {
@ -301,10 +311,11 @@ export class DepositionComponent {
creators: [],
description: this.result.description,
imprint_publisher: this.result.publisher,
language:this.result.languages?this.result.languages.join(', '):'',
related_identifiers: []
}
if(this.result.languages){
record['language'] = this.result.languages[0];
}
if(this.result.journal && this.result.journal){
record['journal_title'] = this.result.journal.journal;
record['journal_volume'] = this.result.journal.volume;
@ -326,8 +337,10 @@ export class DepositionComponent {
/* if (this.result.resultType == 'publication' && this.result.types[0]) {
record['publication_type'] = this.result.types[0];
}*/
for (let author of this.result.authors) {
record.creators.push({name: author.fullName, orcid: author.orcid})
if(this.result.authors) {
for (let author of this.result.authors) {
record.creators.push({name: author.fullName, orcid: author.orcid})
}
}
return record;
}
@ -425,7 +438,7 @@ export class DepositionComponent {
console.log(res)
this.space = null;
this._http.delete(this.properties.depositAPI + "deposit/record/delete?id=" + this.mongoRecord._id).subscribe(res => {
this.depositInfoModal.cancel()
})
}, error => {
console.error(error.message)