From dc1d2e474a0a1497988131dd42d2f3c0a0c10de2 Mon Sep 17 00:00:00 2001 From: oussamasic <oussamazerouali42@gmail.com> Date: Mon, 22 Nov 2021 16:55:44 +0100 Subject: [PATCH] add getRule service --- .../common/common/ArchiveSearchConsts.java | 3 +- .../common/dto/RuleSearchCriteriaDto.java | 1 + .../dto/VitamUiManagementMetadataAction.java | 1 - .../common/dto/VitamUiRuleCategoryAction.java | 8 + .../VitamUiRuleCategoryActionDeletion.java | 6 + .../archive-search-internal/pom.xml | 4 +- .../converter/RuleOperationsConverter.java | 3 + .../service/RulesUpdateCommonService.java | 3 + .../service/ArchiveSearchInternalService.java | 3 - api/api-iam/iam-internal/pom.xml | 4 +- .../src/main/resources/dev/customer-init.yml | 212 ++++++++++++++++++ .../resources/dev/keystore_iam-internal.jks | Bin 0 -> 3863 bytes .../main/resources/dev/truststore_server.jks | Bin 0 -> 3297 bytes .../search/rest/ArchivesSearchController.java | 14 +- .../search/service/ArchivesSearchService.java | 5 - .../appraisal-rule-search.component.ts | 2 +- .../archive-search.component.html | 4 +- .../archive-search.component.ts | 17 +- .../src/app/archive/archive.module.ts | 4 +- .../src/app/archive/archive.service.ts | 12 +- .../add-management-rules.component.html | 9 +- .../add-management-rules.component.ts | 155 +++++++------ .../add-update-property.component.ts | 42 ++-- .../dua-management-rules.component.html | 6 +- .../dua-management-rules.component.ts | 70 +++--- .../management-rules.component.css | 32 --- .../management-rules.component.html | 4 +- .../management-rules.component.ts | 135 +++++------ .../src/app/archive/models/rule-type-enum.ts | 50 +++++ .../archive/models/ruleAction.interface.ts | 5 + .../management-rules-validator.service.ts | 53 +++-- .../src/app/core/api/archive-api.service.ts | 4 - .../management-rules-shared-data.service.ts | 28 +-- .../archive-search/src/assets/i18n/en.json | 7 +- .../archive-search/src/assets/i18n/fr.json | 7 +- 35 files changed, 566 insertions(+), 347 deletions(-) create mode 100644 ui/ui-frontend/projects/archive-search/src/app/archive/models/rule-type-enum.ts diff --git a/api/api-archive-search/archive-search-commons/src/main/java/fr/gouv/vitamui/archives/search/common/common/ArchiveSearchConsts.java b/api/api-archive-search/archive-search-commons/src/main/java/fr/gouv/vitamui/archives/search/common/common/ArchiveSearchConsts.java index 69614d5a7..e264bd5b8 100644 --- a/api/api-archive-search/archive-search-commons/src/main/java/fr/gouv/vitamui/archives/search/common/common/ArchiveSearchConsts.java +++ b/api/api-archive-search/archive-search-commons/src/main/java/fr/gouv/vitamui/archives/search/common/common/ArchiveSearchConsts.java @@ -147,8 +147,7 @@ public class ArchiveSearchConsts { ORIGINATING_AGENCY_ID_FIELD, "#originating_agency", "START_DATE", "StartDate", "END_DATE", "EndDate", - "SP_LABEL", "originating_agency_label", - "APPRAISAL_RULE_START_DATE", "#management.AppraisalRule.Rules.StartDate" + "SP_LABEL", "originating_agency_label" ); diff --git a/api/api-archive-search/archive-search-commons/src/main/java/fr/gouv/vitamui/archives/search/common/dto/RuleSearchCriteriaDto.java b/api/api-archive-search/archive-search-commons/src/main/java/fr/gouv/vitamui/archives/search/common/dto/RuleSearchCriteriaDto.java index fbaf00a2a..9267bfca7 100644 --- a/api/api-archive-search/archive-search-commons/src/main/java/fr/gouv/vitamui/archives/search/common/dto/RuleSearchCriteriaDto.java +++ b/api/api-archive-search/archive-search-commons/src/main/java/fr/gouv/vitamui/archives/search/common/dto/RuleSearchCriteriaDto.java @@ -53,5 +53,6 @@ import java.io.Serializable; public class RuleSearchCriteriaDto implements Serializable { private SearchCriteriaDto searchCriteriaDto; + private VitamUiRuleActions ruleActions; } diff --git a/api/api-archive-search/archive-search-commons/src/main/java/fr/gouv/vitamui/archives/search/common/dto/VitamUiManagementMetadataAction.java b/api/api-archive-search/archive-search-commons/src/main/java/fr/gouv/vitamui/archives/search/common/dto/VitamUiManagementMetadataAction.java index 1bc42db09..5ae6eaa67 100644 --- a/api/api-archive-search/archive-search-commons/src/main/java/fr/gouv/vitamui/archives/search/common/dto/VitamUiManagementMetadataAction.java +++ b/api/api-archive-search/archive-search-commons/src/main/java/fr/gouv/vitamui/archives/search/common/dto/VitamUiManagementMetadataAction.java @@ -54,6 +54,5 @@ import java.io.Serializable; @Getter public class VitamUiManagementMetadataAction implements Serializable { - @JsonProperty("ArchiveUnitProfile") String archiveUnitProfile; } diff --git a/api/api-archive-search/archive-search-commons/src/main/java/fr/gouv/vitamui/archives/search/common/dto/VitamUiRuleCategoryAction.java b/api/api-archive-search/archive-search-commons/src/main/java/fr/gouv/vitamui/archives/search/common/dto/VitamUiRuleCategoryAction.java index 61e862f7b..3cf395cf9 100644 --- a/api/api-archive-search/archive-search-commons/src/main/java/fr/gouv/vitamui/archives/search/common/dto/VitamUiRuleCategoryAction.java +++ b/api/api-archive-search/archive-search-commons/src/main/java/fr/gouv/vitamui/archives/search/common/dto/VitamUiRuleCategoryAction.java @@ -55,12 +55,20 @@ import java.util.Set; public class VitamUiRuleCategoryAction implements Serializable { private List<VitamUiRuleAction> rules; + private String finalAction; + private String classificationLevel; + private String classificationOwner; + private String classificationAudience; + private String classificationReassessingDate; + private Boolean needReassessingAuthorization; + private Boolean preventInheritance; + private Set<String> preventRulesId; } diff --git a/api/api-archive-search/archive-search-commons/src/main/java/fr/gouv/vitamui/archives/search/common/dto/VitamUiRuleCategoryActionDeletion.java b/api/api-archive-search/archive-search-commons/src/main/java/fr/gouv/vitamui/archives/search/common/dto/VitamUiRuleCategoryActionDeletion.java index 5dc901f8c..e2a89d6ec 100644 --- a/api/api-archive-search/archive-search-commons/src/main/java/fr/gouv/vitamui/archives/search/common/dto/VitamUiRuleCategoryActionDeletion.java +++ b/api/api-archive-search/archive-search-commons/src/main/java/fr/gouv/vitamui/archives/search/common/dto/VitamUiRuleCategoryActionDeletion.java @@ -57,10 +57,16 @@ public class VitamUiRuleCategoryActionDeletion implements Serializable { private Optional<List<VitamUiRuleAction>> rules; + private Optional<String> finalAction; + private Optional<String> classificationAudience; + private Optional<String> classificationReassessingDate; + private Optional<Boolean> needReassessingAuthorization; + private Optional<Boolean> preventInheritance; + private Optional<Set<String>> preventRulesId; } diff --git a/api/api-archive-search/archive-search-internal/pom.xml b/api/api-archive-search/archive-search-internal/pom.xml index 0b8059bd5..37a82cc09 100644 --- a/api/api-archive-search/archive-search-internal/pom.xml +++ b/api/api-archive-search/archive-search-internal/pom.xml @@ -204,7 +204,9 @@ <executable>true</executable> <attach>false</attach> <!-- Need to use the original jar for integration-tests --> <mainClass>fr.gouv.vitamui.archive.internal.server.ApiArchiveInternalServerApplication</mainClass> - <jvmArguments>-Xmx512m</jvmArguments> + <jvmArguments> + -Xmx512m + </jvmArguments> <arguments> <!-- use src/main/config/application-dev.yml when using mvn spring-boot:run --> <!-- See : https://docs.spring.io/spring-boot/docs/current/reference/html/boot-features-external-config.html#boot-features-external-config-application-property-files --> diff --git a/api/api-archive-search/archive-search-internal/src/main/java/fr/gouv/vitamui/archive/internal/server/rulesupdate/converter/RuleOperationsConverter.java b/api/api-archive-search/archive-search-internal/src/main/java/fr/gouv/vitamui/archive/internal/server/rulesupdate/converter/RuleOperationsConverter.java index 56b9f277d..ede2340c0 100644 --- a/api/api-archive-search/archive-search-internal/src/main/java/fr/gouv/vitamui/archive/internal/server/rulesupdate/converter/RuleOperationsConverter.java +++ b/api/api-archive-search/archive-search-internal/src/main/java/fr/gouv/vitamui/archive/internal/server/rulesupdate/converter/RuleOperationsConverter.java @@ -60,6 +60,9 @@ import java.util.HashMap; import java.util.List; import java.util.Map; +/** + * Update Archive units Rules Converters + */ @Getter @Setter public class RuleOperationsConverter { diff --git a/api/api-archive-search/archive-search-internal/src/main/java/fr/gouv/vitamui/archive/internal/server/rulesupdate/service/RulesUpdateCommonService.java b/api/api-archive-search/archive-search-internal/src/main/java/fr/gouv/vitamui/archive/internal/server/rulesupdate/service/RulesUpdateCommonService.java index 5bed35aab..edc50eecb 100644 --- a/api/api-archive-search/archive-search-internal/src/main/java/fr/gouv/vitamui/archive/internal/server/rulesupdate/service/RulesUpdateCommonService.java +++ b/api/api-archive-search/archive-search-internal/src/main/java/fr/gouv/vitamui/archive/internal/server/rulesupdate/service/RulesUpdateCommonService.java @@ -45,6 +45,9 @@ import fr.gouv.vitam.common.model.massupdate.RuleActions; import java.util.Arrays; +/** + * Update Archive units Rules Common Service + */ public class RulesUpdateCommonService { public void deleteAttributesFromObjectNode(ObjectNode dslRequest, String ...attributes) { diff --git a/api/api-archive-search/archive-search-internal/src/main/java/fr/gouv/vitamui/archive/internal/server/service/ArchiveSearchInternalService.java b/api/api-archive-search/archive-search-internal/src/main/java/fr/gouv/vitamui/archive/internal/server/service/ArchiveSearchInternalService.java index e41e79d80..a5b72aa81 100644 --- a/api/api-archive-search/archive-search-internal/src/main/java/fr/gouv/vitamui/archive/internal/server/service/ArchiveSearchInternalService.java +++ b/api/api-archive-search/archive-search-internal/src/main/java/fr/gouv/vitamui/archive/internal/server/service/ArchiveSearchInternalService.java @@ -51,7 +51,6 @@ import fr.gouv.vitam.common.model.dip.DataObjectVersions; import fr.gouv.vitam.common.model.elimination.EliminationRequestBody; import fr.gouv.vitam.common.model.export.dip.DipExportType; import fr.gouv.vitam.common.model.export.dip.DipRequest; -import fr.gouv.vitam.common.model.elimination.EliminationRequestBody; import fr.gouv.vitam.common.model.massupdate.MassUpdateUnitRuleRequest; import fr.gouv.vitam.common.model.massupdate.RuleActions; import fr.gouv.vitamui.archive.internal.server.rulesupdate.converter.RuleOperationsConverter; @@ -700,8 +699,6 @@ public class ArchiveSearchInternalService { ObjectNode dslRequest = (ObjectNode) dslQuery; rulesUpdateCommonService.deleteAttributesFromObjectNode(dslRequest, "$projection" ,"$filter","$facets"); -/* massUpdateUnitRuleRequest.setRuleActions(ruleActions); - massUpdateUnitRuleRequest.setDslRequest(dslRequest);*/ rulesUpdateCommonService.setMassUpdateUnitRuleRequest(massUpdateUnitRuleRequest, ruleActions, dslRequest); objectMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL); diff --git a/api/api-iam/iam-internal/pom.xml b/api/api-iam/iam-internal/pom.xml index 1ea922a68..f324ba644 100644 --- a/api/api-iam/iam-internal/pom.xml +++ b/api/api-iam/iam-internal/pom.xml @@ -303,7 +303,9 @@ <executable>true</executable> <attach>true</attach> <!-- Need to use the original jar for integration-tests --> <mainClass>fr.gouv.vitamui.iam.internal.server.ApiIamInternalServerApplication</mainClass> - <jvmArguments>-Xmx512m</jvmArguments> + <jvmArguments> + -Xmx512m + </jvmArguments> <arguments> <argument>--spring.profiles.active=dev</argument> </arguments> diff --git a/api/api-iam/iam-internal/src/main/resources/dev/customer-init.yml b/api/api-iam/iam-internal/src/main/resources/dev/customer-init.yml index e69de29bb..25ce9eec9 100644 --- a/api/api-iam/iam-internal/src/main/resources/dev/customer-init.yml +++ b/api/api-iam/iam-internal/src/main/resources/dev/customer-init.yml @@ -0,0 +1,212 @@ +# This configuration file indicates profiles , profiles groups and users automatically create when a new customer or customer tenant is created. +# Put as many as you want following the template given +customer-init: + # Default profiles for each customer created + profiles: + - name: Profil pour la gestion des profiles de sécurité + description: Gestion des profiles de sécurité dans Vitam + app-name: SECURITY_PROFILES_APP + level: + roles: + - ROLE_GET_SECURITY_PROFILES + - ROLE_CREATE_SECURITY_PROFILES + - ROLE_UPDATE_SECURITY_PROFILES + - ROLE_DELETE_SECURITY_PROFILES + + - name: Profil pour la gestion des formats de fichiers + description: Gestion des formats de fichiers dans Vitam + app-name: FILE_FORMATS_APP + level: + roles: + - ROLE_GET_FILE_FORMATS + - ROLE_CREATE_FILE_FORMATS + - ROLE_UPDATE_FILE_FORMATS + - ROLE_DELETE_FILE_FORMATS + + - name: Profil pour la gestion des ontologies + description: Gestion des ontologies dans Vitam + app-name: ONTOLOGY_APP + level: + roles: + - ROLE_GET_ONTOLOGIES + - ROLE_CREATE_ONTOLOGIES + - ROLE_DELETE_ONTOLOGIES + + - name: Profil pour la gestion des contrats des contextes + description: Gestion des contrats des contextes dans Vitam + app-name: CONTEXTS_APP + level: + roles: + - ROLE_GET_CONTEXTS + - ROLE_CREATE_CONTEXTS + - ROLE_UPDATE_CONTEXTS + #- name: profileName + # description: desc + # level: 1 + # app-name: app + # roles: + # - role_1 + # - role_2 + # - role_3 + # ... + # Default profiles groups for each customer created + profiles-groups: + #- name: group1 + # description: desc + # level: 2 + # profiles: + # - profileName + # ... + # Default users for each customer created + users: + #- last-name: lastName + # first-name: firstName + # profiles-group-name: group1 + # level: 1 + # email-prefix: a@mail.com + # Default profiles for each tenant created + tenant-profiles: + - name: Profil pour la gestion des contrats d'accès + description: Gestion des contrats d'accès dans Vitam + app-name: ACCESS_APP + level: + roles: + - ROLE_GET_ACCESS_CONTRACTS + - ROLE_CREATE_ACCESS_CONTRACTS + - ROLE_UPDATE_ACCESS_CONTRACTS + - ROLE_GET_FILLING_PLAN_ACCESS + + - name: Profil pour la gestion des contrats d'entrée + description: Gestion des contrats d'entrée dans Vitam + app-name: INGEST_APP + level: + roles: + - ROLE_GET_INGEST_CONTRACTS + - ROLE_CREATE_INGEST_CONTRACTS + - ROLE_UPDATE_INGEST_CONTRACTS + - ROLE_GET_FILLING_PLAN_ACCESS + - ROLE_GET_MANAGEMENT_CONTRACTS + - ROLE_GET_ARCHIVE_PROFILES + + - name: Profil pour les services agents + description: Gestion des services agents dans Vitam + app-name: AGENCIES_APP + level: + roles: + - ROLE_GET_AGENCIES + - ROLE_CREATE_AGENCIES + - ROLE_UPDATE_AGENCIES + - ROLE_DELETE_AGENCIES + - ROLE_EXPORT_AGENCIES + + - name: Profil pour la gestion des Audits + description: Gestion des audits dans Vitam + app-name: AUDIT_APP + level: + roles: + - ROLE_GET_AUDITS + - ROLE_RUN_AUDITS + + - name: Profil Journal des Opérations + description: Gestion des applications des Journaux des Opérations + app-name: LOGBOOK_OPERATION_APP + level: + roles: + - ROLE_LOGBOOKS + + - name: Profil pour le dépôt et suivi des versements + description: Gestion des applications de dépôt et suivi des versements + app-name: INGEST_MANAGEMENT_APP + level: + roles: + - ROLE_GET_INGEST + - ROLE_CREATE_INGEST + - ROLE_GET_ALL_INGEST + - ROLE_LOGBOOKS + + - name: Profil Arbres et Plans + description: Gestion des application d'import d'arbres de positionnement et plans de classement + app-name: HOLDING_FILLING_SCHEME_APP + level: + roles: + - ROLE_CREATE_HOLDING_FILLING_SCHEME + - ROLE_GET_HOLDING_FILLING_SCHEME + - ROLE_GET_ALL_HOLDING_FILLING_SCHEME + + - name: Profil pour la gestion des opérations + description: Gérer et consulter l'ensemble des opérations d'entrées qui sont en cours + app-name: LOGBOOK_MANAGEMENT_OPERATION_APP + level: + roles: + - ROLE_GET_LOGBOOK_OPERATION + - ROLE_GET_ALL_LOGBOOK_OPERATION + - ROLE_UPDATE_LOGBOOK_OPERATION + + - name: Profil pour la création des profils paramétrage externe + description: Gérer et consulter l'ensemble des profils paramétrage externe + app-name: EXTERNAL_PARAM_PROFILE_APP + level: + roles: + - ROLE_CREATE_EXTERNAL_PARAM_PROFILE + - ROLE_EDIT_EXTERNAL_PARAM_PROFILE + - ROLE_SEARCH_EXTERNAL_PARAM_PROFILE + - ROLE_GET_PROFILES + - ROLE_UPDATE_PROFILES + - ROLE_LOGBOOKS + + + - name: Consultation + description: Profil pour la recherche et consultation des archives dans Vitam avec mises à jour des règles, sans export DIP et sans élimination + app-name: ARCHIVE_SEARCH_MANAGEMENT_APP + level: + roles: + - ROLE_CREATE_ARCHIVE_SEARCH + - ROLE_GET_ARCHIVE_SEARCH + - ROLE_GET_ALL_ARCHIVE_SEARCH + - ROLE_SEARCH_WITH_RULES + + - name: Archiviste + description: Profil pour la recherche et consultation des archives dans Vitam avec mises à jour des règles de gestion, avec export DIP et sans élimination + app-name: ARCHIVE_SEARCH_MANAGEMENT_APP + level: + roles: + - ROLE_CREATE_ARCHIVE_SEARCH + - ROLE_GET_ARCHIVE_SEARCH + - ROLE_GET_ALL_ARCHIVE_SEARCH + - ROLE_EXPORT_DIP + - ROLE_SEARCH_WITH_RULES + + - name: Archiviste administrateur + description: Profil pour la recherche et consultation des archives dans Vitam avec mises à jour des règles, export DIP et opérations d'élimination + app-name: ARCHIVE_SEARCH_MANAGEMENT_APP + level: + roles: + - ROLE_CREATE_ARCHIVE_SEARCH + - ROLE_GET_ARCHIVE_SEARCH + - ROLE_GET_ALL_ARCHIVE_SEARCH + - ROLE_SEARCH_WITH_RULES + - ROLE_EXPORT_DIP + - ROLE_ELIMINATION + - ROLE_UPDATE_MANAGEMENT_RULES + + #- name: profileName + # description: desc + # level: 1 + # app-name: app + # roles: + # - role_1 + # - role_2 + # - role_3 + # ... + + # Other Default profiles for admin group + admin-profiles: + #- name: profileName + # description: desc + # level: 1 + # app-name: app + # roles: + # - role_1 + # - role_2 + # - role_3 + # ... diff --git a/api/api-iam/iam-internal/src/main/resources/dev/keystore_iam-internal.jks b/api/api-iam/iam-internal/src/main/resources/dev/keystore_iam-internal.jks index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..a69c6518beffb7c89aef80a6f29e5bd2f4a5e1e4 100644 GIT binary patch literal 3863 zcmbuBWmppm*oH@p4y6Wy<T)V7+~`i}&JjvEMhT1!7}7O~NteXv34%03kXE{+K|n+) zMHnE8r1*Kx_x(8kzaQ_9`}y-e*Lywhbv;+4D-r+zApbLD{|<wvix1e-Hvob5b@Bcq zqBeKLS^xmrcxVi5ER>0g?lu(}C7Brcbuuy_fHH;_d8mmz*|w!z248ByHRM2032`0W z+)$Y#-RxHGnKb!HdK$Q!W-k2(=HX|?rq(yvc-kN)c7p_5%+4MtNSuZuufh*~qMD!1 zo4Vhe0m|l96P)IEPF-T;bdc$|^#&E#V~d}Cn`)h;xnT$_%KXmK(5W9VVE8UW+}RgA zo=!b8ZakxI_=PD=UQiWz>HC8ZJ7iYA1+KVm-b`nW+4Y2#MNFu`4ov<IPzGaFVrMhP z7g<?y$1*wn17GZzCQGrXrf}h1yIp)EIg4N|*rIHBU3cH$0W<6AQnfr)ot1&syOp*w zpJce9{3y_?RM=T5Cq%cYigir*;`fe8`HS18(t%Q_s|+C?d`BjtH&`j5Kg(lx`%{9~ zReXe3KjuXjrLw^OiDmAL!EmU+m2%it@8pw#?`EaTwvM`w8?~{Qk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g2i;?u?+zv&}99I6Ff#q=vb8i*$ZO^}ctZ8m(4C(VrcQpLfTd6X;#`sP- z_+$j^VbN_jZ_Rsog1;6XE-O-<={;q_7ha0M^%RoL_cY+gB)^xA$Q?+xiT;pkFdv)s UIOtnvptGb1_jgdysIdL|KWFU&W&i*H literal 0 HcmV?d00001 diff --git a/api/api-iam/iam-internal/src/main/resources/dev/truststore_server.jks b/api/api-iam/iam-internal/src/main/resources/dev/truststore_server.jks index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..c25bb727ec4db42c6b9582f530209b6fc160ffff 100644 GIT binary patch literal 3297 zcmchZc{J4PAIE1OjCD-5>~qt#<tvI}BH6dHPm-|>ri^6_gGh!(NJ2)IEQ1i)>f)9q zB1M)iDGE_`<)S1FF8AKwz1`pMp7T5Bch2wr@to(pKhJZ{^EuCXzn|B$`F`^~2n2%s zG0=fTN-&Y4?Cz>e@$;kZbEi;2AaKCD*@OuY9KY`Xa0mo~PXl!LTYwJj%7a3{5C|9y z@E|x97{-jxJYX;i4g!2sQ2-|bY6n9ILOdy|+yK{(;NXUmJUmr-0qz}z<c9mZQb>WS z`~dHc=Hf;Mlc=ubAd)HuK<`vg+$h%|s<$77L?saeRfU0FJ5?w*ue&Q@r#ZrJy#kWL zJo^FQ0B}Hczv}jI6y{Oek!ruof4CbuME2Y30K-90I)o1d&>>t9Is^<Vq4@+eIk4%O zqIR_LtXvkhlPylAVl}_p1@oA;U!6?BL}NaL4B0>7RcQ4JFg>26GFd9-GdiU;yepMu zn(l})Fg4A&mV5YaW`-8WC{hr0zs+JdYQHuWif*>maxYUFt(@$@bc-juD28><!%w_k zMN}kz+O39$b=etwu(HkQnQZ~#Q^w-;fw+XHH|$iMDfY61eF8!yh_-2+Rx>I#j_eDI zl$1LeNM*<?g`LQ%e<XMeoov(lm4K5~477}BGd6sMGaDy03UlKO3lgl?cIiILL4^;| zw|M6}@#X?Ty&Cq0Gew44;fg1)O{{0jv6IC(u32EcXJ3(g%zCz$!G<>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jH|@FiEpOL@GDCYZ z`JEEXxyq8!dgj*o?rfQ2IItLs78g}wFVZx%bfRvjP@+#EUz>7y9_A(-V`;uIpS!%o z^lz_<-@F>eR~v710e^3Xb+#xmV$$TLSYr~$6~BV@H!Gb6YjjaJ#-y}z+3K8pL;YZe ze`~ptiL>bOjGD;v{5Q*->{m{lx|@H7N(*5;o7`(G;yv<RorjisL+UFZ`=kvkvVYW8 zEbt<r?|X8-R;OE$;1}FUXKBl)H&9|)G?go>ErW1;K=pgsHj48hq~`g%;0s&reTi<a zt&E<%&tK1cv7W(9C*GSjkbe}N8ZN5$E>ggv$J6eR3ZDpd!uQ0ewrInn<;<^rrK``E z&*^d3b(J_N^wSLdrU+;6jWe?>(=XM{`l85fWAw`lCd`43)xr7J)P?vsiLqP(O5oT! zLQkXMTB_|e-49&RZHF@x8*+an^(i<mD5&YmH9tFBxSd&JB-N-zh8(a*4)?OnN_K>K z=^?V}BJ0KJ+ebK_G^nc6P+EZ1i!WoPZ}C>&->VnC$kJ{-s#s#wguhRZY^lC#@!GOK zqHC}D++7i$VzZCVa|^%&4)r0vPpVwG<JdB{nB`h;Nj%x`hE49Q%R~@-K5?+%7ks=E A82|tP literal 0 HcmV?d00001 diff --git a/ui/ui-archive-search/src/main/java/fr/gouv/vitamui/archives/search/rest/ArchivesSearchController.java b/ui/ui-archive-search/src/main/java/fr/gouv/vitamui/archives/search/rest/ArchivesSearchController.java index 12bbef5ad..b2d49b3d9 100644 --- a/ui/ui-archive-search/src/main/java/fr/gouv/vitamui/archives/search/rest/ArchivesSearchController.java +++ b/ui/ui-archive-search/src/main/java/fr/gouv/vitamui/archives/search/rest/ArchivesSearchController.java @@ -44,7 +44,6 @@ import fr.gouv.vitamui.commons.api.logger.VitamUILogger; import fr.gouv.vitamui.commons.api.logger.VitamUILoggerFactory; import fr.gouv.vitamui.commons.rest.AbstractUiRestController; import fr.gouv.vitamui.commons.vitam.api.dto.ResultsDto; -import fr.gouv.vitamui.commons.vitam.api.dto.RuleCategoryDto; import fr.gouv.vitamui.commons.vitam.api.dto.VitamUISearchResponseDto; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; @@ -205,22 +204,11 @@ public class ArchivesSearchController extends AbstractUiRestController { return jsonNodeResponseEntity.getBody(); } - @ApiOperation(value = "get Name") - @PostMapping("ruleName") - @ResponseStatus(HttpStatus.OK) - public String getName() { - - String result = archivesSearchService.getName().getBody(); - return result; - } - - @ApiOperation(value = "Update Archive Units Rules by criteria") @PostMapping(RestApi.MASSUPDATEUNITSRULES) @ResponseStatus(HttpStatus.OK) public String updateArchiveUnitsRules(@RequestBody final RuleSearchCriteriaDto ruleSearchCriteriaDto) { - LOGGER.debug("Update Archive Units Rules with criteria {}", ruleSearchCriteriaDto); - LOGGER.info("Oussama chabaaaaab2 {}", ruleSearchCriteriaDto.getRuleActions()); + LOGGER.debug("Update Archive Units Rules with criteria {} ", ruleSearchCriteriaDto); String result = archivesSearchService.updateArchiveUnitsRules(ruleSearchCriteriaDto, buildUiHttpContext()).getBody(); return result; } diff --git a/ui/ui-archive-search/src/main/java/fr/gouv/vitamui/archives/search/service/ArchivesSearchService.java b/ui/ui-archive-search/src/main/java/fr/gouv/vitamui/archives/search/service/ArchivesSearchService.java index 6b167f9e6..b00a859a2 100644 --- a/ui/ui-archive-search/src/main/java/fr/gouv/vitamui/archives/search/service/ArchivesSearchService.java +++ b/ui/ui-archive-search/src/main/java/fr/gouv/vitamui/archives/search/service/ArchivesSearchService.java @@ -185,11 +185,6 @@ public class ArchivesSearchService extends AbstractPaginateService<ArchiveUnitsD return archiveSearchExternalRestClient.startEliminationAction(context, searchQuery); } - public ResponseEntity<String> getName() { - return new ResponseEntity<String>("Rule Name", HttpStatus.OK); - // return "Rule Name "; - } - public ResponseEntity<String> updateArchiveUnitsRules(final RuleSearchCriteriaDto ruleSearchCriteriaDto,ExternalHttpContext context) { LOGGER.info("Update Archive Units Rules with criteria {}", ruleSearchCriteriaDto); return archiveSearchExternalRestClient.updateArchiveUnitsRules(ruleSearchCriteriaDto, context); diff --git a/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/appraisal-rule-search/appraisal-rule-search.component.ts b/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/appraisal-rule-search/appraisal-rule-search.component.ts index 68433d302..88016aa19 100644 --- a/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/appraisal-rule-search/appraisal-rule-search.component.ts +++ b/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/appraisal-rule-search/appraisal-rule-search.component.ts @@ -32,7 +32,7 @@ const APPRAISAL_RULE_END_DATE = 'APPRAISAL_RULE_END_DATE'; const ELIMINATION_TECHNICAL_ID = 'ELIMINATION_TECHNICAL_ID'; @Component({ - selector: 'appraisal-rule-search', + selector: 'app-appraisal-rule-search', templateUrl: './appraisal-rule-search.component.html', styleUrls: ['./appraisal-rule-search.component.css'] }) diff --git a/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/archive-search.component.html b/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/archive-search.component.html index 249ad7ec6..e46924f7a 100644 --- a/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/archive-search.component.html +++ b/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/archive-search.component.html @@ -90,7 +90,7 @@ 'ARCHIVE_SEARCH.REMOVE_SEARCH_CRITERIA_BY_CATEGORY' | translate }}</a> </div> - <appraisal-rule-search></appraisal-rule-search> + <app-appraisal-rule-search></app-appraisal-rule-search> </div> </ng-container> </mat-tab> @@ -182,7 +182,7 @@ {{ 'ARCHIVE_SEARCH.DIP.EXPORT_DIP' | translate }} </button> <button mat-menu-item (click)="updateManagementRule()" [disabled]="!hasUpdateManagementRuleRole || itemSelected === 0"> - {{ 'ARCHIVE_SEARCH.RULE.UPDATE_RULE' | translate }} + {{ 'ARCHIVE_SEARCH.RULES_ACTION.UPDATE_RULE' | translate }} </button> <button mat-menu-item (click)="startEliminationAnalysis()" [disabled]="!hasEliminationAnalysisOrActionRole || itemSelected === 0"> {{ 'ARCHIVE_SEARCH.ELIMINATION.ANALYSIS' | translate }} diff --git a/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/archive-search.component.ts b/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/archive-search.component.ts index 8205b1bb1..6f978927f 100644 --- a/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/archive-search.component.ts +++ b/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/archive-search.component.ts @@ -52,7 +52,16 @@ import { FilingHoldingSchemeNode } from '../models/node.interface'; import { NodeData } from '../models/nodedata.interface'; import { ActionsRules } from '../models/ruleAction.interface'; import { SearchCriteriaEltements, SearchCriteriaHistory } from '../models/search-criteria-history.interface'; -import { CriteriaValue, PagedResult, SearchCriteria, SearchCriteriaCategory, SearchCriteriaEltDto, SearchCriteriaStatusEnum, SearchCriteriaTypeEnum, SearchCriteriaValue } from '../models/search.criteria'; +import { + CriteriaValue, + PagedResult, + SearchCriteria, + SearchCriteriaCategory, + SearchCriteriaEltDto, + SearchCriteriaStatusEnum, + SearchCriteriaTypeEnum, + SearchCriteriaValue, +} from '../models/search.criteria'; import { Unit } from '../models/unit.interface'; import { VitamUISnackBarComponent } from '../shared/vitamui-snack-bar'; import { DipRequestCreateComponent } from './dip-request-create/dip-request-create.component'; @@ -1171,9 +1180,6 @@ export class ArchiveSearchComponent implements OnInit, OnChanges, OnDestroy { } updateManagementRule() { - // this.route.url.subscribe((data) => { - // console.log('salam', data); - // }); this.listOfUACriteriaSearch = this.prepareUAIdList(this.criteriaSearchList, this.listOfUAIdToInclude, this.listOfUAIdToExclude); const criteriaSearchDSLQuery = { criteriaList: this.listOfUACriteriaSearch, @@ -1181,10 +1187,7 @@ export class ArchiveSearchComponent implements OnInit, OnChanges, OnDestroy { size: PAGE_SIZE, language: this.translateService.currentLang, }; - console.log('hello2', this.router.url); - console.log('cooo', this.startupService.getConfigStringValue('UI_URL')); - // this.managementRulesSharedDataService.emitApplicationName('Hello from archive search'); this.managementRulesSharedDataService.emitselectedItems(this.itemSelected); this.managementRulesSharedDataService.emitCriteriaSearchListToSave(this.criteriaSearchList); this.managementRulesSharedDataService.emitCriteriaSearchDSLQuery(criteriaSearchDSLQuery); diff --git a/ui/ui-frontend/projects/archive-search/src/app/archive/archive.module.ts b/ui/ui-frontend/projects/archive-search/src/app/archive/archive.module.ts index 81cc13f7d..f4bec341c 100644 --- a/ui/ui-frontend/projects/archive-search/src/app/archive/archive.module.ts +++ b/ui/ui-frontend/projects/archive-search/src/app/archive/archive.module.ts @@ -123,7 +123,7 @@ import { ManagementRulesValidatorService } from './validators/management-rules-v SearchCriteriaSaverService, RuleValidator, ManagementRulesSharedDataService, - ManagementRulesValidatorService + ManagementRulesValidatorService, ], declarations: [ ArchiveComponent, @@ -144,6 +144,6 @@ import { ManagementRulesValidatorService } from './validators/management-rules-v DuaManagementRulesComponent, AddUpdatePropertyComponent, ], - schemas: [CUSTOM_ELEMENTS_SCHEMA] + schemas: [CUSTOM_ELEMENTS_SCHEMA], }) export class ArchiveModule {} diff --git a/ui/ui-frontend/projects/archive-search/src/app/archive/archive.service.ts b/ui/ui-frontend/projects/archive-search/src/app/archive/archive.service.ts index dce680b5b..82b46b4d3 100644 --- a/ui/ui-frontend/projects/archive-search/src/app/archive/archive.service.ts +++ b/ui/ui-frontend/projects/archive-search/src/app/archive/archive.service.ts @@ -89,8 +89,8 @@ export class ArchiveService extends SearchService<any> { return pagedResult; } - private static fetchTitle(title: string, title_: any) { - return title ? title : title_ ? (title_.fr ? title_.fr : title_.en) : title_.en; + private static fetchTitle(title: string, titleInLanguages: any) { + return title ? title : titleInLanguages ? (titleInLanguages.fr ? titleInLanguages.fr : titleInLanguages.en) : titleInLanguages.en; } public getOntologiesFromJson(): Observable<any> { @@ -184,14 +184,14 @@ export class ArchiveService extends SearchService<any> { ); } - downloadObjectFromUnit(id: string, title?: string, title_?: any, headers?: HttpHeaders) { + downloadObjectFromUnit(id: string, title?: string, titleInLanguages?: any, headers?: HttpHeaders) { return this.archiveApiService.downloadObjectFromUnit(id, headers).subscribe( (response) => { let filename; if (response.headers.get('content-disposition').includes('filename')) { filename = response.headers.get('content-disposition').split('=')[1]; } else { - filename = this.normalizeTitle(ArchiveService.fetchTitle(title, title_)); + filename = this.normalizeTitle(ArchiveService.fetchTitle(title, titleInLanguages)); } const element = document.createElement('a'); @@ -250,10 +250,6 @@ export class ArchiveService extends SearchService<any> { return this.archiveApiService.updateUnitsRules(ruleSearchCriteriaDto, headers); } - getName(): string { - return 'hello from ui-archive-search'; - } - openSnackBarForWorkflow(message: string, serviceUrl?: string) { this.snackBar.openFromComponent(VitamUISnackBarComponent, { panelClass: 'vitamui-snack-bar', diff --git a/ui/ui-frontend/projects/archive-search/src/app/archive/management-rules/add-management-rules/add-management-rules.component.html b/ui/ui-frontend/projects/archive-search/src/app/archive/management-rules/add-management-rules/add-management-rules.component.html index 66fd847a7..dc19e26cf 100644 --- a/ui/ui-frontend/projects/archive-search/src/app/archive/management-rules/add-management-rules/add-management-rules.component.html +++ b/ui/ui-frontend/projects/archive-search/src/app/archive/management-rules/add-management-rules/add-management-rules.component.html @@ -10,9 +10,16 @@ label="{{ 'RULES.APRAISAL_RULES.RULE_ID' | translate }}" > <vitamui-common-field-error errorKey="required">{{ 'COMMON.REQUIRED' | translate }}</vitamui-common-field-error> - <vitamui-common-field-error errorKey="uniqueCode"> + <vitamui-common-field-error errorKey="uniqueRuleId"> {{ 'RULES.APRAISAL_RULES.SAME_RULE_ID' | translate }}</vitamui-common-field-error > + <vitamui-common-field-error errorKey="ruleIdPattern" + >{{ 'ARCHIVE_SEARCH.RULE.WRONG_FORMAT' | translate }} + </vitamui-common-field-error> + + <vitamui-common-field-error errorKey="ruleIdExists" + >{{ 'RULES.APRAISAL_RULES.RULE_NOT_EXIST' | translate }} + </vitamui-common-field-error> </vitamui-common-editable-input> <vitamui-common-input diff --git a/ui/ui-frontend/projects/archive-search/src/app/archive/management-rules/add-management-rules/add-management-rules.component.ts b/ui/ui-frontend/projects/archive-search/src/app/archive/management-rules/add-management-rules/add-management-rules.component.ts index e36d42cdf..7d853fe6a 100644 --- a/ui/ui-frontend/projects/archive-search/src/app/archive/management-rules/add-management-rules/add-management-rules.component.ts +++ b/ui/ui-frontend/projects/archive-search/src/app/archive/management-rules/add-management-rules/add-management-rules.component.ts @@ -41,10 +41,11 @@ import { MatDialog } from '@angular/material/dialog'; import { cloneDeep } from 'lodash'; import { merge, Subscription } from 'rxjs'; import { debounceTime, filter, map } from 'rxjs/operators'; -import { CriteriaDataType, CriteriaOperator, diff } from 'ui-frontend-common'; +import { CriteriaDataType, CriteriaOperator, diff, Rule, RuleService } from 'ui-frontend-common'; import { isEmpty } from 'underscore'; import { ManagementRulesSharedDataService } from '../../../core/management-rules-shared-data.service'; import { ArchiveService } from '../../archive.service'; +import { RuleTypeEnum } from '../../models/rule-type-enum'; import { ManagementRules, RuleAction, RuleCategoryAction } from '../../models/ruleAction.interface'; import { SearchCriteriaDto, SearchCriteriaEltDto, SearchCriteriaTypeEnum } from '../../models/search.criteria'; import { ManagementRulesValidatorService } from '../../validators/management-rules-validator.service'; @@ -88,14 +89,15 @@ export class AddManagementRulesComponent implements OnInit, OnDestroy { criteriaSearchDSLQuery: SearchCriteriaDto; criteriaSearchDSLQuerySuscription: Subscription; - criteriaSearchForStats: SearchCriteriaDto; - criteriaSearchList: any[] = []; - // accessContract: string; - accessContractSubscription: Subscription; + getRuleSuscription: Subscription; + isLoading = false; isWarningLoading = false; isDisabled = true; managementRules: ManagementRules[] = []; + managementRulesSubscription: Subscription; + rule: Rule; + selectedStartDate: any; @ViewChild('confirmDeleteAddRuleDialog', { static: true }) confirmDeleteAddRuleDialog: TemplateRef<AddManagementRulesComponent>; @@ -104,6 +106,7 @@ export class AddManagementRulesComponent implements OnInit, OnDestroy { private archiveService: ArchiveService, private formBuilder: FormBuilder, public dialog: MatDialog, + public ruleService: RuleService, private managementRulesValidatorService: ManagementRulesValidatorService ) { this.previousRuleDetails = { @@ -114,18 +117,19 @@ export class AddManagementRulesComponent implements OnInit, OnDestroy { }; this.ruleDetailsForm = this.formBuilder.group({ - rule: [null, [Validators.required], [this.managementRulesValidatorService.uniqueCode()]], - // rule: [null, Validators.required], + rule: [ + null, + [Validators.required, this.managementRulesValidatorService.ruleIdPattern()], + [this.managementRulesValidatorService.uniqueRuleId(), , this.managementRulesValidatorService.checkRuleIdExistence()], + ], name: [{ value: null, disabled: true }, Validators.required], startDate: [null, Validators.required], - endDate: [{ value: 'date de fin', disabled: true }], - // endDate: [{ value: null, disabled: true }], + endDate: [{ value: null, disabled: true }], }); merge(this.ruleDetailsForm.statusChanges, this.ruleDetailsForm.valueChanges) .pipe( debounceTime(UPDATE_DEBOUNCE_TIME), - // filter(() => this.ruleDetailsForm.valid), map(() => diff(this.ruleDetailsForm.value, this.previousRuleDetails)), filter((formData) => !isEmpty(formData)), filter((formData) => this.patchForm(formData)) @@ -134,33 +138,36 @@ export class AddManagementRulesComponent implements OnInit, OnDestroy { this.ruleDetailsForm.reset(this.previousRuleDetails); }); - this.ruleDetailsForm.get('startDate').valueChanges.subscribe(() => { + this.ruleDetailsForm.get('startDate').valueChanges.subscribe((date) => { this.cancelStep.emit(); this.isShowCheckButton = true; - this.isDisabled = false; + this.isDisabled = true; + this.selectedStartDate = date; }); - this.ruleDetailsForm.get('rule').valueChanges.subscribe(() => { - this.ruleDetailsForm.patchValue({ name: this.archiveService.getName() }); + this.ruleDetailsForm.get('rule').valueChanges.subscribe((ruleSelected) => { + if (this.ruleDetailsForm.get('rule').value !== this.previousRuleDetails.rule) { + this.getRuleSuscription = this.ruleService.get(ruleSelected).subscribe((ruleResponse) => { + this.rule = ruleResponse; + }); + } + + if (this.rule && this.rule.ruleValue) { + this.ruleDetailsForm.patchValue({ name: this.rule.ruleValue }); + } + this.cancelStep.emit(); }); } ngOnDestroy() { this.showConfirmDeleteAddRuleSuscription?.unsubscribe(); - // this.selectedItemSubscription?.unsubscribe(); + this.managementRulesSubscription?.unsubscribe(); this.criteriaSearchDSLQuerySuscription?.unsubscribe(); - // this.accessContractSubscription?.unsubscribe(); + this.getRuleSuscription.unsubscribe(); } - ngOnInit(): void { - // this.selectedItemSubscription = this.managementRulesSharedDataService.getselectedItems().subscribe((response) => { - // this.selectedItem = response; - // }); - // this.accessContractSubscription = this.managementRulesSharedDataService.getAccessContract().subscribe((accessContract) => { - // this.accessContract = accessContract; - // }); - } + ngOnInit() {} initDSLQuery() { this.criteriaSearchDSLQuerySuscription = this.managementRulesSharedDataService.getCriteriaSearchDSLQuery().subscribe((response) => { @@ -172,13 +179,6 @@ export class AddManagementRulesComponent implements OnInit, OnDestroy { this.isLoading = true; this.initDSLQuery(); - // category: "APPRAISAL_RULE" - // criteria: "APPRAISAL_RULE_ORIGIN_HAS_AT_LEAST_ONE" - // dataType: "STRING" - // operator: "EQ" - // values: [{id: "true", value: "true"}] - // 0: {id: "true", value: "true"} - const onlyManagementRules: SearchCriteriaEltDto = { category: SearchCriteriaTypeEnum.APPRAISAL_RULE, criteria: APPRAISAL_RULE_ORIGIN_HAS_AT_LEAST_ONE, @@ -186,6 +186,7 @@ export class AddManagementRulesComponent implements OnInit, OnDestroy { operator: CriteriaOperator.EQ, values: [{ id: 'true', value: 'true' }], }; + const criteriaWithId: SearchCriteriaEltDto = { criteria: APPRAISAL_RULE_IDENTIFIER, values: [{ id: this.ruleDetailsForm.get('rule').value, value: this.ruleDetailsForm.get('rule').value }], @@ -193,11 +194,11 @@ export class AddManagementRulesComponent implements OnInit, OnDestroy { operator: CriteriaOperator.EQ, dataType: CriteriaDataType.STRING, }; + this.criteriaSearchDSLQuery.criteriaList.push(criteriaWithId); this.criteriaSearchDSLQuery.criteriaList.push(onlyManagementRules); this.archiveService.searchArchiveUnitsByCriteria(this.criteriaSearchDSLQuery, this.accessContract).subscribe((data) => { - console.log('total qui ont cette règle ', data.totalResults); this.itemsWithSameRule = data.totalResults; this.itemsToUpdate = this.selectedItem - data.totalResults; this.isLoading = false; @@ -238,7 +239,6 @@ export class AddManagementRulesComponent implements OnInit, OnDestroy { this.criteriaSearchDSLQuery.criteriaList.push(onlyManagementRules); this.archiveService.searchArchiveUnitsByCriteria(this.criteriaSearchDSLQuery, this.accessContract).subscribe((data) => { - console.log('total qui ont cette règle et aussi la meme date ', data.totalResults); this.itemsWithSameRuleAndDate = data.totalResults; this.isWarningLoading = false; }); @@ -246,7 +246,6 @@ export class AddManagementRulesComponent implements OnInit, OnDestroy { patchForm(data: any): boolean { this.isDisabled = false; - // this.ruleDetailsForm.patchValue({ name: this.archiveService.getName() }); this.previousRuleDetails = { rule: data.rule ? data.rule : this.previousRuleDetails.rule, name: this.ruleDetailsForm.get('name').value, @@ -267,23 +266,41 @@ export class AddManagementRulesComponent implements OnInit, OnDestroy { .subscribe(() => { this.delete.emit(this.ruleDetailsForm.get('rule').value); }); - - console.log('hadi ruleType jdiiida', this.ruleTypeDUA); } addStartDate() { - console.log('ddd', this.ruleDetailsForm.get('startDate').value); this.previousRuleDetails = { rule: this.ruleDetailsForm.get('rule').value, name: this.ruleDetailsForm.get('name').value, startDate: this.ruleDetailsForm.get('startDate').value, endDate: this.ruleDetailsForm.get('endDate').value, }; + if (this.rule && this.rule.ruleMeasurement) { + const startDateSelected = new Date(this.selectedStartDate); + switch (this.rule.ruleMeasurement.toUpperCase()) { + case 'YEAR': + startDateSelected.setFullYear(startDateSelected.getFullYear() + Number(this.rule.ruleDuration)); + break; + case 'MONTH': + startDateSelected.setMonth(startDateSelected.getMonth() + Number(this.rule.ruleDuration)); + break; + case 'DAY': + startDateSelected.setDate(startDateSelected.getDay() + Number(this.rule.ruleDuration)); + break; + } + + const endDate = + this.getDay(new Date(startDateSelected).getDate()) + + '/' + + this.getMonth(new Date(startDateSelected).getMonth() + 1) + + '/' + + new Date(startDateSelected).getFullYear().toString(); + + this.ruleDetailsForm.patchValue({ endDate }); + } this.isShowCheckButton = !this.isShowCheckButton; this.isDisabled = false; - - console.log('valuuuuuuuuu', this.ruleDetailsForm.getRawValue()); } submit() { @@ -296,58 +313,48 @@ export class AddManagementRulesComponent implements OnInit, OnDestroy { name: this.ruleDetailsForm.get('name').value, }; - console.log('fffoooo', rule); - console.log('previous', this.previousRuleDetails); - // this.managementRulesSharedDataService.getRuleTypeDUA().subscribe((data) => { - // this.ruleTypeDUA = data; - // }); - - this.managementRulesSharedDataService.getManagementRules().subscribe((data) => { + this.managementRulesSubscription = this.managementRulesSharedDataService.getManagementRules().subscribe((data) => { this.managementRules = data; }); - if (this.managementRules.findIndex((managementRule) => managementRule.category === 'AppraisalRule') !== -1) { - this.ruleTypeDUA = this.managementRules.find((managementRule) => managementRule.category === 'AppraisalRule').ruleCategoryAction; + + if (this.managementRules.findIndex((managementRule) => managementRule.category === RuleTypeEnum.APPRAISALRULE) !== -1) { + this.ruleTypeDUA = this.managementRules.find( + (managementRule) => managementRule.category === RuleTypeEnum.APPRAISALRULE + ).ruleCategoryAction; if (this.ruleTypeDUA.rules.findIndex((item) => item.rule === rule.rule) === -1) { this.ruleTypeDUA.rules.push(rule); this.ruleTypeDUA.rules = this.ruleTypeDUA.rules.filter((item) => item.rule !== this.lastRuleId); - this.managementRules.find((managementRule) => managementRule.category === 'AppraisalRule').ruleCategoryAction = this.ruleTypeDUA; + this.managementRules.find((managementRule) => managementRule.category === RuleTypeEnum.APPRAISALRULE).ruleCategoryAction = + this.ruleTypeDUA; } } else { this.ruleTypeDUA = { finalAction: '', rules: [rule] }; - const managementRule: ManagementRules = { category: 'AppraisalRule', ruleCategoryAction: this.ruleTypeDUA }; + const managementRule: ManagementRules = { category: RuleTypeEnum.APPRAISALRULE, ruleCategoryAction: this.ruleTypeDUA }; this.managementRules.push(managementRule); } - // this.ruleTypeDUA = this.managementRules.find((managementRule) => managementRule.category === 'AppraisalRule')?.ruleCategoryAction; - - // this.managementRulesSharedDataService.getManagementRules().subscribe((data) => { - // this.ruleTypeDUA = data.find((managementRule) => managementRule.category === 'AppraisalRule').ruleCategoryAction; - // }); - - // if (this.ruleTypeDUA && this.ruleTypeDUA.rules) { - // if (this.ruleTypeDUA.rules.findIndex((item) => item.rule === rule.rule) === -1) { - // this.ruleTypeDUA.rules.push(rule); - // this.ruleTypeDUA.rules = this.ruleTypeDUA.rules.filter((item) => item.rule !== this.lastRuleId); - // } - // } - - // this.managementRulesSharedDataService.emitRuleTypeDUA(this.ruleTypeDUA); - - // this.managementRules.find((managementRule) => managementRule.category === 'AppraisalRule').ruleCategoryAction = this.ruleTypeDUA; this.managementRulesSharedDataService.emitManagementRules(this.managementRules); - // this.managementRulesSharedDataService.getRuleTypeDUA().subscribe((data) => { - // console.log('jdiiid', data); - // }); - - this.managementRulesSharedDataService.getManagementRules().subscribe((data) => { - console.log('jdiiid', data); - }); - this.addRuleToQuery(); this.addRuleAndStartDateToQuery(); this.confirmStep.emit(); this.lastRuleId = this.ruleDetailsForm.get('rule').value; } + + private getMonth(num: number): string { + if (num > 9) { + return num.toString(); + } else { + return '0' + num.toString(); + } + } + + private getDay(day: number): string { + if (day > 9) { + return day.toString(); + } else { + return '0' + day.toString(); + } + } } diff --git a/ui/ui-frontend/projects/archive-search/src/app/archive/management-rules/add-update-property/add-update-property.component.ts b/ui/ui-frontend/projects/archive-search/src/app/archive/management-rules/add-update-property/add-update-property.component.ts index b6b4ed618..6cee6e588 100644 --- a/ui/ui-frontend/projects/archive-search/src/app/archive/management-rules/add-update-property/add-update-property.component.ts +++ b/ui/ui-frontend/projects/archive-search/src/app/archive/management-rules/add-update-property/add-update-property.component.ts @@ -35,54 +35,54 @@ * knowledge of the CeCILL-C license and that you accept its terms. */ -import { Component, OnInit } from '@angular/core'; +import { Component, OnDestroy, OnInit } from '@angular/core'; +import { Subscription } from 'rxjs'; import { ManagementRulesSharedDataService } from '../../../core/management-rules-shared-data.service'; -import { ActionsRules, ManagementRules, RuleCategoryAction } from '../../models/ruleAction.interface'; +import { RuleTypeEnum } from '../../models/rule-type-enum'; +import { ActionsRules, ManagementRules, RuleActionsEnum, RuleCategoryAction } from '../../models/ruleAction.interface'; @Component({ selector: 'app-add-update-property', templateUrl: './add-update-property.component.html', styleUrls: ['./add-update-property.component.css'], }) -export class AddUpdatePropertyComponent implements OnInit { +export class AddUpdatePropertyComponent implements OnInit, OnDestroy { rulePropertyName: string; ruleTypeDUA: RuleCategoryAction; ruleActions: ActionsRules[]; + ruleActionsSubscription: Subscription; managementRules: ManagementRules[] = []; + managementRulesSubscription: Subscription; isValidValue = true; showText = false; constructor(private managementRulesSharedDataService: ManagementRulesSharedDataService) {} - ngOnInit(): void {} + ngOnDestroy() { + this.managementRulesSubscription?.unsubscribe(); + this.ruleActionsSubscription?.unsubscribe(); + } - onUpdateRuleProperty() { - // this.managementRulesSharedDataService.getRuleTypeDUA().subscribe((data) => { - // this.ruleTypeDUA = data; - // }); + ngOnInit() {} - this.managementRulesSharedDataService.getManagementRules().subscribe((data) => { + onUpdateRuleProperty() { + this.managementRulesSubscription = this.managementRulesSharedDataService.getManagementRules().subscribe((data) => { this.managementRules = data; }); - if (this.managementRules.findIndex((managementRule) => managementRule.category === 'AppraisalRule') !== -1) { - // this.ruleTypeDUA = this.managementRules.find((managementRule) => managementRule.category === 'AppraisalRule').ruleCategoryAction; - // this.ruleTypeDUA.finalAction = this.rulePropertyName; - this.managementRules.find((managementRule) => managementRule.category === 'AppraisalRule').ruleCategoryAction.finalAction = + if (this.managementRules.findIndex((managementRule) => managementRule.category === RuleTypeEnum.APPRAISALRULE) !== -1) { + this.managementRules.find((managementRule) => managementRule.category === RuleTypeEnum.APPRAISALRULE).ruleCategoryAction.finalAction = this.rulePropertyName; } else { this.ruleTypeDUA = { finalAction: this.rulePropertyName, rules: [] }; - const managementRule: ManagementRules = { category: 'AppraisalRule', ruleCategoryAction: this.ruleTypeDUA }; + const managementRule: ManagementRules = { category: RuleTypeEnum.APPRAISALRULE, ruleCategoryAction: this.ruleTypeDUA }; this.managementRules.push(managementRule); } - this.managementRulesSharedDataService.getRuleActions().subscribe((data) => { + this.ruleActionsSubscription = this.managementRulesSharedDataService.getRuleActions().subscribe((data) => { this.ruleActions = data; }); - this.ruleActions.find((action) => action.actionType === 'updateProperty').stepValid = true; - // this.ruleTypeDUA.finalAction = this.rulePropertyName; - // this.managementRules.find((managementRule) => managementRule.category === 'AppraisalRule').ruleCategoryAction = this.ruleTypeDUA; - // this.managementRulesSharedDataService.emitRuleTypeDUA(this.ruleTypeDUA); + this.ruleActions.find((action) => action.actionType === RuleActionsEnum.UPDATE_PROPERTY).stepValid = true; this.managementRulesSharedDataService.emitManagementRules(this.managementRules); this.managementRulesSharedDataService.emitRuleActions(this.ruleActions); this.isValidValue = true; @@ -90,10 +90,10 @@ export class AddUpdatePropertyComponent implements OnInit { } onChangeValue() { - this.managementRulesSharedDataService.getRuleActions().subscribe((data) => { + this.ruleActionsSubscription = this.managementRulesSharedDataService.getRuleActions().subscribe((data) => { this.ruleActions = data; }); - this.ruleActions.find((action) => action.actionType === 'updateProperty').stepValid = false; + this.ruleActions.find((action) => action.actionType === RuleActionsEnum.UPDATE_PROPERTY).stepValid = false; this.isValidValue = false; this.showText = false; } diff --git a/ui/ui-frontend/projects/archive-search/src/app/archive/management-rules/dua-management-rules/dua-management-rules.component.html b/ui/ui-frontend/projects/archive-search/src/app/archive/management-rules/dua-management-rules/dua-management-rules.component.html index be38e1514..3dd59060f 100644 --- a/ui/ui-frontend/projects/archive-search/src/app/archive/management-rules/dua-management-rules/dua-management-rules.component.html +++ b/ui/ui-frontend/projects/archive-search/src/app/archive/management-rules/dua-management-rules/dua-management-rules.component.html @@ -1,5 +1,5 @@ <div *ngFor="let action of getActionByRuleType('AppraisalRule')"> - <div *ngIf="action === 'addRules'"> + <div *ngIf="action === 'ADD_RULES'"> <div class="action-style"> {{ 'RULES.RULES_TO_ADD' | translate }} <i class="clickable material-icons mat-icon-rtl-mirror arrow-icon" [style.fontSize.px]="20" (click)="showAddRuleBloc()"> @@ -9,7 +9,7 @@ <div class="collapsible" [@collapse]="collapsed" *ngFor="let actionName of getActions('AppraisalRule')"> <app-add-management-rules - *ngIf="actionName.actionType === action && action === 'addRules'" + *ngIf="actionName.actionType === action && action === 'ADD_RULES'" (delete)="deleteForm(actionName.id, $event)" (confirmStep)="confirmStep(actionName.id)" (cancelStep)="cancelStep(actionName.id)" @@ -47,7 +47,7 @@ </i> </div> - <div *ngIf="action === 'addRules'"> + <div *ngIf="action === 'ADD_RULES'"> <div class="action-style"> {{ 'RULES.MORE_ACTIONS.UPDATE_PROPERTY' | translate }} <i class="clickable material-icons mat-icon-rtl-mirror arrow-icon" [style.fontSize.px]="20" (click)="showUpdatePropertyBloc()"> diff --git a/ui/ui-frontend/projects/archive-search/src/app/archive/management-rules/dua-management-rules/dua-management-rules.component.ts b/ui/ui-frontend/projects/archive-search/src/app/archive/management-rules/dua-management-rules/dua-management-rules.component.ts index c6e9e3d4c..c475b3e80 100644 --- a/ui/ui-frontend/projects/archive-search/src/app/archive/management-rules/dua-management-rules/dua-management-rules.component.ts +++ b/ui/ui-frontend/projects/archive-search/src/app/archive/management-rules/dua-management-rules/dua-management-rules.component.ts @@ -36,9 +36,11 @@ */ import { animate, AUTO_STYLE, state, style, transition, trigger } from '@angular/animations'; -import { Component, Input, OnInit } from '@angular/core'; +import { Component, Input, OnDestroy, OnInit } from '@angular/core'; +import { Subscription } from 'rxjs'; import { ManagementRulesSharedDataService } from '../../../core/management-rules-shared-data.service'; -import { ActionsRules, ManagementRules, RuleCategoryAction } from '../../models/ruleAction.interface'; +import { RuleTypeEnum } from '../../models/rule-type-enum'; +import { ActionsRules, ManagementRules, RuleActionsEnum, RuleCategoryAction } from '../../models/ruleAction.interface'; @Component({ selector: 'app-dua-management-rules', @@ -53,36 +55,49 @@ import { ActionsRules, ManagementRules, RuleCategoryAction } from '../../models/ ]), ], }) -export class DuaManagementRulesComponent implements OnInit { +export class DuaManagementRulesComponent implements OnInit, OnDestroy { @Input() accessContract: string; @Input() selectedItem: string; ruleActions: ActionsRules[]; + ruleActionsSubscription: Subscription; collapsed = false; updatePropertyCollapsed = false; deletePropertyCollapsed = false; ruleCategoryDuaActions: RuleCategoryAction; managementRules: ManagementRules[] = []; + managementRulesSubscription: Subscription; constructor(private managementRulesSharedDataService: ManagementRulesSharedDataService) {} - ngOnInit(): void { - // this.getLogbookOperationDetails(this.ruleActions); + ngOnDestroy() { + this.ruleActionsSubscription?.unsubscribe(); + this.managementRulesSubscription?.unsubscribe(); } + + ngOnInit() {} + + confirmStep(id: number) { + this.ruleActionsSubscription = this.managementRulesSharedDataService.getRuleActions().subscribe((data) => { + this.ruleActions = data; + }); + + this.ruleActions.find((ruleAction) => ruleAction.id === id).stepValid = true; + this.managementRulesSharedDataService.emitRuleActions(this.ruleActions); + } + getActionByRuleType(ruleType: string): string[] { - // console.log('4444', this.ruleActions); - this.managementRulesSharedDataService.getRuleActions().subscribe((data) => { + this.ruleActionsSubscription = this.managementRulesSharedDataService.getRuleActions().subscribe((data) => { this.ruleActions = data; }); - const s: string[] = this.ruleActions.filter((x) => x.ruleType === ruleType).map((x) => x.actionType); - // console.log('s', s); - return s.filter((n, i) => s.indexOf(n) === i); + const rules: string[] = this.ruleActions.filter((actionRules) => actionRules.ruleType === ruleType).map((action) => action.actionType); + return rules.filter((ruleName, index) => rules.indexOf(ruleName) === index); } getActions(category: string): ActionsRules[] { - this.managementRulesSharedDataService.getRuleActions().subscribe((data) => { + this.ruleActionsSubscription = this.managementRulesSharedDataService.getRuleActions().subscribe((data) => { this.ruleActions = data; }); - return this.ruleActions.filter((x) => x.ruleType === category); + return this.ruleActions.filter((ruleAction) => ruleAction.ruleType === category); } showAddRuleBloc() { @@ -90,26 +105,22 @@ export class DuaManagementRulesComponent implements OnInit { } deleteForm(id: number, ruleId: string) { - this.managementRulesSharedDataService.getRuleActions().subscribe((data) => { + this.ruleActionsSubscription = this.managementRulesSharedDataService.getRuleActions().subscribe((data) => { this.ruleActions = data.filter((ruleAction) => ruleAction.id !== id); }); this.ruleActions = this.ruleActions.filter((ruleAction) => ruleAction.id !== id); - if (this.ruleActions.findIndex((action) => action.actionType === 'addRules') === -1) { + if (this.ruleActions.findIndex((action) => action.actionType === RuleActionsEnum.ADD_RULES) === -1) { this.ruleActions = []; } this.managementRulesSharedDataService.emitRuleActions(this.ruleActions); - // this.managementRulesSharedDataService.getRuleTypeDUA().subscribe((data) => { - // this.ruleCategoryDuaActions = data; - // }); - - this.managementRulesSharedDataService.getManagementRules().subscribe((data) => { + this.managementRulesSubscription = this.managementRulesSharedDataService.getManagementRules().subscribe((data) => { this.managementRules = data; }); - if (this.managementRules.findIndex((managementRule) => managementRule.category === 'AppraisalRule') !== -1) { + if (this.managementRules.findIndex((managementRule) => managementRule.category === RuleTypeEnum.APPRAISALRULE) !== -1) { this.ruleCategoryDuaActions = this.managementRules.find( - (managementRule) => managementRule.category === 'AppraisalRule' + (managementRule) => managementRule.category === RuleTypeEnum.APPRAISALRULE ).ruleCategoryAction; this.ruleCategoryDuaActions = { @@ -117,30 +128,19 @@ export class DuaManagementRulesComponent implements OnInit { finalAction: this.ruleCategoryDuaActions.finalAction, }; - this.managementRules.find((managementRule) => managementRule.category === 'AppraisalRule').ruleCategoryAction = + this.managementRules.find((managementRule) => managementRule.category === RuleTypeEnum.APPRAISALRULE).ruleCategoryAction = this.ruleCategoryDuaActions; } - // this.managementRulesSharedDataService.emitRuleTypeDUA(this.ruleCategoryDuaActions); this.managementRulesSharedDataService.emitManagementRules(this.managementRules); } - confirmStep(id: number) { - console.log('id', id); - this.managementRulesSharedDataService.getRuleActions().subscribe((data) => { - this.ruleActions = data; - }); - - this.ruleActions.find((a) => a.id === id).stepValid = true; - this.managementRulesSharedDataService.emitRuleActions(this.ruleActions); - } cancelStep(id: number) { - console.log('id', id); - this.managementRulesSharedDataService.getRuleActions().subscribe((data) => { + this.ruleActionsSubscription = this.managementRulesSharedDataService.getRuleActions().subscribe((data) => { this.ruleActions = data; }); - this.ruleActions.find((a) => a.id === id).stepValid = false; + this.ruleActions.find((ruleAction) => ruleAction.id === id).stepValid = false; this.managementRulesSharedDataService.emitRuleActions(this.ruleActions); } diff --git a/ui/ui-frontend/projects/archive-search/src/app/archive/management-rules/management-rules.component.css b/ui/ui-frontend/projects/archive-search/src/app/archive/management-rules/management-rules.component.css index f21d35883..73739fc70 100644 --- a/ui/ui-frontend/projects/archive-search/src/app/archive/management-rules/management-rules.component.css +++ b/ui/ui-frontend/projects/archive-search/src/app/archive/management-rules/management-rules.component.css @@ -64,38 +64,6 @@ line-height: 50px; } -/* .date-filter { - width: 100%; - height: 70px; - background-color: white; - border: solid 1px var(--vitamui-secondary); - border-radius: 5px; - font-family: "Roboto", sans-serif; - font-size: 15px; - text-align: center; - color: var(--vitamui-secondary); - padding: 25px 12px 25px 13px; - - position: relative; -} */ - -/* .date-filter.clear-date-icon { - font-size: 15px; - font-weight: bold; - margin-left: 4px; -} - -.date-filter.clear-date-icon { - font-size: 15px; - font-weight: bold; - margin-left: 4px; -} */ - -/* .container { - border-radius: 20px; - background-color: #ffffff; -} */ - .margin-btn { margin-right: 300px; } diff --git a/ui/ui-frontend/projects/archive-search/src/app/archive/management-rules/management-rules.component.html b/ui/ui-frontend/projects/archive-search/src/app/archive/management-rules/management-rules.component.html index a96060c8c..0e8b3fb74 100644 --- a/ui/ui-frontend/projects/archive-search/src/app/archive/management-rules/management-rules.component.html +++ b/ui/ui-frontend/projects/archive-search/src/app/archive/management-rules/management-rules.component.html @@ -32,7 +32,7 @@ [disabled]="!isRuleCategorySelected || !isAllActionsValid()" [(value)]="actionSelected" > - <mat-option value="addRules" [disabled]="!isRuleCategorySelected" (click)="onSelectAction(actionSelected)"> + <mat-option value="ADD_RULES" [disabled]="!isRuleCategorySelected" (click)="onSelectAction(actionSelected)"> {{ 'RULES.ACTIONS.ADD_RULE' | translate }} </mat-option> <mat-option value="updateRules" [disabled]="true" (click)="onSelectAction(actionSelected)"> @@ -60,7 +60,7 @@ <mat-form-field class="vitamui-mat-select select-more-actions"> <mat-select placeholder=" {{ 'RULES.OTHER_ACTIONS' | translate }}" [disabled]="true" (valueChange)="onSelectAction($event)"> - <mat-option value="updateProperty" [disabled]="true"> {{ 'RULES.MORE_ACTIONS.UPDATE_PROPERTY' | translate }}</mat-option> + <mat-option value="UPDATE_PROPERTY" [disabled]="true"> {{ 'RULES.MORE_ACTIONS.UPDATE_PROPERTY' | translate }}</mat-option> <mat-option value="deleteProperty" [disabled]="true"> {{ 'RULES.MORE_ACTIONS.DELETE_PROPERTY' | translate }}</mat-option> <mat-option value="BlockPropertyInheritance" [disabled]="true"> {{ 'RULES.MORE_ACTIONS.BLOCK_PROPERTY_INHERITANCE' | translate }}</mat-option diff --git a/ui/ui-frontend/projects/archive-search/src/app/archive/management-rules/management-rules.component.ts b/ui/ui-frontend/projects/archive-search/src/app/archive/management-rules/management-rules.component.ts index 76b60e56f..f2049c791 100644 --- a/ui/ui-frontend/projects/archive-search/src/app/archive/management-rules/management-rules.component.ts +++ b/ui/ui-frontend/projects/archive-search/src/app/archive/management-rules/management-rules.component.ts @@ -36,7 +36,6 @@ */ import { Component, OnDestroy, OnInit, TemplateRef, ViewChild } from '@angular/core'; -import { FormGroup } from '@angular/forms'; import { MatDialog } from '@angular/material/dialog'; import { ActivatedRoute, Router } from '@angular/router'; import { TranslateService } from '@ngx-translate/core'; @@ -45,7 +44,8 @@ import { filter } from 'rxjs/operators'; import { Logger, StartupService } from 'ui-frontend-common'; import { ManagementRulesSharedDataService } from '../../core/management-rules-shared-data.service'; import { ArchiveService } from '../archive.service'; -import { ActionsRules, RuleActions, RuleCategoryAction, RuleSearchCriteriaDto, VitamUiRuleActions } from '../models/ruleAction.interface'; +import { RuleTypeEnum } from '../models/rule-type-enum'; +import { ActionsRules, RuleActions, RuleActionsEnum, RuleCategoryAction, RuleSearchCriteriaDto } from '../models/ruleAction.interface'; import { SearchCriteriaDto, SearchCriteriaEltDto } from '../models/search.criteria'; @Component({ @@ -58,9 +58,10 @@ export class ManagementRulesComponent implements OnInit, OnDestroy { criteriaSearchListToSaveSuscription: Subscription; criteriaSearchDSLQuery: SearchCriteriaDto; criteriaSearchDSLQuerySuscription: Subscription; - accessContractSubscription: Subscription; accessContract: string; + accessContractSubscription: Subscription; tenantIdentifier: string; + tenantIdentifierSubscription: Subscription; selectedItem: number; selectedItemSubscription: Subscription; ruleActions: ActionsRules[] = []; @@ -68,10 +69,9 @@ export class ManagementRulesComponent implements OnInit, OnDestroy { private ruleCategoryDuaActions: RuleCategoryAction = { rules: [], finalAction: '', - // classificationLevel: 'salam', }; + actionSelected: string; - favoriteSeason: string; rulesCatygories: { id: string; name: string; isDisabled: boolean }[] = [ { id: 'StorageRule', name: this.translateService.instant('RULES.CATEGORIES_NAME.STORAGE_RULE'), isDisabled: true }, { id: 'AppraisalRule', name: this.translateService.instant('RULES.CATEGORIES_NAME.APPRAISAL_RULE'), isDisabled: false }, @@ -84,16 +84,8 @@ export class ManagementRulesComponent implements OnInit, OnDestroy { rulesCatygoriesToShow: { id: string; name: string; isDisabled: boolean }[] = []; indexOfSelectedCategory = 0; - ruleDetailsForm: FormGroup; ruleCategorySelected: string; - actionSelected: string; - // collapsed = false; - // updatePropertyCollapsed = false; - // deletePropertyCollapsed = false; isRuleCategorySelected = false; - - vitamUiRuleActions: VitamUiRuleActions; - ruleSearchCriteriaDto: RuleSearchCriteriaDto; @ViewChild('confirmRuleActionsDialog', { static: true }) confirmRuleActionsDialog: TemplateRef<ManagementRulesComponent>; @@ -109,43 +101,29 @@ export class ManagementRulesComponent implements OnInit, OnDestroy { private router: Router, private startupService: StartupService, private translateService: TranslateService, - private logger: Logger + private logger: Logger ) {} - ngOnInit(): void { - this.route.params.subscribe((params) => { + ngOnInit() { + this.tenantIdentifierSubscription = this.route.params.subscribe((params) => { this.tenantIdentifier = params.tenantIdentifier; }); + this.loadAccessContract(); + this.loadSelectedItem(); + this.loadCriteriaSearchListToSave(); + this.loadCriteriaSearchDSLQuery(); - this.accessContractSubscription = this.managementRulesSharedDataService.getAccessContract().subscribe((accessContract) => { - this.accessContract = accessContract; - }); - - this.selectedItemSubscription = this.managementRulesSharedDataService.getselectedItems().subscribe((response) => { - this.selectedItem = response; - }); - - this.criteriaSearchListToSaveSuscription = this.managementRulesSharedDataService.getCriteriaSearchListToSave().subscribe((response) => { - this.criteriaSearchListToSave = response; - }); - - this.criteriaSearchDSLQuerySuscription = this.managementRulesSharedDataService.getCriteriaSearchDSLQuery().subscribe((response) => { - this.criteriaSearchDSLQuery = response; - }); - - console.log('criteria search', this.criteriaSearchListToSave); - console.log('criteria search DS', this.criteriaSearchDSLQuery); if (this.criteriaSearchListToSave.length === 0) { - // this.returnToArchiveSearchPage(); - // envoyer le user vers la page de recherche - // this.ruleActions = []; - // this.managementRulesSharedDataService.emitRuleActions(this.ruleActions); - // this.managementRulesSharedDataService.emitCriteriaSearchListToSave(this.criteriaSearchListToSave); - // this.router.navigate(['/archive-search/tenant/', this.tenantIdentifier]); + this.initializeParameters(); + this.router.navigate(['/archive-search/tenant/', this.tenantIdentifier]); } + } - console.log('Contrat', this.accessContract); - // this.testCheck(); + initializeParameters() { + this.ruleActions = []; + this.managementRulesSharedDataService.emitManagementRules([]); + this.managementRulesSharedDataService.emitRuleActions(this.ruleActions); + this.managementRulesSharedDataService.emitCriteriaSearchListToSave(this.criteriaSearchListToSave); } ngOnDestroy() { @@ -154,10 +132,11 @@ export class ManagementRulesComponent implements OnInit, OnDestroy { this.criteriaSearchDSLQuerySuscription?.unsubscribe(); this.showConfirmRuleActionsDialogSuscription?.unsubscribe(); this.showConfirmLeaveRuleActionsDialogSuscription?.unsubscribe(); + this.tenantIdentifierSubscription?.unsubscribe(); } selectRule(rule: any) { - if (this.rulesCatygoriesToShow.find((x) => x.name === rule.name) === undefined) { + if (this.rulesCatygoriesToShow.find((ruleCategory) => ruleCategory.name === rule.name) === undefined) { this.rulesCatygoriesToShow.push(rule); this.indexOfSelectedCategory = this.rulesCatygoriesToShow.length - 1; } else { @@ -167,19 +146,45 @@ export class ManagementRulesComponent implements OnInit, OnDestroy { this.isRuleCategorySelected = true; } + loadCriteriaSearchDSLQuery() { + this.criteriaSearchDSLQuerySuscription = this.managementRulesSharedDataService.getCriteriaSearchDSLQuery().subscribe((response) => { + this.criteriaSearchDSLQuery = response; + }); + } + + loadCriteriaSearchListToSave() { + this.criteriaSearchListToSaveSuscription = this.managementRulesSharedDataService.getCriteriaSearchListToSave().subscribe((response) => { + this.criteriaSearchListToSave = response; + }); + } + + loadAccessContract() { + this.accessContractSubscription = this.managementRulesSharedDataService.getAccessContract().subscribe((accessContract) => { + this.accessContract = accessContract; + }); + } + + loadSelectedItem() { + this.selectedItemSubscription = this.managementRulesSharedDataService.getselectedItems().subscribe((response) => { + this.selectedItem = response; + }); + } + onSelectAction(rule: string) { - console.log('hel', rule); let idToAdd = 0; this.managementRulesSharedDataService.getRuleActions().subscribe((data) => { this.ruleActions = data; }); if (this.ruleActions && this.ruleActions.length > 0) { - idToAdd = this.ruleActions[this.ruleActions?.length - 1]?.id; + idToAdd = this.ruleActions[this.ruleActions.length - 1]?.id; } - if (rule === 'addRules' && this.ruleActions.filter((action) => action.actionType === 'updateProperty').length === 0) { + if ( + rule === RuleActionsEnum.ADD_RULES && + this.ruleActions.filter((action) => action.actionType === RuleActionsEnum.UPDATE_PROPERTY).length === 0 + ) { this.ruleActions.push({ ruleType: this.ruleCategorySelected, - actionType: 'updateProperty', + actionType: RuleActionsEnum.UPDATE_PROPERTY, id: idToAdd + 1, ruleId: '', stepValid: false, @@ -192,15 +197,9 @@ export class ManagementRulesComponent implements OnInit, OnDestroy { this.actionsSelected.push(rule); } - console.log('actions :', this.actionsSelected); - console.log('tttt', this.ruleActions); this.managementRulesSharedDataService.emitRuleActions(this.ruleActions); } - // getActions(category: string): ActionsRules[] { - // return this.ruleActions.filter((action) => action.ruleType === category); - // } - returnToArchiveSearchPage() { const dialogToOpen = this.confirmLeaveRuleActionsDialog; const dialogRef = this.dialog.open(dialogToOpen, { panelClass: 'vitamui-dialog' }); @@ -209,13 +208,7 @@ export class ManagementRulesComponent implements OnInit, OnDestroy { .afterClosed() .pipe(filter((result) => !!result)) .subscribe(() => { - console.log('go to archive-search page'); - this.ruleActions = []; - // const ruleCategoryAction: RuleCategoryAction = { rules: [], finalAction: '' }; - // this.managementRulesSharedDataService.emitRuleTypeDUA(ruleCategoryAction); - this.managementRulesSharedDataService.emitManagementRules([]); - this.managementRulesSharedDataService.emitRuleActions(this.ruleActions); - this.managementRulesSharedDataService.emitCriteriaSearchListToSave(this.criteriaSearchListToSave); + this.initializeParameters(); this.router.navigate(['/archive-search/tenant/', this.tenantIdentifier]); }); } @@ -224,12 +217,9 @@ export class ManagementRulesComponent implements OnInit, OnDestroy { const dialogToOpen = this.confirmRuleActionsDialog; const dialogRef = this.dialog.open(dialogToOpen, { panelClass: 'vitamui-dialog' }); const actionAddOnRules: any = {}; - // this.managementRulesSharedDataService.getRuleTypeDUA().subscribe((data) => { - // this.ruleCategoryDuaActions = data; - // }); this.managementRulesSharedDataService.getManagementRules().subscribe((data) => { - this.ruleCategoryDuaActions = data.find((rule) => rule.category === 'AppraisalRule')?.ruleCategoryAction; + this.ruleCategoryDuaActions = data.find((rule) => rule.category === RuleTypeEnum.APPRAISALRULE)?.ruleCategoryAction; }); actionAddOnRules.AppraisalRule = { rules: this.ruleCategoryDuaActions.rules, finalAction: this.ruleCategoryDuaActions?.finalAction }; @@ -249,15 +239,10 @@ export class ManagementRulesComponent implements OnInit, OnDestroy { ruleActions: allRuleActions, }; - console.log('objet pour la partie back', this.ruleSearchCriteriaDto); - this.archiveService.updateUnitsRules(ruleSearchCriteriaDto, this.accessContract).subscribe( (response) => { - console.log('BackEnd response', response); const ruleActions: ActionsRules[] = []; - // const ruleCategoryAction: RuleCategoryAction = { rules: [], finalAction: '' }; this.managementRulesSharedDataService.emitRuleActions(ruleActions); - // this.managementRulesSharedDataService.emitRuleTypeDUA(ruleCategoryAction); this.managementRulesSharedDataService.emitManagementRules([]); const serviceUrl = @@ -272,16 +257,6 @@ export class ManagementRulesComponent implements OnInit, OnDestroy { }); } - // update(formData: any): Observable<string> { - // console.log('rak tema', formData.ruleIdentifier); - // return formData.ruleIdentifier; - // } - - // getActionByRuleType(ruleType: string): string[] { - // const s: string[] = this.ruleActions.filter((x) => x.ruleType === ruleType).map((x) => x.actionType); - // return s.filter((n, i) => s.indexOf(n) === i); - // } - isAllActionsValid(): boolean { this.managementRulesSharedDataService.getRuleActions().subscribe((data) => { this.ruleActions = data; @@ -294,7 +269,7 @@ export class ManagementRulesComponent implements OnInit, OnDestroy { } } - objectToArray(object: any): any[] { + private objectToArray(object: any): any[] { return Object.keys(object).map((x) => { const item: any = {}; item[x] = object[x]; diff --git a/ui/ui-frontend/projects/archive-search/src/app/archive/models/rule-type-enum.ts b/ui/ui-frontend/projects/archive-search/src/app/archive/models/rule-type-enum.ts new file mode 100644 index 000000000..d673e8300 --- /dev/null +++ b/ui/ui-frontend/projects/archive-search/src/app/archive/models/rule-type-enum.ts @@ -0,0 +1,50 @@ +/* + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2020) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to implement + * implement a digital archiving front-office system for the secure and + * efficient high volumetry VITAM solution. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. + */ + +export enum RuleTypeEnum { + APPRAISALRULE = 'AppraisalRule', + + ACCESSRULE = 'AccessRule', + + STORAGERULE = 'StorageRule', + + DISSEMINATIONRULE = 'DisseminationRule', + + CLASSIFICATIONRULE = 'ClassificationRule', + + REUSERULE = 'ReuseRule', +} diff --git a/ui/ui-frontend/projects/archive-search/src/app/archive/models/ruleAction.interface.ts b/ui/ui-frontend/projects/archive-search/src/app/archive/models/ruleAction.interface.ts index 30a5e334a..67f66e228 100644 --- a/ui/ui-frontend/projects/archive-search/src/app/archive/models/ruleAction.interface.ts +++ b/ui/ui-frontend/projects/archive-search/src/app/archive/models/ruleAction.interface.ts @@ -102,3 +102,8 @@ export interface ManagementRules { category: string; ruleCategoryAction: RuleCategoryAction; } + +export enum RuleActionsEnum { + ADD_RULES = 'ADD_RULES', + UPDATE_PROPERTY = 'UPDATE_PROPERTY', +} diff --git a/ui/ui-frontend/projects/archive-search/src/app/archive/validators/management-rules-validator.service.ts b/ui/ui-frontend/projects/archive-search/src/app/archive/validators/management-rules-validator.service.ts index a6e651f40..1cde04dae 100644 --- a/ui/ui-frontend/projects/archive-search/src/app/archive/validators/management-rules-validator.service.ts +++ b/ui/ui-frontend/projects/archive-search/src/app/archive/validators/management-rules-validator.service.ts @@ -36,10 +36,12 @@ */ import { Injectable } from '@angular/core'; -import { AbstractControl, AsyncValidatorFn } from '@angular/forms'; +import { AbstractControl, AsyncValidatorFn, ValidationErrors, ValidatorFn } from '@angular/forms'; import { of, timer } from 'rxjs'; import { map, switchMap, take } from 'rxjs/operators'; +import { RuleService } from 'ui-frontend-common'; import { ManagementRulesSharedDataService } from '../../core/management-rules-shared-data.service'; +import { RuleTypeEnum } from '../models/rule-type-enum'; import { ManagementRules, RuleCategoryAction } from '../models/ruleAction.interface'; @Injectable() @@ -47,37 +49,54 @@ export class ManagementRulesValidatorService { debounceTime = 400; ruleActions: RuleCategoryAction; managementRules: ManagementRules[]; - constructor(private managementRulesSharedDataService: ManagementRulesSharedDataService) {} + constructor(private managementRulesSharedDataService: ManagementRulesSharedDataService, private ruleService: RuleService) {} filterRuleActions(ruleId: string): boolean { - // this.managementRulesSharedDataService.getRuleTypeDUA().subscribe((data) => { - // this.ruleActions = data; - // console.log('hada filtre', data); - // }); - this.managementRulesSharedDataService.getManagementRules().subscribe((data) => { this.managementRules = data; - console.log('hada filtre', data); }); - if (this.managementRules.findIndex((managementRule) => managementRule.category === 'AppraisalRule') !== -1) { - this.ruleActions = this.managementRules.find((managementRule) => managementRule.category === 'AppraisalRule').ruleCategoryAction; + if (this.managementRules.findIndex((managementRule) => managementRule.category === RuleTypeEnum.APPRAISALRULE) !== -1) { + this.ruleActions = this.managementRules.find( + (managementRule) => managementRule.category === RuleTypeEnum.APPRAISALRULE + ).ruleCategoryAction; return this.ruleActions.rules?.filter((action) => action.rule === ruleId).length !== 0 ? true : false; } return false; - - // if (this.ruleActions && this.ruleActions.rules) { - // return this.ruleActions.rules?.filter((action) => action.rule === ruleId).length !== 0 ? true : false; - // } } - uniqueCode = (codeToIgnore?: string): AsyncValidatorFn => { + uniqueRuleId = (codeToIgnore?: string): AsyncValidatorFn => { return (control: AbstractControl) => { - console.log('control', control); return timer(this.debounceTime).pipe( switchMap(() => (control.value !== codeToIgnore ? of(this.filterRuleActions(control.value)) : of(false))), take(1), - map((exists: boolean) => (exists ? { uniqueCode: true } : null)) + map((exists: boolean) => (exists ? { uniqueRuleId: true } : null)) + ); + }; + }; + + ruleIdPattern = (): ValidatorFn => { + return (control: AbstractControl): ValidationErrors | null => { + const regexp = /[À-ÖØ-öø-ÿ ]/; + return regexp.test(control.value) ? { ruleIdPattern: true } : null; + }; + }; + + checkRuleIdExistence = (ruleIdToIgnore?: string): AsyncValidatorFn => { + return this.existesRuleProperties('ruleId', 'ruleIdExists', ruleIdToIgnore); + }; + + private existesRuleProperties(field: string, existTag: string, valueToIgnore?: string) { + return (control: AbstractControl) => { + const properties: any = {}; + properties[field] = control.value; + const existField: any = {}; + existField[existTag] = true; + + return timer(this.debounceTime).pipe( + switchMap(() => (control.value !== valueToIgnore ? this.ruleService.existsProperties(properties) : of(false))), + take(1), + map((exists: boolean) => (exists ? null : existField)) ); }; } diff --git a/ui/ui-frontend/projects/archive-search/src/app/core/api/archive-api.service.ts b/ui/ui-frontend/projects/archive-search/src/app/core/api/archive-api.service.ts index 7f8123ac0..19a45d68b 100644 --- a/ui/ui-frontend/projects/archive-search/src/app/core/api/archive-api.service.ts +++ b/ui/ui-frontend/projects/archive-search/src/app/core/api/archive-api.service.ts @@ -131,10 +131,6 @@ export class ArchiveApiService extends BaseHttpClient<any> { }); } - getRuleName(headers?: HttpHeaders): Observable<string> { - return this.http.get(`${this.apiUrl}/ruleName`, { headers, responseType: 'text' }); - } - updateUnitsRules(ruleSearchCriteriaDto: RuleSearchCriteriaDto, headers?: HttpHeaders): Observable<string> { return this.http.post(`${this.apiUrl}/units/rules`, ruleSearchCriteriaDto, { responseType: 'text', diff --git a/ui/ui-frontend/projects/archive-search/src/app/core/management-rules-shared-data.service.ts b/ui/ui-frontend/projects/archive-search/src/app/core/management-rules-shared-data.service.ts index e9ae9e6b6..0b816c19a 100644 --- a/ui/ui-frontend/projects/archive-search/src/app/core/management-rules-shared-data.service.ts +++ b/ui/ui-frontend/projects/archive-search/src/app/core/management-rules-shared-data.service.ts @@ -37,41 +37,25 @@ import { Injectable } from '@angular/core'; import { BehaviorSubject, Observable } from 'rxjs'; -import { ActionsRules, ManagementRules, RuleAction, RuleCategoryAction } from '../archive/models/ruleAction.interface'; +import { ActionsRules, ManagementRules } from '../archive/models/ruleAction.interface'; import { SearchCriteriaDto, SearchCriteriaEltDto } from '../archive/models/search.criteria'; @Injectable({ providedIn: 'root', }) export class ManagementRulesSharedDataService { - private ruleAction: RuleAction[] = []; - private ruleCategoryAction: RuleCategoryAction = { - rules: this.ruleAction, - finalAction: '', - // classificationLevel: 'hello', - }; - // private managementRulesValues: ManagementRules = { - // category: '', - // ruleCategoryAction: this.ruleCategoryAction, - // }; - - // private ruleMap: Map<string, RuleCategoryAction> = new Map().set('AppraisalRule', this.ruleCategoryAction); - private accessContract = new BehaviorSubject<string>(''); private selectedItems = new BehaviorSubject<number>(0); private criteriaSearchListToSave = new BehaviorSubject<SearchCriteriaEltDto[]>([]); private criteriaSearchDSLQuery = new BehaviorSubject<SearchCriteriaDto>(null); private ruleActions = new BehaviorSubject<ActionsRules[]>([]); - // private ruleTypeDUA = new BehaviorSubject<RuleType>({ ruleCategory: 'AppraisalRule', ruleCategoryAction: this.ruleCategoryAction }); - // private ruleTypeDUA = new BehaviorSubject<RuleType>({ ruleMap: this.ruleMap }); - private ruleTypeDUA = new BehaviorSubject<RuleCategoryAction>(this.ruleCategoryAction); + private managementRules = new BehaviorSubject<ManagementRules[]>([]); selectedItem = this.selectedItems.asObservable(); allCriteriaSearchListToSave = this.criteriaSearchListToSave.asObservable(); allCriteriaSearchDSLQuery = this.criteriaSearchDSLQuery.asObservable(); allRuleActions = this.ruleActions.asObservable(); - allRuleTypeDUA = this.ruleTypeDUA.asObservable(); allManagementRules = this.managementRules.asObservable(); constructor() {} @@ -116,14 +100,6 @@ export class ManagementRulesSharedDataService { return this.ruleActions.asObservable(); } - emitRuleTypeDUA(ruleTypeDUA: RuleCategoryAction) { - this.ruleTypeDUA.next(ruleTypeDUA); - } - - getRuleTypeDUA(): Observable<RuleCategoryAction> { - return this.ruleTypeDUA.asObservable(); - } - emitManagementRules(managementRules: ManagementRules[]) { this.managementRules.next(managementRules); } diff --git a/ui/ui-frontend/projects/archive-search/src/assets/i18n/en.json b/ui/ui-frontend/projects/archive-search/src/assets/i18n/en.json index c13dd4329..3cb26ff43 100644 --- a/ui/ui-frontend/projects/archive-search/src/assets/i18n/en.json +++ b/ui/ui-frontend/projects/archive-search/src/assets/i18n/en.json @@ -35,8 +35,8 @@ "EXECUTE": "Delete the archives", "EXECUTE_ONE": "Delete the archive" }, - "RULE" : { - "UPDATE_RULE" : "Update a rule" + "RULES_ACTION" : { + "UPDATE_RULE" : "Update rules" }, "ACCESS_CONTRACT_NOT_FOUND": "No contract associated with current user", @@ -245,7 +245,8 @@ "RULE_NAME": "Label", "END_DATE": "End date", "RULE_ID": "Code", - "SAME_RULE_ID" : "Code identical to the previous action" + "SAME_RULE_ID" : "Code identical to the previous action", + "RULE_NOT_EXIST" :"The rule code entered does not exist" }, "FINAL_ACTION": { diff --git a/ui/ui-frontend/projects/archive-search/src/assets/i18n/fr.json b/ui/ui-frontend/projects/archive-search/src/assets/i18n/fr.json index d8d587593..f2d14c69c 100644 --- a/ui/ui-frontend/projects/archive-search/src/assets/i18n/fr.json +++ b/ui/ui-frontend/projects/archive-search/src/assets/i18n/fr.json @@ -35,8 +35,8 @@ "EXECUTE": "Eliminer les archives", "EXECUTE_ONE": "Eliminer l'archive" }, - "RULE" : { - "UPDATE_RULE" : "Modifier une règle" + "RULES_ACTION" : { + "UPDATE_RULE" : "Mettre à jour des règles" }, "ACCESS_CONTRACT_NOT_FOUND": "Aucun contrat d'accès n'est associé à l'utiisateur", "SHOW_TREES_PLANS": "Afficher les arbres et plans", @@ -272,7 +272,8 @@ "RULE_NAME" : "Libellé", "END_DATE" : "Date de fin", "RULE_ID" : "Code", - "SAME_RULE_ID" : "Code identique à l'action précédente" + "SAME_RULE_ID" : "Code identique à l'action précédente", + "RULE_NOT_EXIST" :"Le code de la règle renseigné n'existe pas" }, "FINAL_ACTION" : { -- GitLab