diff --git a/backend/core/src/main/java/org/opencdmp/commons/enums/DescriptionStatusAvailableActionType.java b/backend/core/src/main/java/org/opencdmp/commons/enums/DescriptionStatusAvailableActionType.java new file mode 100644 index 000000000..a1b37cc66 --- /dev/null +++ b/backend/core/src/main/java/org/opencdmp/commons/enums/DescriptionStatusAvailableActionType.java @@ -0,0 +1,30 @@ +package org.opencdmp.commons.enums; + +import com.fasterxml.jackson.annotation.JsonValue; +import org.opencdmp.data.converters.enums.DatabaseEnum; + +import java.util.Map; + +public enum DescriptionStatusAvailableActionType implements DatabaseEnum { + + Export((short) 0); + + private final Short value; + + DescriptionStatusAvailableActionType(Short value) { + this.value = value; + } + + @Override + @JsonValue + public Short getValue() { + return this.value; + } + + private static final Map map = EnumUtils.getEnumValueMap(DescriptionStatusAvailableActionType.class); + + public static DescriptionStatusAvailableActionType of(Short i) { + return map.get(i); + } + +} diff --git a/backend/core/src/main/java/org/opencdmp/commons/enums/PlanStatusAvailableActionType.java b/backend/core/src/main/java/org/opencdmp/commons/enums/PlanStatusAvailableActionType.java new file mode 100644 index 000000000..5dd7d7aba --- /dev/null +++ b/backend/core/src/main/java/org/opencdmp/commons/enums/PlanStatusAvailableActionType.java @@ -0,0 +1,31 @@ +package org.opencdmp.commons.enums; + +import com.fasterxml.jackson.annotation.JsonValue; +import org.opencdmp.data.converters.enums.DatabaseEnum; + +import java.util.Map; + +public enum PlanStatusAvailableActionType implements DatabaseEnum { + + Deposit((short) 0), + Export((short) 1); + + private final Short value; + + PlanStatusAvailableActionType(Short value) { + this.value = value; + } + + @Override + @JsonValue + public Short getValue() { + return this.value; + } + + private static final Map map = EnumUtils.getEnumValueMap(PlanStatusAvailableActionType.class); + + public static PlanStatusAvailableActionType of(Short i) { + return map.get(i); + } + +} diff --git a/backend/core/src/main/java/org/opencdmp/commons/types/descriptionstatus/DescriptionStatusDefinitionEntity.java b/backend/core/src/main/java/org/opencdmp/commons/types/descriptionstatus/DescriptionStatusDefinitionEntity.java index f7a4a4f84..e2a5d4d0a 100644 --- a/backend/core/src/main/java/org/opencdmp/commons/types/descriptionstatus/DescriptionStatusDefinitionEntity.java +++ b/backend/core/src/main/java/org/opencdmp/commons/types/descriptionstatus/DescriptionStatusDefinitionEntity.java @@ -1,9 +1,9 @@ package org.opencdmp.commons.types.descriptionstatus; -import jakarta.xml.bind.annotation.XmlAccessType; -import jakarta.xml.bind.annotation.XmlAccessorType; -import jakarta.xml.bind.annotation.XmlElement; -import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.*; +import org.opencdmp.commons.enums.DescriptionStatusAvailableActionType; + +import java.util.List; @XmlRootElement(name = "definition") @XmlAccessorType(XmlAccessType.FIELD) @@ -12,7 +12,19 @@ public class DescriptionStatusDefinitionEntity { @XmlElement(name = "authorization") private DescriptionStatusDefinitionAuthorizationEntity authorization; + @XmlElementWrapper(name = "availableActions") + @XmlElement(name = "action") + private List availableActions; + public DescriptionStatusDefinitionAuthorizationEntity getAuthorization() { return this.authorization; } public void setAuthorization(DescriptionStatusDefinitionAuthorizationEntity authorization) { this.authorization = authorization; } + + public List getAvailableActions() { + return availableActions; + } + + public void setAvailableActions(List availableActions) { + this.availableActions = availableActions; + } } diff --git a/backend/core/src/main/java/org/opencdmp/commons/types/planstatus/PlanStatusDefinitionEntity.java b/backend/core/src/main/java/org/opencdmp/commons/types/planstatus/PlanStatusDefinitionEntity.java index 1d8e1d171..6892612b6 100644 --- a/backend/core/src/main/java/org/opencdmp/commons/types/planstatus/PlanStatusDefinitionEntity.java +++ b/backend/core/src/main/java/org/opencdmp/commons/types/planstatus/PlanStatusDefinitionEntity.java @@ -1,6 +1,9 @@ package org.opencdmp.commons.types.planstatus; import jakarta.xml.bind.annotation.*; +import org.opencdmp.commons.enums.PlanStatusAvailableActionType; + +import java.util.List; @XmlRootElement(name = "definition") @XmlAccessorType(XmlAccessType.FIELD) @@ -9,9 +12,21 @@ public class PlanStatusDefinitionEntity { @XmlElement(name = "authorization") private PlanStatusDefinitionAuthorizationEntity authorization; + @XmlElementWrapper(name = "availableActions") + @XmlElement(name = "action") + private List availableActions; + public PlanStatusDefinitionAuthorizationEntity getAuthorization() { return this.authorization; } public void setAuthorization(PlanStatusDefinitionAuthorizationEntity authorization) { this.authorization = authorization; } + + public List getAvailableActions() { + return availableActions; + } + + public void setAvailableActions(List availableActions) { + this.availableActions = availableActions; + } } diff --git a/backend/core/src/main/java/org/opencdmp/model/builder/descriptionstatus/DescriptionStatusDefinitionBuilder.java b/backend/core/src/main/java/org/opencdmp/model/builder/descriptionstatus/DescriptionStatusDefinitionBuilder.java index 797f8055f..adc4d4430 100644 --- a/backend/core/src/main/java/org/opencdmp/model/builder/descriptionstatus/DescriptionStatusDefinitionBuilder.java +++ b/backend/core/src/main/java/org/opencdmp/model/builder/descriptionstatus/DescriptionStatusDefinitionBuilder.java @@ -50,6 +50,7 @@ public class DescriptionStatusDefinitionBuilder extends BaseBuilder availableActions; + public DescriptionStatusDefinitionAuthorization getAuthorization() { return this.authorization; } public void setAuthorization(DescriptionStatusDefinitionAuthorization authorization) { this.authorization = authorization; } + + public List getAvailableActions() { + return availableActions; + } + + public void setAvailableActions(List availableActions) { + this.availableActions = availableActions; + } } diff --git a/backend/core/src/main/java/org/opencdmp/model/persist/descriptionstatus/DescriptionStatusDefinitionPersist.java b/backend/core/src/main/java/org/opencdmp/model/persist/descriptionstatus/DescriptionStatusDefinitionPersist.java index 6e2121027..7f406d40f 100644 --- a/backend/core/src/main/java/org/opencdmp/model/persist/descriptionstatus/DescriptionStatusDefinitionPersist.java +++ b/backend/core/src/main/java/org/opencdmp/model/persist/descriptionstatus/DescriptionStatusDefinitionPersist.java @@ -2,10 +2,10 @@ package org.opencdmp.model.persist.descriptionstatus; import gr.cite.tools.validation.ValidatorFactory; import gr.cite.tools.validation.specification.Specification; +import org.opencdmp.commons.enums.DescriptionStatusAvailableActionType; import org.opencdmp.commons.validation.BaseValidator; import org.opencdmp.convention.ConventionService; import org.opencdmp.errorcode.ErrorThesaurusProperties; -import org.opencdmp.model.descriptionstatus.DescriptionStatusDefinitionAuthorization; import org.springframework.beans.factory.config.ConfigurableBeanFactory; import org.springframework.context.MessageSource; import org.springframework.context.annotation.Scope; @@ -20,9 +20,19 @@ public class DescriptionStatusDefinitionPersist { private DescriptionStatusDefinitionAuthorizationPersist authorization; public final static String _authorization = "authorization"; + private List availableActions; + public final static String _availableActions = "availableActions"; + public DescriptionStatusDefinitionAuthorizationPersist getAuthorization() { return authorization; } public void setAuthorization(DescriptionStatusDefinitionAuthorizationPersist authorization) { this.authorization = authorization; } + public List getAvailableActions() { + return availableActions; + } + + public void setAvailableActions(List availableActions) { + this.availableActions = availableActions; + } @Component(DescriptionStatusDefinitionPersistValidator.ValidatorName) @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) diff --git a/backend/core/src/main/java/org/opencdmp/model/persist/planstatus/PlanStatusDefinitionPersist.java b/backend/core/src/main/java/org/opencdmp/model/persist/planstatus/PlanStatusDefinitionPersist.java index 646f2ad46..ba5cbd03f 100644 --- a/backend/core/src/main/java/org/opencdmp/model/persist/planstatus/PlanStatusDefinitionPersist.java +++ b/backend/core/src/main/java/org/opencdmp/model/persist/planstatus/PlanStatusDefinitionPersist.java @@ -2,6 +2,7 @@ package org.opencdmp.model.persist.planstatus; import gr.cite.tools.validation.ValidatorFactory; import gr.cite.tools.validation.specification.Specification; +import org.opencdmp.commons.enums.PlanStatusAvailableActionType; import org.opencdmp.commons.validation.BaseValidator; import org.opencdmp.convention.ConventionService; import org.opencdmp.errorcode.ErrorThesaurusProperties; @@ -19,11 +20,21 @@ public class PlanStatusDefinitionPersist { public final static String _authorization = "authorization"; private PlanStatusDefinitionAuthorizationPersist authorization = null; + public final static String _availableActions = "availableActions"; + private List availableActions; public PlanStatusDefinitionAuthorizationPersist getAuthorization() { return authorization; } public void setAuthorization(PlanStatusDefinitionAuthorizationPersist authorization) { this.authorization = authorization; } + public List getAvailableActions() { + return availableActions; + } + + public void setAvailableActions(List availableActions) { + this.availableActions = availableActions; + } + @Component(PlanStatusDefinitionPersist.PlanStatusDefinitionPersistValidator.ValidatorName) @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) public static class PlanStatusDefinitionPersistValidator extends BaseValidator { diff --git a/backend/core/src/main/java/org/opencdmp/model/planstatus/PlanStatusDefinition.java b/backend/core/src/main/java/org/opencdmp/model/planstatus/PlanStatusDefinition.java index f310f5bc6..c49049dac 100644 --- a/backend/core/src/main/java/org/opencdmp/model/planstatus/PlanStatusDefinition.java +++ b/backend/core/src/main/java/org/opencdmp/model/planstatus/PlanStatusDefinition.java @@ -1,12 +1,27 @@ package org.opencdmp.model.planstatus; +import org.opencdmp.commons.enums.PlanStatusAvailableActionType; + +import java.util.List; + public class PlanStatusDefinition { public final static String _authorization = "authorization"; private PlanStatusDefinitionAuthorization authorization; + public final static String _availableActions = "availableActions"; + private List availableActions; + public PlanStatusDefinitionAuthorization getAuthorization() { return this.authorization; } public void setAuthorization(PlanStatusDefinitionAuthorization authorization) { this.authorization = authorization; } + + public List getAvailableActions() { + return availableActions; + } + + public void setAvailableActions(List availableActions) { + this.availableActions = availableActions; + } } diff --git a/backend/core/src/main/java/org/opencdmp/service/descriptionstatus/DescriptionStatusServiceImpl.java b/backend/core/src/main/java/org/opencdmp/service/descriptionstatus/DescriptionStatusServiceImpl.java index 75f948c86..98180a847 100644 --- a/backend/core/src/main/java/org/opencdmp/service/descriptionstatus/DescriptionStatusServiceImpl.java +++ b/backend/core/src/main/java/org/opencdmp/service/descriptionstatus/DescriptionStatusServiceImpl.java @@ -129,7 +129,7 @@ public class DescriptionStatusServiceImpl implements DescriptionStatusService { return data; data.setAuthorization(this.buildDescriptionStatusDefinitionAuthorizationEntity(persist.getAuthorization())); - + if (!this.conventionService.isListNullOrEmpty(persist.getAvailableActions())) data.setAvailableActions(persist.getAvailableActions()); return data; } diff --git a/backend/core/src/main/java/org/opencdmp/service/planstatus/PlanStatusServiceImpl.java b/backend/core/src/main/java/org/opencdmp/service/planstatus/PlanStatusServiceImpl.java index 18a66d3d9..f4dce1f98 100644 --- a/backend/core/src/main/java/org/opencdmp/service/planstatus/PlanStatusServiceImpl.java +++ b/backend/core/src/main/java/org/opencdmp/service/planstatus/PlanStatusServiceImpl.java @@ -136,6 +136,8 @@ public class PlanStatusServiceImpl implements PlanStatusService { PlanStatusDefinitionAuthorizationEntity definitionAuthorizationData = this.buildPlanStatusDefinitionAuthorizationEntity(persist.getAuthorization()); data.setAuthorization(definitionAuthorizationData); } + + if (!this.conventionService.isListNullOrEmpty(persist.getAvailableActions())) data.setAvailableActions(persist.getAvailableActions()); return data; } diff --git a/frontend/src/app/core/common/enum/description-status-available-action-type.ts b/frontend/src/app/core/common/enum/description-status-available-action-type.ts new file mode 100644 index 000000000..f8d2451c7 --- /dev/null +++ b/frontend/src/app/core/common/enum/description-status-available-action-type.ts @@ -0,0 +1,3 @@ +export enum DescriptionStatusAvailableActionType { + Export = 0, +} \ No newline at end of file diff --git a/frontend/src/app/core/common/enum/plan-status-available-action-type.ts b/frontend/src/app/core/common/enum/plan-status-available-action-type.ts new file mode 100644 index 000000000..ef40ff21b --- /dev/null +++ b/frontend/src/app/core/common/enum/plan-status-available-action-type.ts @@ -0,0 +1,4 @@ +export enum PlanStatusAvailableActionType { + Deposit = 0, + Export = 1 +} \ No newline at end of file diff --git a/frontend/src/app/core/model/description-status/description-status.ts b/frontend/src/app/core/model/description-status/description-status.ts index 856b38958..72dcdd733 100644 --- a/frontend/src/app/core/model/description-status/description-status.ts +++ b/frontend/src/app/core/model/description-status/description-status.ts @@ -1,5 +1,6 @@ import { AppRole } from "@app/core/common/enum/app-role"; import { DescriptionStatusEnum } from "@app/core/common/enum/description-status"; +import { DescriptionStatusAvailableActionType } from "@app/core/common/enum/description-status-available-action-type"; import { PlanUserRole } from "@app/core/common/enum/plan-user-role"; import { BaseEntity } from "@common/base/base-entity.model"; @@ -12,6 +13,7 @@ export interface DescriptionStatus extends BaseEntity{ export interface DescriptionStatusDefinition { authorization: DescriptionStatusDefinitionAuthorization + availableActions: DescriptionStatusAvailableActionType[]; } export interface DescriptionStatusDefinitionAuthorization { diff --git a/frontend/src/app/core/model/plan-status/plan-status.ts b/frontend/src/app/core/model/plan-status/plan-status.ts index f531d0a38..cf29f9b00 100644 --- a/frontend/src/app/core/model/plan-status/plan-status.ts +++ b/frontend/src/app/core/model/plan-status/plan-status.ts @@ -1,5 +1,6 @@ import { AppRole } from "@app/core/common/enum/app-role"; import { PlanStatusEnum } from "@app/core/common/enum/plan-status"; +import { PlanStatusAvailableActionType } from "@app/core/common/enum/plan-status-available-action-type"; import { PlanUserRole } from "@app/core/common/enum/plan-user-role"; import { BaseEntity } from "@common/base/base-entity.model"; @@ -12,6 +13,7 @@ export interface PlanStatus extends BaseEntity{ export interface PlanStatusDefinition { authorization: PlanStatusDefinitionAuthorization + availableActions: PlanStatusAvailableActionType[] } export interface PlanStatusDefinitionAuthorization { diff --git a/frontend/src/app/core/services/utilities/enum-utils.service.ts b/frontend/src/app/core/services/utilities/enum-utils.service.ts index 37d986f0c..95cc0c653 100644 --- a/frontend/src/app/core/services/utilities/enum-utils.service.ts +++ b/frontend/src/app/core/services/utilities/enum-utils.service.ts @@ -31,6 +31,8 @@ import { PlanStatusEnum } from '../../common/enum/plan-status'; import { ValidationType } from '../../common/enum/validation-type'; import { UsageLimitTargetMetric } from '@app/core/common/enum/usage-limit-target-metric'; import { UsageLimitPeriodicityRange } from '@app/core/common/enum/usage-limit-periodicity-range'; +import { PlanStatusAvailableActionType } from '@app/core/common/enum/plan-status-available-action-type'; +import { DescriptionStatusAvailableActionType } from '@app/core/common/enum/description-status-available-action-type'; @Injectable() export class EnumUtils { @@ -76,6 +78,13 @@ export class EnumUtils { } } + toPlanStatusAvailableActionTypeString(status: PlanStatusAvailableActionType): string { + switch (status) { + case PlanStatusAvailableActionType.Deposit: return this.language.instant('TYPES.PLAN-STATUS-AVAILABLE-ACTION-TYPE.DEPOSIT'); + case PlanStatusAvailableActionType.Export: return this.language.instant('TYPES.PLAN-STATUS-AVAILABLE-ACTION-TYPE.EXPORT'); + } + } + toDescriptionTemplateFieldValidationTypeString(status: ValidationType): string { switch (status) { case ValidationType.None: return this.language.instant('TYPES.DESCRIPTION-TEMPLATE-FIELD-VALIDATION-TYPE.NONE'); @@ -218,6 +227,12 @@ export class EnumUtils { } } + toDescriptionStatusAvailableActionTypeString(status: DescriptionStatusAvailableActionType): string { + switch (status) { + case DescriptionStatusAvailableActionType.Export: return this.language.instant('TYPES.DESCRIPTION-STATUS-AVAILABLE-ACTION-TYPE.EXPORT'); + } + } + toPlanUserRolesString(roles: PlanUserRole[]): string { return roles.map(x => this.toPlanUserRoleString(x)).join(', ') } toPlanUserRoleString(role: PlanUserRole): string { switch (role) { diff --git a/frontend/src/app/ui/admin/description-status/editor/description-status-editor/description-status-editor.component.html b/frontend/src/app/ui/admin/description-status/editor/description-status-editor/description-status-editor.component.html index 72c7413a8..5d78c660e 100644 --- a/frontend/src/app/ui/admin/description-status/editor/description-status-editor/description-status-editor.component.html +++ b/frontend/src/app/ui/admin/description-status/editor/description-status-editor/description-status-editor.component.html @@ -61,6 +61,18 @@ +
+

+ {{'DESCRIPTION-STATUS-EDITOR.FIELDS.AVAILABLE-ACTIONS' | translate}} +

+ + {{'DESCRIPTION-STATUS-EDITOR.FIELDS.AVAILABLE-ACTIONS' | translate}} + + {{enumUtils.toDescriptionStatusAvailableActionTypeString(actionType)}} + + +
+

{{'DESCRIPTION-STATUS-EDITOR.FIELDS.AUTHORIZATION' | translate}} diff --git a/frontend/src/app/ui/admin/description-status/editor/description-status-editor/description-status-editor.component.ts b/frontend/src/app/ui/admin/description-status/editor/description-status-editor/description-status-editor.component.ts index 1c045470d..98176a8b2 100644 --- a/frontend/src/app/ui/admin/description-status/editor/description-status-editor/description-status-editor.component.ts +++ b/frontend/src/app/ui/admin/description-status/editor/description-status-editor/description-status-editor.component.ts @@ -29,6 +29,7 @@ import { DescriptionStatusForm, DescriptionStatusDefinitionAuthorizationItemForm import { DescriptionStatusEditorResolver } from './description-status-editor.resolver'; import { BaseEditor } from '@common/base/base-editor'; import { PlanUserRole } from '@app/core/common/enum/plan-user-role'; +import { DescriptionStatusAvailableActionType } from '@app/core/common/enum/description-status-available-action-type'; @Component({ selector: 'app-description-status-editor', @@ -39,6 +40,7 @@ export class DescriptionStatusEditorComponent extends BaseEditor(DescriptionStatusEnum); protected userRolesEnum = this.enumUtils.getEnumValues(AppRole); protected planRolesEnum = this.enumUtils.getEnumValues(PlanUserRole); + protected descriptionStatusAvailableActionTypeEnumValues = this.enumUtils.getEnumValues(DescriptionStatusAvailableActionType); protected belongsToCurrentTenant: boolean; constructor( diff --git a/frontend/src/app/ui/admin/description-status/editor/description-status-editor/description-status-editor.model.ts b/frontend/src/app/ui/admin/description-status/editor/description-status-editor/description-status-editor.model.ts index 86f1f1eb3..7b7600b8a 100644 --- a/frontend/src/app/ui/admin/description-status/editor/description-status-editor/description-status-editor.model.ts +++ b/frontend/src/app/ui/admin/description-status/editor/description-status-editor/description-status-editor.model.ts @@ -1,6 +1,7 @@ import { FormControl, FormGroup, Validators } from "@angular/forms"; import { AppRole } from "@app/core/common/enum/app-role"; import { DescriptionStatusEnum } from "@app/core/common/enum/description-status"; +import { DescriptionStatusAvailableActionType } from "@app/core/common/enum/description-status-available-action-type"; import { PlanUserRole } from "@app/core/common/enum/plan-user-role"; import { DescriptionStatus, DescriptionStatusDefinition, DescriptionStatusDefinitionAuthorizationItem } from "@app/core/model/description-status/description-status"; import { DescriptionStatusPersist } from "@app/core/model/description-status/description-status-persist"; @@ -46,6 +47,7 @@ export class DescriptionStatusEditorModel extends BaseEditorModel implements Des edit: this.buildDefinitionAuthorizationItemForm({item: this.definition?.authorization?.edit, rootPath: 'edit', disabled}) }) }); + definitionForm.addControl('availableActions', new FormControl({value: this.definition?.availableActions, disabled}, context.getValidation('availableActions').validators)); definitionForm.controls.authorization.addValidators(context.getValidation('authorization').validators); definitionForm.addValidators(context.getValidation('definition').validators); return definitionForm; @@ -73,6 +75,7 @@ export class DescriptionStatusEditorModel extends BaseEditorModel implements Des baseValidationArray.push({ key: 'definition', validators: [BackendErrorValidator(this.validationErrorModel, 'definition')] }); baseValidationArray.push({ key: 'authorization', validators: [BackendErrorValidator(this.validationErrorModel, 'definition.authorization')] }); baseValidationArray.push({ key: 'edit', validators: [BackendErrorValidator(this.validationErrorModel, 'definition.authorization.edit')] }); + baseValidationArray.push({ key: 'availableActions', validators: [BackendErrorValidator(this.validationErrorModel, 'definition.availableActions')] }); baseContext.validation = baseValidationArray; return baseContext; @@ -102,6 +105,7 @@ export interface DescriptionStatusForm { export interface DescriptionStatusDefinitionForm { authorization: FormGroup + availableActions?: FormControl } export interface DescriptionStatusDefinitionAuthorizationForm { diff --git a/frontend/src/app/ui/admin/description-status/editor/description-status-editor/description-status-editor.resolver.ts b/frontend/src/app/ui/admin/description-status/editor/description-status-editor/description-status-editor.resolver.ts index d66a4be28..e86e04d64 100644 --- a/frontend/src/app/ui/admin/description-status/editor/description-status-editor/description-status-editor.resolver.ts +++ b/frontend/src/app/ui/admin/description-status/editor/description-status-editor/description-status-editor.resolver.ts @@ -28,6 +28,8 @@ export class DescriptionStatusEditorResolver extends BaseEditorResolver{ [nameof(x => x.definition), nameof(x => x.authorization), nameof(x => x.edit), nameof(x => x.allowAnonymous)].join('.'), [nameof(x => x.definition), nameof(x => x.authorization), nameof(x => x.edit), nameof(x => x.allowAuthenticated)].join('.'), + [nameof(x => x.definition), nameof(x => x.availableActions)].join('.'), + nameof(x => x.updatedAt), nameof(x => x.createdAt), nameof(x => x.hash), diff --git a/frontend/src/app/ui/admin/plan-status/editor/plan-status-editor.resolver.ts b/frontend/src/app/ui/admin/plan-status/editor/plan-status-editor.resolver.ts index fc09a146b..94c2d91ec 100644 --- a/frontend/src/app/ui/admin/plan-status/editor/plan-status-editor.resolver.ts +++ b/frontend/src/app/ui/admin/plan-status/editor/plan-status-editor.resolver.ts @@ -28,6 +28,8 @@ export class PlanStatusEditorResolver extends BaseEditorResolver{ [nameof(x => x.definition), nameof(x => x.authorization), nameof(x => x.edit), nameof(x => x.allowAnonymous)].join('.'), [nameof(x => x.definition), nameof(x => x.authorization), nameof(x => x.edit), nameof(x => x.allowAuthenticated)].join('.'), + [nameof(x => x.definition), nameof(x => x.availableActions)].join('.'), + nameof(x => x.updatedAt), nameof(x => x.createdAt), nameof(x => x.hash), diff --git a/frontend/src/app/ui/admin/plan-status/editor/plan-status-editor/plan-status-editor.component.html b/frontend/src/app/ui/admin/plan-status/editor/plan-status-editor/plan-status-editor.component.html index 081b4b1c4..f1ac7f599 100644 --- a/frontend/src/app/ui/admin/plan-status/editor/plan-status-editor/plan-status-editor.component.html +++ b/frontend/src/app/ui/admin/plan-status/editor/plan-status-editor/plan-status-editor.component.html @@ -60,7 +60,17 @@ }

- +
+

+ {{'PLAN-STATUS-EDITOR.FIELDS.AVAILABLE-ACTIONS' | translate}} +

+ + {{'PLAN-STATUS-EDITOR.FIELDS.AVAILABLE-ACTIONS' | translate}} + + {{enumUtils.toPlanStatusAvailableActionTypeString(actionType)}} + + +

{{'PLAN-STATUS-EDITOR.FIELDS.AUTHORIZATION' | translate}} diff --git a/frontend/src/app/ui/admin/plan-status/editor/plan-status-editor/plan-status-editor.component.ts b/frontend/src/app/ui/admin/plan-status/editor/plan-status-editor/plan-status-editor.component.ts index f999d7a0b..2f716aef7 100644 --- a/frontend/src/app/ui/admin/plan-status/editor/plan-status-editor/plan-status-editor.component.ts +++ b/frontend/src/app/ui/admin/plan-status/editor/plan-status-editor/plan-status-editor.component.ts @@ -29,6 +29,7 @@ import { PlanStatusEnum } from '@app/core/common/enum/plan-status'; import { FormGroup } from '@angular/forms'; import { PlanUserRole } from '@app/core/common/enum/plan-user-role'; import { AppRole } from '@app/core/common/enum/app-role'; +import { PlanStatusAvailableActionType } from '@app/core/common/enum/plan-status-available-action-type'; @Component({ selector: 'app-plan-status-editor', @@ -40,6 +41,7 @@ export class PlanStatusEditorComponent extends BaseEditor(PlanStatusEnum); protected userRolesEnum = this.enumUtils.getEnumValues(AppRole); protected planRolesEnum = this.enumUtils.getEnumValues(PlanUserRole); + protected planStatusAvailableActionTypeEnumValues = this.enumUtils.getEnumValues(PlanStatusAvailableActionType); protected belongsToCurrentTenant: boolean; constructor( diff --git a/frontend/src/app/ui/admin/plan-status/editor/plan-status-editor/plan-status-editor.model.ts b/frontend/src/app/ui/admin/plan-status/editor/plan-status-editor/plan-status-editor.model.ts index 56e2afc38..ab599d3a9 100644 --- a/frontend/src/app/ui/admin/plan-status/editor/plan-status-editor/plan-status-editor.model.ts +++ b/frontend/src/app/ui/admin/plan-status/editor/plan-status-editor/plan-status-editor.model.ts @@ -2,6 +2,7 @@ import { FormArray, FormControl, FormGroup, Validators } from "@angular/forms"; import { AppRole } from "@app/core/common/enum/app-role"; import { AppPermission } from "@app/core/common/enum/permission.enum"; import { PlanStatusEnum } from "@app/core/common/enum/plan-status"; +import { PlanStatusAvailableActionType } from "@app/core/common/enum/plan-status-available-action-type"; import { PlanUserRole } from "@app/core/common/enum/plan-user-role"; import { PlanStatus, PlanStatusDefinition, PlanStatusDefinitionAuthorizationItem } from "@app/core/model/plan-status/plan-status"; import { PlanStatusPersist } from "@app/core/model/plan-status/plan-status-persist"; @@ -47,6 +48,7 @@ export class PlanStatusEditorModel extends BaseEditorModel implements PlanStatus edit: this.buildDefinitionAuthorizationItemForm({item: this.definition?.authorization?.edit, rootPath: 'edit', disabled}) }) }); + definitionForm.addControl('availableActions', new FormControl({value: this.definition?.availableActions, disabled}, context.getValidation('availableActions').validators)); definitionForm.controls.authorization.addValidators(context.getValidation('authorization').validators); definitionForm.addValidators(context.getValidation('definition').validators); return definitionForm; @@ -74,6 +76,7 @@ export class PlanStatusEditorModel extends BaseEditorModel implements PlanStatus baseValidationArray.push({ key: 'definition', validators: [BackendErrorValidator(this.validationErrorModel, 'definition')] }); baseValidationArray.push({ key: 'authorization', validators: [BackendErrorValidator(this.validationErrorModel, 'definition.authorization')] }); baseValidationArray.push({ key: 'edit', validators: [BackendErrorValidator(this.validationErrorModel, 'definition.authorization.edit')] }); + baseValidationArray.push({ key: 'availableActions', validators: [BackendErrorValidator(this.validationErrorModel, 'definition.availableActions')] }); baseContext.validation = baseValidationArray; return baseContext; @@ -104,6 +107,7 @@ export interface PlanStatusForm { export interface PlanStatusDefinitionForm { authorization: FormGroup + availableActions?: FormControl } export interface PlanStatusDefinitionAuthorizationForm { diff --git a/frontend/src/assets/i18n/baq.json b/frontend/src/assets/i18n/baq.json index 46e6fb75f..bb652eda6 100644 --- a/frontend/src/assets/i18n/baq.json +++ b/frontend/src/assets/i18n/baq.json @@ -916,7 +916,8 @@ "ALLOW-AUTHENTICATED": "Allow authenticated users", "ALLOW-ANONYMOUS": "Allow anonymous users", "ROLES": "User roles", - "PLAN-ROLES": "User plan roles" + "PLAN-ROLES": "User plan roles", + "AVAILABLE-ACTIONS": "Available Actions" }, "DEFAULT-VALUE": { "NONE": "None" @@ -958,7 +959,8 @@ "ALLOW-AUTHENTICATED": "Allow authenticated users", "ALLOW-ANONYMOUS": "Allow anonymous users", "ROLES": "User roles", - "PLAN-ROLES": "User plan roles" + "PLAN-ROLES": "User plan roles", + "AVAILABLE-ACTIONS": "Available Actions" }, "DEFAULT-VALUE": { "NONE": "None" @@ -2107,6 +2109,9 @@ "FINALIZED": "Finalized", "CANCELED": "Canceled" }, + "DESCRIPTION-STATUS-AVAILABLE-ACTION-TYPE": { + "EXPORT": "Export" + }, "PLAN-USER-ROLE": { "OWNER": "Owner", "VIEWER": "Viewer", @@ -2120,6 +2125,10 @@ "FINALISED": "Amaituta", "DRAFT": "Zirriborroa" }, + "PLAN-STATUS-AVAILABLE-ACTION-TYPE": { + "DEPOSIT": "Deposit", + "EXPORT": "Export" + }, "PLAN-VISIBILITY": { "PUBLIC": "Argitaratuta" }, diff --git a/frontend/src/assets/i18n/de.json b/frontend/src/assets/i18n/de.json index f32703dd8..38fd7f5e1 100644 --- a/frontend/src/assets/i18n/de.json +++ b/frontend/src/assets/i18n/de.json @@ -916,7 +916,8 @@ "ALLOW-AUTHENTICATED": "Allow authenticated users", "ALLOW-ANONYMOUS": "Allow anonymous users", "ROLES": "User roles", - "PLAN-ROLES": "User plan roles" + "PLAN-ROLES": "User plan roles", + "AVAILABLE-ACTIONS": "Available Actions" }, "DEFAULT-VALUE": { "NONE": "None" @@ -958,7 +959,8 @@ "ALLOW-AUTHENTICATED": "Allow authenticated users", "ALLOW-ANONYMOUS": "Allow anonymous users", "ROLES": "User roles", - "PLAN-ROLES": "User plan roles" + "PLAN-ROLES": "User plan roles", + "AVAILABLE-ACTIONS": "Available Actions" }, "DEFAULT-VALUE": { "NONE": "None" @@ -2107,6 +2109,9 @@ "FINALIZED": "Finalized", "CANCELED": "Canceled" }, + "DESCRIPTION-STATUS-AVAILABLE-ACTION-TYPE": { + "EXPORT": "Export" + }, "PLAN-USER-ROLE": { "OWNER": "Owner", "VIEWER": "Viewer", @@ -2120,6 +2125,10 @@ "FINALISED": "Fertiggestellt", "DRAFT": "Entwurf" }, + "PLAN-STATUS-AVAILABLE-ACTION-TYPE": { + "DEPOSIT": "Deposit", + "EXPORT": "Export" + }, "PLAN-VISIBILITY": { "PUBLIC": "Veröffentlicht" }, diff --git a/frontend/src/assets/i18n/en.json b/frontend/src/assets/i18n/en.json index 137e0edc3..2950bb440 100644 --- a/frontend/src/assets/i18n/en.json +++ b/frontend/src/assets/i18n/en.json @@ -914,7 +914,8 @@ "ALLOW-AUTHENTICATED": "Allow authenticated users", "ALLOW-ANONYMOUS": "Allow anonymous users", "ROLES": "User roles", - "PLAN-ROLES": "User plan roles" + "PLAN-ROLES": "User plan roles", + "AVAILABLE-ACTIONS": "Available Actions" }, "DEFAULT-VALUE": { "NONE": "None" @@ -965,7 +966,8 @@ "ALLOW-AUTHENTICATED": "Allow authenticated users", "ALLOW-ANONYMOUS": "Allow anonymous users", "ROLES": "User roles", - "PLAN-ROLES": "User plan roles" + "PLAN-ROLES": "User plan roles", + "AVAILABLE-ACTIONS": "Available Actions" }, "DEFAULT-VALUE": { "NONE": "None" @@ -2107,6 +2109,9 @@ "FINALIZED": "Finalized", "CANCELED": "Canceled" }, + "DESCRIPTION-STATUS-AVAILABLE-ACTION-TYPE": { + "EXPORT": "Export" + }, "PLAN-USER-ROLE": { "OWNER": "Owner", "VIEWER": "Viewer", @@ -2120,6 +2125,10 @@ "FINALISED": "Finalized", "DRAFT": "Draft" }, + "PLAN-STATUS-AVAILABLE-ACTION-TYPE": { + "DEPOSIT": "Deposit", + "EXPORT": "Export" + }, "PLAN-VISIBILITY": { "PUBLIC": "Published" }, diff --git a/frontend/src/assets/i18n/es.json b/frontend/src/assets/i18n/es.json index a148167cc..f8e55b687 100644 --- a/frontend/src/assets/i18n/es.json +++ b/frontend/src/assets/i18n/es.json @@ -916,7 +916,8 @@ "ALLOW-AUTHENTICATED": "Allow authenticated users", "ALLOW-ANONYMOUS": "Allow anonymous users", "ROLES": "User roles", - "PLAN-ROLES": "User plan roles" + "PLAN-ROLES": "User plan roles", + "AVAILABLE-ACTIONS": "Available Actions" }, "DEFAULT-VALUE": { "NONE": "None" @@ -958,7 +959,8 @@ "ALLOW-AUTHENTICATED": "Allow authenticated users", "ALLOW-ANONYMOUS": "Allow anonymous users", "ROLES": "User roles", - "PLAN-ROLES": "User plan roles" + "PLAN-ROLES": "User plan roles", + "AVAILABLE-ACTIONS": "Available Actions" }, "DEFAULT-VALUE": { "NONE": "None" @@ -2107,6 +2109,9 @@ "FINALIZED": "Finalized", "CANCELED": "Canceled" }, + "DESCRIPTION-STATUS-AVAILABLE-ACTION-TYPE": { + "EXPORT": "Export" + }, "PLAN-USER-ROLE": { "OWNER": "Owner", "VIEWER": "Viewer", @@ -2120,6 +2125,10 @@ "FINALISED": "Finalizado", "DRAFT": "Borrador" }, + "PLAN-STATUS-AVAILABLE-ACTION-TYPE": { + "DEPOSIT": "Deposit", + "EXPORT": "Export" + }, "PLAN-VISIBILITY": { "PUBLIC": "Publicado" }, diff --git a/frontend/src/assets/i18n/gr.json b/frontend/src/assets/i18n/gr.json index 6e3a74fc0..07071f85a 100644 --- a/frontend/src/assets/i18n/gr.json +++ b/frontend/src/assets/i18n/gr.json @@ -916,7 +916,8 @@ "ALLOW-AUTHENTICATED": "Allow authenticated users", "ALLOW-ANONYMOUS": "Allow anonymous users", "ROLES": "User roles", - "PLAN-ROLES": "User plan roles" + "PLAN-ROLES": "User plan roles", + "AVAILABLE-ACTIONS": "Available Actions" }, "DEFAULT-VALUE": { "NONE": "None" @@ -958,7 +959,8 @@ "ALLOW-AUTHENTICATED": "Allow authenticated users", "ALLOW-ANONYMOUS": "Allow anonymous users", "ROLES": "User roles", - "PLAN-ROLES": "User plan roles" + "PLAN-ROLES": "User plan roles", + "AVAILABLE-ACTIONS": "Available Actions" }, "DEFAULT-VALUE": { "NONE": "None" @@ -2107,6 +2109,9 @@ "FINALIZED": "Finalized", "CANCELED": "Canceled" }, + "DESCRIPTION-STATUS-AVAILABLE-ACTION-TYPE": { + "EXPORT": "Export" + }, "PLAN-USER-ROLE": { "OWNER": "Owner", "VIEWER": "Viewer", @@ -2120,6 +2125,10 @@ "FINALISED": "Οριστικοποιημένο", "DRAFT": "Προσχέδιο" }, + "PLAN-STATUS-AVAILABLE-ACTION-TYPE": { + "DEPOSIT": "Deposit", + "EXPORT": "Export" + }, "PLAN-VISIBILITY": { "PUBLIC": "Δημοσιευμένο" }, diff --git a/frontend/src/assets/i18n/hr.json b/frontend/src/assets/i18n/hr.json index 17935d254..ca942b4c9 100644 --- a/frontend/src/assets/i18n/hr.json +++ b/frontend/src/assets/i18n/hr.json @@ -916,7 +916,8 @@ "ALLOW-AUTHENTICATED": "Allow authenticated users", "ALLOW-ANONYMOUS": "Allow anonymous users", "ROLES": "User roles", - "PLAN-ROLES": "User plan roles" + "PLAN-ROLES": "User plan roles", + "AVAILABLE-ACTIONS": "Available Actions" }, "DEFAULT-VALUE": { "NONE": "None" @@ -958,7 +959,8 @@ "ALLOW-AUTHENTICATED": "Allow authenticated users", "ALLOW-ANONYMOUS": "Allow anonymous users", "ROLES": "User roles", - "PLAN-ROLES": "User plan roles" + "PLAN-ROLES": "User plan roles", + "AVAILABLE-ACTIONS": "Available Actions" }, "DEFAULT-VALUE": { "NONE": "None" @@ -2107,6 +2109,9 @@ "FINALIZED": "Finalized", "CANCELED": "Canceled" }, + "DESCRIPTION-STATUS-AVAILABLE-ACTION-TYPE": { + "EXPORT": "Export" + }, "PLAN-USER-ROLE": { "OWNER": "Owner", "VIEWER": "Viewer", @@ -2120,6 +2125,10 @@ "FINALISED": "Završeno", "DRAFT": "Nacrt" }, + "PLAN-STATUS-AVAILABLE-ACTION-TYPE": { + "DEPOSIT": "Deposit", + "EXPORT": "Export" + }, "PLAN-VISIBILITY": { "PUBLIC": "Objavljeno" }, diff --git a/frontend/src/assets/i18n/pl.json b/frontend/src/assets/i18n/pl.json index 5030528c4..dca917e72 100644 --- a/frontend/src/assets/i18n/pl.json +++ b/frontend/src/assets/i18n/pl.json @@ -916,7 +916,8 @@ "ALLOW-AUTHENTICATED": "Allow authenticated users", "ALLOW-ANONYMOUS": "Allow anonymous users", "ROLES": "User roles", - "PLAN-ROLES": "User plan roles" + "PLAN-ROLES": "User plan roles", + "AVAILABLE-ACTIONS": "Available Actions" }, "DEFAULT-VALUE": { "NONE": "None" @@ -958,7 +959,8 @@ "ALLOW-AUTHENTICATED": "Allow authenticated users", "ALLOW-ANONYMOUS": "Allow anonymous users", "ROLES": "User roles", - "PLAN-ROLES": "User plan roles" + "PLAN-ROLES": "User plan roles", + "AVAILABLE-ACTIONS": "Available Actions" }, "DEFAULT-VALUE": { "NONE": "None" @@ -2107,6 +2109,9 @@ "FINALIZED": "Finalized", "CANCELED": "Canceled" }, + "DESCRIPTION-STATUS-AVAILABLE-ACTION-TYPE": { + "EXPORT": "Export" + }, "PLAN-USER-ROLE": { "OWNER": "Owner", "VIEWER": "Viewer", @@ -2120,6 +2125,10 @@ "FINALISED": "Sfinalizowane", "DRAFT": "Wersja robocza" }, + "PLAN-STATUS-AVAILABLE-ACTION-TYPE": { + "DEPOSIT": "Deposit", + "EXPORT": "Export" + }, "PLAN-VISIBILITY": { "PUBLIC": "Opublikowane" }, diff --git a/frontend/src/assets/i18n/pt.json b/frontend/src/assets/i18n/pt.json index fdc4d82ed..1892c2c18 100644 --- a/frontend/src/assets/i18n/pt.json +++ b/frontend/src/assets/i18n/pt.json @@ -916,7 +916,8 @@ "ALLOW-AUTHENTICATED": "Allow authenticated users", "ALLOW-ANONYMOUS": "Allow anonymous users", "ROLES": "User roles", - "PLAN-ROLES": "User plan roles" + "PLAN-ROLES": "User plan roles", + "AVAILABLE-ACTIONS": "Available Actions" }, "DEFAULT-VALUE": { "NONE": "None" @@ -958,7 +959,8 @@ "ALLOW-AUTHENTICATED": "Allow authenticated users", "ALLOW-ANONYMOUS": "Allow anonymous users", "ROLES": "User roles", - "PLAN-ROLES": "User plan roles" + "PLAN-ROLES": "User plan roles", + "AVAILABLE-ACTIONS": "Available Actions" }, "DEFAULT-VALUE": { "NONE": "None" @@ -2107,6 +2109,9 @@ "FINALIZED": "Finalized", "CANCELED": "Canceled" }, + "DESCRIPTION-STATUS-AVAILABLE-ACTION-TYPE": { + "EXPORT": "Export" + }, "PLAN-USER-ROLE": { "OWNER": "Owner", "VIEWER": "Viewer", @@ -2120,6 +2125,10 @@ "FINALISED": "Concluído", "DRAFT": "Rascunho" }, + "PLAN-STATUS-AVAILABLE-ACTION-TYPE": { + "DEPOSIT": "Deposit", + "EXPORT": "Export" + }, "PLAN-VISIBILITY": { "PUBLIC": "Publicado" }, diff --git a/frontend/src/assets/i18n/sk.json b/frontend/src/assets/i18n/sk.json index f1eaadf44..dc00444f0 100644 --- a/frontend/src/assets/i18n/sk.json +++ b/frontend/src/assets/i18n/sk.json @@ -916,7 +916,8 @@ "ALLOW-AUTHENTICATED": "Allow authenticated users", "ALLOW-ANONYMOUS": "Allow anonymous users", "ROLES": "User roles", - "PLAN-ROLES": "User plan roles" + "PLAN-ROLES": "User plan roles", + "AVAILABLE-ACTIONS": "Available Actions" }, "DEFAULT-VALUE": { "NONE": "None" @@ -958,7 +959,8 @@ "ALLOW-AUTHENTICATED": "Allow authenticated users", "ALLOW-ANONYMOUS": "Allow anonymous users", "ROLES": "User roles", - "PLAN-ROLES": "User plan roles" + "PLAN-ROLES": "User plan roles", + "AVAILABLE-ACTIONS": "Available Actions" }, "DEFAULT-VALUE": { "NONE": "None" @@ -2107,6 +2109,9 @@ "FINALIZED": "Finalized", "CANCELED": "Canceled" }, + "DESCRIPTION-STATUS-AVAILABLE-ACTION-TYPE": { + "EXPORT": "Export" + }, "PLAN-USER-ROLE": { "OWNER": "Owner", "VIEWER": "Viewer", @@ -2120,6 +2125,10 @@ "FINALISED": "Dokončené", "DRAFT": "Návrh" }, + "PLAN-STATUS-AVAILABLE-ACTION-TYPE": { + "DEPOSIT": "Deposit", + "EXPORT": "Export" + }, "PLAN-VISIBILITY": { "PUBLIC": "Publikované" }, diff --git a/frontend/src/assets/i18n/sr.json b/frontend/src/assets/i18n/sr.json index c589b8f6f..7b22f8948 100644 --- a/frontend/src/assets/i18n/sr.json +++ b/frontend/src/assets/i18n/sr.json @@ -916,7 +916,8 @@ "ALLOW-AUTHENTICATED": "Allow authenticated users", "ALLOW-ANONYMOUS": "Allow anonymous users", "ROLES": "User roles", - "PLAN-ROLES": "User plan roles" + "PLAN-ROLES": "User plan roles", + "AVAILABLE-ACTIONS": "Available Actions" }, "DEFAULT-VALUE": { "NONE": "None" @@ -958,7 +959,8 @@ "ALLOW-AUTHENTICATED": "Allow authenticated users", "ALLOW-ANONYMOUS": "Allow anonymous users", "ROLES": "User roles", - "PLAN-ROLES": "User plan roles" + "PLAN-ROLES": "User plan roles", + "AVAILABLE-ACTIONS": "Available Actions" }, "DEFAULT-VALUE": { "NONE": "None" @@ -2107,6 +2109,9 @@ "FINALIZED": "Finalized", "CANCELED": "Canceled" }, + "DESCRIPTION-STATUS-AVAILABLE-ACTION-TYPE": { + "EXPORT": "Export" + }, "PLAN-USER-ROLE": { "OWNER": "Owner", "VIEWER": "Viewer", @@ -2120,6 +2125,10 @@ "FINALISED": "Završeno", "DRAFT": "Radna verzija" }, + "PLAN-STATUS-AVAILABLE-ACTION-TYPE": { + "DEPOSIT": "Deposit", + "EXPORT": "Export" + }, "PLAN-VISIBILITY": { "PUBLIC": "Objavljeno" }, diff --git a/frontend/src/assets/i18n/tr.json b/frontend/src/assets/i18n/tr.json index 99d672fcb..83daaaba9 100644 --- a/frontend/src/assets/i18n/tr.json +++ b/frontend/src/assets/i18n/tr.json @@ -916,7 +916,8 @@ "ALLOW-AUTHENTICATED": "Allow authenticated users", "ALLOW-ANONYMOUS": "Allow anonymous users", "ROLES": "User roles", - "PLAN-ROLES": "User plan roles" + "PLAN-ROLES": "User plan roles", + "AVAILABLE-ACTIONS": "Available Actions" }, "DEFAULT-VALUE": { "NONE": "None" @@ -958,7 +959,8 @@ "ALLOW-AUTHENTICATED": "Allow authenticated users", "ALLOW-ANONYMOUS": "Allow anonymous users", "ROLES": "User roles", - "PLAN-ROLES": "User plan roles" + "PLAN-ROLES": "User plan roles", + "AVAILABLE-ACTIONS": "Available Actions" }, "DEFAULT-VALUE": { "NONE": "None" @@ -2107,6 +2109,9 @@ "FINALIZED": "Finalized", "CANCELED": "Canceled" }, + "DESCRIPTION-STATUS-AVAILABLE-ACTION-TYPE": { + "EXPORT": "Export" + }, "PLAN-USER-ROLE": { "OWNER": "Owner", "VIEWER": "Viewer", @@ -2120,6 +2125,10 @@ "FINALISED": "Tamamlandı", "DRAFT": "Taslak" }, + "PLAN-STATUS-AVAILABLE-ACTION-TYPE": { + "DEPOSIT": "Deposit", + "EXPORT": "Export" + }, "PLAN-VISIBILITY": { "PUBLIC": "Yayınlandı" },