2023-10-25 16:47:48 +02:00
|
|
|
import { Component, ElementRef, OnInit, ViewChild } from '@angular/core';
|
|
|
|
import { MatDialog } from '@angular/material/dialog';
|
|
|
|
import { ActivatedRoute, Params, Router } from '@angular/router';
|
|
|
|
import { DmpStatus } from '@app/core/common/enum/dmp-status';
|
|
|
|
import { AuthService } from '@app/core/services/auth/auth.service';
|
2023-12-29 16:04:16 +01:00
|
|
|
import { DmpService } from '@app/core/services/dmp/dmp.service';
|
2023-01-20 13:56:29 +01:00
|
|
|
import {
|
|
|
|
SnackBarNotificationLevel,
|
|
|
|
UiNotificationService
|
|
|
|
} from '@app/core/services/notification/ui-notification-service';
|
2023-10-25 16:47:48 +02:00
|
|
|
import { ConfirmationDialogComponent } from '@common/modules/confirmation-dialog/confirmation-dialog.component';
|
2023-10-20 17:01:09 +02:00
|
|
|
// import {BreadcrumbItem} from '@app/ui/misc/breadcrumb/definition/breadcrumb-item';
|
2023-10-25 16:47:48 +02:00
|
|
|
import { Location } from '@angular/common';
|
2023-12-04 18:37:52 +01:00
|
|
|
import { DescriptionStatus } from '@app/core/common/enum/description-status';
|
|
|
|
import { DmpAccessType } from '@app/core/common/enum/dmp-access-type';
|
|
|
|
import { DmpUserRole } from '@app/core/common/enum/dmp-user-role';
|
2023-12-29 16:04:16 +01:00
|
|
|
import { DepositConfiguration } from '@app/core/model/deposit/deposit-configuration';
|
2023-12-04 18:37:52 +01:00
|
|
|
import { Description } from '@app/core/model/description/description';
|
2023-12-06 22:10:01 +01:00
|
|
|
import { Dmp, DmpUser, DmpUserRemovePersist } from '@app/core/model/dmp/dmp';
|
2023-12-28 16:18:49 +01:00
|
|
|
import { DmpReference } from '@app/core/model/dmp/dmp-reference';
|
2023-12-04 18:37:52 +01:00
|
|
|
import { EntityDoi } from '@app/core/model/entity-doi/entity-doi';
|
2023-12-28 16:18:49 +01:00
|
|
|
import { Reference } from '@app/core/model/reference/reference';
|
2023-10-25 16:47:48 +02:00
|
|
|
import { ConfigurationService } from '@app/core/services/configuration/configuration.service';
|
2023-12-29 16:04:16 +01:00
|
|
|
import { DepositService } from '@app/core/services/deposit/deposit.service';
|
2023-10-20 17:01:09 +02:00
|
|
|
import { DmpBlueprintService } from '@app/core/services/dmp/dmp-blueprint.service';
|
2023-12-29 16:04:16 +01:00
|
|
|
import { FileTransformerService } from '@app/core/services/file-transformer/file-transformer.service';
|
2023-10-25 16:47:48 +02:00
|
|
|
import { LockService } from '@app/core/services/lock/lock.service';
|
|
|
|
import { MatomoService } from '@app/core/services/matomo/matomo-service';
|
2023-12-04 18:37:52 +01:00
|
|
|
import { ReferenceService } from '@app/core/services/reference/reference.service';
|
|
|
|
import { EnumUtils } from '@app/core/services/utilities/enum-utils.service';
|
2023-10-25 16:47:48 +02:00
|
|
|
import { FileUtils } from '@app/core/services/utilities/file-utils.service';
|
|
|
|
import { PopupNotificationDialogComponent } from '@app/library/notification/popup/popup-notification.component';
|
|
|
|
import { BaseComponent } from '@common/base/base.component';
|
2023-10-24 09:40:26 +02:00
|
|
|
import { Guid } from '@common/types/guid';
|
2023-10-25 16:47:48 +02:00
|
|
|
import { TranslateService } from '@ngx-translate/core';
|
2023-12-28 16:18:49 +01:00
|
|
|
import * as FileSaver from 'file-saver';
|
2023-12-04 18:37:52 +01:00
|
|
|
import { takeUntil } from 'rxjs/operators';
|
2023-10-24 17:00:11 +02:00
|
|
|
import { nameof } from 'ts-simple-nameof';
|
2024-01-05 14:33:27 +01:00
|
|
|
import { DmpInvitationDialogComponent } from '../invitation/dialog/dmp-invitation-dialog.component';
|
2024-02-09 21:46:05 +01:00
|
|
|
import { ReferenceTypeService } from '@app/core/services/reference-type/reference-type.service';
|
2024-02-22 12:57:42 +01:00
|
|
|
import { DmpBlueprint, DmpBlueprintDefinition, DmpBlueprintDefinitionSection } from '@app/core/model/dmp-blueprint/dmp-blueprint';
|
2024-03-01 17:50:46 +01:00
|
|
|
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';
|
2024-03-06 17:41:26 +01:00
|
|
|
import { ReferenceType } from '@app/core/model/reference-type/reference-type';
|
2024-03-11 08:47:03 +01:00
|
|
|
import { IsActive } from '@app/core/common/enum/is-active.enum';
|
2024-03-15 08:39:36 +01:00
|
|
|
import { DmpFinalizeDialogComponent, DmpFinalizeDialogOutput } from '../dmp-finalize-dialog/dmp-finalize-dialog.component';
|
|
|
|
import { DmpEditorResolver } from '../dmp-editor-blueprint/dmp-editor.resolver';
|
2019-05-21 15:42:28 +02:00
|
|
|
|
|
|
|
@Component({
|
|
|
|
selector: 'app-dmp-overview',
|
|
|
|
templateUrl: './dmp-overview.component.html',
|
|
|
|
styleUrls: ['./dmp-overview.component.scss']
|
|
|
|
})
|
|
|
|
export class DmpOverviewComponent extends BaseComponent implements OnInit {
|
|
|
|
|
2024-03-11 08:47:03 +01:00
|
|
|
dmp: any;
|
2024-02-22 12:57:42 +01:00
|
|
|
selectedBlueprint: DmpBlueprint;
|
2023-12-04 18:37:52 +01:00
|
|
|
researchers: DmpReference[] = [];
|
2019-05-21 15:42:28 +02:00
|
|
|
isNew = true;
|
2019-07-01 11:35:09 +02:00
|
|
|
isFinalized = false;
|
2019-07-18 16:16:12 +02:00
|
|
|
isPublicView = true;
|
2019-07-01 11:35:09 +02:00
|
|
|
hasPublishButton: boolean = true;
|
2023-10-20 17:01:09 +02:00
|
|
|
// breadCrumbs: Observable<BreadcrumbItem[]> = observableOf();
|
2024-03-01 17:50:46 +01:00
|
|
|
// isUserOwner: boolean;
|
2024-03-21 12:06:59 +01:00
|
|
|
isLocked: Boolean;
|
2020-07-02 17:29:33 +02:00
|
|
|
textMessage: any;
|
2023-12-04 18:37:52 +01:00
|
|
|
pastVersions: Dmp[]; //TODO: get these from the backend
|
2023-12-04 16:56:12 +01:00
|
|
|
selectedModel: EntityDoi;
|
2020-07-02 17:29:33 +02:00
|
|
|
|
2021-09-24 20:52:14 +02:00
|
|
|
@ViewChild('doi')
|
2020-07-02 17:29:33 +02:00
|
|
|
doi: ElementRef;
|
2020-07-01 17:32:22 +02:00
|
|
|
|
2023-12-29 16:04:16 +01:00
|
|
|
depositRepos: DepositConfiguration[] = [];
|
2022-10-24 08:35:49 +02:00
|
|
|
|
2023-12-04 18:37:52 +01:00
|
|
|
descriptionStatusEnum = DescriptionStatus;
|
|
|
|
dmpAccessTypeEnum = DmpAccessType;
|
|
|
|
dmpStatusEnum = DmpStatus;
|
|
|
|
dmpUserRoleEnum = DmpUserRole;
|
2019-05-21 15:42:28 +02:00
|
|
|
|
|
|
|
constructor(
|
|
|
|
private route: ActivatedRoute,
|
|
|
|
private router: Router,
|
2023-12-29 16:04:16 +01:00
|
|
|
private dmpService: DmpService,
|
2023-10-20 17:01:09 +02:00
|
|
|
private dmpBlueprintService: DmpBlueprintService,
|
2023-12-29 16:04:16 +01:00
|
|
|
private depositRepositoriesService: DepositService,
|
2019-05-21 15:42:28 +02:00
|
|
|
private translate: TranslateService,
|
|
|
|
private authentication: AuthService,
|
|
|
|
private dialog: MatDialog,
|
|
|
|
private language: TranslateService,
|
2020-04-08 15:36:06 +02:00
|
|
|
private uiNotificationService: UiNotificationService,
|
|
|
|
private configurationService: ConfigurationService,
|
2020-07-01 17:32:22 +02:00
|
|
|
private location: Location,
|
2020-12-14 18:28:13 +01:00
|
|
|
private lockService: LockService,
|
2023-10-25 16:47:48 +02:00
|
|
|
private matomoService: MatomoService,
|
2023-12-04 18:37:52 +01:00
|
|
|
private fileUtils: FileUtils,
|
|
|
|
public referenceService: ReferenceService,
|
2023-12-29 16:04:16 +01:00
|
|
|
public enumUtils: EnumUtils,
|
2024-02-09 21:46:05 +01:00
|
|
|
public fileTransformerService: FileTransformerService,
|
|
|
|
private referenceTypeService: ReferenceTypeService
|
2019-05-21 15:42:28 +02:00
|
|
|
) {
|
|
|
|
super();
|
|
|
|
}
|
|
|
|
|
|
|
|
ngOnInit() {
|
2020-12-14 18:28:13 +01:00
|
|
|
this.matomoService.trackPageView('DMP Overview');
|
2019-05-21 15:42:28 +02:00
|
|
|
// Gets dmp data using parameter id
|
|
|
|
this.route.params
|
|
|
|
.pipe(takeUntil(this._destroyed))
|
|
|
|
.subscribe((params: Params) => {
|
|
|
|
const itemId = params['id'];
|
2019-06-11 10:25:32 +02:00
|
|
|
const publicId = params['publicId'];
|
2019-05-21 15:42:28 +02:00
|
|
|
if (itemId != null) {
|
|
|
|
this.isNew = false;
|
2019-07-18 16:16:12 +02:00
|
|
|
this.isPublicView = false;
|
2023-12-04 16:56:12 +01:00
|
|
|
this.dmpService.getSingle(itemId, this.lookupFields())
|
2019-05-21 15:42:28 +02:00
|
|
|
.pipe(takeUntil(this._destroyed))
|
|
|
|
.subscribe(data => {
|
|
|
|
this.dmp = data;
|
2024-03-13 18:24:01 +01:00
|
|
|
this.dmp.dmpUsers = data.dmpUsers.filter(x => x.isActive === IsActive.Active);
|
2024-03-15 08:39:36 +01:00
|
|
|
if (this.dmp.descriptions) {
|
|
|
|
if (this.dmp.status == DmpStatus.Finalized) {
|
|
|
|
this.dmp.descriptions = data.descriptions.filter(x => x.isActive === IsActive.Active && x.status === DescriptionStatus.Finalized);
|
2024-03-19 11:48:17 +01:00
|
|
|
} else {
|
2024-03-15 08:39:36 +01:00
|
|
|
this.dmp.descriptions = data.descriptions.filter(x => x.isActive === IsActive.Active && x.status !== DescriptionStatus.Canceled);
|
|
|
|
}
|
|
|
|
}
|
2024-03-13 18:24:01 +01:00
|
|
|
this.selectedBlueprint = data.blueprint;
|
2024-02-09 21:46:05 +01:00
|
|
|
this.researchers = this.referenceService.getReferencesForTypes(this.dmp?.dmpReferences, [this.referenceTypeService.getResearcherReferenceType()]);
|
2023-10-25 16:47:48 +02:00
|
|
|
if (!this.hasDoi()) {
|
2023-12-04 16:56:12 +01:00
|
|
|
this.selectedModel = this.dmp.entityDois[0];
|
2023-01-20 13:56:29 +01:00
|
|
|
}
|
2020-07-02 17:29:33 +02:00
|
|
|
this.checkLockStatus(this.dmp.id);
|
2024-03-01 17:50:46 +01:00
|
|
|
// this.setIsUserOwner();
|
2020-07-09 13:28:55 +02:00
|
|
|
this.getAllVersions(this.dmp);
|
2023-10-20 17:01:09 +02:00
|
|
|
// 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 });
|
|
|
|
// this.breadCrumbs = observableOf(breadCrumbs);
|
2020-01-16 16:14:50 +01:00
|
|
|
}, (error: any) => {
|
|
|
|
if (error.status === 404) {
|
|
|
|
return this.onFetchingDeletedCallbackError('/plans/');
|
|
|
|
}
|
2020-02-26 12:36:42 +01:00
|
|
|
if (error.status === 403) {
|
|
|
|
return this.onFetchingForbiddenCallbackError('/plans/');
|
|
|
|
}
|
2020-01-16 16:14:50 +01:00
|
|
|
});
|
2019-05-21 15:42:28 +02:00
|
|
|
}
|
2019-06-11 10:25:32 +02:00
|
|
|
else if (publicId != null) {
|
|
|
|
this.isNew = false;
|
2019-07-01 11:35:09 +02:00
|
|
|
this.isFinalized = true;
|
2019-07-18 16:16:12 +02:00
|
|
|
this.isPublicView = true;
|
2024-03-07 16:14:39 +01:00
|
|
|
this.dmpService.getPublicSingle(publicId, this.lookupFields())
|
2019-06-11 10:25:32 +02:00
|
|
|
.pipe(takeUntil(this._destroyed))
|
|
|
|
.subscribe(data => {
|
|
|
|
this.dmp = data;
|
2024-02-09 21:46:05 +01:00
|
|
|
this.researchers = this.referenceService.getReferencesForTypes(this.dmp?.dmpReferences, [this.referenceTypeService.getResearcherReferenceType()]);
|
2023-10-25 16:47:48 +02:00
|
|
|
if (!this.hasDoi()) {
|
2023-12-04 16:56:12 +01:00
|
|
|
this.selectedModel = this.dmp.entityDois[0];
|
2023-01-20 13:56:29 +01:00
|
|
|
}
|
2020-08-03 10:40:38 +02:00
|
|
|
// this.checkLockStatus(this.dmp.id);
|
2020-07-09 13:28:55 +02:00
|
|
|
this.getAllVersions(this.dmp);
|
2023-10-20 17:01:09 +02:00
|
|
|
// const breadCrumbs = [];
|
|
|
|
// breadCrumbs.push({ parentComponentName: null, label: this.language.instant('NAV-BAR.PUBLIC-DMPS'), url: "/explore-plans" });
|
2023-12-20 08:20:38 +01:00
|
|
|
// breadCrumbs.push({ parentComponentName: 'DmpListingComponent', label: this.dmp.label, url: '/plans/overview/public/' + this.dmp.id });
|
2023-10-20 17:01:09 +02:00
|
|
|
// this.breadCrumbs = observableOf(breadCrumbs);
|
2020-01-16 16:14:50 +01:00
|
|
|
}, (error: any) => {
|
|
|
|
if (error.status === 404) {
|
2020-04-22 17:40:43 +02:00
|
|
|
return this.onFetchingDeletedCallbackError('/explore-plans');
|
2020-01-16 16:14:50 +01:00
|
|
|
}
|
2020-02-26 12:36:42 +01:00
|
|
|
if (error.status === 403) {
|
2020-04-22 17:40:43 +02:00
|
|
|
return this.onFetchingForbiddenCallbackError('/explore-plans');
|
2020-02-26 12:36:42 +01:00
|
|
|
}
|
2019-06-11 10:25:32 +02:00
|
|
|
});
|
|
|
|
}
|
2019-05-21 15:42:28 +02:00
|
|
|
});
|
2024-03-13 18:24:01 +01:00
|
|
|
if (this.isAuthenticated()) {
|
2024-03-22 12:49:26 +01:00
|
|
|
this.depositRepositoriesService.getAvailableRepos([
|
|
|
|
nameof<DepositConfiguration>(x => x.depositType),
|
|
|
|
nameof<DepositConfiguration>(x => x.repositoryId),
|
|
|
|
nameof<DepositConfiguration>(x => x.repositoryAuthorizationUrl),
|
|
|
|
nameof<DepositConfiguration>(x => x.repositoryRecordUrl),
|
|
|
|
nameof<DepositConfiguration>(x => x.repositoryClientId),
|
|
|
|
nameof<DepositConfiguration>(x => x.hasLogo),
|
|
|
|
nameof<DepositConfiguration>(x => x.redirectUri)
|
|
|
|
])
|
2024-03-13 18:24:01 +01:00
|
|
|
.pipe(takeUntil(this._destroyed))
|
|
|
|
.subscribe(
|
|
|
|
repos => {
|
|
|
|
this.depositRepos = repos;
|
|
|
|
},
|
|
|
|
error => this.depositRepos = []);
|
2024-03-12 13:07:47 +01:00
|
|
|
}
|
2019-05-21 15:42:28 +02:00
|
|
|
}
|
|
|
|
|
2020-01-16 16:14:50 +01:00
|
|
|
onFetchingDeletedCallbackError(redirectRoot: string) {
|
|
|
|
this.uiNotificationService.snackBarNotification(this.language.instant('DMP-OVERVIEW.ERROR.DELETED-DMP'), SnackBarNotificationLevel.Error);
|
|
|
|
this.router.navigate([redirectRoot]);
|
|
|
|
}
|
|
|
|
|
2020-02-26 12:36:42 +01:00
|
|
|
onFetchingForbiddenCallbackError(redirectRoot: string) {
|
|
|
|
this.uiNotificationService.snackBarNotification(this.language.instant('DMP-OVERVIEW.ERROR.FORBIDEN-DMP'), SnackBarNotificationLevel.Error);
|
|
|
|
this.router.navigate([redirectRoot]);
|
|
|
|
}
|
|
|
|
|
2023-12-04 16:56:12 +01:00
|
|
|
isUserAuthor(userId: Guid): boolean {
|
2020-08-03 10:40:38 +02:00
|
|
|
if (this.isAuthenticated()) {
|
2023-12-04 16:56:12 +01:00
|
|
|
const principalId: Guid = this.authentication.userId();
|
|
|
|
return userId === principalId;
|
2020-08-03 10:40:38 +02:00
|
|
|
} else return false;
|
2020-07-02 17:29:33 +02:00
|
|
|
}
|
|
|
|
|
2024-03-06 10:53:40 +01:00
|
|
|
canEditDmp(): boolean{
|
2024-03-14 10:23:46 +01:00
|
|
|
return (this.isDraftDmp()) && (this.dmp.authorizationFlags?.some(x => x === AppPermission.EditDmp) || this.authentication.hasPermission(AppPermission.EditDmp)) && this.isPublicView == false;
|
2024-03-06 10:53:40 +01:00
|
|
|
}
|
|
|
|
|
2024-03-01 17:50:46 +01:00
|
|
|
canCreateNewVersion(): boolean {
|
2024-03-14 10:23:46 +01:00
|
|
|
return this.dmp.authorizationFlags?.some(x => x === AppPermission.CreateNewVersionDmp) || this.authentication.hasPermission(AppPermission.CreateNewVersionDmp) && this.isPublicView == false;
|
2024-03-01 17:50:46 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
canDeleteDmp(): boolean {
|
2024-03-14 10:23:46 +01:00
|
|
|
return this.dmp.authorizationFlags?.some(x => x === AppPermission.DeleteDmp) || this.authentication.hasPermission(AppPermission.DeleteDmp) && this.isPublicView == false;
|
2024-03-01 17:50:46 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
canCloneDmp(): boolean {
|
2024-03-14 10:23:46 +01:00
|
|
|
return this.dmp.authorizationFlags?.some(x => x === AppPermission.CloneDmp) || this.authentication.hasPermission(AppPermission.CloneDmp);
|
2024-03-01 17:50:46 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
canFinalizeDmp(): boolean {
|
2024-03-14 10:23:46 +01:00
|
|
|
return this.dmp.authorizationFlags?.some(x => x === AppPermission.FinalizeDmp) || this.authentication.hasPermission(AppPermission.FinalizeDmp) && this.isPublicView == false;
|
2024-03-01 17:50:46 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
canExportDmp(): boolean {
|
2024-03-14 10:23:46 +01:00
|
|
|
return this.dmp.authorizationFlags?.some(x => x === AppPermission.ExportDmp) || this.authentication.hasPermission(AppPermission.ExportDmp);
|
2024-03-01 17:50:46 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
canInviteDmpUsers(): boolean {
|
2024-03-14 10:23:46 +01:00
|
|
|
return this.dmp.authorizationFlags?.some(x => x === AppPermission.InviteDmpUsers) || this.authentication.hasPermission(AppPermission.InviteDmpUsers) && this.isPublicView == false;
|
2024-03-01 17:50:46 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
canAssignDmpUsers(): boolean {
|
2024-03-14 10:23:46 +01:00
|
|
|
return this.dmp.authorizationFlags?.some(x => x === AppPermission.AssignDmpUsers) || this.authentication.hasPermission(AppPermission.AssignDmpUsers) && this.isPublicView == false;
|
2024-03-01 17:50:46 +01:00
|
|
|
}
|
|
|
|
|
2024-03-19 11:48:17 +01:00
|
|
|
canDepositDmp(): boolean {
|
|
|
|
return this.dmp.authorizationFlags?.some(x => x === AppPermission.DepositDmp) || this.authentication.hasPermission(AppPermission.DepositDmp) && this.isPublicView == false;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2024-03-06 10:53:40 +01:00
|
|
|
editClicked() {
|
|
|
|
this.router.navigate(['/plans/edit/', this.dmp.id]);
|
2019-05-21 15:42:28 +02:00
|
|
|
}
|
|
|
|
|
2024-03-01 17:50:46 +01:00
|
|
|
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]);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
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]);
|
|
|
|
}
|
|
|
|
});
|
2023-12-04 16:56:12 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// private checkForGrant(blueprint: DmpBlueprintDefinition) {
|
|
|
|
// let hasGrant = false;
|
|
|
|
// blueprint.sections.forEach(section => section.fields.forEach(
|
|
|
|
// field => {
|
2024-02-09 21:46:05 +01:00
|
|
|
// if (field.category as unknown === DmpBlueprintFieldCategory.System && field.systemFieldType === DmpBlueprintSystemFieldType.GRANT) {
|
2023-12-04 16:56:12 +01:00
|
|
|
// hasGrant = true;
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// ));
|
|
|
|
// if (!hasGrant) {
|
|
|
|
// this.formGroup.removeControl('grant');
|
|
|
|
// }
|
|
|
|
// }
|
2019-05-21 15:42:28 +02:00
|
|
|
|
2023-12-04 16:56:12 +01:00
|
|
|
// private checkForFunder(blueprint: DmpBlueprintDefinition) {
|
|
|
|
// let hasFunder = false;
|
|
|
|
// blueprint.sections.forEach(section => section.fields.forEach(
|
|
|
|
// field => {
|
2024-02-09 21:46:05 +01:00
|
|
|
// if (field.category as unknown === DmpBlueprintFieldCategory.System && field.systemFieldType === DmpBlueprintSystemFieldType.FUNDER) {
|
2023-12-04 16:56:12 +01:00
|
|
|
// hasFunder = true;
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// ));
|
|
|
|
// if (!hasFunder) {
|
|
|
|
// this.formGroup.removeControl('funder');
|
|
|
|
// }
|
|
|
|
// }
|
2020-03-03 10:20:27 +01:00
|
|
|
|
2023-12-04 16:56:12 +01:00
|
|
|
// private checkForProject(blueprint: DmpBlueprintDefinition) {
|
|
|
|
// let hasProject = false;
|
|
|
|
// blueprint.sections.forEach(section => section.fields.forEach(
|
|
|
|
// field => {
|
2024-02-09 21:46:05 +01:00
|
|
|
// if (field.category as unknown === DmpBlueprintFieldCategory.System && field.systemFieldType === DmpBlueprintSystemFieldType.PROJECT) {
|
2023-12-04 16:56:12 +01:00
|
|
|
// hasProject = true;
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// ));
|
|
|
|
// if (!hasProject) {
|
|
|
|
// this.formGroup.removeControl('project');
|
|
|
|
// }
|
|
|
|
// }
|
2020-03-03 10:20:27 +01:00
|
|
|
|
2023-12-04 16:56:12 +01:00
|
|
|
// openCloneDialog(isNewVersion: boolean) {
|
|
|
|
// const dialogRef = this.dialog.open(CloneDialogComponent, {
|
|
|
|
// maxWidth: '900px',
|
|
|
|
// maxHeight: '80vh',
|
|
|
|
// data: {
|
|
|
|
// formGroup: this.formGroup,
|
2023-12-04 18:37:52 +01:00
|
|
|
// descriptions: this.dmp.descriptions,
|
2023-12-04 16:56:12 +01:00
|
|
|
// isNewVersion: isNewVersion,
|
|
|
|
// confirmButton: this.language.instant('DMP-EDITOR.CLONE-DIALOG.SAVE'),
|
|
|
|
// cancelButton: this.language.instant('DMP-EDITOR.CLONE-DIALOG.CANCEL'),
|
|
|
|
// }
|
|
|
|
// });
|
|
|
|
// dialogRef.afterClosed().pipe(takeUntil(this._destroyed)).subscribe(result => {
|
|
|
|
// if (result) {
|
|
|
|
// if (!isNewVersion) {
|
|
|
|
// this.dmpService.clone(this.formGroup.getRawValue(), this.dmp.id)
|
|
|
|
// .pipe(takeUntil(this._destroyed))
|
|
|
|
// .subscribe(
|
|
|
|
// complete => this.onCallbackSuccess(complete),
|
|
|
|
// error => this.onCallbackError(error)
|
|
|
|
// );
|
|
|
|
// } else if (isNewVersion) {
|
|
|
|
// this.dmpService.newVersion(this.formGroup.getRawValue(), this.dmp.id)
|
|
|
|
// .pipe(takeUntil(this._destroyed))
|
|
|
|
// .subscribe(
|
|
|
|
// complete => this.onCallbackSuccess(complete),
|
|
|
|
// error => this.onCallbackError(error)
|
|
|
|
// );
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// });
|
|
|
|
// }
|
2019-05-21 15:42:28 +02:00
|
|
|
|
2023-12-04 16:56:12 +01:00
|
|
|
// onCallbackSuccess(dmpId: String): void {
|
|
|
|
// this.uiNotificationService.snackBarNotification(this.language.instant('GENERAL.SNACK-BAR.SUCCESSFUL-UPDATE'), SnackBarNotificationLevel.Success);
|
|
|
|
// this.router.navigate(['/plans/edit/', dmpId]);
|
|
|
|
// }
|
2019-05-21 15:42:28 +02:00
|
|
|
|
2023-12-04 16:56:12 +01:00
|
|
|
// onCallbackError(error: any) {
|
|
|
|
// this.uiNotificationService.snackBarNotification(error.error.message ? error.error.message : this.language.instant('GENERAL.SNACK-BAR.UNSUCCESSFUL-UPDATE'), SnackBarNotificationLevel.Error);
|
|
|
|
// }
|
2019-05-21 15:42:28 +02:00
|
|
|
|
|
|
|
deleteClicked() {
|
|
|
|
const dialogRef = this.dialog.open(ConfirmationDialogComponent, {
|
|
|
|
maxWidth: '300px',
|
|
|
|
data: {
|
|
|
|
message: this.language.instant('GENERAL.CONFIRMATION-DIALOG.DELETE-ITEM'),
|
2019-05-22 15:36:24 +02:00
|
|
|
confirmButton: this.language.instant('GENERAL.CONFIRMATION-DIALOG.ACTIONS.DELETE'),
|
2019-06-26 11:24:06 +02:00
|
|
|
cancelButton: this.language.instant('GENERAL.CONFIRMATION-DIALOG.ACTIONS.CANCEL'),
|
|
|
|
isDeleteConfirmation: true
|
2019-05-21 15:42:28 +02:00
|
|
|
}
|
|
|
|
});
|
|
|
|
dialogRef.afterClosed().pipe(takeUntil(this._destroyed)).subscribe(result => {
|
|
|
|
if (result) {
|
|
|
|
this.dmpService.delete(this.dmp.id)
|
|
|
|
.pipe(takeUntil(this._destroyed))
|
|
|
|
.subscribe(
|
2020-07-20 11:16:23 +02:00
|
|
|
complete => { this.onDeleteCallbackSuccess() },
|
2019-09-20 17:27:54 +02:00
|
|
|
error => this.onDeleteCallbackError(error)
|
2019-05-21 15:42:28 +02:00
|
|
|
);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2020-07-20 11:16:23 +02:00
|
|
|
onDeleteCallbackSuccess(): void {
|
2020-07-22 13:26:49 +02:00
|
|
|
this.uiNotificationService.snackBarNotification(this.language.instant('GENERAL.SNACK-BAR.SUCCESSFUL-DELETE'), SnackBarNotificationLevel.Success);
|
2019-05-21 15:42:28 +02:00
|
|
|
this.router.navigate(['/plans']);
|
|
|
|
}
|
|
|
|
|
|
|
|
onDeleteCallbackError(error) {
|
2021-04-30 09:57:13 +02:00
|
|
|
this.uiNotificationService.snackBarNotification(error.error.message ? this.language.instant(error.error.message) : this.language.instant('GENERAL.SNACK-BAR.UNSUCCESSFUL-DELETE'), SnackBarNotificationLevel.Error);
|
2019-05-21 15:42:28 +02:00
|
|
|
}
|
|
|
|
|
2020-07-20 11:16:23 +02:00
|
|
|
onUpdateCallbackSuccess(): void {
|
|
|
|
this.uiNotificationService.snackBarNotification(this.language.instant('GENERAL.SNACK-BAR.SUCCESSFUL-UPDATE'), SnackBarNotificationLevel.Success);
|
|
|
|
this.reloadPage();
|
|
|
|
}
|
|
|
|
|
|
|
|
onUpdateCallbackError(error) {
|
|
|
|
this.uiNotificationService.snackBarNotification(error.error.message ? error.error.message : this.language.instant('DATASET-UPLOAD.SNACK-BAR.UNSUCCESSFUL'), SnackBarNotificationLevel.Error);
|
|
|
|
}
|
|
|
|
|
2019-05-21 15:42:28 +02:00
|
|
|
downloadXml(id: string) {
|
2023-12-04 16:56:12 +01:00
|
|
|
// this.dmpService.downloadXML(id)
|
|
|
|
// .pipe(takeUntil(this._destroyed))
|
|
|
|
// .subscribe(response => {
|
|
|
|
// const blob = new Blob([response.body], { type: 'application/xml' });
|
|
|
|
// const filename = this.fileUtils.getFilenameFromContentDispositionHeader(response.headers.get('Content-Disposition'));
|
2019-05-21 15:42:28 +02:00
|
|
|
|
2023-12-04 16:56:12 +01:00
|
|
|
// FileSaver.saveAs(blob, filename);
|
|
|
|
// this.matomoService.trackDownload('dmps', "xml", id);
|
|
|
|
// });
|
2019-05-21 15:42:28 +02:00
|
|
|
}
|
|
|
|
|
2023-12-19 17:09:09 +01:00
|
|
|
download(id: string, format: string) {
|
|
|
|
this.dmpService.download(id, format)
|
2023-12-18 11:55:19 +01:00
|
|
|
.pipe(takeUntil(this._destroyed))
|
|
|
|
.subscribe(response => {
|
2023-12-19 17:09:09 +01:00
|
|
|
const blob = new Blob([response.body], { type: 'application/octet-stream' });
|
2023-12-18 11:55:19 +01:00
|
|
|
const filename = this.fileUtils.getFilenameFromContentDispositionHeader(response.headers.get('Content-Disposition'));
|
2019-05-21 15:42:28 +02:00
|
|
|
|
2023-12-18 11:55:19 +01:00
|
|
|
FileSaver.saveAs(blob, filename);
|
2023-12-19 17:09:09 +01:00
|
|
|
this.matomoService.trackDownload('dmps', format, id);
|
2023-12-18 11:55:19 +01:00
|
|
|
});
|
2019-05-21 15:42:28 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
downloadPDF(id: string) {
|
2023-12-18 11:55:19 +01:00
|
|
|
this.dmpService.downloadPDF(id)
|
|
|
|
.pipe(takeUntil(this._destroyed))
|
|
|
|
.subscribe(response => {
|
|
|
|
const blob = new Blob([response.body], { type: 'application/pdf' });
|
|
|
|
const filename = this.fileUtils.getFilenameFromContentDispositionHeader(response.headers.get('Content-Disposition'));
|
2019-05-21 15:42:28 +02:00
|
|
|
|
2023-12-18 11:55:19 +01:00
|
|
|
FileSaver.saveAs(blob, filename);
|
|
|
|
this.matomoService.trackDownload('dmps', "pdf", id);
|
|
|
|
});
|
2019-05-21 15:42:28 +02:00
|
|
|
}
|
|
|
|
|
2019-06-04 16:55:23 +02:00
|
|
|
downloadJson(id: string) {
|
2023-12-04 16:56:12 +01:00
|
|
|
//TODO: add this
|
|
|
|
// this.dmpService.downloadJson(id)
|
|
|
|
// .pipe(takeUntil(this._destroyed))
|
|
|
|
// .subscribe(complete => {
|
|
|
|
// const blob = new Blob([complete.body], { type: 'application/json' });
|
|
|
|
// const filename = this.fileUtils.getFilenameFromContentDispositionHeader(complete.headers.get('Content-Disposition'));
|
|
|
|
// FileSaver.saveAs(blob, filename);
|
|
|
|
// this.matomoService.trackDownload('dmps', "json", id);
|
|
|
|
// }, async error => {
|
|
|
|
// this.onExportCallbackError(error);
|
|
|
|
// });
|
|
|
|
}
|
|
|
|
|
|
|
|
// async onExportCallbackError(error: any) {
|
|
|
|
// const errorJsonText = await error.error.text();
|
|
|
|
// const errorObj = JSON.parse(errorJsonText);
|
|
|
|
// this.uiNotificationService.snackBarNotification(errorObj.message, SnackBarNotificationLevel.Error);
|
|
|
|
// }
|
2019-05-21 15:42:28 +02:00
|
|
|
|
2023-12-04 16:56:12 +01:00
|
|
|
isUserDmpRelated(): boolean {
|
|
|
|
const principalId: Guid = this.authentication.userId();
|
2023-12-05 21:36:00 +01:00
|
|
|
return this.dmp.dmpUsers?.some(x => (x.user.id === principalId));
|
2019-07-01 11:35:09 +02:00
|
|
|
}
|
|
|
|
|
2024-03-06 10:53:40 +01:00
|
|
|
isDraftDmp() {
|
|
|
|
return this.dmp.status == DmpStatus.Draft;
|
2019-07-01 11:35:09 +02:00
|
|
|
}
|
|
|
|
|
2023-12-04 16:56:12 +01:00
|
|
|
isFinalizedDmp(dmp: Dmp) {
|
2019-07-01 11:35:09 +02:00
|
|
|
return dmp.status == DmpStatus.Finalized;
|
|
|
|
}
|
|
|
|
|
2023-12-04 18:37:52 +01:00
|
|
|
isPublishedDmp() {
|
|
|
|
return (this.dmp.status == DmpStatus.Finalized && this.dmp.accessType === DmpAccessType.Public);
|
2020-07-09 13:28:55 +02:00
|
|
|
}
|
2020-04-10 16:16:37 +02:00
|
|
|
|
2023-12-04 16:56:12 +01:00
|
|
|
hasDoi() {
|
|
|
|
return (this.dmp.entityDois == null || this.dmp.entityDois.length == 0);
|
2019-07-01 11:35:09 +02:00
|
|
|
}
|
|
|
|
|
2023-12-04 16:56:12 +01:00
|
|
|
getAllVersions(dmp: Dmp) {
|
|
|
|
//TODO: add this
|
|
|
|
// this.dmpService.getAllVersions(dmp.groupId, this.isPublicView)
|
|
|
|
// .pipe(takeUntil(this._destroyed))
|
|
|
|
// .subscribe(items => {
|
|
|
|
// this.versions = items;
|
|
|
|
// });
|
2019-07-01 11:35:09 +02:00
|
|
|
}
|
|
|
|
|
2023-12-04 16:56:12 +01:00
|
|
|
afterDeposit(result: EntityDoi[]) {
|
2023-01-20 13:56:29 +01:00
|
|
|
if (result.length > 0) {
|
2023-12-04 16:56:12 +01:00
|
|
|
this.dmp.entityDois = result;
|
|
|
|
this.selectedModel = this.dmp.entityDois[this.dmp.entityDois.length - 1];
|
2023-01-20 13:56:29 +01:00
|
|
|
}
|
2022-11-02 08:41:40 +01:00
|
|
|
}
|
|
|
|
|
2023-01-31 16:39:17 +01:00
|
|
|
get inputRepos() {
|
2023-12-04 16:56:12 +01:00
|
|
|
return this.depositRepos.filter(repo => !this.dmp.entityDois.find(doi => doi.repositoryId === repo.repositoryId));
|
2023-01-31 16:39:17 +01:00
|
|
|
}
|
|
|
|
|
2023-10-25 16:47:48 +02:00
|
|
|
moreDeposit() {
|
2023-12-04 16:56:12 +01:00
|
|
|
return (this.dmp.entityDois.length < this.depositRepos.length);
|
|
|
|
}
|
|
|
|
|
|
|
|
finalize() {
|
2024-03-13 18:24:01 +01:00
|
|
|
const dialogRef = this.dialog.open(DmpFinalizeDialogComponent, {
|
|
|
|
maxWidth: '500px',
|
|
|
|
restoreFocus: false,
|
|
|
|
autoFocus: false,
|
|
|
|
data: {
|
|
|
|
dmp: this.dmp
|
|
|
|
}
|
|
|
|
});
|
2024-03-15 08:39:36 +01:00
|
|
|
dialogRef.afterClosed().pipe(takeUntil(this._destroyed)).subscribe((result: DmpFinalizeDialogOutput) => {
|
|
|
|
if (result && !result.cancelled) {
|
2024-03-14 10:26:21 +01:00
|
|
|
|
2024-03-15 08:39:36 +01:00
|
|
|
this.dmpService.finalize(this.dmp.id, result.descriptionsToBeFinalized)
|
|
|
|
.pipe(takeUntil(this._destroyed))
|
|
|
|
.subscribe(data => {
|
|
|
|
this.reloadPage();
|
|
|
|
this.onUpdateCallbackSuccess()
|
|
|
|
}, (error: any) => {
|
|
|
|
this.onUpdateCallbackError(error)
|
|
|
|
});
|
2024-03-13 18:24:01 +01:00
|
|
|
}
|
|
|
|
});
|
2023-12-04 16:56:12 +01:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
// private checkIfAnyProfileIsUsedLessThanMin(dmp: Dmp): Observable<boolean> {
|
|
|
|
// const blueprintId = dmp.profile.id;
|
|
|
|
// return this.dmpBlueprintService.getSingle(Guid.parse(blueprintId))
|
|
|
|
// .pipe(map(result => {
|
|
|
|
// return result.definition.sections.some(section => {
|
|
|
|
// if (!section.hasTemplates)
|
|
|
|
// return false;
|
|
|
|
// return section.descriptionTemplates.some(template => {
|
|
|
|
// if (!(template.minMultiplicity > 0))
|
|
|
|
// return false;
|
|
|
|
// let count = 0;
|
2023-12-04 18:37:52 +01:00
|
|
|
// dmp.descriptions.filter(description => description.dmpSectionIndex === (section.ordinal - 1)).forEach(description => {
|
|
|
|
// if (Guid.parse(description.profile.id) === template.descriptionTemplateId) {
|
2023-12-04 16:56:12 +01:00
|
|
|
// count++;
|
|
|
|
// }
|
|
|
|
// })
|
|
|
|
// if (count < template.minMultiplicity) {
|
|
|
|
// this.dialog.open(PopupNotificationDialogComponent, {
|
|
|
|
// data: {
|
|
|
|
// title: this.language.instant('DMP-OVERVIEW.MIN-DESCRIPTIONS-DIALOG.TITLE', { 'minMultiplicity': template.minMultiplicity }),
|
|
|
|
// message: this.language.instant('DMP-OVERVIEW.MIN-DESCRIPTIONS-DIALOG.MESSAGE',)
|
|
|
|
// }, maxWidth: '30em'
|
|
|
|
// });
|
|
|
|
// return true;
|
|
|
|
// }
|
|
|
|
// else
|
|
|
|
// return false;
|
|
|
|
// })
|
|
|
|
// })
|
|
|
|
// }), takeUntil(this._destroyed));
|
2020-09-03 17:49:45 +02:00
|
|
|
// }
|
2019-07-18 12:17:34 +02:00
|
|
|
|
2020-01-07 17:15:07 +01:00
|
|
|
public isAuthenticated(): boolean {
|
2023-10-11 16:53:12 +02:00
|
|
|
return this.authentication.currentAccountIsAuthenticated();
|
2020-01-07 17:15:07 +01:00
|
|
|
}
|
|
|
|
|
2020-07-09 17:31:51 +02:00
|
|
|
versionChanged(versionId: string): void {
|
2020-10-12 11:45:32 +02:00
|
|
|
if (this.isPublicView) {
|
2023-12-20 08:20:38 +01:00
|
|
|
this.router.navigate(['/explore-plans/overview/public/' + versionId]);
|
2020-10-12 11:45:32 +02:00
|
|
|
} else {
|
|
|
|
this.router.navigate(['/plans/overview/' + versionId]);
|
|
|
|
}
|
2020-07-09 17:31:51 +02:00
|
|
|
}
|
|
|
|
|
2020-02-14 17:14:48 +01:00
|
|
|
openShareDialog(rowId: any, rowName: any) {
|
2024-01-05 14:33:27 +01:00
|
|
|
const dialogRef = this.dialog.open(DmpInvitationDialogComponent, {
|
|
|
|
// height: '250px',
|
|
|
|
// width: '700px',
|
|
|
|
autoFocus: false,
|
|
|
|
restoreFocus: false,
|
|
|
|
data: {
|
|
|
|
dmpId: rowId,
|
2024-02-22 12:57:42 +01:00
|
|
|
dmpName: rowName,
|
|
|
|
blueprint: this.selectedBlueprint
|
2024-01-05 14:33:27 +01:00
|
|
|
}
|
|
|
|
});
|
2023-12-04 16:56:12 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
selectDoi(entityDoi: EntityDoi) {
|
|
|
|
this.selectedModel = entityDoi;
|
|
|
|
const foundIdx = this.dmp.entityDois.findIndex(el => el.id == entityDoi.id);
|
|
|
|
this.dmp.entityDois.splice(foundIdx, 1);
|
|
|
|
this.dmp.entityDois.unshift(entityDoi);
|
2022-11-14 08:34:49 +01:00
|
|
|
}
|
|
|
|
|
2023-12-29 16:04:16 +01:00
|
|
|
// createDoiLink(doiModel: DoiModel): string {
|
|
|
|
createDoiLink(doiModel: any): string {
|
2023-12-04 16:56:12 +01:00
|
|
|
//TODO: needs rewriting
|
2023-06-01 11:15:22 +02:00
|
|
|
const repository = this.depositRepos.find(r => r.repositoryId == doiModel.repositoryId);
|
2023-10-25 16:47:48 +02:00
|
|
|
if (typeof repository !== "undefined") {
|
|
|
|
if (doiModel.repositoryId == "Zenodo") {
|
2022-12-19 10:37:49 +01:00
|
|
|
const doiarr = doiModel.doi.split('.');
|
|
|
|
const id = doiarr[doiarr.length - 1];
|
2023-06-01 11:15:22 +02:00
|
|
|
return repository.repositoryRecordUrl + id;
|
2022-12-19 10:37:49 +01:00
|
|
|
}
|
2023-10-25 16:47:48 +02:00
|
|
|
else {
|
2023-06-01 11:15:22 +02:00
|
|
|
return repository.repositoryRecordUrl + doiModel.doi;
|
2022-12-19 10:37:49 +01:00
|
|
|
}
|
2022-11-14 08:34:49 +01:00
|
|
|
}
|
2023-10-25 16:47:48 +02:00
|
|
|
else {
|
2022-12-19 10:37:49 +01:00
|
|
|
return "";
|
2022-11-14 08:34:49 +01:00
|
|
|
}
|
2020-05-07 09:57:20 +02:00
|
|
|
}
|
|
|
|
|
2023-12-04 16:56:12 +01:00
|
|
|
reverseFinalization() {
|
2024-03-15 08:39:36 +01:00
|
|
|
const dialogRef = this.dialog.open(ConfirmationDialogComponent, {
|
|
|
|
restoreFocus: false,
|
|
|
|
data: {
|
|
|
|
message: this.language.instant('DMP-OVERVIEW.UNDO-FINALIZATION-DIALOG.TITLE'),
|
|
|
|
confirmButton: this.language.instant('DMP-OVERVIEW.UNDO-FINALIZATION-DIALOG.CONFIRM'),
|
|
|
|
cancelButton: this.language.instant('DMP-OVERVIEW.UNDO-FINALIZATION-DIALOG.NEGATIVE'),
|
|
|
|
isDeleteConfirmation: false
|
|
|
|
}
|
|
|
|
});
|
|
|
|
dialogRef.afterClosed().pipe(takeUntil(this._destroyed)).subscribe(result => {
|
|
|
|
if (result) {
|
|
|
|
this.dmpService.undoFinalize(this.dmp.id, DmpEditorResolver.lookupFields()).pipe(takeUntil(this._destroyed))
|
|
|
|
.subscribe(data => {
|
|
|
|
this.reloadPage();
|
|
|
|
this.onUpdateCallbackSuccess()
|
|
|
|
}, (error: any) => {
|
|
|
|
this.onUpdateCallbackError(error)
|
|
|
|
});
|
|
|
|
}
|
|
|
|
});
|
2020-05-26 13:31:47 +02:00
|
|
|
}
|
|
|
|
|
2020-06-30 17:33:01 +02:00
|
|
|
goBack(): void {
|
|
|
|
this.location.back();
|
2020-07-01 17:32:22 +02:00
|
|
|
}
|
|
|
|
|
2020-07-09 15:01:49 +02:00
|
|
|
reloadPage(): void {
|
2020-07-22 13:26:49 +02:00
|
|
|
const path = this.location.path();
|
2020-07-22 10:19:25 +02:00
|
|
|
this.router.navigateByUrl('/reload', { skipLocationChange: true }).then(() => {
|
2020-07-22 13:26:49 +02:00
|
|
|
this.router.navigate([path]);
|
2020-07-09 15:01:49 +02:00
|
|
|
});
|
2020-07-10 17:28:10 +02:00
|
|
|
}
|
2020-07-09 15:01:49 +02:00
|
|
|
|
2023-12-04 16:56:12 +01:00
|
|
|
// updateUsers() {
|
|
|
|
// return this.dmpService.updateUsers(this.dmp.id, this.dmp.users).pipe(takeUntil(this._destroyed))
|
|
|
|
// .subscribe(
|
|
|
|
// complete => {
|
|
|
|
// this.onUpdateCallbackSuccess();
|
|
|
|
// },
|
|
|
|
// error => this.onUpdateCallbackError(error)
|
|
|
|
// );
|
|
|
|
// }
|
2020-07-09 09:17:49 +02:00
|
|
|
|
2023-12-06 22:10:01 +01:00
|
|
|
removeUserFromDmp(dmpUser: DmpUser) {
|
|
|
|
const dialogRef = this.dialog.open(ConfirmationDialogComponent, {
|
|
|
|
data: {
|
|
|
|
message: this.language.instant('GENERAL.CONFIRMATION-DIALOG.DELETE-USER'),
|
|
|
|
confirmButton: this.language.instant('GENERAL.CONFIRMATION-DIALOG.ACTIONS.REMOVE'),
|
|
|
|
cancelButton: this.language.instant('GENERAL.CONFIRMATION-DIALOG.ACTIONS.CANCEL'),
|
|
|
|
isDeleteConfirmation: false
|
|
|
|
}
|
|
|
|
});
|
|
|
|
dialogRef.afterClosed().subscribe(result => {
|
|
|
|
if (result) {
|
|
|
|
const dmpUserRemovePersist: DmpUserRemovePersist = {
|
|
|
|
id: dmpUser.id,
|
|
|
|
dmpId: this.dmp.id,
|
|
|
|
role: dmpUser.role
|
|
|
|
};
|
|
|
|
this.dmpService.removeUser(dmpUserRemovePersist).pipe(takeUntil(this._destroyed))
|
|
|
|
.subscribe(data => {
|
|
|
|
this.reloadPage();
|
|
|
|
this.onUpdateCallbackSuccess()
|
|
|
|
}, (error: any) => {
|
|
|
|
this.onUpdateCallbackError(error)
|
|
|
|
});
|
|
|
|
}
|
|
|
|
});
|
2020-07-01 17:32:22 +02:00
|
|
|
}
|
2020-07-07 17:30:25 +02:00
|
|
|
|
2020-07-02 17:29:33 +02:00
|
|
|
copyDoi(doi) {
|
2022-11-14 08:34:49 +01:00
|
|
|
const el = document.createElement('textarea');
|
|
|
|
el.value = doi;
|
|
|
|
el.setAttribute('readonly', '');
|
|
|
|
el.style.position = 'absolute';
|
|
|
|
el.style.left = '-9999px';
|
|
|
|
document.body.appendChild(el);
|
|
|
|
el.select();
|
2020-07-02 17:29:33 +02:00
|
|
|
document.execCommand('copy');
|
2022-11-14 08:34:49 +01:00
|
|
|
document.body.removeChild(el);
|
2020-10-27 11:00:02 +01:00
|
|
|
this.uiNotificationService.snackBarNotification(this.language.instant('GENERAL.SNACK-BAR.SUCCESSFUL-COPY-TO-CLIPBOARD'), SnackBarNotificationLevel.Success);
|
2020-07-02 17:29:33 +02:00
|
|
|
}
|
2020-07-07 17:30:25 +02:00
|
|
|
|
2020-07-02 17:29:33 +02:00
|
|
|
public getOrcidPath(): string {
|
|
|
|
return this.configurationService.orcidPath;
|
|
|
|
}
|
2020-07-01 17:32:22 +02:00
|
|
|
|
2023-12-04 18:37:52 +01:00
|
|
|
isOrcid(reference: Reference) {
|
|
|
|
return reference.source === 'orcid';
|
2020-09-25 16:49:19 +02:00
|
|
|
}
|
|
|
|
|
2020-07-10 17:28:10 +02:00
|
|
|
getOrcidPathForResearcher(reference: string): string {
|
|
|
|
const path = this.getOrcidPath();
|
2023-12-04 18:37:52 +01:00
|
|
|
return path + reference;
|
2020-07-10 17:28:10 +02:00
|
|
|
}
|
|
|
|
|
2023-12-04 16:56:12 +01:00
|
|
|
checkLockStatus(id: Guid) {
|
2023-12-11 17:55:20 +01:00
|
|
|
this.lockService.checkLockStatus(Guid.parse(id.toString())).pipe(takeUntil(this._destroyed))
|
2021-06-22 13:12:58 +02:00
|
|
|
.subscribe(lockStatus => {
|
2024-03-21 12:06:59 +01:00
|
|
|
this.isLocked = lockStatus.status;
|
|
|
|
if (this.isLocked) {
|
2023-10-25 16:47:48 +02:00
|
|
|
this.dialog.open(PopupNotificationDialogComponent, {
|
|
|
|
data: {
|
|
|
|
title: this.language.instant('DMP-OVERVIEW.LOCKED-DIALOG.TITLE'),
|
|
|
|
message: this.language.instant('DMP-OVERVIEW.LOCKED-DIALOG.MESSAGE')
|
|
|
|
}, maxWidth: '30em'
|
|
|
|
});
|
2021-06-22 13:12:58 +02:00
|
|
|
}
|
|
|
|
});
|
2020-07-01 17:32:22 +02:00
|
|
|
}
|
|
|
|
|
2023-12-04 16:56:12 +01:00
|
|
|
private lookupFields(): string[] {
|
|
|
|
return [
|
|
|
|
nameof<Dmp>(x => x.id),
|
|
|
|
nameof<Dmp>(x => x.label),
|
2023-12-29 16:04:16 +01:00
|
|
|
nameof<Dmp>(x => x.description),
|
2023-12-04 16:56:12 +01:00
|
|
|
nameof<Dmp>(x => x.status),
|
|
|
|
nameof<Dmp>(x => x.accessType),
|
|
|
|
nameof<Dmp>(x => x.version),
|
|
|
|
nameof<Dmp>(x => x.groupId),
|
2023-12-04 18:37:52 +01:00
|
|
|
nameof<Dmp>(x => x.version),
|
2023-12-04 16:56:12 +01:00
|
|
|
nameof<Dmp>(x => x.updatedAt),
|
2024-03-15 08:39:36 +01:00
|
|
|
nameof<Dmp>(x => x.entityDois),
|
2024-03-14 10:23:46 +01:00
|
|
|
[nameof<Dmp>(x => x.authorizationFlags), AppPermission.CreateNewVersionDmp].join('.'),
|
|
|
|
[nameof<Dmp>(x => x.authorizationFlags), AppPermission.DeleteDmp].join('.'),
|
|
|
|
[nameof<Dmp>(x => x.authorizationFlags), AppPermission.CloneDmp].join('.'),
|
|
|
|
[nameof<Dmp>(x => x.authorizationFlags), AppPermission.FinalizeDmp].join('.'),
|
|
|
|
[nameof<Dmp>(x => x.authorizationFlags), AppPermission.ExportDmp].join('.'),
|
|
|
|
[nameof<Dmp>(x => x.authorizationFlags), AppPermission.InviteDmpUsers].join('.'),
|
|
|
|
[nameof<Dmp>(x => x.authorizationFlags), AppPermission.AssignDmpUsers].join('.'),
|
|
|
|
[nameof<Dmp>(x => x.authorizationFlags), AppPermission.EditDmp].join('.'),
|
2024-03-19 11:48:17 +01:00
|
|
|
[nameof<Dmp>(x => x.authorizationFlags), AppPermission.DepositDmp].join('.'),
|
2023-12-04 16:56:12 +01:00
|
|
|
[nameof<Dmp>(x => x.entityDois), nameof<EntityDoi>(x => x.id)].join('.'),
|
|
|
|
[nameof<Dmp>(x => x.entityDois), nameof<EntityDoi>(x => x.repositoryId)].join('.'),
|
|
|
|
[nameof<Dmp>(x => x.entityDois), nameof<EntityDoi>(x => x.doi)].join('.'),
|
|
|
|
[nameof<Dmp>(x => x.descriptions), nameof<Description>(x => x.id)].join('.'),
|
|
|
|
[nameof<Dmp>(x => x.descriptions), nameof<Description>(x => x.label)].join('.'),
|
2023-12-04 18:37:52 +01:00
|
|
|
[nameof<Dmp>(x => x.descriptions), nameof<Description>(x => x.status)].join('.'),
|
2024-03-11 08:47:03 +01:00
|
|
|
[nameof<Dmp>(x => x.descriptions), nameof<Description>(x => x.isActive)].join('.'),
|
2023-12-04 16:56:12 +01:00
|
|
|
[nameof<Dmp>(x => x.dmpUsers), nameof<DmpUser>(x => x.id)].join('.'),
|
|
|
|
[nameof<Dmp>(x => x.dmpUsers), nameof<DmpUser>(x => x.user.id)].join('.'),
|
2023-12-04 18:37:52 +01:00
|
|
|
[nameof<Dmp>(x => x.dmpUsers), nameof<DmpUser>(x => x.user.name)].join('.'),
|
2023-12-04 16:56:12 +01:00
|
|
|
[nameof<Dmp>(x => x.dmpUsers), nameof<DmpUser>(x => x.role)].join('.'),
|
2024-03-11 08:47:03 +01:00
|
|
|
[nameof<Dmp>(x => x.dmpUsers), nameof<DmpUser>(x => x.dmp.id)].join('.'),
|
|
|
|
[nameof<Dmp>(x => x.dmpUsers), nameof<DmpUser>(x => x.isActive)].join('.'),
|
2023-12-04 18:37:52 +01:00
|
|
|
[nameof<Dmp>(x => x.dmpReferences), nameof<DmpReference>(x => x.id)].join('.'),
|
|
|
|
[nameof<Dmp>(x => x.dmpReferences), nameof<DmpReference>(x => x.reference), nameof<Reference>(x => x.id)].join('.'),
|
|
|
|
[nameof<Dmp>(x => x.dmpReferences), nameof<DmpReference>(x => x.reference), nameof<Reference>(x => x.label)].join('.'),
|
2024-03-06 17:41:26 +01:00
|
|
|
[nameof<Dmp>(x => x.dmpReferences), nameof<DmpReference>(x => x.reference), nameof<Reference>(x => x.type), nameof<ReferenceType>(x => x.id)].join('.'),
|
2023-12-04 18:37:52 +01:00
|
|
|
[nameof<Dmp>(x => x.dmpReferences), nameof<DmpReference>(x => x.reference), nameof<Reference>(x => x.source)].join('.'),
|
|
|
|
[nameof<Dmp>(x => x.dmpReferences), nameof<DmpReference>(x => x.reference), nameof<Reference>(x => x.reference)].join('.'),
|
2024-03-11 14:20:09 +01:00
|
|
|
[nameof<Dmp>(x => x.dmpReferences), nameof<DmpReference>(x => x.isActive)].join('.'),
|
2024-02-22 12:57:42 +01:00
|
|
|
|
|
|
|
[nameof<Dmp>(x => x.blueprint), nameof<DmpBlueprint>(x => x.id)].join('.'),
|
|
|
|
[nameof<Dmp>(x => x.blueprint), nameof<DmpBlueprint>(x => x.definition)].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('.'),
|
2024-03-14 10:23:46 +01:00
|
|
|
|
2024-03-04 11:42:14 +01:00
|
|
|
nameof<Dmp>(x => x.hash),
|
2023-12-04 16:56:12 +01:00
|
|
|
]
|
2020-07-01 17:32:22 +02:00
|
|
|
}
|
2019-05-21 15:42:28 +02:00
|
|
|
}
|