diff --git a/dmp-frontend/src/app/ui/description/listing/description-listing.component.ts b/dmp-frontend/src/app/ui/description/listing/description-listing.component.ts index 5b945b595..b7f4d2629 100644 --- a/dmp-frontend/src/app/ui/description/listing/description-listing.component.ts +++ b/dmp-frontend/src/app/ui/description/listing/description-listing.component.ts @@ -34,6 +34,7 @@ import { TranslateService } from '@ngx-translate/core'; import { debounceTime, takeUntil } from 'rxjs/operators'; import { nameof } from 'ts-simple-nameof'; import { StartNewDescriptionDialogComponent } from '../start-new-description-dialog/start-new-description-dialog.component'; +import { DmpBlueprint, DmpBlueprintDefinition, DmpBlueprintDefinitionSection } from '@app/core/model/dmp-blueprint/dmp-blueprint'; @Component({ selector: 'app-description-listing-component', @@ -202,6 +203,7 @@ export class DescriptionListingComponent extends BaseComponent implements OnInit [nameof(x => x.authorizationFlags), AppPermission.EditDescription].join('.'), [nameof(x => x.authorizationFlags), AppPermission.DeleteDescription].join('.'), + [nameof(x => x.authorizationFlags), AppPermission.InviteDmpUsers].join('.'), [nameof(x => x.descriptionTemplate), nameof(x => x.id)].join('.'), [nameof(x => x.descriptionTemplate), nameof(x => x.label)].join('.'), @@ -210,9 +212,14 @@ export class DescriptionListingComponent extends BaseComponent implements OnInit [nameof(x => x.dmp), nameof(x => x.label)].join('.'), [nameof(x => x.dmp), nameof(x => x.status)].join('.'), [nameof(x => x.dmp), nameof(x => x.accessType)].join('.'), + [nameof(x => x.dmp), nameof(x => x.blueprint), nameof(x => x.id)].join('.'), + [nameof(x => x.dmp), nameof(x => x.blueprint), nameof(x => x.label)].join('.'), + [nameof(x => x.dmp), nameof(x => x.blueprint), nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.id)].join('.'), + [nameof(x => x.dmp), nameof(x => x.blueprint), nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.label)].join('.'), [nameof(x => x.dmp), nameof(x => x.dmpUsers), nameof(x => x.id)].join('.'), [nameof(x => x.dmp), nameof(x => x.dmpUsers), nameof(x => x.user.id)].join('.'), [nameof(x => x.dmp), nameof(x => x.dmpUsers), nameof(x => x.role)].join('.'), + [nameof(x => x.dmp), nameof(x => x.dmpUsers), nameof(x => x.isActive)].join('.'), [nameof(x => x.dmp), nameof(x => x.dmpReferences), nameof(x => x.id)].join('.'), [nameof(x => x.dmp), nameof(x => x.dmpReferences), nameof(x => x.reference), nameof(x => x.id)].join('.'), [nameof(x => x.dmp), nameof(x => x.dmpReferences), nameof(x => x.reference), nameof(x => x.label)].join('.'), diff --git a/dmp-frontend/src/app/ui/description/listing/listing-item/description-listing-item.component.html b/dmp-frontend/src/app/ui/description/listing/listing-item/description-listing-item.component.html index 052c5c46f..2f897d634 100644 --- a/dmp-frontend/src/app/ui/description/listing/listing-item/description-listing-item.component.html +++ b/dmp-frontend/src/app/ui/description/listing/listing-item/description-listing-item.component.html @@ -8,8 +8,8 @@
{{description.label}}
{{description.label}}
- {{ enumUtils.toDmpUserRolesString(dmpService.getCurrentUserRolesInDmp(description?.dmp?.dmpUsers)) }} - . + {{ enumUtils.toDmpUserRolesString(dmpService.getCurrentUserRolesInDmp(description?.dmp?.dmpUsers)) }} + . public{{'DESCRIPTION-LISTING.STATES.PUBLIC' | translate}} done{{ enumUtils.toDescriptionStatusString(description.status) }} create{{ enumUtils.toDescriptionStatusString(description.status) }} @@ -25,7 +25,7 @@ diff --git a/dmp-frontend/src/app/ui/description/listing/listing-item/description-listing-item.component.ts b/dmp-frontend/src/app/ui/description/listing/listing-item/description-listing-item.component.ts index 539ad3045..89046c430 100644 --- a/dmp-frontend/src/app/ui/description/listing/listing-item/description-listing-item.component.ts +++ b/dmp-frontend/src/app/ui/description/listing/listing-item/description-listing-item.component.ts @@ -47,6 +47,7 @@ export class DescriptionListingItemComponent extends BaseComponent implements On dmpAccessTypeEnum = DmpAccessType; canDelete: boolean = false; canEdit: boolean = false; + canInviteDmpUsers: boolean = false; constructor( @@ -90,6 +91,9 @@ export class DescriptionListingItemComponent extends BaseComponent implements On this.canEdit = this.authService.hasPermission(AppPermission.EditDescription) || this.description.authorizationFlags?.some(x => x === AppPermission.EditDescription); + this.canInviteDmpUsers = this.authService.hasPermission(AppPermission.InviteDmpUsers) || + this.description.authorizationFlags?.some(x => x === AppPermission.InviteDmpUsers); + } setIsUserOwner() { @@ -100,6 +104,11 @@ export class DescriptionListingItemComponent extends BaseComponent implements On } } + isUserDMPRelated() { + const principalId: Guid = this.authService.userId(); + return this.description.dmp.dmpUsers?.some(x => (x.user.id === principalId)); + } + public isAuthenticated(): boolean { return this.authService.currentAccountIsAuthenticated(); } @@ -151,7 +160,7 @@ export class DescriptionListingItemComponent extends BaseComponent implements On // }); } - openShareDialog(dmpRowId: any, dmpRowName: any) { + openShareDialog() { // TODO: This is a shared component. Put it in a seperate module. const dialogRef = this.dialog.open(DmpInvitationDialogComponent, { // height: '250px', @@ -159,8 +168,9 @@ export class DescriptionListingItemComponent extends BaseComponent implements On autoFocus: false, restoreFocus: false, data: { - dmpId: dmpRowId, - dmpName: dmpRowName + dmpId: this.description.dmp.id, + dmpName: this.description.dmp.label, + blueprint: this.description.dmp.blueprint } }); } diff --git a/dmp-frontend/src/app/ui/description/overview/description-overview.component.html b/dmp-frontend/src/app/ui/description/overview/description-overview.component.html index f022a76d2..5fcbd7c2f 100644 --- a/dmp-frontend/src/app/ui/description/overview/description-overview.component.html +++ b/dmp-frontend/src/app/ui/description/overview/description-overview.component.html @@ -145,7 +145,7 @@
- diff --git a/dmp-frontend/src/app/ui/description/overview/description-overview.component.ts b/dmp-frontend/src/app/ui/description/overview/description-overview.component.ts index 319404a78..9ec336dfd 100644 --- a/dmp-frontend/src/app/ui/description/overview/description-overview.component.ts +++ b/dmp-frontend/src/app/ui/description/overview/description-overview.component.ts @@ -37,6 +37,9 @@ import { AppPermission } from '@app/core/common/enum/permission.enum'; import { DescriptionValidationOutput } from '@app/ui/dmp/dmp-finalize-dialog/dmp-finalize-dialog.component'; import { LockService } from '@app/core/services/lock/lock.service'; import { PopupNotificationDialogComponent } from '@app/library/notification/popup/popup-notification.component'; +import { IsActive } from '@app/core/common/enum/is-active.enum'; +import { DmpInvitationDialogComponent } from '@app/ui/dmp/invitation/dialog/dmp-invitation-dialog.component'; +import { DmpBlueprint, DmpBlueprintDefinition, DmpBlueprintDefinitionSection } from '@app/core/model/dmp-blueprint/dmp-blueprint'; @Component({ @@ -108,6 +111,7 @@ export class DescriptionOverviewComponent extends BaseComponent implements OnIni .pipe(takeUntil(this._destroyed)) .subscribe(data => { this.description = data; + this.description.dmp.dmpUsers = data.dmp.dmpUsers.filter(x => x.isActive === IsActive.Active); this.researchers = this.referenceService.getReferencesForTypes(this.description?.dmp?.dmpReferences, [this.referenceTypeService.getResearcherReferenceType()]); // this.users = this.description.dmp.users; this.checkLockStatus(this.description.id); @@ -121,7 +125,7 @@ export class DescriptionOverviewComponent extends BaseComponent implements OnIni this.description.authorizationFlags?.some(x => x === AppPermission.FinalizeDescription); this.canInviteDmpUsers = this.authService.hasPermission(AppPermission.InviteDmpUsers) || - this.description.dmp?.authorizationFlags?.some(x => x === AppPermission.InviteDmpUsers); + this.description.authorizationFlags?.some(x => x === AppPermission.InviteDmpUsers); // const breadCrumbs = []; // breadCrumbs.push({ parentComponentName: null, label: this.language.instant('NAV-BAR.MY-DESCRIPTION-DESCRIPTIONS'), url: "/descriptions" }); // breadCrumbs.push({ parentComponentName: 'DescriptionListingComponent', label: this.description.label, url: '/descriptions/overview/' + this.description.id }); @@ -205,16 +209,16 @@ export class DescriptionOverviewComponent extends BaseComponent implements OnIni } - openShareDialog(rowId: any, rowName: any) { - // TODO: add dialog - // const dialogRef = this.dialog.open(DmpInvitationDialogComponent, { - // autoFocus: false, - // restoreFocus: false, - // data: { - // dmpId: rowId, - // dmpName: rowName - // } - // }); + openShareDialog() { + const dialogRef = this.dialog.open(DmpInvitationDialogComponent, { + autoFocus: false, + restoreFocus: false, + data: { + dmpId: this.description.dmp.id, + dmpName: this.description.dmp.label, + blueprint: this.description.dmp.blueprint + } + }); } public isAuthenticated(): boolean { @@ -428,7 +432,7 @@ export class DescriptionOverviewComponent extends BaseComponent implements OnIni } hasReversableStatus(description: Description): boolean { - return description.dmp.status == DmpStatus.Draft && description.status == DescriptionStatus.Finalized + return description.dmp.status == DmpStatus.Draft && description.status == DescriptionStatus.Finalized && this.canFinalize } reverseFinalization(description: Description) { @@ -471,6 +475,7 @@ export class DescriptionOverviewComponent extends BaseComponent implements OnIni [nameof(x => x.authorizationFlags), AppPermission.EditDescription].join('.'), [nameof(x => x.authorizationFlags), AppPermission.DeleteDescription].join('.'), [nameof(x => x.authorizationFlags), AppPermission.FinalizeDescription].join('.'), + [nameof(x => x.authorizationFlags), AppPermission.InviteDmpUsers].join('.'), [nameof(x => x.descriptionTemplate), nameof(x => x.id)].join('.'), [nameof(x => x.descriptionTemplate), nameof(x => x.label)].join('.'), @@ -483,10 +488,15 @@ export class DescriptionOverviewComponent extends BaseComponent implements OnIni [nameof(x => x.dmp), nameof(x => x.accessType)].join('.'), [nameof(x => x.dmp), nameof(x => x.status)].join('.'), [nameof(x => x.dmp), nameof(x => x.authorizationFlags),AppPermission.InviteDmpUsers].join('.'), + [nameof(x => x.dmp), nameof(x => x.blueprint), nameof(x => x.id)].join('.'), + [nameof(x => x.dmp), nameof(x => x.blueprint), nameof(x => x.label)].join('.'), + [nameof(x => x.dmp), nameof(x => x.blueprint), nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.id)].join('.'), + [nameof(x => x.dmp), nameof(x => x.blueprint), nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.label)].join('.'), [nameof(x => x.dmp), nameof(x => x.dmpUsers), nameof(x => x.id)].join('.'), [nameof(x => x.dmp), nameof(x => x.dmpUsers), nameof(x => x.user.id)].join('.'), [nameof(x => x.dmp), nameof(x => x.dmpUsers), nameof(x => x.user.name)].join('.'), [nameof(x => x.dmp), nameof(x => x.dmpUsers), nameof(x => x.role)].join('.'), + [nameof(x => x.dmp), nameof(x => x.dmpUsers), nameof(x => x.isActive)].join('.'), [nameof(x => x.dmp), nameof(x => x.dmpReferences), nameof(x => x.id)].join('.'), [nameof(x => x.dmp), nameof(x => x.dmpReferences), nameof(x => x.reference), nameof(x => x.id)].join('.'), [nameof(x => x.dmp), nameof(x => x.dmpReferences), nameof(x => x.reference), nameof(x => x.label)].join('.'), diff --git a/dmp-frontend/src/app/ui/dmp/listing/listing-item/dmp-listing-item.component.html b/dmp-frontend/src/app/ui/dmp/listing/listing-item/dmp-listing-item.component.html index c5a98ad6a..da02f3fe2 100644 --- a/dmp-frontend/src/app/ui/dmp/listing/listing-item/dmp-listing-item.component.html +++ b/dmp-frontend/src/app/ui/dmp/listing/listing-item/dmp-listing-item.component.html @@ -29,7 +29,7 @@
open_in_new{{'DMP-LISTING.ACTIONS.EXPORT' | translate}} - add{{'DMP-LISTING.ACTIONS.ADD-DESCRIPTION-SHORT' | translate}} + add{{'DMP-LISTING.ACTIONS.ADD-DESCRIPTION-SHORT' | translate}} group_add{{'DMP-LISTING.ACTIONS.INVITE-SHORT' | translate}} filter_none{{'DMP-LISTING.ACTIONS.CLONE' | translate}} library_books{{'DMP-LISTING.ACTIONS.VIEW-VERSION' | translate}} diff --git a/dmp-frontend/src/app/ui/dmp/listing/listing-item/dmp-listing-item.component.ts b/dmp-frontend/src/app/ui/dmp/listing/listing-item/dmp-listing-item.component.ts index cc13d266e..d79398185 100644 --- a/dmp-frontend/src/app/ui/dmp/listing/listing-item/dmp-listing-item.component.ts +++ b/dmp-frontend/src/app/ui/dmp/listing/listing-item/dmp-listing-item.component.ts @@ -216,6 +216,10 @@ export class DmpListingItemComponent extends BaseComponent implements OnInit { onDeleteCallbackError(error) { this.uiNotificationService.snackBarNotification(error.error.message ? error.error.message : this.language.instant('GENERAL.SNACK-BAR.UNSUCCESSFUL-DELETE'), SnackBarNotificationLevel.Error); } + + canEditDmp(dmp: Dmp): boolean { + return (this.dmp.authorizationFlags?.some(x => x === AppPermission.EditDmp) || this.authentication.hasPermission(AppPermission.EditDmp)) && this.isPublic == false; + } canCreateNewVersion(dmp: Dmp): boolean { return (this.dmp.authorizationFlags?.some(x => x === AppPermission.CreateNewVersionDmp) || this.authentication.hasPermission(AppPermission.CreateNewVersionDmp)) && this.isPublic == false; diff --git a/dmp-frontend/src/app/ui/tag/tags-field/tags-field.component.html b/dmp-frontend/src/app/ui/tag/tags-field/tags-field.component.html index d4c901cad..f2799fd1f 100644 --- a/dmp-frontend/src/app/ui/tag/tags-field/tags-field.component.html +++ b/dmp-frontend/src/app/ui/tag/tags-field/tags-field.component.html @@ -8,7 +8,7 @@ - + {{tag}}