From ad1539af59bf32b716817aad7c262fd52152a0a7 Mon Sep 17 00:00:00 2001 From: Diamantis Tziotzios Date: Mon, 4 Dec 2023 19:37:52 +0200 Subject: [PATCH] dmp overview page refactor --- .../lookup/DmpDescriptionTemplateLookup.java | 22 +++- .../query/dmp-description-template.lookup.ts | 26 +++++ dmp-frontend/src/app/core/query/dmp.lookup.ts | 8 +- .../src/app/core/services/dmp/dmp.service.ts | 4 +- .../services/reference/reference.service.ts | 5 + .../description-copy-dialog.component.ts | 10 +- .../listing/description-listing.component.ts | 5 +- .../description-listing-item.component.ts | 2 +- .../description-overview.component.html | 4 +- .../description-overview.component.ts | 5 +- dmp-frontend/src/app/ui/dmp/dmp.routing.ts | 20 ++-- .../dmp/overview/dmp-overview.component.html | 105 +++++++++--------- .../dmp/overview/dmp-overview.component.scss | 30 ++--- .../ui/dmp/overview/dmp-overview.component.ts | 104 ++++++++--------- dmp-frontend/src/assets/i18n/en.json | 40 +++++-- 15 files changed, 227 insertions(+), 163 deletions(-) create mode 100644 dmp-frontend/src/app/core/query/dmp-description-template.lookup.ts diff --git a/dmp-backend/core/src/main/java/eu/eudat/query/lookup/DmpDescriptionTemplateLookup.java b/dmp-backend/core/src/main/java/eu/eudat/query/lookup/DmpDescriptionTemplateLookup.java index 637315f31..3a5f4400f 100644 --- a/dmp-backend/core/src/main/java/eu/eudat/query/lookup/DmpDescriptionTemplateLookup.java +++ b/dmp-backend/core/src/main/java/eu/eudat/query/lookup/DmpDescriptionTemplateLookup.java @@ -14,7 +14,8 @@ public class DmpDescriptionTemplateLookup extends Lookup { private List ids; private List dmpIds; - private List descriptionTemplateIds; + private List descriptionTemplateGroupIds; + private List sectionIds; private List excludedIds; @@ -52,19 +53,28 @@ public class DmpDescriptionTemplateLookup extends Lookup { this.dmpIds = dmpIds; } - public List getDescriptionTemplateIds() { - return descriptionTemplateIds; + public List getDescriptionTemplateGroupIds() { + return descriptionTemplateGroupIds; } - public void setDescriptionTemplateIds(List descriptionTemplateIds) { - this.descriptionTemplateIds = descriptionTemplateIds; + public List getSectionIds() { + return sectionIds; + } + + public void setSectionIds(List sectionIds) { + this.sectionIds = sectionIds; + } + + public void setDescriptionTemplateGroupIds(List descriptionTemplateGroupIds) { + this.descriptionTemplateGroupIds = descriptionTemplateGroupIds; } public DmpDescriptionTemplateQuery enrich(QueryFactory queryFactory) { DmpDescriptionTemplateQuery query = queryFactory.query(DmpDescriptionTemplateQuery.class); if (this.ids != null) query.ids(this.ids); if (this.dmpIds != null) query.ids(this.dmpIds); - if (this.descriptionTemplateIds != null) query.ids(this.descriptionTemplateIds); + if (this.descriptionTemplateGroupIds != null) query.descriptionTemplateGroupIds(this.descriptionTemplateGroupIds); + if (this.sectionIds != null) query.sectionIds(this.sectionIds); if (this.excludedIds != null) query.excludedIds(this.excludedIds); if (this.isActive != null) query.isActive(this.isActive); diff --git a/dmp-frontend/src/app/core/query/dmp-description-template.lookup.ts b/dmp-frontend/src/app/core/query/dmp-description-template.lookup.ts new file mode 100644 index 000000000..8703bc871 --- /dev/null +++ b/dmp-frontend/src/app/core/query/dmp-description-template.lookup.ts @@ -0,0 +1,26 @@ +import { Lookup } from '@common/model/lookup'; +import { Guid } from '@common/types/guid'; +import { IsActive } from '../common/enum/is-active.enum'; + +export class DmpDescriptionTemplateLookup extends Lookup implements DmpDescriptionTemplateFilter { + ids: Guid[]; + excludedIds: Guid[]; + dmpIds: Guid[]; + descriptionTemplateGroupIds: Guid[]; + sectionIds: Guid[]; + isActive: IsActive[]; + + + constructor() { + super(); + } +} + +export interface DmpDescriptionTemplateFilter { + ids: Guid[]; + excludedIds: Guid[]; + dmpIds: Guid[]; + descriptionTemplateGroupIds: Guid[]; + sectionIds: Guid[]; + isActive: IsActive[]; +} diff --git a/dmp-frontend/src/app/core/query/dmp.lookup.ts b/dmp-frontend/src/app/core/query/dmp.lookup.ts index 536318b00..db95b39d7 100644 --- a/dmp-frontend/src/app/core/query/dmp.lookup.ts +++ b/dmp-frontend/src/app/core/query/dmp.lookup.ts @@ -1,9 +1,10 @@ import { Lookup } from '@common/model/lookup'; import { Guid } from '@common/types/guid'; -import { IsActive } from '../common/enum/is-active.enum'; +import { DmpAccessType } from '../common/enum/dmp-access-type'; import { DmpStatus } from '../common/enum/dmp-status'; import { DmpVersionStatus } from '../common/enum/dmp-version-status'; -import { DmpAccessType } from '../common/enum/dmp-access-type'; +import { IsActive } from '../common/enum/is-active.enum'; +import { DmpDescriptionTemplateLookup } from './dmp-description-template.lookup'; export class DmpLookup extends Lookup implements DmpFilter { ids: Guid[]; @@ -14,7 +15,8 @@ export class DmpLookup extends Lookup implements DmpFilter { statuses: DmpStatus[]; accessTypes: DmpAccessType[]; versions: Number[]; - + dmpDescriptionTemplateSubQuery: DmpDescriptionTemplateLookup; + constructor() { super(); diff --git a/dmp-frontend/src/app/core/services/dmp/dmp.service.ts b/dmp-frontend/src/app/core/services/dmp/dmp.service.ts index 5e4a57c66..1bc4b9bbd 100644 --- a/dmp-frontend/src/app/core/services/dmp/dmp.service.ts +++ b/dmp-frontend/src/app/core/services/dmp/dmp.service.ts @@ -33,6 +33,7 @@ import { ConfigurationService } from '../configuration/configuration.service'; import { BaseHttpV2Service } from '../http/base-http-v2.service'; import { BaseHttpService } from '../http/base-http.service'; import { DmpStatus } from '@app/core/common/enum/dmp-status'; +import { DmpDescriptionTemplateLookup } from '@app/core/query/dmp-description-template.lookup'; @Injectable() export class DmpServiceNew { @@ -160,7 +161,7 @@ export class DmpServiceNew { valueAssign: (item: Dmp) => item.id, }; - public buildAutocompleteLookup(like?: string, excludedIds?: Guid[], ids?: Guid[], statuses?: DmpStatus[]): DmpLookup { + public buildAutocompleteLookup(like?: string, excludedIds?: Guid[], ids?: Guid[], statuses?: DmpStatus[], dmpDescriptionTemplateSubQuery?: DmpDescriptionTemplateLookup): DmpLookup { const lookup: DmpLookup = new DmpLookup(); lookup.page = { size: 100, offset: 0 }; if (excludedIds && excludedIds.length > 0) { lookup.excludedIds = excludedIds; } @@ -173,6 +174,7 @@ export class DmpServiceNew { nameof(x => x.label) ] }; + if (dmpDescriptionTemplateSubQuery != null) lookup.dmpDescriptionTemplateSubQuery = dmpDescriptionTemplateSubQuery; lookup.order = { items: [nameof(x => x.label)] }; if (like) { lookup.like = this.filterService.transformLike(like); } return lookup; diff --git a/dmp-frontend/src/app/core/services/reference/reference.service.ts b/dmp-frontend/src/app/core/services/reference/reference.service.ts index 889a44569..36f0b04ca 100644 --- a/dmp-frontend/src/app/core/services/reference/reference.service.ts +++ b/dmp-frontend/src/app/core/services/reference/reference.service.ts @@ -119,6 +119,10 @@ export class ReferenceService { // // + hasRerefenceOfTypes(dmpReferences: DmpReference[], referenceTypes: ReferenceType[]): boolean { + return this.getReferencesForTypes(dmpReferences, referenceTypes)?.length > 0; + } + getReferencesForTypes(dmpReferences: DmpReference[], referenceTypes: ReferenceType[]): DmpReference[] { return dmpReferences?.filter(x => referenceTypes?.includes(x?.reference?.type)); } @@ -126,4 +130,5 @@ export class ReferenceService { getReferencesForTypesFirstSafe(dmpReferences: DmpReference[], referenceTypes: ReferenceType[]): DmpReference { return this.getReferencesForTypes(dmpReferences, referenceTypes)?.find(Boolean); } + } diff --git a/dmp-frontend/src/app/ui/description/description-copy-dialog/description-copy-dialog.component.ts b/dmp-frontend/src/app/ui/description/description-copy-dialog/description-copy-dialog.component.ts index f021937d1..e10134a84 100644 --- a/dmp-frontend/src/app/ui/description/description-copy-dialog/description-copy-dialog.component.ts +++ b/dmp-frontend/src/app/ui/description/description-copy-dialog/description-copy-dialog.component.ts @@ -9,6 +9,8 @@ import { SingleAutoCompleteConfiguration } from '@app/library/auto-complete/sing import { Dmp } from '@app/core/model/dmp/dmp'; import { DmpServiceNew } from '@app/core/services/dmp/dmp.service'; import { DescriptionService } from '@app/core/services/description/description.service'; +import { DmpDescriptionTemplateLookup } from '@app/core/query/dmp-description-template.lookup'; +import { IsActive } from '@app/core/common/enum/is-active.enum'; @Component({ selector: 'description-copy-dialog-component', @@ -20,14 +22,18 @@ export class DescriptionCopyDialogComponent { dmpModel: Dmp; descriptionDescriptionTemplateLabel: String; dmpAutoCompleteConfiguration: SingleAutoCompleteConfiguration = { //TODO: add filter to only get DMPs that have connection with the same Description Template group. - initialItems: (data?: any) => this.dmpService.query(this.dmpService.buildAutocompleteLookup()).pipe(map(x => x.items)), - filterFn: (searchQuery: string, data?: any) => this.dmpService.query(this.dmpService.buildAutocompleteLookup(searchQuery)).pipe(map(x => x.items)), + initialItems: (data?: any) => this.dmpService.query(this.dmpService.buildAutocompleteLookup(null,null,null,null, this.dmpDescriptionTemplateLookup)).pipe(map(x => x.items)), + filterFn: (searchQuery: string, data?: any) => this.dmpService.query(this.dmpService.buildAutocompleteLookup(searchQuery, null, null, null, this.dmpDescriptionTemplateLookup)).pipe(map(x => x.items)), getSelectedItem: (selectedItem: any) => this.dmpService.query(this.dmpService.buildAutocompleteLookup(null, null, [selectedItem])).pipe(map(x => x.items[0])), displayFn: (item: Dmp) => item.label, titleFn: (item: Dmp) => item.label, valueAssign: (item: Dmp) => item.id, }; + dmpDescriptionTemplateLookup: DmpDescriptionTemplateLookup = { + descriptionTemplateGroupIds: [this.data.descriptionTemplate.groupId], + isActive: [IsActive.Active] + } as DmpDescriptionTemplateLookup; constructor( public dialogRef: MatDialogRef, 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 51cb0c6d5..0a8d86dab 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 @@ -7,7 +7,6 @@ import { MatPaginator } from '@angular/material/paginator'; import { MatSort } from '@angular/material/sort'; import { ActivatedRoute, Params, Router } from '@angular/router'; import { DescriptionStatus } from '@app/core/common/enum/description-status'; -import { DmpStatus } from '@app/core/common/enum/dmp-status'; import { IsActive } from '@app/core/common/enum/is-active.enum'; import { RecentActivityOrder } from '@app/core/common/enum/recent-activity-order'; import { DataTableRequest } from '@app/core/model/data-table/data-table-request'; @@ -107,9 +106,6 @@ export class DescriptionListingComponent extends BaseComponent implements OnInit this.dmpId = queryParams['dmpId']; this.status = queryParams['status']; - this.lookup.dmpSubQuery = new DmpLookup(); - this.lookup.dmpSubQuery.statuses = [DmpStatus.Draft]; - this.lookup.page = { size: this.pageSize, offset: 0 }; this.lookup.order = { items: ['-' + nameof(x => x.updatedAt)] }; this.lookup.metadata = { countAll: true }; @@ -191,6 +187,7 @@ export class DescriptionListingComponent extends BaseComponent implements OnInit nameof(x => x.updatedAt), [nameof(x => x.descriptionTemplate), nameof(x => x.id)].join('.'), [nameof(x => x.descriptionTemplate), nameof(x => x.label)].join('.'), + [nameof(x => x.descriptionTemplate), nameof(x => x.groupId)].join('.'), [nameof(x => x.dmp), nameof(x => x.id)].join('.'), [nameof(x => x.dmp), nameof(x => x.label)].join('.'), [nameof(x => x.dmp), nameof(x => x.accessType)].join('.'), 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 5757b8c7b..96ad20b29 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 @@ -165,7 +165,7 @@ export class DescriptionListingItemComponent extends BaseComponent implements On data: { formControl: formControl, descriptionId: description.id, - descriptionProfileId: description.descriptionTemplate.id, + descriptionTemplate: description.descriptionTemplate, descriptionProfileExist: false, confirmButton: this.language.instant('DESCRIPTION-LISTING.COPY-DIALOG.COPY'), cancelButton: this.language.instant('DESCRIPTION-LISTING.COPY-DIALOG.CANCEL') 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 e6d3ea297..9a7bb3f19 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 @@ -59,7 +59,7 @@ -
+
{{'DESCRIPTION-OVERVIEW.GRANT' | translate}}
{{referenceService.getReferencesForTypesFirstSafe(description?.dmp?.dmpReferences, [referenceTypeEnum.Grants])?.reference?.label}}
@@ -149,7 +149,7 @@

{{ enumUtils.toDmpUserRoleString(dmpUser.role) }}

- +
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 a0de6c142..11b101b49 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 @@ -55,6 +55,8 @@ export class DescriptionOverviewComponent extends BaseComponent implements OnIni descriptionStatusEnum = DescriptionStatus; dmpAccessTypeEnum = DmpAccessType; referenceTypeEnum = ReferenceType; + dmpStatusEnum = DmpStatus; + dmpUserRoleEnum = DmpUserRole; constructor( private route: ActivatedRoute, @@ -335,7 +337,7 @@ export class DescriptionOverviewComponent extends BaseComponent implements OnIni data: { formControl: formControl, descriptionId: this.description.id, - descriptionProfileId: this.description.descriptionTemplate.id, + descriptionTemplate: this.description.descriptionTemplate, descriptionProfileExist: false, confirmButton: this.language.instant('DESCRIPTION-OVERVIEW.COPY-DIALOG.COPY'), cancelButton: this.language.instant('DESCRIPTION-OVERVIEW.COPY-DIALOG.CANCEL') @@ -440,6 +442,7 @@ export class DescriptionOverviewComponent extends BaseComponent implements OnIni nameof(x => x.updatedAt), [nameof(x => x.descriptionTemplate), nameof(x => x.id)].join('.'), [nameof(x => x.descriptionTemplate), nameof(x => x.label)].join('.'), + [nameof(x => x.descriptionTemplate), nameof(x => x.groupId)].join('.'), [nameof(x => x.dmp), nameof(x => x.id)].join('.'), [nameof(x => x.dmp), nameof(x => x.label)].join('.'), [nameof(x => x.dmp), nameof(x => x.accessType)].join('.'), diff --git a/dmp-frontend/src/app/ui/dmp/dmp.routing.ts b/dmp-frontend/src/app/ui/dmp/dmp.routing.ts index 537f6c742..0450658f3 100644 --- a/dmp-frontend/src/app/ui/dmp/dmp.routing.ts +++ b/dmp-frontend/src/app/ui/dmp/dmp.routing.ts @@ -24,7 +24,14 @@ const routes: Routes = [ breadcrumb: true }, }, - + { + path: 'overview/:id', + component: DmpOverviewComponent, + data: { + breadcrumb: true, + title: 'GENERAL.TITLES.DMP-OVERVIEW' + }, + }, // { // path: 'edit/:id', // component: DmpEditorBlueprintComponent, @@ -43,14 +50,7 @@ const routes: Routes = [ // }, // canDeactivate: [CanDeactivateGuard] // }, - // { - // path: 'overview/:id', - // component: DmpOverviewComponent, - // data: { - // breadcrumb: true, - // title: 'GENERAL.TITLES.DMP-OVERVIEW' - // }, - // }, + // { // path: 'publicOverview/:publicId', // component: DmpOverviewComponent, @@ -61,7 +61,7 @@ const routes: Routes = [ // }, - + // { // path: 'new', // component: DmpEditorBlueprintComponent, diff --git a/dmp-frontend/src/app/ui/dmp/overview/dmp-overview.component.html b/dmp-frontend/src/app/ui/dmp/overview/dmp-overview.component.html index 3f0bca21b..e7580d2a2 100644 --- a/dmp-frontend/src/app/ui/dmp/overview/dmp-overview.component.html +++ b/dmp-frontend/src/app/ui/dmp/overview/dmp-overview.component.html @@ -3,12 +3,12 @@
chevron_left -

{{'DMP-WIZARD.ACTIONS.BACK' | translate}}

+

{{'DMP-OVERVIEW.ACTIONS.BACK' | translate}}

- +

{{ dmp.label }}

@@ -16,114 +16,114 @@

{{ enumUtils.toDmpUserRolesString(dmpService.getCurrentUserRolesInDmp(dmp?.dmpUsers)) }}

- . -
+ . +
public {{'DMP-OVERVIEW.PUBLIC' | translate}}
- . + .
lock_outline {{'DMP-OVERVIEW.LOCKED' | translate}}
- - - {{'DMP-LISTING.VERSION' | translate}} {{version.version}} + + + {{'DMP-OVERVIEW.VERSION' | translate}} {{version.version}} -
{{'GENERAL.STATUSES.EDIT' | translate}} : - {{dmp.modifiedTime | dateTimeCultureFormatter: "d MMMM y"}} +
{{'DMP-OVERVIEW.EDITED' | translate}} : + {{dmp.updatedAt | dateTimeCultureFormatter: "d MMMM y"}}
check - {{'TYPES.DMP.FINALISED' | translate}} + {{'DMP-OVERVIEW.FINALISED' | translate}}
- - -
-
+
{{'DMP-OVERVIEW.GRANT' | translate}}
-
{{ dmp.grant.label }}
+
{{referenceService.getReferencesForTypesFirstSafe(dmp?.dmpReferences, [referenceTypeEnum.Grants])?.reference?.label}}
-
{{'DMP-OVERVIEW.RESEARCHERS' | translate}}
+
{{'DESCRIPTION-OVERVIEW.RESEARCHERS' | translate}}
-
- - +
+ +
 
-
{{ researcher.name }},
-
{{ researcher.name }}
+
{{ dmpReference.reference?.data?.name }},
+
{{ dmpReference.reference?.data?.name }}
- -
{{ researcher.name }},
-
{{ researcher.name }}
+ +
{{ dmpReference.reference?.data?.name }},
+
{{ dmpReference.reference?.data?.name }}
- horizontal_rule + horizontal_rule
-
{{'DATASET-LISTING.COLUMNS.DESCRIPTION' | translate}}
+
{{'DMP-OVERVIEW.DESCRIPTION' | translate}}

horizontal_rule
-
{{'DMP-OVERVIEW.DESCRIPTIONS-USED' | translate}}
+
{{'DMP-OVERVIEW.DESCRIPTIONS' | translate}}
-
- + -
+
horizontal_rule
-
- {{'DMP-EDITOR.TITLE.SUBTITLE' | translate}}: + {{'DMP-OVERVIEW.DOI-PROVIDED' | translate}}: - - {{doi.repositoryId}} + + {{entityDoi.repositoryId}}
-
+
{{selectedModel.doi}}
- - -

{{ 'DMP-LISTING.ACTIONS.FINALIZE' | translate }}

+

{{ 'DMP-OVERVIEW.ACTIONS.FINALIZE' | translate }}


-
+
-

{{ 'DMP-LISTING.ACTIONS.UNFINALIZE' | translate }}

+

{{ 'DMP-OVERVIEW.ACTIONS.REVERSE' | translate }}

- {{ 'DMP-LISTING.ACTIONS.EXPORT' | translate }}

+ {{ 'DMP-OVERVIEW.ACTIONS.EXPORT' | translate }}

-

{{ 'DMP-LISTING.ACTIONS.START-NEW-VERSION' | translate }} +

{{ 'DMP-OVERVIEW.OVERVIEW.NEW-VERSION' | translate }}

@@ -188,25 +188,26 @@

{{ 'DMP-OVERVIEW.DMP-AUTHORS' | translate }}

-
+
-

{{ user.name }} - ({{ 'DMP-OVERVIEW.YOU' | translate }}) +

{{ dmpUser.user?.name }} + + ({{ 'DMP-OVERVIEW.YOU' | translate }})

{{ enumUtils.toDmpUserRoleString(dmpUser.role) }}

- +
diff --git a/dmp-frontend/src/app/ui/dmp/overview/dmp-overview.component.scss b/dmp-frontend/src/app/ui/dmp/overview/dmp-overview.component.scss index 9833fa58d..be9a2b39b 100644 --- a/dmp-frontend/src/app/ui/dmp/overview/dmp-overview.component.scss +++ b/dmp-frontend/src/app/ui/dmp/overview/dmp-overview.component.scss @@ -31,7 +31,9 @@ .account-icon { font-size: 2.5em; -} + height: auto; + width: auto; + } // ********BUTTONS******** @@ -42,7 +44,7 @@ align-self: center; } -.dataset-btn { +.description-btn { width: 36.1em; padding: 0 1.1em; background-color: var(--secondary-color); @@ -52,7 +54,7 @@ // opacity: 0.8; } -.dataset-finalized-btn { +.description-finalized-btn { width: 36.1em; padding: 0 1.1em; background-color: #b2f772; @@ -179,11 +181,11 @@ margin-bottom: 1.875em; } -.dataset { +.description { width: fit-content; } -.dataset-btn-label { +.description-btn-label { margin-right: 1em; overflow: hidden; text-overflow: ellipsis; @@ -291,20 +293,20 @@ } .dmp-label, -.dataset-btn, -.dataset-finalized-btn, -.add-dataset-btn, +.description-btn, +.description-finalized-btn, +.add-description-btn, .doi-panel, .researcher { display: flex; align-items: center; } -.add-dataset-btn { +.add-description-btn { color: #212121 !important; } -.add-dataset-btn:hover { +.add-description-btn:hover { color: var(--primary-color) !important; } @@ -456,7 +458,7 @@ // color: var(--primary-color-3); // } -// .dataset-card { +// .description-card { // display: flex; // flex-direction: column; // min-width: 0; @@ -473,7 +475,7 @@ // box-shadow: 0 1px 4px 0 rgba(0, 0, 0, 0.14); // } -// .dataset-card h4 { +// .description-card h4 { // padding-left: 1em; // margin: 1em 1.5em; // } @@ -544,12 +546,12 @@ // text-overflow: ellipsis; // } -// .datasets-counter { +// .descriptions-counter { // display: flex; // cursor: pointer; // } -// .datasets-counter :hover { +// .descriptions-counter :hover { // color: var(--primary-color-3) !important; // } diff --git a/dmp-frontend/src/app/ui/dmp/overview/dmp-overview.component.ts b/dmp-frontend/src/app/ui/dmp/overview/dmp-overview.component.ts index d5782a629..72d2f18e3 100644 --- a/dmp-frontend/src/app/ui/dmp/overview/dmp-overview.component.ts +++ b/dmp-frontend/src/app/ui/dmp/overview/dmp-overview.component.ts @@ -1,61 +1,41 @@ import { Component, ElementRef, OnInit, ViewChild } from '@angular/core'; import { MatDialog } from '@angular/material/dialog'; import { ActivatedRoute, Params, Router } from '@angular/router'; -import { DatasetStatus } from '@app/core/common/enum/dataset-status'; import { DmpStatus } from '@app/core/common/enum/dmp-status'; -import { DatasetOverviewModel } from '@app/core/model/dataset/dataset-overview'; -import { DatasetsToBeFinalized } from '@app/core/model/dataset/datasets-toBeFinalized'; import { UserInfoListingModel } from '@app/core/model/user/user-info-listing'; import { AuthService } from '@app/core/services/auth/auth.service'; -import { DmpService, DmpServiceNew } from '@app/core/services/dmp/dmp.service'; +import { DmpServiceNew } from '@app/core/services/dmp/dmp.service'; import { SnackBarNotificationLevel, UiNotificationService } from '@app/core/services/notification/ui-notification-service'; -import { - DmpFinalizeDialogComponent, - DmpFinalizeDialogInput, - DmpFinalizeDialogOutput -} from '@app/ui/dmp/editor/dmp-finalize-dialog/dmp-finalize-dialog.component'; import { ConfirmationDialogComponent } from '@common/modules/confirmation-dialog/confirmation-dialog.component'; // import {BreadcrumbItem} from '@app/ui/misc/breadcrumb/definition/breadcrumb-item'; import { Location } from '@angular/common'; -import { UntypedFormGroup } from '@angular/forms'; -import { DmpBlueprintSectionFieldCategory } from '@app/core/common/enum/dmp-blueprint-section-field-category'; -import { DmpBlueprintSystemFieldType } from '@app/core/common/enum/dmp-blueprint-system-field-type'; -import { Role } from "@app/core/common/enum/role"; +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'; +import { ReferenceType } from '@app/core/common/enum/reference-type'; import { DepositConfigurationModel } from '@app/core/model/deposit/deposit-configuration'; -import { DescriptionTemplatesInSection, DmpBlueprint, DmpBlueprintDefinition, DmpBlueprintDefinitionSection, FieldInSection } from '@app/core/model/dmp-blueprint/dmp-blueprint'; -import { Dmp, Dmp, DmpUser } from '@app/core/model/dmp/dmp'; +import { Description } from '@app/core/model/description/description'; +import { Dmp, DmpUser } from '@app/core/model/dmp/dmp'; import { DoiModel } from '@app/core/model/doi/doi'; -import { VersionListingModel } from '@app/core/model/version/version-listing.model'; +import { EntityDoi } from '@app/core/model/entity-doi/entity-doi'; +import { DmpReference, Reference } from '@app/core/model/reference/reference'; import { ConfigurationService } from '@app/core/services/configuration/configuration.service'; import { DepositRepositoriesService } from '@app/core/services/deposit-repositories/deposit-repositories.service'; import { DmpBlueprintService } from '@app/core/services/dmp/dmp-blueprint.service'; import { LockService } from '@app/core/services/lock/lock.service'; import { MatomoService } from '@app/core/services/matomo/matomo-service'; +import { ReferenceService } from '@app/core/services/reference/reference.service'; +import { EnumUtils } from '@app/core/services/utilities/enum-utils.service'; import { FileUtils } from '@app/core/services/utilities/file-utils.service'; import { PopupNotificationDialogComponent } from '@app/library/notification/popup/popup-notification.component'; -import { isNullOrUndefined } from '@app/utilities/enhancers/utils'; import { BaseComponent } from '@common/base/base.component'; import { Guid } from '@common/types/guid'; import { TranslateService } from '@ngx-translate/core'; -import * as FileSaver from 'file-saver'; -import { Observable } from 'rxjs'; -import { map, takeUntil } from 'rxjs/operators'; +import { takeUntil } from 'rxjs/operators'; import { nameof } from 'ts-simple-nameof'; -import { CloneDialogComponent } from '../clone/clone-dialog/clone-dialog.component'; -import { DmpEditorModel } from '../editor/dmp-editor.model'; -import { ExtraPropertiesFormModel } from '../editor/general-tab/extra-properties-form.model'; -import { FunderFormModel } from '../editor/grant-tab/funder-form-model'; -import { GrantTabModel } from '../editor/grant-tab/grant-tab-model'; -import { ProjectFormModel } from '../editor/grant-tab/project-form-model'; -import { DmpInvitationDialogComponent } from '../invitation/dmp-invitation-dialog.component'; -import { StartNewDmpDialogComponent } from '../start-new-dmp-dialogue/start-new-dmp-dialog.component'; -import { EntityDoi } from '@app/core/model/entity-doi/entity-doi'; -import { DmpUserRole } from '@app/core/common/enum/dmp-user-role'; -import { DmpAccessType } from '@app/core/common/enum/dmp-access-type'; -import { Description } from '@app/core/model/description/description'; @Component({ selector: 'app-dmp-overview', @@ -65,6 +45,7 @@ import { Description } from '@app/core/model/description/description'; export class DmpOverviewComponent extends BaseComponent implements OnInit { dmp: Dmp; + researchers: DmpReference[] = []; isNew = true; isFinalized = false; isPublicView = true; @@ -73,8 +54,7 @@ export class DmpOverviewComponent extends BaseComponent implements OnInit { isUserOwner: boolean; lockStatus: Boolean; textMessage: any; - versions: VersionListingModel[]; - version: VersionListingModel; + pastVersions: Dmp[]; //TODO: get these from the backend selectedModel: EntityDoi; @ViewChild('doi') @@ -82,7 +62,11 @@ export class DmpOverviewComponent extends BaseComponent implements OnInit { depositRepos: DepositConfigurationModel[] = []; - formGroup: UntypedFormGroup; + descriptionStatusEnum = DescriptionStatus; + dmpAccessTypeEnum = DmpAccessType; + referenceTypeEnum = ReferenceType; + dmpStatusEnum = DmpStatus; + dmpUserRoleEnum = DmpUserRole; constructor( private route: ActivatedRoute, @@ -99,7 +83,9 @@ export class DmpOverviewComponent extends BaseComponent implements OnInit { private location: Location, private lockService: LockService, private matomoService: MatomoService, - private fileUtils: FileUtils + private fileUtils: FileUtils, + public referenceService: ReferenceService, + public enumUtils: EnumUtils ) { super(); } @@ -119,6 +105,7 @@ export class DmpOverviewComponent extends BaseComponent implements OnInit { .pipe(takeUntil(this._destroyed)) .subscribe(data => { this.dmp = data; + this.researchers = this.referenceService.getReferencesForTypes(this.dmp?.dmpReferences, [ReferenceType.Researcher]); if (!this.hasDoi()) { this.selectedModel = this.dmp.entityDois[0]; } @@ -146,6 +133,7 @@ export class DmpOverviewComponent extends BaseComponent implements OnInit { .pipe(takeUntil(this._destroyed)) .subscribe(data => { this.dmp = data; + this.researchers = this.referenceService.getReferencesForTypes(this.dmp?.dmpReferences, [ReferenceType.Researcher]); if (!this.hasDoi()) { this.selectedModel = this.dmp.entityDois[0]; } @@ -279,7 +267,7 @@ export class DmpOverviewComponent extends BaseComponent implements OnInit { // maxHeight: '80vh', // data: { // formGroup: this.formGroup, - // datasets: this.dmp.datasets, + // descriptions: this.dmp.descriptions, // isNewVersion: isNewVersion, // confirmButton: this.language.instant('DMP-EDITOR.CLONE-DIALOG.SAVE'), // cancelButton: this.language.instant('DMP-EDITOR.CLONE-DIALOG.CANCEL'), @@ -426,8 +414,8 @@ export class DmpOverviewComponent extends BaseComponent implements OnInit { return dmp.status == DmpStatus.Finalized; } - isPublishedDMP(dmp: Dmp) { - return (dmp.status == DmpStatus.Finalized && dmp.accessType === DmpAccessType.Public); + isPublishedDmp() { + return (this.dmp.status == DmpStatus.Finalized && this.dmp.accessType === DmpAccessType.Public); } hasDoi() { @@ -471,7 +459,7 @@ export class DmpOverviewComponent extends BaseComponent implements OnInit { // const dialogInputModel: DmpFinalizeDialogInput = { // dmpLabel: this.dmp.label, // dmpDescription: this.dmp.description, - // datasets: this.dmp.datasets.map(x => { + // descriptions: this.dmp.descriptions.map(x => { // return { label: x.label, id: x.id, status: x.status } // }), // accessRights: extraProperties.visible @@ -492,10 +480,10 @@ export class DmpOverviewComponent extends BaseComponent implements OnInit { // if (result && !result.cancelled) { // this.checkIfAnyProfileIsUsedLessThanMin(data).subscribe(checked => { // if (!checked) { - // var datasetsToBeFinalized: DatasetsToBeFinalized = { - // uuids: result.datasetsToBeFinalized + // var descriptionsToBeFinalized: DescriptionsToBeFinalized = { + // uuids: result.descriptionsToBeFinalized // }; - // this.dmpService.finalize(datasetsToBeFinalized, this.dmp.id) + // this.dmpService.finalize(descriptionsToBeFinalized, this.dmp.id) // .pipe(takeUntil(this._destroyed)) // .subscribe( // complete => { @@ -536,8 +524,8 @@ export class DmpOverviewComponent extends BaseComponent implements OnInit { // if (!(template.minMultiplicity > 0)) // return false; // let count = 0; - // dmp.datasets.filter(dataset => dataset.dmpSectionIndex === (section.ordinal - 1)).forEach(dataset => { - // if (Guid.parse(dataset.profile.id) === template.descriptionTemplateId) { + // dmp.descriptions.filter(description => description.dmpSectionIndex === (section.ordinal - 1)).forEach(description => { + // if (Guid.parse(description.profile.id) === template.descriptionTemplateId) { // count++; // } // }) @@ -693,15 +681,13 @@ export class DmpOverviewComponent extends BaseComponent implements OnInit { return this.configurationService.orcidPath; } - isOrcid(reference: string) { - const head = reference.split(':')[0]; - return head === 'orcid'; + isOrcid(reference: Reference) { + return reference.source === 'orcid'; } getOrcidPathForResearcher(reference: string): string { const path = this.getOrcidPath(); - const userId = reference.split(':')[1]; - return path + userId; + return path + reference; } checkLockStatus(id: Guid) { @@ -727,24 +713,24 @@ export class DmpOverviewComponent extends BaseComponent implements OnInit { nameof(x => x.accessType), nameof(x => x.version), nameof(x => x.groupId), + nameof(x => x.version), nameof(x => x.updatedAt), [nameof(x => x.entityDois), nameof(x => x.id)].join('.'), [nameof(x => x.entityDois), nameof(x => x.repositoryId)].join('.'), [nameof(x => x.entityDois), nameof(x => x.doi)].join('.'), [nameof(x => x.descriptions), nameof(x => x.id)].join('.'), [nameof(x => x.descriptions), nameof(x => x.label)].join('.'), - // [nameof(x => x.descriptionTemplate), nameof(x => x.label)].join('.'), - // [nameof(x => x.dmp), nameof(x => x.id)].join('.'), - // [nameof(x => x.dmp), nameof(x => x.label)].join('.'), - // [nameof(x => x.dmp), nameof(x => x.accessType)].join('.'), + [nameof(x => x.descriptions), nameof(x => x.status)].join('.'), [nameof(x => x.dmpUsers), nameof(x => x.id)].join('.'), [nameof(x => x.dmpUsers), nameof(x => x.user.id)].join('.'), + [nameof(x => x.dmpUsers), nameof(x => x.user.name)].join('.'), [nameof(x => x.dmpUsers), nameof(x => x.role)].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('.'), - // [nameof(x => x.dmp), nameof(x => x.dmpReferences), nameof(x => x.reference), nameof(x => x.type)].join('.'), - // [nameof(x => x.dmp), nameof(x => x.dmpReferences), nameof(x => x.reference), nameof(x => x.reference)].join('.'), + [nameof(x => x.dmpReferences), nameof(x => x.id)].join('.'), + [nameof(x => x.dmpReferences), nameof(x => x.reference), nameof(x => x.id)].join('.'), + [nameof(x => x.dmpReferences), nameof(x => x.reference), nameof(x => x.label)].join('.'), + [nameof(x => x.dmpReferences), nameof(x => x.reference), nameof(x => x.type)].join('.'), + [nameof(x => x.dmpReferences), nameof(x => x.reference), nameof(x => x.source)].join('.'), + [nameof(x => x.dmpReferences), nameof(x => x.reference), nameof(x => x.reference)].join('.'), ] } } diff --git a/dmp-frontend/src/assets/i18n/en.json b/dmp-frontend/src/assets/i18n/en.json index d31564dfb..743b014eb 100644 --- a/dmp-frontend/src/assets/i18n/en.json +++ b/dmp-frontend/src/assets/i18n/en.json @@ -872,16 +872,39 @@ } }, "DMP-OVERVIEW": { - "GRANT": "Grant", - "DMP-AUTHORS": "DΜP Authors", - "RESEARCHERS": "Researchers", - "DESCRIPTIONS-USED": "Descriptions used", - "COLLABORATORS": "Collaborators", + "TITLE": "DMP", "PUBLIC": "Public", - "PRIVATE": "Private", "LOCKED": "Locked", - "UNLOCKED": "Unlocked", + "VERSION":"Version", + "EDITED": "Edited", + "FINALISED": "Finalized", + "GRANT": "Grant", + "RESEARCHERS": "Researchers", + "DESCRIPTION": "Description", + "DESCRIPTIONS": "Descriptions included", + "DOI-PROVIDED": "DOI provided by", + "DMP-AUTHORS": "DΜP Authors", "YOU": "you", + "ACTIONS": { + "BACK":"Back", + "EDIT":"Edit", + "CLONE":"Clone", + "DELETE":"Delete", + "ADD-DESCRIPTION": "Add Description", + "COPY":"Copy", + "FINALIZE":"Finalize", + "VISIT-WEBSITE": "Visit Website", + "REVERSE":"Undo Finalization", + "EXPORT":"Export", + "NEW-VERSION":"Start new version", + "INVITE-SHORT": "Invite", + "REMOVE-AUTHOR": "Remove" + }, + + + "COLLABORATORS": "Collaborators", + "PRIVATE": "Private", + "UNLOCKED": "Unlocked", "LOCK": "Lock", "TOOLTIP": { "LEVEL-OF-ACCESS": "Level of Access", @@ -937,7 +960,8 @@ "FINALIZE":"Finalize", "REVERSE":"Undo Finalization", "EXPORT":"Export", - "INVITE-SHORT": "Invite" + "INVITE-SHORT": "Invite", + "REMOVE-AUTHOR": "Remove" }, "COPY-DIALOG": { "COPY": "Copy",