Fixes not showing "New Version" option on DMP overview action menu.

This commit is contained in:
gkolokythas 2020-01-08 13:04:04 +02:00
parent 493ab9763e
commit 3da0cc9ad4
2 changed files with 3 additions and 2 deletions

View File

@ -11,7 +11,7 @@
<mat-icon class="more-horiz">more_horiz</mat-icon>
</button>
<mat-menu #actionsMenu="matMenu" xPosition="before">
<button *ngIf="!this.isPublicView && isUserOwner" mat-menu-item (click)="newVersion(dmp.id, dmp.label)">
<button *ngIf="isUserOwner" mat-menu-item (click)="newVersion(dmp.id, dmp.label)">
<mat-icon>queue</mat-icon>{{'DMP-LISTING.ACTIONS.NEW-VERSION' | translate}}
</button>
<button mat-menu-item (click)="viewVersions(dmp.groupId, dmp.label)">

View File

@ -79,6 +79,7 @@ export class DmpOverviewComponent extends BaseComponent implements OnInit {
.pipe(takeUntil(this._destroyed))
.subscribe(data => {
this.dmp = data;
this.setIsUserOwner();
const breadCrumbs = [];
breadCrumbs.push({ parentComponentName: null, label: this.language.instant('NAV-BAR.PUBLIC-DMPS'), url: "/explore-plans" });
breadCrumbs.push({ parentComponentName: 'DmpListingComponent', label: this.dmp.label, url: '/plans/publicOverview/' + this.dmp.id });
@ -91,7 +92,7 @@ export class DmpOverviewComponent extends BaseComponent implements OnInit {
setIsUserOwner() {
if (this.dmp) {
const principal: Principal = this.authentication.current();
this.isUserOwner = principal.id === this.dmp.users.find(x => x.role === Role.Owner).id;
if (principal) this.isUserOwner = principal.id === this.dmp.users.find(x => x.role === Role.Owner).id;
}
}