From 3d3ae7e04067da0ccbc1cd8d58b3888b18749664 Mon Sep 17 00:00:00 2001 From: amentis Date: Wed, 24 Jul 2024 17:59:33 +0300 Subject: [PATCH] add description template type code and fallback description template import --- .../DescriptionTemplateImportExport.java | 11 ++-- .../DescriptionTemplateTypeImportExport.java | 42 ++++++++++++++ .../data/DescriptionTemplateTypeEntity.java | 15 ++++- .../errorcode/ErrorThesaurusProperties.java | 10 ++++ .../model/DescriptionTemplateType.java | 11 ++++ .../DescriptionTemplateTypeBuilder.java | 2 + .../DescriptionTemplateTypePersist.java | 23 +++++++- .../query/DescriptionTemplateTypeQuery.java | 29 +++++++++- .../DescriptionTemplateServiceImpl.java | 58 +++++++++++++++---- .../DescriptionTemplateTypeServiceImpl.java | 16 ++++- .../web/src/main/resources/config/errors.yml | 5 +- .../core/common/enum/respone-error-code.ts | 3 + .../description-template-type.ts | 2 + ...iption-template-type-editor.component.html | 12 ++++ .../description-template-type-editor.model.ts | 4 ++ ...scription-template-type-editor.resolver.ts | 1 + ...ription-template-type-listing.component.ts | 9 ++- frontend/src/assets/i18n/baq.json | 7 ++- frontend/src/assets/i18n/de.json | 7 ++- frontend/src/assets/i18n/en.json | 7 ++- frontend/src/assets/i18n/es.json | 7 ++- frontend/src/assets/i18n/gr.json | 7 ++- frontend/src/assets/i18n/hr.json | 7 ++- frontend/src/assets/i18n/pl.json | 7 ++- frontend/src/assets/i18n/pt.json | 7 ++- frontend/src/assets/i18n/sk.json | 7 ++- frontend/src/assets/i18n/sr.json | 7 ++- frontend/src/assets/i18n/tr.json | 7 ++- 28 files changed, 285 insertions(+), 45 deletions(-) create mode 100644 backend/core/src/main/java/org/opencdmp/commons/types/descriptiontemplatetype/DescriptionTemplateTypeImportExport.java diff --git a/backend/core/src/main/java/org/opencdmp/commons/types/descriptiontemplate/importexport/DescriptionTemplateImportExport.java b/backend/core/src/main/java/org/opencdmp/commons/types/descriptiontemplate/importexport/DescriptionTemplateImportExport.java index b36cc5654..7b411ead7 100644 --- a/backend/core/src/main/java/org/opencdmp/commons/types/descriptiontemplate/importexport/DescriptionTemplateImportExport.java +++ b/backend/core/src/main/java/org/opencdmp/commons/types/descriptiontemplate/importexport/DescriptionTemplateImportExport.java @@ -2,6 +2,7 @@ package org.opencdmp.commons.types.descriptiontemplate.importexport; import jakarta.xml.bind.annotation.*; +import org.opencdmp.commons.types.descriptiontemplatetype.DescriptionTemplateTypeImportExport; import java.util.ArrayList; import java.util.List; @@ -18,7 +19,7 @@ public class DescriptionTemplateImportExport { @XmlElement(name = "language") private String language; @XmlElement(name = "type") - private UUID type; + private DescriptionTemplateTypeImportExport descriptionTemplateType; @XmlElement(name = "version") private Short version; @XmlElement(name = "groupId") @@ -62,12 +63,12 @@ public class DescriptionTemplateImportExport { } - public UUID getType() { - return this.type; + public DescriptionTemplateTypeImportExport getDescriptionTemplateType() { + return descriptionTemplateType; } - public void setType(UUID type) { - this.type = type; + public void setDescriptionTemplateType(DescriptionTemplateTypeImportExport descriptionTemplateType) { + this.descriptionTemplateType = descriptionTemplateType; } public Short getVersion() { diff --git a/backend/core/src/main/java/org/opencdmp/commons/types/descriptiontemplatetype/DescriptionTemplateTypeImportExport.java b/backend/core/src/main/java/org/opencdmp/commons/types/descriptiontemplatetype/DescriptionTemplateTypeImportExport.java new file mode 100644 index 000000000..255a36d30 --- /dev/null +++ b/backend/core/src/main/java/org/opencdmp/commons/types/descriptiontemplatetype/DescriptionTemplateTypeImportExport.java @@ -0,0 +1,42 @@ +package org.opencdmp.commons.types.descriptiontemplatetype; + + +import jakarta.xml.bind.annotation.*; + +import java.util.UUID; + +@XmlRootElement(name = "descriptionTemplateType") +@XmlAccessorType(XmlAccessType.FIELD) +public class DescriptionTemplateTypeImportExport { + + @XmlElement(name = "id") + private UUID id; + @XmlElement(name = "code") + private String code; + @XmlElement(name = "name") + private String name; + + public UUID getId() { + return id; + } + + public void setId(UUID id) { + this.id = id; + } + + public String getCode() { + return code; + } + + public void setCode(String code) { + this.code = code; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } +} diff --git a/backend/core/src/main/java/org/opencdmp/data/DescriptionTemplateTypeEntity.java b/backend/core/src/main/java/org/opencdmp/data/DescriptionTemplateTypeEntity.java index c7ada0082..8b595d7ae 100644 --- a/backend/core/src/main/java/org/opencdmp/data/DescriptionTemplateTypeEntity.java +++ b/backend/core/src/main/java/org/opencdmp/data/DescriptionTemplateTypeEntity.java @@ -20,9 +20,14 @@ public class DescriptionTemplateTypeEntity extends TenantScopedBaseEntity { public static final String _id = "id"; + @Column(name = "code", length = _codeLength, nullable = false) + private String code; + public final static String _code = "code"; + public final static int _codeLength = 200; + @Column(name = "name", length = DescriptionTemplateTypeEntity._nameLength, nullable = false) private String name; - public static final int _nameLength = 500; + public static final int _nameLength = 250; public static final String _name = "name"; @@ -56,6 +61,14 @@ public class DescriptionTemplateTypeEntity extends TenantScopedBaseEntity { this.id = id; } + public String getCode() { + return code; + } + + public void setCode(String code) { + this.code = code; + } + public String getName() { return name; } diff --git a/backend/core/src/main/java/org/opencdmp/errorcode/ErrorThesaurusProperties.java b/backend/core/src/main/java/org/opencdmp/errorcode/ErrorThesaurusProperties.java index e5a308716..6d9e7a570 100644 --- a/backend/core/src/main/java/org/opencdmp/errorcode/ErrorThesaurusProperties.java +++ b/backend/core/src/main/java/org/opencdmp/errorcode/ErrorThesaurusProperties.java @@ -408,4 +408,14 @@ public class ErrorThesaurusProperties { public void setUsageLimitMetricAlreadyExists(ErrorDescription usageLimitMetricAlreadyExists) { this.usageLimitMetricAlreadyExists = usageLimitMetricAlreadyExists; } + + private ErrorDescription descriptionTemplateTypeCodeExists; + + public ErrorDescription getDescriptionTemplateTypeCodeExists() { + return descriptionTemplateTypeCodeExists; + } + + public void setDescriptionTemplateTypeCodeExists(ErrorDescription descriptionTemplateTypeCodeExists) { + this.descriptionTemplateTypeCodeExists = descriptionTemplateTypeCodeExists; + } } diff --git a/backend/core/src/main/java/org/opencdmp/model/DescriptionTemplateType.java b/backend/core/src/main/java/org/opencdmp/model/DescriptionTemplateType.java index 29c2cb455..0227d225e 100644 --- a/backend/core/src/main/java/org/opencdmp/model/DescriptionTemplateType.java +++ b/backend/core/src/main/java/org/opencdmp/model/DescriptionTemplateType.java @@ -12,6 +12,9 @@ public class DescriptionTemplateType { public final static String _id = "id"; private UUID id; + public final static String _code = "code"; + private String code; + public final static String _name = "name"; private String name; @@ -44,6 +47,14 @@ public class DescriptionTemplateType { this.id = id; } + public String getCode() { + return code; + } + + public void setCode(String code) { + this.code = code; + } + public String getName() { return name; } diff --git a/backend/core/src/main/java/org/opencdmp/model/builder/DescriptionTemplateTypeBuilder.java b/backend/core/src/main/java/org/opencdmp/model/builder/DescriptionTemplateTypeBuilder.java index 8a46d6de6..85edc0b6d 100644 --- a/backend/core/src/main/java/org/opencdmp/model/builder/DescriptionTemplateTypeBuilder.java +++ b/backend/core/src/main/java/org/opencdmp/model/builder/DescriptionTemplateTypeBuilder.java @@ -48,6 +48,8 @@ public class DescriptionTemplateTypeBuilder extends BaseBuilder !this.isEmpty(item.getName())) .must(() -> this.lessEqualLength(item.getName(), DescriptionTemplateTypeEntity._nameLength)) - .failOn(DescriptionTemplateTypePersist._name).failWith(messageSource.getMessage("Validation_MaxLength", new Object[]{DescriptionTemplateTypePersist._name}, LocaleContextHolder.getLocale())) - ); + .failOn(DescriptionTemplateTypePersist._name).failWith(messageSource.getMessage("Validation_MaxLength", new Object[]{DescriptionTemplateTypePersist._name}, LocaleContextHolder.getLocale())), + this.spec() + .must(() -> !this.isEmpty(item.getCode())) + .failOn(DescriptionTemplateTypePersist._code).failWith(messageSource.getMessage("Validation_Required", new Object[]{DescriptionTemplateTypePersist._code}, LocaleContextHolder.getLocale())), + this.spec() + .iff(() -> !this.isEmpty(item.getCode())) + .must(() -> this.lessEqualLength(item.getCode(), DescriptionTemplateTypeEntity._codeLength)) + .failOn(DescriptionTemplateTypePersist._code).failWith(messageSource.getMessage("Validation_MaxLength", new Object[]{DescriptionTemplateTypePersist._code}, LocaleContextHolder.getLocale())) + ); } } diff --git a/backend/core/src/main/java/org/opencdmp/query/DescriptionTemplateTypeQuery.java b/backend/core/src/main/java/org/opencdmp/query/DescriptionTemplateTypeQuery.java index a81f0375e..8de0a61f2 100644 --- a/backend/core/src/main/java/org/opencdmp/query/DescriptionTemplateTypeQuery.java +++ b/backend/core/src/main/java/org/opencdmp/query/DescriptionTemplateTypeQuery.java @@ -33,6 +33,8 @@ public class DescriptionTemplateTypeQuery extends QueryBase statuses; + private Collection codes; + private Collection excludedIds; private EnumSet authorize = EnumSet.of(AuthorizationFlags.None); @@ -87,6 +89,21 @@ public class DescriptionTemplateTypeQuery extends QueryBase values) { + this.codes = values; + return this; + } + public DescriptionTemplateTypeQuery excludedIds(Collection values) { this.excludedIds = values; return this; @@ -150,7 +167,9 @@ public class DescriptionTemplateTypeQuery extends QueryBase inClause = queryContext.CriteriaBuilder.in(queryContext.Root.get(DescriptionTemplateTypeEntity._isActive)); @@ -165,6 +184,12 @@ public class DescriptionTemplateTypeQuery extends QueryBase inClause = queryContext.CriteriaBuilder.in(queryContext.Root.get(DescriptionTemplateTypeEntity._code)); + for (String item : this.codes) + inClause.value(item); + predicates.add(inClause); + } if (this.excludedIds != null) { CriteriaBuilder.In notInClause = queryContext.CriteriaBuilder.in(queryContext.Root.get(DescriptionTemplateTypeEntity._id)); for (UUID item : this.excludedIds) @@ -184,6 +209,7 @@ public class DescriptionTemplateTypeQuery extends QueryBase 0 ) { + return query.firstAs(new BaseFieldSet().ensure(DescriptionTemplate._id)).getId(); + } else { + if (!this.conventionService.isNullOrEmpty(importXml.getCode())){ + // search by code + query = this.queryFactory.query(DescriptionTemplateTypeQuery.class).codes(importXml.getCode()); + if (query != null && query.count() > 0) { + return query.firstAs(new BaseFieldSet().ensure(DescriptionTemplate._id)).getId(); + } + } + + } + } + return null; + } + @Override public DescriptionTemplate importXml(byte[] bytes, UUID groupId, String label, FieldSet fields) throws MyForbiddenException, MyNotFoundException, JAXBException, ParserConfigurationException, TransformerException, InvalidApplicationException, IOException, InstantiationException, IllegalAccessException, SAXException { logger.debug(new MapLogEntry("import data").And("bytes", bytes).And("fields", fields)); @@ -907,7 +930,7 @@ public class DescriptionTemplateServiceImpl implements DescriptionTemplateServic //region Export @Override - public DescriptionTemplateImportExport exportXmlEntity(UUID id, boolean ignoreAuthorize) throws MyForbiddenException, MyNotFoundException, JAXBException, ParserConfigurationException, IOException, InstantiationException, IllegalAccessException, SAXException { + public DescriptionTemplateImportExport exportXmlEntity(UUID id, boolean ignoreAuthorize) throws MyForbiddenException, MyNotFoundException, JAXBException, ParserConfigurationException, IOException, InstantiationException, IllegalAccessException, SAXException, InvalidApplicationException { logger.debug(new MapLogEntry("exportXml").And("id", id)); if (!ignoreAuthorize) this.authorizationService.authorizeAtLeastOneForce(List.of(this.authorizationContentResolver.descriptionTemplateAffiliation(id)), Permission.ExportDescriptionTemplate); @@ -933,11 +956,10 @@ public class DescriptionTemplateServiceImpl implements DescriptionTemplateServic return this.responseUtilsService.buildResponseFileFromText(xml, data.getLabel() + ".xml"); } - private DescriptionTemplateImportExport definitionXmlToExport(DescriptionTemplateEntity data, DefinitionEntity entity) { + private DescriptionTemplateImportExport definitionXmlToExport(DescriptionTemplateEntity data, DefinitionEntity entity) throws InvalidApplicationException { DescriptionTemplateImportExport xml = new DescriptionTemplateImportExport(); xml.setId(data.getId()); - xml.setType(data.getTypeId()); - xml.setType(data.getTypeId()); + xml.setDescriptionTemplateType(this.descriptionTemplateTypeXmlToExport(data.getTypeId())); xml.setLanguage(data.getLanguage()); xml.setDescription(data.getDescription()); xml.setGroupId(data.getGroupId()); @@ -952,6 +974,22 @@ public class DescriptionTemplateServiceImpl implements DescriptionTemplateServic return xml; } + private DescriptionTemplateTypeImportExport descriptionTemplateTypeXmlToExport(UUID typeId) throws InvalidApplicationException { + DescriptionTemplateTypeImportExport xml = new DescriptionTemplateTypeImportExport(); + + if (typeId == null) return xml; + + DescriptionTemplateTypeEntity data = this.entityManager.find(DescriptionTemplateTypeEntity.class, typeId); + if (data == null) + throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{typeId, DescriptionTemplateType.class.getSimpleName()}, LocaleContextHolder.getLocale())); + + xml.setId(typeId); + xml.setName(data.getName()); + xml.setCode(data.getCode()); + + return xml; + } + private DescriptionTemplatePageImportExport pageXmlToExport(PageEntity entity) { DescriptionTemplatePageImportExport xml = new DescriptionTemplatePageImportExport(); xml.setId(entity.getId()); diff --git a/backend/core/src/main/java/org/opencdmp/service/descriptiontemplatetype/DescriptionTemplateTypeServiceImpl.java b/backend/core/src/main/java/org/opencdmp/service/descriptiontemplatetype/DescriptionTemplateTypeServiceImpl.java index 5500fc51c..bf9a6febc 100644 --- a/backend/core/src/main/java/org/opencdmp/service/descriptiontemplatetype/DescriptionTemplateTypeServiceImpl.java +++ b/backend/core/src/main/java/org/opencdmp/service/descriptiontemplatetype/DescriptionTemplateTypeServiceImpl.java @@ -3,6 +3,7 @@ package org.opencdmp.service.descriptiontemplatetype; import gr.cite.commons.web.authz.service.AuthorizationService; import gr.cite.tools.data.builder.BuilderFactory; import gr.cite.tools.data.deleter.DeleterFactory; +import gr.cite.tools.data.query.QueryFactory; import gr.cite.tools.exception.MyApplicationException; import gr.cite.tools.exception.MyForbiddenException; import gr.cite.tools.exception.MyNotFoundException; @@ -25,6 +26,7 @@ import org.opencdmp.model.DescriptionTemplateType; import org.opencdmp.model.builder.DescriptionTemplateTypeBuilder; import org.opencdmp.model.deleter.DescriptionTemplateTypeDeleter; import org.opencdmp.model.persist.DescriptionTemplateTypePersist; +import org.opencdmp.query.DescriptionTemplateTypeQuery; import org.opencdmp.service.accounting.AccountingService; import org.opencdmp.service.usagelimit.UsageLimitServiceImpl; import org.slf4j.LoggerFactory; @@ -51,6 +53,8 @@ public class DescriptionTemplateTypeServiceImpl implements DescriptionTemplateTy private final BuilderFactory builderFactory; + private final QueryFactory queryFactory; + private final ConventionService conventionService; private final ErrorThesaurusProperties errors; @@ -69,6 +73,7 @@ public class DescriptionTemplateTypeServiceImpl implements DescriptionTemplateTy AuthorizationService authorizationService, DeleterFactory deleterFactory, BuilderFactory builderFactory, + QueryFactory queryFactory, ConventionService conventionService, ErrorThesaurusProperties errors, MessageSource messageSource, @@ -77,6 +82,7 @@ public class DescriptionTemplateTypeServiceImpl implements DescriptionTemplateTy this.authorizationService = authorizationService; this.deleterFactory = deleterFactory; this.builderFactory = builderFactory; + this.queryFactory = queryFactory; this.conventionService = conventionService; this.errors = errors; this.messageSource = messageSource; @@ -105,12 +111,18 @@ public class DescriptionTemplateTypeServiceImpl implements DescriptionTemplateTy data.setCreatedAt(Instant.now()); } + data.setCode(model.getCode()); data.setName(model.getName()); data.setStatus(model.getStatus()); data.setUpdatedAt(Instant.now()); - if (isUpdate) + + Long descriptionTemplateTypeCodes = this.queryFactory.query(DescriptionTemplateTypeQuery.class).disableTracking().codes(model.getCode()).isActive(IsActive.Active).count(); + + if (isUpdate) { + if (descriptionTemplateTypeCodes > 1) throw new MyValidationException(this.errors.getDescriptionTemplateTypeCodeExists().getCode(), this.errors.getDescriptionTemplateTypeCodeExists().getMessage()); this.entityManager.merge(data); - else{ + } else { + if (descriptionTemplateTypeCodes > 0) throw new MyValidationException(this.errors.getDescriptionTemplateTypeCodeExists().getCode(), this.errors.getDescriptionTemplateTypeCodeExists().getMessage()); this.entityManager.persist(data); this.accountingService.increase(UsageLimitTargetMetric.DESCRIPTION_TEMPLATE_TYPE_COUNT.getValue()); } diff --git a/backend/web/src/main/resources/config/errors.yml b/backend/web/src/main/resources/config/errors.yml index 944caa928..716f33773 100644 --- a/backend/web/src/main/resources/config/errors.yml +++ b/backend/web/src/main/resources/config/errors.yml @@ -127,4 +127,7 @@ error-thesaurus: message: Usage limit exception for this target metric usageLimitMetricAlreadyExists: code: 146 - message: Usage limit metric is already selected as target \ No newline at end of file + message: Usage limit metric is already selected as target + descriptionTemplateTypeCodeExists: + code: 147 + message: Description template type code exists \ No newline at end of file diff --git a/frontend/src/app/core/common/enum/respone-error-code.ts b/frontend/src/app/core/common/enum/respone-error-code.ts index b00192641..4c5529b2e 100644 --- a/frontend/src/app/core/common/enum/respone-error-code.ts +++ b/frontend/src/app/core/common/enum/respone-error-code.ts @@ -42,6 +42,7 @@ export enum ResponseErrorCode { MaxDescriptionsExceeded = 144, UsageLimitException = 145, UsageLimitMetricAlreadyExists = 146, + DescriptionTemplateTypeCodeExists = 147, // Notification & Annotation Errors InvalidApiKey = 200, @@ -160,6 +161,8 @@ export class ResponseErrorCodeHelper { return language.instant("GENERAL.BACKEND-ERRORS.USAGE-LIMIT-EXCEPTION"); case ResponseErrorCode.UsageLimitMetricAlreadyExists: return language.instant("GENERAL.BACKEND-ERRORS.USAGE-LIMIT-METRIC-ALLREADY-EXISTS"); + case ResponseErrorCode.DescriptionTemplateTypeCodeExists: + return language.instant("GENERAL.BACKEND-ERRORS.DESCRIPTION-TEMPLATE-TYPE-CODE-EXISTS"); default: return language.instant("GENERAL.SNACK-BAR.NOT-FOUND"); } diff --git a/frontend/src/app/core/model/description-template-type/description-template-type.ts b/frontend/src/app/core/model/description-template-type/description-template-type.ts index 9e5cd6123..3b4adbbca 100644 --- a/frontend/src/app/core/model/description-template-type/description-template-type.ts +++ b/frontend/src/app/core/model/description-template-type/description-template-type.ts @@ -3,10 +3,12 @@ import { BaseEntity, BaseEntityPersist } from "@common/base/base-entity.model"; export interface DescriptionTemplateType extends BaseEntity { name: string; + code: string; status: DescriptionTemplateTypeStatus; } export interface DescriptionTemplateTypePersist extends BaseEntityPersist { name: string; + code: string; status: DescriptionTemplateTypeStatus; } \ No newline at end of file diff --git a/frontend/src/app/ui/admin/description-types/editor/description-template-type-editor.component.html b/frontend/src/app/ui/admin/description-types/editor/description-template-type-editor.component.html index 5d58a3053..4c4da31ea 100644 --- a/frontend/src/app/ui/admin/description-types/editor/description-template-type-editor.component.html +++ b/frontend/src/app/ui/admin/description-types/editor/description-template-type-editor.component.html @@ -55,6 +55,18 @@ {{'GENERAL.VALIDATION.REQUIRED' | translate}} +
+ + {{'DESCRIPTION-TEMPLATE-TYPE-EDITOR.FIELDS.CODE' | translate}} + +
+
+ + + {{formGroup.get('code').getError('backendError').message}} + {{'GENERAL.VALIDATION.REQUIRED' | translate}} + +
diff --git a/frontend/src/app/ui/admin/description-types/editor/description-template-type-editor.model.ts b/frontend/src/app/ui/admin/description-types/editor/description-template-type-editor.model.ts index 30f004801..20ddc61c0 100644 --- a/frontend/src/app/ui/admin/description-types/editor/description-template-type-editor.model.ts +++ b/frontend/src/app/ui/admin/description-types/editor/description-template-type-editor.model.ts @@ -8,6 +8,7 @@ import { Validation, ValidationContext } from '@common/forms/validation/validati export class DescriptionTemplateTypeEditorModel extends BaseEditorModel implements DescriptionTemplateTypePersist { name: string; + code: string; status: DescriptionTemplateTypeStatus = DescriptionTemplateTypeStatus.Draft; permissions: string[]; @@ -21,6 +22,7 @@ export class DescriptionTemplateTypeEditorModel extends BaseEditorModel implemen super.fromModel(item); this.id = item.id; this.name = item.name; + this.code = item.code; this.status = item.status; this.isActive = item.isActive; this.hash = item.hash; @@ -36,6 +38,7 @@ export class DescriptionTemplateTypeEditorModel extends BaseEditorModel implemen return this.formBuilder.group({ id: [{ value: this.id, disabled: disabled }, context.getValidation('id').validators], name: [{ value: this.name, disabled: disabled }, context.getValidation('name').validators], + code: [{ value: this.code, disabled: disabled }, context.getValidation('code').validators], status: [{ value: this.status, disabled: disabled }, context.getValidation('status').validators], hash: [{ value: this.hash, disabled: disabled }, context.getValidation('hash').validators] }); @@ -46,6 +49,7 @@ export class DescriptionTemplateTypeEditorModel extends BaseEditorModel implemen const baseValidationArray: Validation[] = new Array(); baseValidationArray.push({ key: 'id', validators: [BackendErrorValidator(this.validationErrorModel, 'id')] }); baseValidationArray.push({ key: 'name', validators: [Validators.required, BackendErrorValidator(this.validationErrorModel, 'name')] }); + baseValidationArray.push({ key: 'code', validators: [Validators.required, BackendErrorValidator(this.validationErrorModel, 'code')] }); baseValidationArray.push({ key: 'status', validators: [Validators.required, BackendErrorValidator(this.validationErrorModel, 'status')] }); baseValidationArray.push({ key: 'hash', validators: [] }); diff --git a/frontend/src/app/ui/admin/description-types/editor/description-template-type-editor.resolver.ts b/frontend/src/app/ui/admin/description-types/editor/description-template-type-editor.resolver.ts index 0e47a57da..2af580d75 100644 --- a/frontend/src/app/ui/admin/description-types/editor/description-template-type-editor.resolver.ts +++ b/frontend/src/app/ui/admin/description-types/editor/description-template-type-editor.resolver.ts @@ -21,6 +21,7 @@ export class DescriptionTemplateTypeEditorResolver extends BaseEditorResolver { ...BaseEditorResolver.lookupFields(), nameof(x => x.id), nameof(x => x.name), + nameof(x => x.code), nameof(x => x.status), nameof(x => x.createdAt), nameof(x => x.hash), diff --git a/frontend/src/app/ui/admin/description-types/listing/description-template-type-listing.component.ts b/frontend/src/app/ui/admin/description-types/listing/description-template-type-listing.component.ts index 20680cd0e..043bf2a0d 100644 --- a/frontend/src/app/ui/admin/description-types/listing/description-template-type-listing.component.ts +++ b/frontend/src/app/ui/admin/description-types/listing/description-template-type-listing.component.ts @@ -42,6 +42,7 @@ export class DescriptionTemplateTypeListingComponent extends BaseListingComponen private readonly lookupFields: string[] = [ nameof(x => x.id), nameof(x => x.name), + nameof(x => x.code), nameof(x => x.status), nameof(x => x.updatedAt), nameof(x => x.createdAt), @@ -96,7 +97,13 @@ export class DescriptionTemplateTypeListingComponent extends BaseListingComponen prop: nameof(x => x.name), sortable: true, languageName: 'DESCRIPTION-TEMPLATE-TYPE-LISTING.FIELDS.NAME' - }, { + }, + { + prop: nameof(x => x.code), + sortable: true, + languageName: 'DESCRIPTION-TEMPLATE-TYPE-LISTING.FIELDS.CODE', + }, + { prop: nameof(x => x.status), sortable: true, languageName: 'DESCRIPTION-TEMPLATE-TYPE-LISTING.FIELDS.STATUS', diff --git a/frontend/src/assets/i18n/baq.json b/frontend/src/assets/i18n/baq.json index 90e4a30a5..2be04a945 100644 --- a/frontend/src/assets/i18n/baq.json +++ b/frontend/src/assets/i18n/baq.json @@ -81,7 +81,8 @@ "REQUEST-HAS-EXPIRED": "Request has expired", "MAX-DESCRIPTION-EXCEEDED": "This plan has reached the maximun descriptions for this description template", "USAGE-LIMIT-EXCEPTION": "Υou have exceeded the {{usageLimitLabel}} usage limit. Please contact your administrator.", - "USAGE-LIMIT-METRIC-ALLREADY-EXISTS": "This usage limit metric is already defined in this tenant. Change metric or select other tenant." + "USAGE-LIMIT-METRIC-ALLREADY-EXISTS": "This usage limit metric is already defined in this tenant. Change metric or select other tenant.", + "DESCRIPTION-TEMPLATE-TYPE-CODE-EXISTS": "The description template type code you provided already exists. Please choose a different code." }, "FORM-VALIDATION-DISPLAY-DIALOG": { "WARNING": "Kontuz!", @@ -1086,6 +1087,7 @@ "CREATE-TYPE": "Create Description Type", "FIELDS": { "NAME": "Name", + "CODE": "Code", "STATUS": "Status", "UPDATED-AT": "Updated", "CREATED-AT": "Created", @@ -1466,7 +1468,8 @@ "DESCRIPTION-TEMPLATE-TYPE-EDITOR": { "TITLE-EDIT-DESCRIPTION-TEMPLATE-TYPE": "Editing Description Template Type", "FIELDS": { - "NAME": "Name" + "NAME": "Name", + "CODE": "Code" }, "ACTIONS": { "SAVE": "Save", diff --git a/frontend/src/assets/i18n/de.json b/frontend/src/assets/i18n/de.json index dccff95ba..99cbb719b 100644 --- a/frontend/src/assets/i18n/de.json +++ b/frontend/src/assets/i18n/de.json @@ -81,7 +81,8 @@ "REQUEST-HAS-EXPIRED": "Request has expired", "MAX-DESCRIPTION-EXCEEDED": "This plan has reached the maximun descriptions for this description template", "USAGE-LIMIT-EXCEPTION": "Υou have exceeded the {{usageLimitLabel}} usage limit. Please contact your administrator.", - "USAGE-LIMIT-METRIC-ALLREADY-EXISTS": "This usage limit metric is already defined in this tenant. Change metric or select other tenant." + "USAGE-LIMIT-METRIC-ALLREADY-EXISTS": "This usage limit metric is already defined in this tenant. Change metric or select other tenant.", + "DESCRIPTION-TEMPLATE-TYPE-CODE-EXISTS": "The description template type code you provided already exists. Please choose a different code." }, "FORM-VALIDATION-DISPLAY-DIALOG": { "WARNING": "Warnung!", @@ -1086,6 +1087,7 @@ "CREATE-TYPE": "Create Description Type", "FIELDS": { "NAME": "Name", + "CODE": "Code", "STATUS": "Status", "UPDATED-AT": "Updated", "CREATED-AT": "Created", @@ -1466,7 +1468,8 @@ "DESCRIPTION-TEMPLATE-TYPE-EDITOR": { "TITLE-EDIT-DESCRIPTION-TEMPLATE-TYPE": "Editing Description Template Type", "FIELDS": { - "NAME": "Name" + "NAME": "Name", + "CODE": "Code" }, "ACTIONS": { "SAVE": "Save", diff --git a/frontend/src/assets/i18n/en.json b/frontend/src/assets/i18n/en.json index 0ffd3590a..82798b827 100644 --- a/frontend/src/assets/i18n/en.json +++ b/frontend/src/assets/i18n/en.json @@ -81,7 +81,8 @@ "REQUEST-HAS-EXPIRED": "Request has expired", "MAX-DESCRIPTION-EXCEEDED": "This plan has reached the maximun descriptions for this description template", "USAGE-LIMIT-EXCEPTION": "Υou have exceeded the {{usageLimitLabel}} usage limit. Please contact your administrator.", - "USAGE-LIMIT-METRIC-ALLREADY-EXISTS": "This usage limit metric is already defined in this tenant. Change metric or select other tenant." + "USAGE-LIMIT-METRIC-ALLREADY-EXISTS": "This usage limit metric is already defined in this tenant. Change metric or select other tenant.", + "DESCRIPTION-TEMPLATE-TYPE-CODE-EXISTS": "The description template type code you provided already exists. Please choose a different code." }, "FORM-VALIDATION-DISPLAY-DIALOG": { "WARNING": "Warning!", @@ -1086,6 +1087,7 @@ "CREATE-TYPE": "Create Description Type", "FIELDS": { "NAME": "Name", + "CODE": "Code", "STATUS": "Status", "UPDATED-AT": "Updated", "CREATED-AT": "Created", @@ -1466,7 +1468,8 @@ "DESCRIPTION-TEMPLATE-TYPE-EDITOR": { "TITLE-EDIT-DESCRIPTION-TEMPLATE-TYPE": "Editing Description Template Type", "FIELDS": { - "NAME": "Name" + "NAME": "Name", + "CODE": "Code" }, "ACTIONS": { "SAVE": "Save", diff --git a/frontend/src/assets/i18n/es.json b/frontend/src/assets/i18n/es.json index e77189c0f..b1868c05d 100644 --- a/frontend/src/assets/i18n/es.json +++ b/frontend/src/assets/i18n/es.json @@ -81,7 +81,8 @@ "REQUEST-HAS-EXPIRED": "Request has expired", "MAX-DESCRIPTION-EXCEEDED": "This plan has reached the maximun descriptions for this description template", "USAGE-LIMIT-EXCEPTION": "Υou have exceeded the {{usageLimitLabel}} usage limit. Please contact your administrator.", - "USAGE-LIMIT-METRIC-ALLREADY-EXISTS": "This usage limit metric is already defined in this tenant. Change metric or select other tenant." + "USAGE-LIMIT-METRIC-ALLREADY-EXISTS": "This usage limit metric is already defined in this tenant. Change metric or select other tenant.", + "DESCRIPTION-TEMPLATE-TYPE-CODE-EXISTS": "The description template type code you provided already exists. Please choose a different code." }, "FORM-VALIDATION-DISPLAY-DIALOG": { "WARNING": "Atención!", @@ -1086,6 +1087,7 @@ "CREATE-TYPE": "Create Description Type", "FIELDS": { "NAME": "Name", + "CODE": "Code", "STATUS": "Status", "UPDATED-AT": "Updated", "CREATED-AT": "Created", @@ -1466,7 +1468,8 @@ "DESCRIPTION-TEMPLATE-TYPE-EDITOR": { "TITLE-EDIT-DESCRIPTION-TEMPLATE-TYPE": "Editing Description Template Type", "FIELDS": { - "NAME": "Name" + "NAME": "Name", + "CODE": "Code" }, "ACTIONS": { "SAVE": "Save", diff --git a/frontend/src/assets/i18n/gr.json b/frontend/src/assets/i18n/gr.json index eefde065d..2822e1016 100644 --- a/frontend/src/assets/i18n/gr.json +++ b/frontend/src/assets/i18n/gr.json @@ -81,7 +81,8 @@ "REQUEST-HAS-EXPIRED": "Request has expired", "MAX-DESCRIPTION-EXCEEDED": "This plan has reached the maximun descriptions for this description template", "USAGE-LIMIT-EXCEPTION": "Υou have exceeded the {{usageLimitLabel}} usage limit. Please contact your administrator.", - "USAGE-LIMIT-METRIC-ALLREADY-EXISTS": "This usage limit metric is already defined in this tenant. Change metric or select other tenant." + "USAGE-LIMIT-METRIC-ALLREADY-EXISTS": "This usage limit metric is already defined in this tenant. Change metric or select other tenant.", + "DESCRIPTION-TEMPLATE-TYPE-CODE-EXISTS": "The description template type code you provided already exists. Please choose a different code." }, "FORM-VALIDATION-DISPLAY-DIALOG": { "WARNING": "Προσοχή!", @@ -1086,6 +1087,7 @@ "CREATE-TYPE": "Create Description Type", "FIELDS": { "NAME": "Name", + "CODE": "Code", "STATUS": "Status", "UPDATED-AT": "Updated", "CREATED-AT": "Created", @@ -1466,7 +1468,8 @@ "DESCRIPTION-TEMPLATE-TYPE-EDITOR": { "TITLE-EDIT-DESCRIPTION-TEMPLATE-TYPE": "Editing Description Template Type", "FIELDS": { - "NAME": "Name" + "NAME": "Name", + "CODE": "Code" }, "ACTIONS": { "SAVE": "Save", diff --git a/frontend/src/assets/i18n/hr.json b/frontend/src/assets/i18n/hr.json index 9755debc2..85cb87338 100644 --- a/frontend/src/assets/i18n/hr.json +++ b/frontend/src/assets/i18n/hr.json @@ -81,7 +81,8 @@ "REQUEST-HAS-EXPIRED": "Request has expired", "MAX-DESCRIPTION-EXCEEDED": "This plan has reached the maximun descriptions for this description template", "USAGE-LIMIT-EXCEPTION": "Υou have exceeded the {{usageLimitLabel}} usage limit. Please contact your administrator.", - "USAGE-LIMIT-METRIC-ALLREADY-EXISTS": "This usage limit metric is already defined in this tenant. Change metric or select other tenant." + "USAGE-LIMIT-METRIC-ALLREADY-EXISTS": "This usage limit metric is already defined in this tenant. Change metric or select other tenant.", + "DESCRIPTION-TEMPLATE-TYPE-CODE-EXISTS": "The description template type code you provided already exists. Please choose a different code." }, "FORM-VALIDATION-DISPLAY-DIALOG": { "WARNING": "Oprez!", @@ -1086,6 +1087,7 @@ "CREATE-TYPE": "Create Description Type", "FIELDS": { "NAME": "Name", + "CODE": "Code", "STATUS": "Status", "UPDATED-AT": "Updated", "CREATED-AT": "Created", @@ -1466,7 +1468,8 @@ "DESCRIPTION-TEMPLATE-TYPE-EDITOR": { "TITLE-EDIT-DESCRIPTION-TEMPLATE-TYPE": "Editing Description Template Type", "FIELDS": { - "NAME": "Name" + "NAME": "Name", + "CODE": "Code" }, "ACTIONS": { "SAVE": "Save", diff --git a/frontend/src/assets/i18n/pl.json b/frontend/src/assets/i18n/pl.json index 0fff12fb8..1267fe35a 100644 --- a/frontend/src/assets/i18n/pl.json +++ b/frontend/src/assets/i18n/pl.json @@ -81,7 +81,8 @@ "REQUEST-HAS-EXPIRED": "Request has expired", "MAX-DESCRIPTION-EXCEEDED": "This plan has reached the maximun descriptions for this description template", "USAGE-LIMIT-EXCEPTION": "Υou have exceeded the {{usageLimitLabel}} usage limit. Please contact your administrator.", - "USAGE-LIMIT-METRIC-ALLREADY-EXISTS": "This usage limit metric is already defined in this tenant. Change metric or select other tenant." + "USAGE-LIMIT-METRIC-ALLREADY-EXISTS": "This usage limit metric is already defined in this tenant. Change metric or select other tenant.", + "DESCRIPTION-TEMPLATE-TYPE-CODE-EXISTS": "The description template type code you provided already exists. Please choose a different code." }, "FORM-VALIDATION-DISPLAY-DIALOG": { "WARNING": "Ostrzeżenie!", @@ -1086,6 +1087,7 @@ "CREATE-TYPE": "Create Description Type", "FIELDS": { "NAME": "Name", + "CODE": "Code", "STATUS": "Status", "UPDATED-AT": "Updated", "CREATED-AT": "Created", @@ -1466,7 +1468,8 @@ "DESCRIPTION-TEMPLATE-TYPE-EDITOR": { "TITLE-EDIT-DESCRIPTION-TEMPLATE-TYPE": "Editing Description Template Type", "FIELDS": { - "NAME": "Name" + "NAME": "Name", + "CODE": "Code" }, "ACTIONS": { "SAVE": "Save", diff --git a/frontend/src/assets/i18n/pt.json b/frontend/src/assets/i18n/pt.json index 7f9c21132..eca650059 100644 --- a/frontend/src/assets/i18n/pt.json +++ b/frontend/src/assets/i18n/pt.json @@ -81,7 +81,8 @@ "REQUEST-HAS-EXPIRED": "Request has expired", "MAX-DESCRIPTION-EXCEEDED": "This plan has reached the maximun descriptions for this description template", "USAGE-LIMIT-EXCEPTION": "Υou have exceeded the {{usageLimitLabel}} usage limit. Please contact your administrator.", - "USAGE-LIMIT-METRIC-ALLREADY-EXISTS": "This usage limit metric is already defined in this tenant. Change metric or select other tenant." + "USAGE-LIMIT-METRIC-ALLREADY-EXISTS": "This usage limit metric is already defined in this tenant. Change metric or select other tenant.", + "DESCRIPTION-TEMPLATE-TYPE-CODE-EXISTS": "The description template type code you provided already exists. Please choose a different code." }, "FORM-VALIDATION-DISPLAY-DIALOG": { "WARNING": "Atenção!", @@ -1086,6 +1087,7 @@ "CREATE-TYPE": "Create Description Type", "FIELDS": { "NAME": "Name", + "CODE": "Code", "STATUS": "Status", "UPDATED-AT": "Updated", "CREATED-AT": "Created", @@ -1466,7 +1468,8 @@ "DESCRIPTION-TEMPLATE-TYPE-EDITOR": { "TITLE-EDIT-DESCRIPTION-TEMPLATE-TYPE": "Editing Description Template Type", "FIELDS": { - "NAME": "Name" + "NAME": "Name", + "CODE": "Code" }, "ACTIONS": { "SAVE": "Save", diff --git a/frontend/src/assets/i18n/sk.json b/frontend/src/assets/i18n/sk.json index 065ed0b47..e2afa3c6a 100644 --- a/frontend/src/assets/i18n/sk.json +++ b/frontend/src/assets/i18n/sk.json @@ -81,7 +81,8 @@ "REQUEST-HAS-EXPIRED": "Request has expired", "MAX-DESCRIPTION-EXCEEDED": "This plan has reached the maximun descriptions for this description template", "USAGE-LIMIT-EXCEPTION": "Υou have exceeded the {{usageLimitLabel}} usage limit. Please contact your administrator.", - "USAGE-LIMIT-METRIC-ALLREADY-EXISTS": "This usage limit metric is already defined in this tenant. Change metric or select other tenant." + "USAGE-LIMIT-METRIC-ALLREADY-EXISTS": "This usage limit metric is already defined in this tenant. Change metric or select other tenant.", + "DESCRIPTION-TEMPLATE-TYPE-CODE-EXISTS": "The description template type code you provided already exists. Please choose a different code." }, "FORM-VALIDATION-DISPLAY-DIALOG": { "WARNING": "Upozornenie!", @@ -1086,6 +1087,7 @@ "CREATE-TYPE": "Create Description Type", "FIELDS": { "NAME": "Name", + "CODE": "Code", "STATUS": "Status", "UPDATED-AT": "Updated", "CREATED-AT": "Created", @@ -1466,7 +1468,8 @@ "DESCRIPTION-TEMPLATE-TYPE-EDITOR": { "TITLE-EDIT-DESCRIPTION-TEMPLATE-TYPE": "Editing Description Template Type", "FIELDS": { - "NAME": "Name" + "NAME": "Name", + "CODE": "Code" }, "ACTIONS": { "SAVE": "Save", diff --git a/frontend/src/assets/i18n/sr.json b/frontend/src/assets/i18n/sr.json index 6de3e699c..6aa1f8439 100644 --- a/frontend/src/assets/i18n/sr.json +++ b/frontend/src/assets/i18n/sr.json @@ -81,7 +81,8 @@ "REQUEST-HAS-EXPIRED": "Request has expired", "MAX-DESCRIPTION-EXCEEDED": "This plan has reached the maximun descriptions for this description template", "USAGE-LIMIT-EXCEPTION": "Υou have exceeded the {{usageLimitLabel}} usage limit. Please contact your administrator.", - "USAGE-LIMIT-METRIC-ALLREADY-EXISTS": "This usage limit metric is already defined in this tenant. Change metric or select other tenant." + "USAGE-LIMIT-METRIC-ALLREADY-EXISTS": "This usage limit metric is already defined in this tenant. Change metric or select other tenant.", + "DESCRIPTION-TEMPLATE-TYPE-CODE-EXISTS": "The description template type code you provided already exists. Please choose a different code." }, "FORM-VALIDATION-DISPLAY-DIALOG": { "WARNING": "Oprez!", @@ -1086,6 +1087,7 @@ "CREATE-TYPE": "Create Description Type", "FIELDS": { "NAME": "Name", + "CODE": "Code", "STATUS": "Status", "UPDATED-AT": "Updated", "CREATED-AT": "Created", @@ -1466,7 +1468,8 @@ "DESCRIPTION-TEMPLATE-TYPE-EDITOR": { "TITLE-EDIT-DESCRIPTION-TEMPLATE-TYPE": "Editing Description Template Type", "FIELDS": { - "NAME": "Name" + "NAME": "Name", + "CODE": "Code" }, "ACTIONS": { "SAVE": "Save", diff --git a/frontend/src/assets/i18n/tr.json b/frontend/src/assets/i18n/tr.json index 078d82b40..776ca01eb 100644 --- a/frontend/src/assets/i18n/tr.json +++ b/frontend/src/assets/i18n/tr.json @@ -81,7 +81,8 @@ "REQUEST-HAS-EXPIRED": "Request has expired", "MAX-DESCRIPTION-EXCEEDED": "This plan has reached the maximun descriptions for this description template", "USAGE-LIMIT-EXCEPTION": "Υou have exceeded the {{usageLimitLabel}} usage limit. Please contact your administrator.", - "USAGE-LIMIT-METRIC-ALLREADY-EXISTS": "This usage limit metric is already defined in this tenant. Change metric or select other tenant." + "USAGE-LIMIT-METRIC-ALLREADY-EXISTS": "This usage limit metric is already defined in this tenant. Change metric or select other tenant.", + "DESCRIPTION-TEMPLATE-TYPE-CODE-EXISTS": "The description template type code you provided already exists. Please choose a different code." }, "FORM-VALIDATION-DISPLAY-DIALOG": { "WARNING": "Uyarı!", @@ -1086,6 +1087,7 @@ "CREATE-TYPE": "Create Description Type", "FIELDS": { "NAME": "Name", + "CODE": "Code", "STATUS": "Status", "UPDATED-AT": "Updated", "CREATED-AT": "Created", @@ -1466,7 +1468,8 @@ "DESCRIPTION-TEMPLATE-TYPE-EDITOR": { "TITLE-EDIT-DESCRIPTION-TEMPLATE-TYPE": "Editing Description Template Type", "FIELDS": { - "NAME": "Name" + "NAME": "Name", + "CODE": "Code" }, "ACTIONS": { "SAVE": "Save",