From b45bff44527c05ba0cedb3c71b49afe09cf7b134 Mon Sep 17 00:00:00 2001 From: sgiannopoulos Date: Fri, 28 Jun 2024 18:26:18 +0300 Subject: [PATCH] fix public pages --- .../java/org/opencdmp/data/DmpEntity.java | 36 +++++++-------- .../core/common/enum/recent-activity-order.ts | 1 + .../services/utilities/enum-utils.service.ts | 1 + .../description-listing.component.html | 5 ++- .../listing/description-listing.component.ts | 35 ++++++++------- .../ui/dmp/listing/dmp-listing.component.html | 4 +- .../ui/dmp/listing/dmp-listing.component.ts | 45 ++++++++++--------- dmp-frontend/src/assets/i18n/baq.json | 7 +-- dmp-frontend/src/assets/i18n/de.json | 7 +-- dmp-frontend/src/assets/i18n/en.json | 7 +-- dmp-frontend/src/assets/i18n/es.json | 7 +-- dmp-frontend/src/assets/i18n/gr.json | 7 +-- dmp-frontend/src/assets/i18n/hr.json | 7 +-- dmp-frontend/src/assets/i18n/pl.json | 7 +-- dmp-frontend/src/assets/i18n/pt.json | 7 +-- dmp-frontend/src/assets/i18n/sk.json | 7 +-- dmp-frontend/src/assets/i18n/sr.json | 7 +-- dmp-frontend/src/assets/i18n/tr.json | 7 +-- 18 files changed, 112 insertions(+), 92 deletions(-) diff --git a/backend/core/src/main/java/org/opencdmp/data/DmpEntity.java b/backend/core/src/main/java/org/opencdmp/data/DmpEntity.java index 27646a807..970734a60 100644 --- a/backend/core/src/main/java/org/opencdmp/data/DmpEntity.java +++ b/backend/core/src/main/java/org/opencdmp/data/DmpEntity.java @@ -1,5 +1,6 @@ package org.opencdmp.data; +import jakarta.persistence.*; import org.opencdmp.commons.enums.DmpAccessType; import org.opencdmp.commons.enums.DmpStatus; import org.opencdmp.commons.enums.DmpVersionStatus; @@ -9,7 +10,6 @@ import org.opencdmp.data.converters.enums.DmpStatusConverter; import org.opencdmp.data.converters.enums.DmpVersionStatusConverter; import org.opencdmp.data.converters.enums.IsActiveConverter; import org.opencdmp.data.tenant.TenantScopedBaseEntity; -import jakarta.persistence.*; import java.time.Instant; import java.util.UUID; @@ -110,7 +110,7 @@ public class DmpEntity extends TenantScopedBaseEntity { public static final String _publicAfter = "publicAfter"; public UUID getId() { - return id; + return this.id; } public void setId(UUID id) { @@ -118,7 +118,7 @@ public class DmpEntity extends TenantScopedBaseEntity { } public String getLabel() { - return label; + return this.label; } public void setLabel(String label) { @@ -126,7 +126,7 @@ public class DmpEntity extends TenantScopedBaseEntity { } public Short getVersion() { - return version; + return this.version; } public void setVersion(Short version) { @@ -134,7 +134,7 @@ public class DmpEntity extends TenantScopedBaseEntity { } public DmpStatus getStatus() { - return status; + return this.status; } public void setStatus(DmpStatus status) { @@ -142,7 +142,7 @@ public class DmpEntity extends TenantScopedBaseEntity { } public String getProperties() { - return properties; + return this.properties; } public void setProperties(String properties) { @@ -150,7 +150,7 @@ public class DmpEntity extends TenantScopedBaseEntity { } public UUID getGroupId() { - return groupId; + return this.groupId; } public void setGroupId(UUID groupId) { @@ -158,7 +158,7 @@ public class DmpEntity extends TenantScopedBaseEntity { } public String getDescription() { - return description; + return this.description; } public void setDescription(String description) { @@ -166,7 +166,7 @@ public class DmpEntity extends TenantScopedBaseEntity { } public Instant getCreatedAt() { - return createdAt; + return this.createdAt; } public void setCreatedAt(Instant createdAt) { @@ -174,7 +174,7 @@ public class DmpEntity extends TenantScopedBaseEntity { } public Instant getUpdatedAt() { - return updatedAt; + return this.updatedAt; } public void setUpdatedAt(Instant updatedAt) { @@ -182,7 +182,7 @@ public class DmpEntity extends TenantScopedBaseEntity { } public IsActive getIsActive() { - return isActive; + return this.isActive; } public void setIsActive(IsActive isActive) { @@ -190,7 +190,7 @@ public class DmpEntity extends TenantScopedBaseEntity { } public Instant getFinalizedAt() { - return finalizedAt; + return this.finalizedAt; } public void setFinalizedAt(Instant finalizedAt) { @@ -198,7 +198,7 @@ public class DmpEntity extends TenantScopedBaseEntity { } public UUID getCreatorId() { - return creatorId; + return this.creatorId; } public void setCreatorId(UUID creatorId) { @@ -206,7 +206,7 @@ public class DmpEntity extends TenantScopedBaseEntity { } public DmpAccessType getAccessType() { - return accessType; + return this.accessType; } public void setAccessType(DmpAccessType accessType) { @@ -214,7 +214,7 @@ public class DmpEntity extends TenantScopedBaseEntity { } public UUID getBlueprintId() { - return blueprintId; + return this.blueprintId; } public void setBlueprintId(UUID blueprintId) { @@ -222,7 +222,7 @@ public class DmpEntity extends TenantScopedBaseEntity { } public String getLanguage() { - return language; + return this.language; } public void setLanguage(String language) { @@ -230,7 +230,7 @@ public class DmpEntity extends TenantScopedBaseEntity { } public Instant getPublicAfter() { - return publicAfter; + return this.publicAfter; } public void setPublicAfter(Instant publicAfter) { @@ -238,7 +238,7 @@ public class DmpEntity extends TenantScopedBaseEntity { } public DmpVersionStatus getVersionStatus() { - return versionStatus; + return this.versionStatus; } public void setVersionStatus(DmpVersionStatus versionStatus) { diff --git a/dmp-frontend/src/app/core/common/enum/recent-activity-order.ts b/dmp-frontend/src/app/core/common/enum/recent-activity-order.ts index 47439b208..aaae0af6c 100644 --- a/dmp-frontend/src/app/core/common/enum/recent-activity-order.ts +++ b/dmp-frontend/src/app/core/common/enum/recent-activity-order.ts @@ -2,4 +2,5 @@ export enum RecentActivityOrder { UpdatedAt = 0, Label = 1, Status = 2, + PublishedAt = 3, } diff --git a/dmp-frontend/src/app/core/services/utilities/enum-utils.service.ts b/dmp-frontend/src/app/core/services/utilities/enum-utils.service.ts index f8c2819f9..03ba327a4 100644 --- a/dmp-frontend/src/app/core/services/utilities/enum-utils.service.ts +++ b/dmp-frontend/src/app/core/services/utilities/enum-utils.service.ts @@ -230,6 +230,7 @@ export class EnumUtils { case RecentActivityOrder.Label: return this.language.instant('TYPES.RECENT-ACTIVITY-ORDER.LABEL'); case RecentActivityOrder.UpdatedAt: return this.language.instant('TYPES.RECENT-ACTIVITY-ORDER.MODIFIED'); case RecentActivityOrder.Status: return this.language.instant('TYPES.RECENT-ACTIVITY-ORDER.STATUS'); + case RecentActivityOrder.PublishedAt: return this.language.instant('TYPES.RECENT-ACTIVITY-ORDER.PUBLISHED-AT'); } } diff --git a/dmp-frontend/src/app/ui/description/listing/description-listing.component.html b/dmp-frontend/src/app/ui/description/listing/description-listing.component.html index 4a1a60d79..0fb170d2c 100644 --- a/dmp-frontend/src/app/ui/description/listing/description-listing.component.html +++ b/dmp-frontend/src/app/ui/description/listing/description-listing.component.html @@ -27,7 +27,7 @@ -
+
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 97757c523..8ae4c8c41 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 @@ -94,9 +94,9 @@ export class DescriptionListingComponent extends BaseListingComponent 0; } get hasFilters(): boolean { - return (this.lookup.like != null && this.lookup.like != '') || this.lookup.statuses != null || - this.lookup.dmpSubQuery != null || this.lookup.descriptionTemplateSubQuery != null || - this.lookup.descriptionTagSubQuery != null || this.lookup.descriptionReferenceSubQuery != null; + return (this.lookup.like != null && this.lookup.like != '') || this.lookup.statuses != null || + this.lookup.dmpSubQuery != null || this.lookup.descriptionTemplateSubQuery != null || + this.lookup.descriptionTagSubQuery != null || this.lookup.descriptionReferenceSubQuery != null; } constructor( @@ -139,7 +139,7 @@ export class DescriptionListingComponent extends BaseListingComponent(x => x.label)) : this.toDescSortField(nameof(x => x.updatedAt)); + + let recentActivityOrder = this.isPublic ? this.toDescSortField(nameof(x => x.finalizedAt)) : this.toDescSortField(nameof(x => x.updatedAt)); lookup.order = { items: [recentActivityOrder] }; - + this.updateOrderUiFields(lookup.order); lookup.project = { @@ -247,7 +247,9 @@ export class DescriptionListingComponent extends BaseListingComponent(x => x.status)] }; } else if (this.formGroup.get('order').value == RecentActivityOrder.Label) { this.lookup.order = { items: [this.sortingDirectionPrefix + nameof(x => x.label)] }; - } else { + } else if (this.formGroup.get('order').value == RecentActivityOrder.PublishedAt) { + this.lookup.order = { items: [this.sortingDirectionPrefix + nameof(x => x.finalizedAt)] }; + }else { this.lookup.order = { items: [this.sortingDirectionPrefix + nameof(x => x.updatedAt)] }; } this.filterChanged(this.lookup); @@ -371,6 +373,7 @@ export class DescriptionListingComponent extends BaseListingComponent(x => x.updatedAt): return RecentActivityOrder.UpdatedAt; case nameof(x => x.label): return RecentActivityOrder.Label; + case nameof(x => x.finalizedAt): return RecentActivityOrder.PublishedAt; case nameof(x => x.status): return RecentActivityOrder.Status; } } @@ -379,7 +382,7 @@ export class DescriptionListingComponent extends BaseListingComponent 0) { @@ -392,7 +395,7 @@ export class DescriptionListingComponent extends BaseListingComponent 0; if (addDmps || addRoles) { lookup.dmpSubQuery = DescriptionFilterService.initializeDmpLookup(); - + if (addDmps) lookup.dmpSubQuery.ids = dmps?.length > 0 ? dmps : null; if (addRoles) { @@ -420,7 +423,7 @@ export class DescriptionListingComponent extends BaseListingComponent referencesWithType.referenceTypeId != null && referencesWithType.referenceIds?.length > 0) ?? null; } @@ -438,18 +441,18 @@ export class DescriptionListingComponent extends BaseListingComponent(x => x.id), diff --git a/dmp-frontend/src/app/ui/dmp/listing/dmp-listing.component.html b/dmp-frontend/src/app/ui/dmp/listing/dmp-listing.component.html index 94c323818..4f4c85ce8 100644 --- a/dmp-frontend/src/app/ui/dmp/listing/dmp-listing.component.html +++ b/dmp-frontend/src/app/ui/dmp/listing/dmp-listing.component.html @@ -32,7 +32,7 @@ {{enumUtils.toRecentActivityOrderString(order.UpdatedAt)}} - + {{enumUtils.toRecentActivityOrderString(order.PublishedAt)}} {{enumUtils.toRecentActivityOrderString(order.Label)}} {{enumUtils.toRecentActivityOrderString(order.Status)}} @@ -42,7 +42,7 @@ +
diff --git a/dmp-frontend/src/app/ui/dmp/listing/dmp-listing.component.ts b/dmp-frontend/src/app/ui/dmp/listing/dmp-listing.component.ts index 061a25fdb..eb9051701 100644 --- a/dmp-frontend/src/app/ui/dmp/listing/dmp-listing.component.ts +++ b/dmp-frontend/src/app/ui/dmp/listing/dmp-listing.component.ts @@ -43,7 +43,7 @@ import { DmpFilterService } from './filtering/services/dmp-filter.service'; styleUrls: ['./dmp-listing.component.scss'], }) export class DmpListingComponent extends BaseListingComponent implements OnInit { - + userSettingsKey = { key: 'DmpListingUserSettings' }; @ViewChild(MatPaginator, { static: true }) _paginator: MatPaginator; @@ -86,9 +86,9 @@ export class DmpListingComponent extends BaseListingComponent 0; } get hasFilters(): boolean { - return (this.lookup.like != null && this.lookup.like != '') || this.lookup.statuses != null || - this.lookup.dmpReferenceSubQuery != null || this.lookup.dmpDescriptionTemplateSubQuery != null || - this.lookup.dmpBlueprintSubQuery != null || this.lookup.dmpUserSubQuery != null; + return (this.lookup.like != null && this.lookup.like != '') || this.lookup.statuses != null || + this.lookup.dmpReferenceSubQuery != null || this.lookup.dmpDescriptionTemplateSubQuery != null || + this.lookup.dmpBlueprintSubQuery != null || this.lookup.dmpUserSubQuery != null; } constructor( @@ -116,7 +116,7 @@ export class DmpListingComponent extends BaseListingComponent { @@ -129,7 +129,7 @@ export class DmpListingComponent extends BaseListingComponent 0) { @@ -140,7 +140,7 @@ export class DmpListingComponent extends BaseListingComponent(x => x.label)) : this.toDescSortField(nameof(x => x.updatedAt)); + + let recentActivityOrder = this.isPublic ? this.toDescSortField(nameof(x => x.finalizedAt)) : this.toDescSortField(nameof(x => x.updatedAt)); lookup.order = { items: [recentActivityOrder] }; - + this.updateOrderUiFields(lookup.order); lookup.project = { @@ -246,7 +246,9 @@ export class DmpListingComponent extends BaseListingComponent(x => x.status)] }; } else if (this.formGroup.get('order').value == RecentActivityOrder.Label) { this.lookup.order = { items: [this.sortingDirectionPrefix + nameof(x => x.label)] }; - } else { + } else if (this.formGroup.get('order').value == RecentActivityOrder.PublishedAt){ + this.lookup.order = { items: [this.sortingDirectionPrefix + nameof(x => x.finalizedAt)] }; + }else { this.lookup.order = { items: [this.sortingDirectionPrefix + nameof(x => x.updatedAt)] }; } this.filterChanged(this.lookup); @@ -283,7 +285,7 @@ export class DmpListingComponent extends BaseListingComponent(x => x.updatedAt): return RecentActivityOrder.UpdatedAt; case nameof(x => x.label): return RecentActivityOrder.Label; + case nameof(x => x.finalizedAt): return RecentActivityOrder.PublishedAt; case nameof(x => x.status): return RecentActivityOrder.Status; } } @@ -350,7 +353,7 @@ export class DmpListingComponent extends BaseListingComponent 0) { @@ -363,11 +366,11 @@ export class DmpListingComponent extends BaseListingComponent 0) { lookup.dmpBlueprintSubQuery = DmpFilterService.initializeDmpBlueprintLookup(); - lookup.dmpBlueprintSubQuery.ids = dmpBlueprints; + lookup.dmpBlueprintSubQuery.ids = dmpBlueprints; } else lookup.dmpBlueprintSubQuery = null; // Dmps - let roles = formGroup.get("role")?.value !== null ? [formGroup.get("role")?.value] : null; + let roles = formGroup.get("role")?.value !== null ? [formGroup.get("role")?.value] : null; if (roles && roles?.length > 0) { lookup.dmpUserSubQuery = DmpFilterService.initializeDmpUserLookup(); lookup.dmpUserSubQuery.userRoles = roles; @@ -382,7 +385,7 @@ export class DmpListingComponent extends BaseListingComponent 0 ? lookup.statuses[0] : null], descriptionTemplates: lookup.dmpDescriptionTemplateSubQuery?.descriptionTemplateGroupIds ? [lookup.dmpDescriptionTemplateSubQuery?.descriptionTemplateGroupIds] : [], - dmpBlueprints: lookup.dmpBlueprintSubQuery?.ids ? [lookup.dmpBlueprintSubQuery?.ids]: [], + dmpBlueprints: lookup.dmpBlueprintSubQuery?.ids ? [lookup.dmpBlueprintSubQuery?.ids]: [], role: lookup.dmpUserSubQuery?.userRoles ? lookup.dmpUserSubQuery?.userRoles[0] : null, }); } @@ -402,12 +405,12 @@ export class DmpListingComponent extends BaseListingComponent