dmp listing small changes
This commit is contained in:
parent
5da3c4f9b9
commit
806f763e2b
|
@ -18,6 +18,12 @@ export enum AppPermission {
|
|||
BrowseDmp = "BrowseDmp",
|
||||
EditDmp = "EditDmp",
|
||||
DeleteDmp= "DeleteDmp",
|
||||
CloneDmp = "CloneDmp",
|
||||
CreateNewVersionDmp = "CreateNewVersionDmp",
|
||||
ExportDmp = "ExportDmp",
|
||||
FinalizeDmp = "FinalizeDmp",
|
||||
AssignDmpUsers = "AssignDmpUsers",
|
||||
InviteDmpUsers = "InviteDmpUsers",
|
||||
|
||||
//DescriptionTemplateType
|
||||
BrowseDescriptionTemplate = "BrowseDescriptionTemplate",
|
||||
|
|
|
@ -131,10 +131,10 @@ export class ReferenceTypeService {
|
|||
}
|
||||
|
||||
public getResearcherReferenceType(): Guid {
|
||||
return null;
|
||||
return Guid.parse('5a2112e7-ea99-4cfe-98a1-68665e26726e');;
|
||||
}
|
||||
|
||||
public getGrantReferenceType(): Guid {
|
||||
return null;
|
||||
return Guid.parse('5b9c284f-f041-4995-96cc-fad7ad13289c');
|
||||
}
|
||||
}
|
|
@ -163,7 +163,7 @@
|
|||
<div class="col" *ngIf="field.get('category').value != null">
|
||||
<mat-form-field class="w-100">
|
||||
<mat-label>{{'DMP-BLUEPRINT-EDITOR.FIELDS.SEMANTICS' | translate}}</mat-label>
|
||||
<app-multiple-auto-complete placeholder="{{'DMP-BLUEPRINT-EDITOR.FIELDS.SEMANTICS' | translate}}" [hidePlaceholder]="true" required='false' [separatorKeysCodes]="separatorKeysCodes" [formControl]="field.get('semantics')" [configuration]="semanticsService.multipleAutocompleteConfiguration">
|
||||
<app-multiple-auto-complete placeholder="{{'DMP-BLUEPRINT-EDITOR.FIELDS.SEMANTICS' | translate}}" [hidePlaceholder]="true" [required]="false" [separatorKeysCodes]="separatorKeysCodes" [formControl]="field.get('semantics')" [configuration]="semanticsService.multipleAutocompleteConfiguration">
|
||||
</app-multiple-auto-complete>
|
||||
<mat-error *ngIf="field.get('semantics').hasError('backendError')">{{field.get('semantics').getError('backendError').message}}</mat-error>
|
||||
<mat-error *ngIf="field.get('semantics').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
||||
|
|
|
@ -30,11 +30,11 @@
|
|||
<div class="dmp-card-actions">
|
||||
<a class="col-auto border-right pointer" [matMenuTriggerFor]="exportMenu"><span class="material-icons icon-align pr-2">open_in_new</span>{{'DMP-LISTING.ACTIONS.EXPORT' | translate}}</a>
|
||||
<a class="col-auto border-right pointer" *ngIf="isDraftDmp(dmp)" [routerLink]="['/plans/edit/' + dmp.id]" target="_blank"><span class="material-icons icon-align">add</span>{{'DMP-LISTING.ACTIONS.ADD-DESCRIPTION-SHORT' | translate}}</a>
|
||||
<a class="col-auto border-right pointer" *ngIf="isUserOwner(dmp)" (click)="inviteToDmp()"><span class="material-icons icon-align pr-2">group_add</span>{{'DMP-LISTING.ACTIONS.INVITE-SHORT' | translate}}</a>
|
||||
<a class="col-auto border-right pointer" *ngIf="isDmpOwner(dmp)" (click)="inviteToDmp()"><span class="material-icons icon-align pr-2">group_add</span>{{'DMP-LISTING.ACTIONS.INVITE-SHORT' | translate}}</a>
|
||||
<a class="col-auto border-right pointer" *ngIf="isAuthenticated()" (click)="cloneClicked()"><span class="material-icons icon-align pr-2">filter_none</span>{{'DMP-LISTING.ACTIONS.CLONE' | translate}}</a>
|
||||
<a class="col-auto border-right pointer" *ngIf="!isAuthenticated()" (click)="viewVersions(dmp)"><span class="material-icons icon-align pr-2">library_books</span>{{'DMP-LISTING.ACTIONS.VIEW-VERSION' | translate}}</a>
|
||||
|
||||
<a class="col-auto border-right pointer" *ngIf="!isDraftDmp(dmp) && isUserOwner(dmp)" (click)="deleteClicked(dmp.id)"><span class="material-icons icon-align pr-2">delete</span>{{ 'DMP-LISTING.ACTIONS.DELETE' | translate }}</a>
|
||||
<a class="col-auto border-right pointer" *ngIf="!isDraftDmp(dmp) && isDmpOwner(dmp)" (click)="deleteClicked(dmp.id)"><span class="material-icons icon-align pr-2">delete</span>{{ 'DMP-LISTING.ACTIONS.DELETE' | translate }}</a>
|
||||
<a class="col-auto pointer" *ngIf="isAuthenticated()" [matMenuTriggerFor]="actionsMenu"><span class="material-icons icon-align pl-2">more_horiz</span></a>
|
||||
</div>
|
||||
<mat-menu #exportMenu="matMenu" xPosition="before">
|
||||
|
@ -44,13 +44,13 @@
|
|||
</button>
|
||||
</mat-menu>
|
||||
<mat-menu #actionsMenu="matMenu" xPosition="before">
|
||||
<button *ngIf="isUserOwner(dmp)" mat-menu-item (click)="newVersionClicked()">
|
||||
<button *ngIf="canCreateNewVersion(dmp)" mat-menu-item (click)="newVersionClicked()">
|
||||
<mat-icon>queue</mat-icon>{{'DMP-LISTING.ACTIONS.NEW-VERSION' | translate}}
|
||||
</button>
|
||||
<button mat-menu-item (click)="viewVersions(dmp)">
|
||||
<mat-icon>library_books</mat-icon>{{'DMP-LISTING.ACTIONS.VIEW-VERSION' | translate}}
|
||||
</button>
|
||||
<button mat-menu-item *ngIf="isDraftDmp(dmp) && isUserOwner(dmp)" (click)="deleteClicked(dmp.id)" class="menu-item">
|
||||
<button mat-menu-item *ngIf="isDraftDmp(dmp) && isDmpOwner(dmp)" (click)="deleteClicked(dmp.id)" class="menu-item">
|
||||
<mat-icon>delete</mat-icon>{{ 'DMP-LISTING.ACTIONS.DELETE' | translate }}
|
||||
</button>
|
||||
</mat-menu>
|
||||
|
|
|
@ -26,6 +26,7 @@ import { AuthService } from '../../../../core/services/auth/auth.service';
|
|||
import { CloneDmpDialogComponent } from '../../clone-dialog/dmp-clone-dialog.component';
|
||||
import { DmpInvitationDialogComponent } from '../../invitation/dialog/dmp-invitation-dialog.component';
|
||||
import { NewVersionDmpDialogComponent } from '../../new-version-dialog/dmp-new-version-dialog.component';
|
||||
import { AppPermission } from '@app/core/common/enum/permission.enum';
|
||||
|
||||
@Component({
|
||||
selector: 'app-dmp-listing-item-component',
|
||||
|
@ -104,7 +105,7 @@ export class DmpListingItemComponent extends BaseComponent implements OnInit {
|
|||
}
|
||||
|
||||
viewVersions(dmp: Dmp) {
|
||||
if (dmp.accessType == DmpAccessType.Public && dmp.status == DmpStatus.Finalized && !this.isUserOwner(dmp)) {
|
||||
if (dmp.accessType == DmpAccessType.Public && dmp.status == DmpStatus.Finalized && !this.isDmpOwner(dmp)) {
|
||||
let url = this.router.createUrlTree(['/explore-plans/versions/', dmp.groupId]);
|
||||
window.open(url.toString(), '_blank');
|
||||
} else {
|
||||
|
@ -214,8 +215,12 @@ export class DmpListingItemComponent extends BaseComponent implements OnInit {
|
|||
this.uiNotificationService.snackBarNotification(error.error.message ? error.error.message : this.language.instant('GENERAL.SNACK-BAR.UNSUCCESSFUL-DELETE'), SnackBarNotificationLevel.Error);
|
||||
}
|
||||
|
||||
isUserOwner(dmp: Dmp): boolean {
|
||||
isDmpOwner(dmp: Dmp): boolean {
|
||||
const principalId: Guid = this.authentication.userId();
|
||||
if (principalId) return !!dmp.dmpUsers?.find(x => (x.role === DmpUserRole.Owner) && (principalId === x.id));
|
||||
}
|
||||
|
||||
canCreateNewVersion(dmp: Dmp): boolean {
|
||||
return this.isDmpOwner(dmp) || this.authentication.hasPermission(AppPermission.CreateNewVersionDmp);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue