fix public pages

This commit is contained in:
Efstratios Giannopoulos 2024-06-28 18:26:18 +03:00
parent 9a455ad873
commit b45bff4452
18 changed files with 112 additions and 92 deletions

View File

@ -1,5 +1,6 @@
package org.opencdmp.data; package org.opencdmp.data;
import jakarta.persistence.*;
import org.opencdmp.commons.enums.DmpAccessType; import org.opencdmp.commons.enums.DmpAccessType;
import org.opencdmp.commons.enums.DmpStatus; import org.opencdmp.commons.enums.DmpStatus;
import org.opencdmp.commons.enums.DmpVersionStatus; 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.DmpVersionStatusConverter;
import org.opencdmp.data.converters.enums.IsActiveConverter; import org.opencdmp.data.converters.enums.IsActiveConverter;
import org.opencdmp.data.tenant.TenantScopedBaseEntity; import org.opencdmp.data.tenant.TenantScopedBaseEntity;
import jakarta.persistence.*;
import java.time.Instant; import java.time.Instant;
import java.util.UUID; import java.util.UUID;
@ -110,7 +110,7 @@ public class DmpEntity extends TenantScopedBaseEntity {
public static final String _publicAfter = "publicAfter"; public static final String _publicAfter = "publicAfter";
public UUID getId() { public UUID getId() {
return id; return this.id;
} }
public void setId(UUID id) { public void setId(UUID id) {
@ -118,7 +118,7 @@ public class DmpEntity extends TenantScopedBaseEntity {
} }
public String getLabel() { public String getLabel() {
return label; return this.label;
} }
public void setLabel(String label) { public void setLabel(String label) {
@ -126,7 +126,7 @@ public class DmpEntity extends TenantScopedBaseEntity {
} }
public Short getVersion() { public Short getVersion() {
return version; return this.version;
} }
public void setVersion(Short version) { public void setVersion(Short version) {
@ -134,7 +134,7 @@ public class DmpEntity extends TenantScopedBaseEntity {
} }
public DmpStatus getStatus() { public DmpStatus getStatus() {
return status; return this.status;
} }
public void setStatus(DmpStatus status) { public void setStatus(DmpStatus status) {
@ -142,7 +142,7 @@ public class DmpEntity extends TenantScopedBaseEntity {
} }
public String getProperties() { public String getProperties() {
return properties; return this.properties;
} }
public void setProperties(String properties) { public void setProperties(String properties) {
@ -150,7 +150,7 @@ public class DmpEntity extends TenantScopedBaseEntity {
} }
public UUID getGroupId() { public UUID getGroupId() {
return groupId; return this.groupId;
} }
public void setGroupId(UUID groupId) { public void setGroupId(UUID groupId) {
@ -158,7 +158,7 @@ public class DmpEntity extends TenantScopedBaseEntity {
} }
public String getDescription() { public String getDescription() {
return description; return this.description;
} }
public void setDescription(String description) { public void setDescription(String description) {
@ -166,7 +166,7 @@ public class DmpEntity extends TenantScopedBaseEntity {
} }
public Instant getCreatedAt() { public Instant getCreatedAt() {
return createdAt; return this.createdAt;
} }
public void setCreatedAt(Instant createdAt) { public void setCreatedAt(Instant createdAt) {
@ -174,7 +174,7 @@ public class DmpEntity extends TenantScopedBaseEntity {
} }
public Instant getUpdatedAt() { public Instant getUpdatedAt() {
return updatedAt; return this.updatedAt;
} }
public void setUpdatedAt(Instant updatedAt) { public void setUpdatedAt(Instant updatedAt) {
@ -182,7 +182,7 @@ public class DmpEntity extends TenantScopedBaseEntity {
} }
public IsActive getIsActive() { public IsActive getIsActive() {
return isActive; return this.isActive;
} }
public void setIsActive(IsActive isActive) { public void setIsActive(IsActive isActive) {
@ -190,7 +190,7 @@ public class DmpEntity extends TenantScopedBaseEntity {
} }
public Instant getFinalizedAt() { public Instant getFinalizedAt() {
return finalizedAt; return this.finalizedAt;
} }
public void setFinalizedAt(Instant finalizedAt) { public void setFinalizedAt(Instant finalizedAt) {
@ -198,7 +198,7 @@ public class DmpEntity extends TenantScopedBaseEntity {
} }
public UUID getCreatorId() { public UUID getCreatorId() {
return creatorId; return this.creatorId;
} }
public void setCreatorId(UUID creatorId) { public void setCreatorId(UUID creatorId) {
@ -206,7 +206,7 @@ public class DmpEntity extends TenantScopedBaseEntity {
} }
public DmpAccessType getAccessType() { public DmpAccessType getAccessType() {
return accessType; return this.accessType;
} }
public void setAccessType(DmpAccessType accessType) { public void setAccessType(DmpAccessType accessType) {
@ -214,7 +214,7 @@ public class DmpEntity extends TenantScopedBaseEntity {
} }
public UUID getBlueprintId() { public UUID getBlueprintId() {
return blueprintId; return this.blueprintId;
} }
public void setBlueprintId(UUID blueprintId) { public void setBlueprintId(UUID blueprintId) {
@ -222,7 +222,7 @@ public class DmpEntity extends TenantScopedBaseEntity {
} }
public String getLanguage() { public String getLanguage() {
return language; return this.language;
} }
public void setLanguage(String language) { public void setLanguage(String language) {
@ -230,7 +230,7 @@ public class DmpEntity extends TenantScopedBaseEntity {
} }
public Instant getPublicAfter() { public Instant getPublicAfter() {
return publicAfter; return this.publicAfter;
} }
public void setPublicAfter(Instant publicAfter) { public void setPublicAfter(Instant publicAfter) {
@ -238,7 +238,7 @@ public class DmpEntity extends TenantScopedBaseEntity {
} }
public DmpVersionStatus getVersionStatus() { public DmpVersionStatus getVersionStatus() {
return versionStatus; return this.versionStatus;
} }
public void setVersionStatus(DmpVersionStatus versionStatus) { public void setVersionStatus(DmpVersionStatus versionStatus) {

View File

@ -2,4 +2,5 @@ export enum RecentActivityOrder {
UpdatedAt = 0, UpdatedAt = 0,
Label = 1, Label = 1,
Status = 2, Status = 2,
PublishedAt = 3,
} }

View File

@ -230,6 +230,7 @@ export class EnumUtils {
case RecentActivityOrder.Label: return this.language.instant('TYPES.RECENT-ACTIVITY-ORDER.LABEL'); 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.UpdatedAt: return this.language.instant('TYPES.RECENT-ACTIVITY-ORDER.MODIFIED');
case RecentActivityOrder.Status: return this.language.instant('TYPES.RECENT-ACTIVITY-ORDER.STATUS'); 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');
} }
} }

View File

@ -46,6 +46,7 @@
<mat-form-field class="sort-form w-100"> <mat-form-field class="sort-form w-100">
<mat-select placeholder="{{'GENERAL.CRITERIA.LIKE'| translate}}" [formControl]="formGroup.get('order')" (selectionChange)="orderByChanged()"> <mat-select placeholder="{{'GENERAL.CRITERIA.LIKE'| translate}}" [formControl]="formGroup.get('order')" (selectionChange)="orderByChanged()">
<mat-option *ngIf="!isPublic" [value]="order.UpdatedAt">{{enumUtils.toRecentActivityOrderString(order.UpdatedAt)}}</mat-option> <mat-option *ngIf="!isPublic" [value]="order.UpdatedAt">{{enumUtils.toRecentActivityOrderString(order.UpdatedAt)}}</mat-option>
<mat-option *ngIf="isPublic" [value]="order.PublishedAt">{{enumUtils.toRecentActivityOrderString(order.PublishedAt)}}</mat-option>
<mat-option [value]="order.Label">{{enumUtils.toRecentActivityOrderString(order.Label)}}</mat-option> <mat-option [value]="order.Label">{{enumUtils.toRecentActivityOrderString(order.Label)}}</mat-option>
<mat-option *ngIf="!isPublic" [value]="order.Status">{{enumUtils.toRecentActivityOrderString(order.Status)}}</mat-option> <mat-option *ngIf="!isPublic" [value]="order.Status">{{enumUtils.toRecentActivityOrderString(order.Status)}}</mat-option>
</mat-select> </mat-select>

View File

@ -192,7 +192,7 @@ export class DescriptionListingComponent extends BaseListingComponent<BaseDescri
lookup.page = { offset: 0, size: this.ITEMS_PER_PAGE }; lookup.page = { offset: 0, size: this.ITEMS_PER_PAGE };
lookup.isActive = [IsActive.Active]; lookup.isActive = [IsActive.Active];
let recentActivityOrder = this.isPublic ? this.toAscSortField(nameof<Description>(x => x.label)) : this.toDescSortField(nameof<Description>(x => x.updatedAt)); let recentActivityOrder = this.isPublic ? this.toDescSortField(nameof<Description>(x => x.finalizedAt)) : this.toDescSortField(nameof<Description>(x => x.updatedAt));
lookup.order = { items: [recentActivityOrder] }; lookup.order = { items: [recentActivityOrder] };
this.updateOrderUiFields(lookup.order); this.updateOrderUiFields(lookup.order);
@ -247,7 +247,9 @@ export class DescriptionListingComponent extends BaseListingComponent<BaseDescri
this.lookup.order = { items: [this.sortingDirectionPrefix + nameof<Dmp>(x => x.status)] }; this.lookup.order = { items: [this.sortingDirectionPrefix + nameof<Dmp>(x => x.status)] };
} else if (this.formGroup.get('order').value == RecentActivityOrder.Label) { } else if (this.formGroup.get('order').value == RecentActivityOrder.Label) {
this.lookup.order = { items: [this.sortingDirectionPrefix + nameof<Dmp>(x => x.label)] }; this.lookup.order = { items: [this.sortingDirectionPrefix + nameof<Dmp>(x => x.label)] };
} else { } else if (this.formGroup.get('order').value == RecentActivityOrder.PublishedAt) {
this.lookup.order = { items: [this.sortingDirectionPrefix + nameof<Dmp>(x => x.finalizedAt)] };
}else {
this.lookup.order = { items: [this.sortingDirectionPrefix + nameof<Dmp>(x => x.updatedAt)] }; this.lookup.order = { items: [this.sortingDirectionPrefix + nameof<Dmp>(x => x.updatedAt)] };
} }
this.filterChanged(this.lookup); this.filterChanged(this.lookup);
@ -371,6 +373,7 @@ export class DescriptionListingComponent extends BaseListingComponent<BaseDescri
switch (recentActivityOrderValue) { switch (recentActivityOrderValue) {
case nameof<Description>(x => x.updatedAt): return RecentActivityOrder.UpdatedAt; case nameof<Description>(x => x.updatedAt): return RecentActivityOrder.UpdatedAt;
case nameof<Description>(x => x.label): return RecentActivityOrder.Label; case nameof<Description>(x => x.label): return RecentActivityOrder.Label;
case nameof<Description>(x => x.finalizedAt): return RecentActivityOrder.PublishedAt;
case nameof<Description>(x => x.status): return RecentActivityOrder.Status; case nameof<Description>(x => x.status): return RecentActivityOrder.Status;
} }
} }

View File

@ -32,7 +32,7 @@
<mat-form-field class="sort-form w-100"> <mat-form-field class="sort-form w-100">
<mat-select placeholder="{{'GENERAL.CRITERIA.LIKE'| translate}}" [formControl]="formGroup.get('order')" (selectionChange)="orderByChanged()"> <mat-select placeholder="{{'GENERAL.CRITERIA.LIKE'| translate}}" [formControl]="formGroup.get('order')" (selectionChange)="orderByChanged()">
<mat-option *ngIf="!isPublic" [value]="order.UpdatedAt">{{enumUtils.toRecentActivityOrderString(order.UpdatedAt)}}</mat-option> <mat-option *ngIf="!isPublic" [value]="order.UpdatedAt">{{enumUtils.toRecentActivityOrderString(order.UpdatedAt)}}</mat-option>
<!-- <mat-option *ngIf="isPublic" [value]="order.PUBLISHED">{{enumUtils.toRecentActivityOrderString(order.PUBLISHED)}}</mat-option> --> <mat-option *ngIf="isPublic" [value]="order.PublishedAt">{{enumUtils.toRecentActivityOrderString(order.PublishedAt)}}</mat-option>
<mat-option [value]="order.Label">{{enumUtils.toRecentActivityOrderString(order.Label)}}</mat-option> <mat-option [value]="order.Label">{{enumUtils.toRecentActivityOrderString(order.Label)}}</mat-option>
<mat-option *ngIf="!isPublic" [value]="order.Status">{{enumUtils.toRecentActivityOrderString(order.Status)}}</mat-option> <mat-option *ngIf="!isPublic" [value]="order.Status">{{enumUtils.toRecentActivityOrderString(order.Status)}}</mat-option>
</mat-select> </mat-select>

View File

@ -206,7 +206,7 @@ export class DmpListingComponent extends BaseListingComponent<BaseDmp, DmpLookup
lookup.page = { offset: 0, size: this.ITEMS_PER_PAGE }; lookup.page = { offset: 0, size: this.ITEMS_PER_PAGE };
lookup.isActive = [IsActive.Active]; lookup.isActive = [IsActive.Active];
let recentActivityOrder = this.isPublic ? this.toAscSortField(nameof<Description>(x => x.label)) : this.toDescSortField(nameof<Description>(x => x.updatedAt)); let recentActivityOrder = this.isPublic ? this.toDescSortField(nameof<Description>(x => x.finalizedAt)) : this.toDescSortField(nameof<Description>(x => x.updatedAt));
lookup.order = { items: [recentActivityOrder] }; lookup.order = { items: [recentActivityOrder] };
this.updateOrderUiFields(lookup.order); this.updateOrderUiFields(lookup.order);
@ -246,7 +246,9 @@ export class DmpListingComponent extends BaseListingComponent<BaseDmp, DmpLookup
this.lookup.order = { items: [this.sortingDirectionPrefix + nameof<Dmp>(x => x.status)] }; this.lookup.order = { items: [this.sortingDirectionPrefix + nameof<Dmp>(x => x.status)] };
} else if (this.formGroup.get('order').value == RecentActivityOrder.Label) { } else if (this.formGroup.get('order').value == RecentActivityOrder.Label) {
this.lookup.order = { items: [this.sortingDirectionPrefix + nameof<Dmp>(x => x.label)] }; this.lookup.order = { items: [this.sortingDirectionPrefix + nameof<Dmp>(x => x.label)] };
} else { } else if (this.formGroup.get('order').value == RecentActivityOrder.PublishedAt){
this.lookup.order = { items: [this.sortingDirectionPrefix + nameof<Dmp>(x => x.finalizedAt)] };
}else {
this.lookup.order = { items: [this.sortingDirectionPrefix + nameof<Dmp>(x => x.updatedAt)] }; this.lookup.order = { items: [this.sortingDirectionPrefix + nameof<Dmp>(x => x.updatedAt)] };
} }
this.filterChanged(this.lookup); this.filterChanged(this.lookup);
@ -342,6 +344,7 @@ export class DmpListingComponent extends BaseListingComponent<BaseDmp, DmpLookup
switch (recentActivityOrderValue) { switch (recentActivityOrderValue) {
case nameof<Dmp>(x => x.updatedAt): return RecentActivityOrder.UpdatedAt; case nameof<Dmp>(x => x.updatedAt): return RecentActivityOrder.UpdatedAt;
case nameof<Dmp>(x => x.label): return RecentActivityOrder.Label; case nameof<Dmp>(x => x.label): return RecentActivityOrder.Label;
case nameof<Dmp>(x => x.finalizedAt): return RecentActivityOrder.PublishedAt;
case nameof<Dmp>(x => x.status): return RecentActivityOrder.Status; case nameof<Dmp>(x => x.status): return RecentActivityOrder.Status;
} }
} }

View File

@ -1916,7 +1916,8 @@
"RECENT-ACTIVITY-ORDER": { "RECENT-ACTIVITY-ORDER": {
"LABEL": "Etiketa", "LABEL": "Etiketa",
"MODIFIED": "Aldatuta", "MODIFIED": "Aldatuta",
"STATUS": "Egoera" "STATUS": "Egoera",
"PUBLISHED-AT": "Published"
}, },
"DESCRIPTION-TEMPLATE-TYPE-STATUS": { "DESCRIPTION-TEMPLATE-TYPE-STATUS": {
"FINALIZED": "Finalized", "FINALIZED": "Finalized",

View File

@ -1916,7 +1916,8 @@
"RECENT-ACTIVITY-ORDER": { "RECENT-ACTIVITY-ORDER": {
"LABEL": "Label", "LABEL": "Label",
"MODIFIED": "Modified", "MODIFIED": "Modified",
"STATUS": "Status" "STATUS": "Status",
"PUBLISHED-AT": "Published"
}, },
"DESCRIPTION-TEMPLATE-TYPE-STATUS": { "DESCRIPTION-TEMPLATE-TYPE-STATUS": {
"FINALIZED": "Finalized", "FINALIZED": "Finalized",

View File

@ -1916,7 +1916,8 @@
"RECENT-ACTIVITY-ORDER": { "RECENT-ACTIVITY-ORDER": {
"LABEL": "Label", "LABEL": "Label",
"MODIFIED": "Modified", "MODIFIED": "Modified",
"STATUS": "Status" "STATUS": "Status",
"PUBLISHED-AT": "Published"
}, },
"DESCRIPTION-TEMPLATE-TYPE-STATUS": { "DESCRIPTION-TEMPLATE-TYPE-STATUS": {
"FINALIZED": "Finalized", "FINALIZED": "Finalized",

View File

@ -1916,7 +1916,8 @@
"RECENT-ACTIVITY-ORDER": { "RECENT-ACTIVITY-ORDER": {
"LABEL": "Etiqueta", "LABEL": "Etiqueta",
"MODIFIED": "Modificado", "MODIFIED": "Modificado",
"STATUS": "Estado" "STATUS": "Estado",
"PUBLISHED-AT": "Published"
}, },
"DESCRIPTION-TEMPLATE-TYPE-STATUS": { "DESCRIPTION-TEMPLATE-TYPE-STATUS": {
"FINALIZED": "Finalized", "FINALIZED": "Finalized",

View File

@ -1916,7 +1916,8 @@
"RECENT-ACTIVITY-ORDER": { "RECENT-ACTIVITY-ORDER": {
"LABEL": "Ετικέτα", "LABEL": "Ετικέτα",
"MODIFIED": "Τροποποιημένο", "MODIFIED": "Τροποποιημένο",
"STATUS": "Κατάσταση" "STATUS": "Κατάσταση",
"PUBLISHED-AT": "Published"
}, },
"DESCRIPTION-TEMPLATE-TYPE-STATUS": { "DESCRIPTION-TEMPLATE-TYPE-STATUS": {
"FINALIZED": "Finalized", "FINALIZED": "Finalized",

View File

@ -1916,7 +1916,8 @@
"RECENT-ACTIVITY-ORDER": { "RECENT-ACTIVITY-ORDER": {
"LABEL": "Oznaka", "LABEL": "Oznaka",
"MODIFIED": "Izmijenjeno", "MODIFIED": "Izmijenjeno",
"STATUS": "Status" "STATUS": "Status",
"PUBLISHED-AT": "Published"
}, },
"DESCRIPTION-TEMPLATE-TYPE-STATUS": { "DESCRIPTION-TEMPLATE-TYPE-STATUS": {
"FINALIZED": "Finalized", "FINALIZED": "Finalized",

View File

@ -1916,7 +1916,8 @@
"RECENT-ACTIVITY-ORDER": { "RECENT-ACTIVITY-ORDER": {
"LABEL": "Etykieta", "LABEL": "Etykieta",
"MODIFIED": "Zmodyfikowany", "MODIFIED": "Zmodyfikowany",
"STATUS": "Status" "STATUS": "Status",
"PUBLISHED-AT": "Published"
}, },
"DESCRIPTION-TEMPLATE-TYPE-STATUS": { "DESCRIPTION-TEMPLATE-TYPE-STATUS": {
"FINALIZED": "Finalized", "FINALIZED": "Finalized",

View File

@ -1916,7 +1916,8 @@
"RECENT-ACTIVITY-ORDER": { "RECENT-ACTIVITY-ORDER": {
"LABEL": "Etiqueta", "LABEL": "Etiqueta",
"MODIFIED": "Modificado", "MODIFIED": "Modificado",
"STATUS": "Estado" "STATUS": "Estado",
"PUBLISHED-AT": "Published"
}, },
"DESCRIPTION-TEMPLATE-TYPE-STATUS": { "DESCRIPTION-TEMPLATE-TYPE-STATUS": {
"FINALIZED": "Finalized", "FINALIZED": "Finalized",

View File

@ -1916,7 +1916,8 @@
"RECENT-ACTIVITY-ORDER": { "RECENT-ACTIVITY-ORDER": {
"LABEL": "Označenie", "LABEL": "Označenie",
"MODIFIED": "Modifikované", "MODIFIED": "Modifikované",
"STATUS": "Stav" "STATUS": "Stav",
"PUBLISHED-AT": "Published"
}, },
"DESCRIPTION-TEMPLATE-TYPE-STATUS": { "DESCRIPTION-TEMPLATE-TYPE-STATUS": {
"FINALIZED": "Finalized", "FINALIZED": "Finalized",

View File

@ -1916,7 +1916,8 @@
"RECENT-ACTIVITY-ORDER": { "RECENT-ACTIVITY-ORDER": {
"LABEL": "Oznaka", "LABEL": "Oznaka",
"MODIFIED": "Izmenjeno", "MODIFIED": "Izmenjeno",
"STATUS": "Status" "STATUS": "Status",
"PUBLISHED-AT": "Published"
}, },
"DESCRIPTION-TEMPLATE-TYPE-STATUS": { "DESCRIPTION-TEMPLATE-TYPE-STATUS": {
"FINALIZED": "Finalized", "FINALIZED": "Finalized",

View File

@ -1916,7 +1916,8 @@
"RECENT-ACTIVITY-ORDER": { "RECENT-ACTIVITY-ORDER": {
"LABEL": "Etiket", "LABEL": "Etiket",
"MODIFIED": "Değiştirilmiş", "MODIFIED": "Değiştirilmiş",
"STATUS": "Durum" "STATUS": "Durum",
"PUBLISHED-AT": "Published"
}, },
"DESCRIPTION-TEMPLATE-TYPE-STATUS": { "DESCRIPTION-TEMPLATE-TYPE-STATUS": {
"FINALIZED": "Finalized", "FINALIZED": "Finalized",