Fix after deposit action in dmp overwiew.

This commit is contained in:
Konstantinos Triantafyllou 2023-01-24 12:13:58 +02:00
parent 8f74c36205
commit 34f8e4f96d
2 changed files with 4 additions and 3 deletions

View File

@ -123,13 +123,13 @@
</ng-container> </ng-container>
</div> </div>
<div *ngIf="dmp.dois" class="doi-panel"> <div *ngIf="dmp.dois && selectedModel" class="doi-panel">
<span class="ml-3 mr-3">{{selectedModel.doi}}</span> <span class="ml-3 mr-3">{{selectedModel.doi}}</span>
<div class="d-flex justify-content-end ml-3"> <div class="d-flex justify-content-end ml-3">
<button (click)="copyDoi(dmp.dois[0].doi)" mat-mini-fab class="mr-2 d-flex justify-content-center align-items-center" matTooltip="{{'DMP-LISTING.ACTIONS.COPY' | translate}}" matTooltipPosition="above"> <button (click)="copyDoi(dmp.dois[0].doi)" mat-mini-fab class="mr-2 d-flex justify-content-center align-items-center" matTooltip="{{'DMP-LISTING.ACTIONS.COPY' | translate}}" matTooltipPosition="above">
<mat-icon class="mat-mini-fab-icon">content_copy</mat-icon> <mat-icon class="mat-mini-fab-icon">content_copy</mat-icon>
</button> </button>
<button mat-mini-fab class="mr-2 d-flex justify-content-center align-items-center" matTooltip="{{'GRANT-EDITOR.ACTIONS.VISIT-WEBSITE' | translate}}" matTooltipPosition="above"> <button *ngIf="depositRepos" mat-mini-fab class="mr-2 d-flex justify-content-center align-items-center" matTooltip="{{'GRANT-EDITOR.ACTIONS.VISIT-WEBSITE' | translate}}" matTooltipPosition="above">
<a [href]="createDoiLink(dmp.dois[0])" class="doi-link" target="_blank"> <a [href]="createDoiLink(dmp.dois[0])" class="doi-link" target="_blank">
<mat-icon class="mat-mini-fab-icon">launch</mat-icon> <mat-icon class="mat-mini-fab-icon">launch</mat-icon>
</a> </a>

View File

@ -509,6 +509,7 @@ export class DmpOverviewComponent extends BaseComponent implements OnInit {
afterDeposit(result: DoiModel[]) { afterDeposit(result: DoiModel[]) {
if (result.length > 0) { if (result.length > 0) {
this.dmp.dois.push(...result); this.dmp.dois.push(...result);
this.selectedModel = this.dmp.dois[this.dmp.dois.length - 1];
this.hasDOIToken = true; this.hasDOIToken = true;
} }
} }
@ -642,7 +643,7 @@ export class DmpOverviewComponent extends BaseComponent implements OnInit {
selectDoi(doiModel: DoiModel){ selectDoi(doiModel: DoiModel){
this.selectedModel = doiModel; this.selectedModel = doiModel;
const foundIdx = this.dmp.dois.findIndex(el => el == doiModel); const foundIdx = this.dmp.dois.findIndex(el => el.id == doiModel.id);
this.dmp.dois.splice(foundIdx, 1); this.dmp.dois.splice(foundIdx, 1);
this.dmp.dois.unshift(doiModel); this.dmp.dois.unshift(doiModel);
} }