Add "invite Collaborators" on DMP Overview (ref #241)
This commit is contained in:
parent
995cb32017
commit
dd482f08a3
|
@ -11,6 +11,9 @@
|
|||
<mat-icon class="more-horiz">more_horiz</mat-icon>
|
||||
</button>
|
||||
<mat-menu #actionsMenu="matMenu" xPosition="before">
|
||||
<button mat-menu-item (click)="openShareDialog(dmp.id,dmp.label)">
|
||||
<mat-icon>share</mat-icon>{{'DMP-LISTING.ACTIONS.INVITE' | translate}}
|
||||
</button>
|
||||
<button *ngIf="isUserOwner" mat-menu-item (click)="newVersion(dmp.id, dmp.label)">
|
||||
<mat-icon>queue</mat-icon>{{'DMP-LISTING.ACTIONS.NEW-VERSION' | translate}}
|
||||
</button>
|
||||
|
|
|
@ -21,6 +21,7 @@ import * as FileSaver from 'file-saver';
|
|||
import { Observable, of as observableOf } from 'rxjs';
|
||||
import { takeUntil } from 'rxjs/operators';
|
||||
import { Role } from "@app/core/common/enum/role";
|
||||
import { DmpInvitationDialogComponent } from '../invitation/dmp-invitation.component';
|
||||
|
||||
@Component({
|
||||
selector: 'app-dmp-overview',
|
||||
|
@ -64,7 +65,7 @@ export class DmpOverviewComponent extends BaseComponent implements OnInit {
|
|||
.pipe(takeUntil(this._destroyed))
|
||||
.subscribe(data => {
|
||||
this.dmp = data;
|
||||
this.setIsUserOwner();
|
||||
this.setIsUserOwnerOrCreator();
|
||||
const breadCrumbs = [];
|
||||
breadCrumbs.push({ parentComponentName: null, label: this.language.instant('NAV-BAR.MY-DMPS'), url: "/plans" });
|
||||
breadCrumbs.push({ parentComponentName: 'DmpListingComponent', label: this.dmp.label, url: '/plans/overview/' + this.dmp.id });
|
||||
|
@ -83,7 +84,7 @@ export class DmpOverviewComponent extends BaseComponent implements OnInit {
|
|||
.pipe(takeUntil(this._destroyed))
|
||||
.subscribe(data => {
|
||||
this.dmp = data;
|
||||
this.setIsUserOwner();
|
||||
this.setIsUserOwnerOrCreator();
|
||||
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 });
|
||||
|
@ -102,10 +103,10 @@ export class DmpOverviewComponent extends BaseComponent implements OnInit {
|
|||
this.router.navigate([redirectRoot]);
|
||||
}
|
||||
|
||||
setIsUserOwner() {
|
||||
setIsUserOwnerOrCreator() {
|
||||
if (this.dmp) {
|
||||
const principal: Principal = this.authentication.current();
|
||||
if (principal) 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 || x.role === Role.Creator).id;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -243,12 +244,15 @@ export class DmpOverviewComponent extends BaseComponent implements OnInit {
|
|||
}
|
||||
});
|
||||
}
|
||||
if (role === Role.Owner) {
|
||||
return this.translate.instant('DMP-LISTING.OWNER');
|
||||
} else if (role === Role.Member) {
|
||||
return this.translate.instant('DMP-LISTING.MEMBER');
|
||||
} else {
|
||||
return this.translate.instant('DMP-LISTING.OWNER');
|
||||
switch (role) {
|
||||
case Role.Creator:
|
||||
return this.translate.instant('DMP-LISTING.CREATOR');
|
||||
case Role.Owner:
|
||||
return this.translate.instant('DMP-LISTING.OWNER');
|
||||
case Role.Member:
|
||||
return this.translate.instant('DMP-LISTING.MEMBER');
|
||||
default:
|
||||
return this.translate.instant('DMP-LISTING.OWNER');
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -266,10 +270,15 @@ export class DmpOverviewComponent extends BaseComponent implements OnInit {
|
|||
}
|
||||
|
||||
roleDisplay(value: UserInfoListingModel) {
|
||||
if (value.role === Role.Member) {
|
||||
return this.translate.instant('DMP-LISTING.MEMBER');
|
||||
} else {
|
||||
return this.translate.instant('DMP-LISTING.OWNER');
|
||||
switch (value.role) {
|
||||
case Role.Creator:
|
||||
return this.translate.instant('DMP-LISTING.CREATOR');
|
||||
case Role.Owner:
|
||||
return this.translate.instant('DMP-LISTING.OWNER');
|
||||
case Role.Member:
|
||||
return this.translate.instant('DMP-LISTING.MEMBER');
|
||||
default:
|
||||
return this.translate.instant('DMP-LISTING.OWNER');
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -409,6 +418,18 @@ export class DmpOverviewComponent extends BaseComponent implements OnInit {
|
|||
return !(!this.authentication.current());
|
||||
}
|
||||
|
||||
openShareDialog(rowId: any, rowName: any) {
|
||||
const dialogRef = this.dialog.open(DmpInvitationDialogComponent, {
|
||||
// height: '250px',
|
||||
// width: '700px',
|
||||
restoreFocus: false,
|
||||
data: {
|
||||
dmpId: rowId,
|
||||
dmpName: rowName
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// advancedClicked() {
|
||||
// const dialogRef = this.dialog.open(ExportMethodDialogComponent, {
|
||||
// maxWidth: '500px',
|
||||
|
|
Loading…
Reference in New Issue