dmp ui fixes

This commit is contained in:
amentis 2024-03-01 18:50:46 +02:00
parent f0c076fe4f
commit b84cd93ce6
13 changed files with 151 additions and 79 deletions

View File

@ -6,8 +6,11 @@ import eu.eudat.convention.ConventionService;
import eu.eudat.data.DmpEntity;
import eu.eudat.errorcode.ErrorThesaurusProperties;
import org.apache.commons.compress.utils.Lists;
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
import org.springframework.context.MessageSource;
import org.springframework.context.annotation.Scope;
import org.springframework.context.i18n.LocaleContextHolder;
import org.springframework.stereotype.Component;
import java.util.Arrays;
import java.util.List;
@ -16,6 +19,7 @@ import java.util.UUID;
public class NewVersionDmpPersist {
private UUID id = null;
public static final String _id = "id";
private String label = null;
@ -85,6 +89,8 @@ public class NewVersionDmpPersist {
this.hash = hash;
}
@Component(NewVersionDmpPersist.NewVersionDmpPersistValidator.ValidatorName)
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
public static class NewVersionDmpPersistValidator extends BaseValidator<NewVersionDmpPersist> {
public static final String ValidatorName = "NewVersionDmpPersistValidator";

View File

@ -803,7 +803,9 @@ public class DmpServiceImpl implements DmpService {
if (userId != null){
user.setUser(userId);
this.assignUsers(id, List.of(user), null);
this.sendDmpInvitationExistingUser(user.getUser(), dmp, user.getRole());
if (this.userScope.getUserId() != userId){
this.sendDmpInvitationExistingUser(user.getUser(), dmp, user.getRole());
}
}else if (user.getEmail() != null) {
this.sendDmpInvitationExternalUser(user.getEmail(),dmp, user.getRole());
}

View File

@ -85,7 +85,7 @@ export class DmpService {
const options = { params: { f: reqFields } };
return this.http
.post<Dmp>(url, item).pipe(
.post<Dmp>(url, item, options).pipe(
catchError((error: any) => throwError(error)));
}
@ -94,7 +94,7 @@ export class DmpService {
const options = { params: { f: reqFields } };
return this.http
.post<Dmp>(url, item).pipe(
.post<Dmp>(url, item, options ).pipe(
catchError((error: any) => throwError(error)));
}

View File

@ -34,7 +34,7 @@
<div class="col-12" *ngIf="hasDescriptions()">
<h5>{{'DMP-CLONE-DIALOG.FIELDS.DESCRIPTIONS-HINT' | translate}}</h5>
</div>
<div class="col-12">
<div class="col-12" *ngIf="hasDescriptions()">
<mat-card class="mat-card">
<mat-selection-list #selectedItems [formControl]="formGroup.get('descriptions')">
<mat-list-option *ngFor="let description of dmp.descriptions;" [value]="description.id">
@ -43,7 +43,7 @@
</mat-selection-list>
</mat-card>
</div>
<div class="col-12" *ngIf="hasDescriptions()">
<div class="col-12" *ngIf="!hasDescriptions()">
<h5 mat-subheader class="p-3">{{'DMP-CLONE-DIALOG.NO-DESCRIPTIONS' | translate}}</h5>
</div>
</div>

View File

@ -8,6 +8,7 @@ import { BaseComponent } from '@common/base/base.component';
import { TranslateService } from '@ngx-translate/core';
import { takeUntil } from 'rxjs/operators';
import { DmpCloneDialogEditorModel } from './dmp-clone-dialog.editor.model';
import { DmpEditorResolver } from '../dmp-editor-blueprint/dmp-editor.resolver';
@Component({
selector: 'app-dmp-clone-dialog',
@ -37,7 +38,7 @@ export class CloneDmpDialogComponent extends BaseComponent {
}
hasDescriptions() {
return this.dmp.descriptions.length > 0;
return this.dmp.descriptions?.length > 0;
}
close() {
@ -51,7 +52,7 @@ export class CloneDmpDialogComponent extends BaseComponent {
confirm() {
if (!this.formGroup.valid) { return; }
const value: CloneDmpPersist = this.formGroup.value;
this.dmpService.clone(value).pipe(takeUntil(this._destroyed)).subscribe(
this.dmpService.clone(value, DmpEditorResolver.lookupFields()).pipe(takeUntil(this._destroyed)).subscribe(
dmp => this.dialogRef.close(dmp),
error => this.onCallbackError(error)
);

View File

@ -295,25 +295,27 @@ export class DmpBlueprintValueEditorModel implements DmpBlueprintValuePersist {
this.fieldId = item.fieldId;
this.fieldValue = item.fieldValue;
// TODO check typeId field
dmpReferences.forEach(dmpReference => {
if(dmpReference.data.blueprintFieldId == this.fieldId){
this.references.push({
data: dmpReference.data,
reference: {
id: dmpReference.reference.id,
label: dmpReference.reference.label,
reference: dmpReference.reference.reference,
source: dmpReference.reference.source,
typeId: null,
description: dmpReference.reference.source,
definition: dmpReference.reference.definition,
abbreviation: dmpReference.reference.abbreviation,
sourceType: dmpReference.reference.sourceType
}
})
}
})
if(dmpReferences){
dmpReferences.forEach(dmpReference => {
if(dmpReference.data.blueprintFieldId == this.fieldId){
this.references.push({
data: dmpReference.data,
reference: {
id: dmpReference.reference.id,
label: dmpReference.reference.label,
reference: dmpReference.reference.reference,
source: dmpReference.reference.source,
typeId: null,
description: dmpReference.reference.source,
definition: dmpReference.reference.definition,
abbreviation: dmpReference.reference.abbreviation,
sourceType: dmpReference.reference.sourceType
}
})
}
})
}
return this;
}

View File

@ -18,7 +18,7 @@ import { GuidedTourService } from '@app/library/guided-tour/guided-tour.service'
// import { BreadcrumbItem } from '@app/ui/misc/breadcrumb/definition/breadcrumb-item';
import { IsActive } from '@app/core/common/enum/is-active.enum';
import { Description } from '@app/core/model/description/description';
import { DmpBlueprint } from '@app/core/model/dmp-blueprint/dmp-blueprint';
import { DmpBlueprint, DmpBlueprintDefinition, DmpBlueprintDefinitionSection } from '@app/core/model/dmp-blueprint/dmp-blueprint';
import { Dmp, DmpUser } from '@app/core/model/dmp/dmp';
import { DmpLookup } from '@app/core/query/dmp.lookup';
import { BaseComponent } from '@common/base/base.component';
@ -172,6 +172,8 @@ export class DmpListingComponent extends BaseComponent implements OnInit { //IBr
[nameof<Dmp>(x => x.blueprint), nameof<DmpBlueprint>(x => x.id)].join('.'),
[nameof<Dmp>(x => x.blueprint), nameof<DmpBlueprint>(x => x.label)].join('.'),
[nameof<Dmp>(x => x.blueprint), nameof<DmpBlueprint>(x => x.definition), nameof<DmpBlueprintDefinition>(x => x.sections), nameof<DmpBlueprintDefinitionSection>(x => x.id)].join('.'),
[nameof<Dmp>(x => x.blueprint), nameof<DmpBlueprint>(x => x.definition), nameof<DmpBlueprintDefinition>(x => x.sections), nameof<DmpBlueprintDefinitionSection>(x => x.label)].join('.'),
// [nameof<Description>(x => x.descriptionTemplate), nameof<DescriptionTemplate>(x => x.label)].join('.'),
// [nameof<Description>(x => x.dmp), nameof<Dmp>(x => x.id)].join('.'),

View File

@ -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="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="canInviteDmpUsers(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="canCloneDmp(dmp)" (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) && 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 border-right pointer" *ngIf="isDraftDmp(dmp) && canDeleteDmp(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">

View File

@ -91,7 +91,9 @@ export class DmpListingItemComponent extends BaseComponent implements OnInit {
autoFocus: false,
restoreFocus: false,
data: {
dmpId: this.dmp.id
dmpId: this.dmp.id,
dmpName: this.dmp.label,
blueprint: this.dmp.blueprint
}
});
}
@ -223,4 +225,28 @@ export class DmpListingItemComponent extends BaseComponent implements OnInit {
canCreateNewVersion(dmp: Dmp): boolean {
return this.isDmpOwner(dmp) || this.authentication.hasPermission(AppPermission.CreateNewVersionDmp);
}
canDeleteDmp(dmp: Dmp): boolean {
return this.isDmpOwner(dmp) || this.authentication.hasPermission(AppPermission.DeleteDmp);
}
canCloneDmp(dmp: Dmp): boolean {
return this.isDmpOwner(dmp) || this.authentication.hasPermission(AppPermission.CloneDmp);
}
canFinalizeDmp(dmp: Dmp): boolean {
return this.isDmpOwner(dmp) || this.authentication.hasPermission(AppPermission.FinalizeDmp);
}
canExportDmp(dmp: Dmp): boolean {
return this.isDmpOwner(dmp) || this.authentication.hasPermission(AppPermission.ExportDmp);
}
canInviteDmpUsers(dmp: Dmp): boolean {
return this.isDmpOwner(dmp) || this.authentication.hasPermission(AppPermission.InviteDmpUsers);
}
canAssignDmpUsers(dmp: Dmp): boolean {
return this.isDmpOwner(dmp) || this.authentication.hasPermission(AppPermission.AssignDmpUsers);
}
}

View File

@ -46,7 +46,7 @@
<div class="col-12" *ngIf="hasDescriptions()">
<h5>{{'DMP-NEW-VERSION-DIALOG.FIELDS.DESCRIPTIONS-HINT' | translate}}</h5>
</div>
<div class="col-12">
<div class="col-12" *ngIf="hasDescriptions()">
<mat-card class="mat-card">
<mat-selection-list #selectedItems [formControl]="formGroup.get('descriptions')">
<mat-list-option *ngFor="let description of dmp.descriptions;" [value]="description.id">
@ -55,7 +55,7 @@
</mat-selection-list>
</mat-card>
</div>
<div class="col-12" *ngIf="hasDescriptions()">
<div class="col-12" *ngIf="!hasDescriptions()">
<h5 mat-subheader class="p-3">{{'DMP-NEW-VERSION-DIALOG.NO-DESCRIPTIONS' | translate}}</h5>
</div>
</div>

View File

@ -9,6 +9,7 @@ import { TranslateService } from '@ngx-translate/core';
import { takeUntil } from 'rxjs/operators';
import { DmpNewVersionDialogEditorModel } from './dmp-new-version-dialog.editor.model';
import { DmpBlueprintService } from '@app/core/services/dmp/dmp-blueprint.service';
import { DmpEditorResolver } from '../dmp-editor-blueprint/dmp-editor.resolver';
@Component({
selector: 'app-dmp-new-version-dialog',
@ -39,7 +40,7 @@ export class NewVersionDmpDialogComponent extends BaseComponent {
}
hasDescriptions() {
return this.dmp.descriptions.length > 0;
return this.dmp.descriptions?.length > 0;
}
close() {
@ -53,7 +54,7 @@ export class NewVersionDmpDialogComponent extends BaseComponent {
confirm() {
if (!this.formGroup.valid) { return; }
const value: NewVersionDmpPersist = this.formGroup.value;
this.dmpService.newVersion(value).pipe(takeUntil(this._destroyed)).subscribe(
this.dmpService.newVersion(value, DmpEditorResolver.lookupFields()).pipe(takeUntil(this._destroyed)).subscribe(
dmp => this.dialogRef.close(dmp),
error => this.onCallbackError(error)
);

View File

@ -43,14 +43,14 @@
</div>
</div>
<div class="row">
<!-- <button *ngIf="isDraftDmp(dmp) && isUserOwner && !lockStatus" (click)="editClicked(dmp)" mat-mini-fab class="mr-3 d-flex justify-content-center align-items-center" matTooltip="{{'DMP-OVERVIEW.ACTIONS.EDIT' | translate}}" matTooltipPosition="above"> -->
<!-- <button *ngIf="isDraftDmp(dmp) && isDmpOwner(dmp) && !lockStatus" (click)="editClicked(dmp)" mat-mini-fab class="mr-3 d-flex justify-content-center align-items-center" matTooltip="{{'DMP-OVERVIEW.ACTIONS.EDIT' | translate}}" matTooltipPosition="above"> -->
<button *ngIf="isDraftDmp(dmp) && !lockStatus" (click)="editClicked(dmp)" mat-mini-fab class="mr-3 d-flex justify-content-center align-items-center" matTooltip="{{'DMP-OVERVIEW.ACTIONS.EDIT' | translate}}" matTooltipPosition="above">
<mat-icon class="mat-mini-fab-icon">create</mat-icon>
</button>
<button *ngIf="isAuthenticated()" (click)="cloneOrNewVersionClicked(dmp, false)" mat-mini-fab class="mr-3 d-flex justify-content-center align-items-center" matTooltip="{{'DMP-OVERVIEW.ACTIONS.CLONE' | translate}}" matTooltipPosition="above">
<button *ngIf="canCloneDmp()" (click)="cloneClicked()" mat-mini-fab class="mr-3 d-flex justify-content-center align-items-center" matTooltip="{{'DMP-OVERVIEW.ACTIONS.CLONE' | translate}}" matTooltipPosition="above">
<mat-icon class="mat-mini-fab-icon">content_copy</mat-icon>
</button>
<button *ngIf="isUserOwner && !lockStatus" (click)="deleteClicked()" mat-mini-fab class="mr-3 d-flex justify-content-center align-items-center" matTooltip="{{'DMP-OVERVIEW.ACTIONS.DELETE' | translate}}" matTooltipPosition="above">
<button *ngIf="canDeleteDmp() && !lockStatus" (click)="deleteClicked()" mat-mini-fab class="mr-3 d-flex justify-content-center align-items-center" matTooltip="{{'DMP-OVERVIEW.ACTIONS.DELETE' | translate}}" matTooltipPosition="above">
<mat-icon class="mat-mini-fab-icon">delete</mat-icon>
</button>
</div>
@ -133,7 +133,7 @@
</div>
</div>
<div class="frame mb-3 pt-4 pl-3 pr-5 pb-1">
<div *ngIf="isDraftDmp(dmp) && isUserOwner && !lockStatus">
<div *ngIf="isDraftDmp(dmp) && canFinalizeDmp() && !lockStatus">
<div class="row ml-0 mr-0 pl-4 d-flex align-items-center" (click)="finalize(dmp)">
<button mat-mini-fab class="finalize-btn">
<mat-icon class="mat-mini-fab-icon">check</mat-icon>
@ -144,8 +144,8 @@
<hr class="hr-line">
</div>
</div>
<app-dmp-deposit-dropdown *ngIf="(hasDoi(dmp) || moreDeposit()) && isFinalizedDmp(dmp) && !this.isPublicView && isUserOwner && inputRepos.length > 0" [inputRepos]="inputRepos" [dmp]="dmp" (outputReposEmitter)="afterDeposit($event)"></app-dmp-deposit-dropdown>
<div *ngIf="isFinalizedDmp(dmp) && hasDoi(dmp) && !isPublishedDmp(dmp) && isUserOwner" (click)="reverseFinalization()" class="row ml-0 mr-0 pl-4 pb-3 d-flex align-items-center">
<app-dmp-deposit-dropdown *ngIf="(hasDoi(dmp) || moreDeposit()) && isFinalizedDmp(dmp) && !this.isPublicView && isDmpOwner(dmp) && inputRepos.length > 0" [inputRepos]="inputRepos" [dmp]="dmp" (outputReposEmitter)="afterDeposit($event)"></app-dmp-deposit-dropdown>
<div *ngIf="isFinalizedDmp(dmp) && hasDoi(dmp) && !isPublishedDmp(dmp) && isDmpOwner(dmp)" (click)="reverseFinalization()" class="row ml-0 mr-0 pl-4 pb-3 d-flex align-items-center">
<button mat-mini-fab class="frame-btn">
<mat-icon class="mat-mini-fab-icon">unarchive</mat-icon>
</button>
@ -158,7 +158,7 @@
<p class="mb-0 mr-0 pl-2 frame-txt" [matMenuTriggerFor]="exportMenu">
{{ 'DMP-OVERVIEW.ACTIONS.EXPORT' | translate }}</p>
</div>
<div *ngIf="isUserOwner" class="row ml-0 mr-0 pl-4 pb-3 d-flex align-items-center" (click)="cloneOrNewVersionClicked(dmp, true)">
<div *ngIf="canCreateNewVersion()" class="row ml-0 mr-0 pl-4 pb-3 d-flex align-items-center" (click)="newVersionClicked()">
<button mat-mini-fab class="frame-btn">
<mat-icon class="mat-mini-fab-icon">add_to_photos</mat-icon>
</button>
@ -190,10 +190,10 @@
<p class="authors-role">{{ enumUtils.toDmpUserRoleString(dmpUser.role) }}</p>
</div>
</div>
<button *ngIf="isUserOwner && dmp.status === dmpStatusEnum.Draft && dmpUser.role != dmpUserRoleEnum.Owner" (click)="removeUserFromDmp(dmpUser)" class="remove-btn">{{ 'DMP-OVERVIEW.ACTIONS.REMOVE-AUTHOR' | translate}}</button>
<button *ngIf="isDmpOwner(dmp) && dmp.status === dmpStatusEnum.Draft && dmpUser.role != dmpUserRoleEnum.Owner" (click)="removeUserFromDmp(dmpUser)" class="remove-btn">{{ 'DMP-OVERVIEW.ACTIONS.REMOVE-AUTHOR' | translate}}</button>
</div>
</div>
<div *ngIf="isUserOwner" class="row mt-3 mb-3 d-flex align-items-center justify-content-center">
<div *ngIf="isDmpOwner(dmp)" class="row mt-3 mb-3 d-flex align-items-center justify-content-center">
<button mat-raised-button class="invite-btn" (click)="openShareDialog(dmp.id,dmp.label)">
<mat-icon>group_add</mat-icon>
{{'DMP-OVERVIEW.ACTIONS.INVITE-SHORT' | translate}}

View File

@ -39,6 +39,9 @@ import { nameof } from 'ts-simple-nameof';
import { DmpInvitationDialogComponent } from '../invitation/dialog/dmp-invitation-dialog.component';
import { ReferenceTypeService } from '@app/core/services/reference-type/reference-type.service';
import { DmpBlueprint, DmpBlueprintDefinition, DmpBlueprintDefinitionSection } from '@app/core/model/dmp-blueprint/dmp-blueprint';
import { CloneDmpDialogComponent } from '../clone-dialog/dmp-clone-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-overview',
@ -55,7 +58,7 @@ export class DmpOverviewComponent extends BaseComponent implements OnInit {
isPublicView = true;
hasPublishButton: boolean = true;
// breadCrumbs: Observable<BreadcrumbItem[]> = observableOf();
isUserOwner: boolean;
// isUserOwner: boolean;
lockStatus: Boolean;
textMessage: any;
pastVersions: Dmp[]; //TODO: get these from the backend
@ -116,7 +119,7 @@ export class DmpOverviewComponent extends BaseComponent implements OnInit {
this.selectedModel = this.dmp.entityDois[0];
}
this.checkLockStatus(this.dmp.id);
this.setIsUserOwner();
// this.setIsUserOwner();
this.getAllVersions(this.dmp);
// const breadCrumbs = [];
// breadCrumbs.push({ parentComponentName: null, label: this.language.instant('NAV-BAR.MY-DMPS'), url: "/plans" });
@ -178,13 +181,6 @@ export class DmpOverviewComponent extends BaseComponent implements OnInit {
this.router.navigate([redirectRoot]);
}
setIsUserOwner() {
if (this.dmp) {
const principalId: Guid = this.authentication.userId();
if (principalId) this.isUserOwner = !!this.dmp.dmpUsers?.find(x => (x.role === DmpUserRole.Owner) && (principalId === x.user?.id));
}
}
isUserAuthor(userId: Guid): boolean {
if (this.isAuthenticated()) {
const principalId: Guid = this.authentication.userId();
@ -192,37 +188,73 @@ export class DmpOverviewComponent extends BaseComponent implements OnInit {
} else return false;
}
isDmpOwner(): boolean {
const principalId: Guid = this.authentication.userId();
if (principalId) return !!this.dmp.dmpUsers?.find(x => (x.role === DmpUserRole.Owner) && (principalId === x.id));
}
canCreateNewVersion(): boolean {
return this.isDmpOwner() || this.authentication.hasPermission(AppPermission.CreateNewVersionDmp);
}
canDeleteDmp(): boolean {
return this.isDmpOwner() || this.authentication.hasPermission(AppPermission.DeleteDmp);
}
canCloneDmp(): boolean {
return this.isDmpOwner() || this.authentication.hasPermission(AppPermission.CloneDmp);
}
canFinalizeDmp(): boolean {
return this.isDmpOwner() || this.authentication.hasPermission(AppPermission.FinalizeDmp);
}
canExportDmp(): boolean {
return this.isDmpOwner() || this.authentication.hasPermission(AppPermission.ExportDmp);
}
canInviteDmpUsers(): boolean {
return this.isDmpOwner() || this.authentication.hasPermission(AppPermission.InviteDmpUsers);
}
canAssignDmpUsers(): boolean {
return this.isDmpOwner() || this.authentication.hasPermission(AppPermission.AssignDmpUsers);
}
editClicked(dmp: Dmp) {
this.router.navigate(['/plans/edit/', dmp.id]);
}
cloneOrNewVersionClicked(dmp: Dmp, isNewVersion: boolean) {
//TODO: split the logic here to new version and clone seperately
// this.dmpService.getSingle(this.dmp.id).pipe(map(data => data as Dmp))
// .pipe(takeUntil(this._destroyed))
// .subscribe(data => {
// this.dmp = new DmpEditorModel();
// this.dmp.grant = new GrantTabModel();
// this.dmp.project = new ProjectFormModel();
// this.dmp.funder = new FunderFormModel();
// this.dmp.extraProperties = new ExtraPropertiesFormModel();
// this.dmp.fromModel(data);
// this.dmp.status = DmpStatus.Draft;
// this.formGroup = this.dmp.buildForm();
cloneClicked() {
const dialogRef = this.dialog.open(CloneDmpDialogComponent, {
maxWidth: '700px',
maxHeight: '80vh',
data: {
dmp: this.dmp
}
});
dialogRef.afterClosed().pipe(takeUntil(this._destroyed)).subscribe((result: Dmp) => {
if (result) {
this.uiNotificationService.snackBarNotification(this.language.instant('GENERAL.SNACK-BAR.SUCCESSFUL-UPDATE'), SnackBarNotificationLevel.Success);
this.router.navigate(['/plans/edit/', result.id]);
}
});
}
// if (!isNullOrUndefined(this.formGroup.get('profile').value)) {
// this.getBlueprintDefinition(Guid.parse(this.formGroup.get('profile').value), result => {
// this.checkForGrant(result.definition);
// this.checkForFunder(result.definition);
// this.checkForProject(result.definition);
// });
// }
// if (!isNewVersion) {
// this.formGroup.get('label').setValue(this.dmp.label + " New");
// }
// this.openCloneDialog(isNewVersion);
// });
newVersionClicked() {
const dialogRef = this.dialog.open(NewVersionDmpDialogComponent, {
maxWidth: '700px',
maxHeight: '80vh',
data: {
dmp: this.dmp
}
});
dialogRef.afterClosed().pipe(takeUntil(this._destroyed)).subscribe((result: Dmp) => {
if (result) {
this.uiNotificationService.snackBarNotification(this.language.instant('GENERAL.SNACK-BAR.SUCCESSFUL-UPDATE'), SnackBarNotificationLevel.Success);
this.router.navigate(['/plans/edit/', result.id]);
}
});
}
// private checkForGrant(blueprint: DmpBlueprintDefinition) {