From 66128d3033d4c7c50be589f8a63dc2c69b31c7fe Mon Sep 17 00:00:00 2001 From: Paris Alexandre Date: Wed, 9 Aug 2023 10:15:11 +0200 Subject: [PATCH] [VAS] Story 8084: mutualisation model --- .../service/ArchiveSearchInternalService.java | 2 +- .../api/utils/ArchiveSearchConsts.java | 2 + .../utils/MetadataSearchCriteriaUtils.java | 15 +- ui/ui-frontend-common/package.json | 2 +- .../components/vitamui-tree-node/index.ts | 2 - .../vitamui-tree-node.component.ts | 2 +- .../src/app/modules/models/criteria/index.ts} | 26 +- .../search-criteria-history.interface.ts | 4 +- .../criteria/search-criteria.interface.ts} | 8 +- .../criteria/search-response.interface.ts} | 22 +- .../src/app/modules/models/index.ts | 5 +- .../filing-holding-scheme.handler.spec.ts | 20 +- .../nodes}/filing-holding-scheme.handler.ts | 117 +++--- .../src/app/modules/models/nodes/index.ts | 31 ++ .../nodes}/node.interface.ts | 49 ++- .../nodes}/node.utils.ts | 5 +- .../src/assets/shared-i18n/en.json | 14 +- .../src/assets/shared-i18n/fr.json | 13 +- ui/ui-frontend/package.json | 2 +- ...rchive-unit-rules-details-tab.component.ts | 3 +- .../dip-request-create.component.ts | 3 +- .../add-management-rules.component.spec.ts | 9 +- .../add-management-rules.component.ts | 3 +- .../archive-unit-rules.component.spec.ts | 3 +- .../block-rules-inheritance.component.ts | 3 +- .../delete-unit-rules.component.spec.ts | 9 +- .../delete-unit-rules.component.ts | 3 +- ...ock-category-inheritance.component.spec.ts | 3 +- .../unlock-category-inheritance.component.ts | 3 +- ...unlock-rules-inheritance.component.spec.ts | 9 +- .../unlock-rules-inheritance.component.ts | 7 +- .../update-unit-rules.component.spec.ts | 9 +- .../update-unit-rules.component.ts | 3 +- .../management-rules.component.spec.ts | 3 +- .../management-rules.component.ts | 15 +- .../reclassification.component.spec.ts | 11 +- .../reclassification.component.ts | 10 +- .../transfer-request-modal.component.ts | 3 +- .../access-rule-search.component.spec.ts | 5 +- .../access-rule-search.component.ts | 5 +- .../appraisal-rule-search.component.spec.ts | 5 +- .../appraisal-rule-search.component.ts | 5 +- ...issemination-rule-search.component.spec.ts | 5 +- .../dissemination-rule-search.component.ts | 5 +- .../reuse-rule-search.component.spec.ts | 5 +- .../reuse-rule-search.component.ts | 5 +- .../storage-rule-search.component.spec.ts | 5 +- .../storage-rule-search.component.ts | 5 +- .../archive-search-rules-facets.component.ts | 2 +- .../search-access-rules-facets.component.ts | 5 +- ...search-appraisal-rules-facets.component.ts | 5 +- ...ch-dissemination-rules-facets.component.ts | 5 +- .../search-reuse-rules-facets.component.ts | 5 +- .../search-storage-rules-facets.component.ts | 5 +- .../archive-search.component.spec.ts | 5 +- .../archive-search.component.ts | 41 ++- .../search-criteria-list.component.spec.ts | 5 +- .../search-criteria-list.component.ts | 3 +- .../search-criteria-list.service.ts | 3 +- .../search-criteria-saver.component.spec.ts | 6 +- .../search-criteria-saver.component.ts | 4 +- .../search-criteria-saver.service.spec.ts | 3 +- .../search-criteria-saver.service.ts | 9 +- .../simple-criteria-search.component.spec.ts | 3 +- .../simple-criteria-search.component.ts | 6 +- ...cription-criteria-search.component.spec.ts | 3 +- ...d-description-criteria-search.component.ts | 3 +- .../src/app/archive/archive.service.ts | 5 +- .../archive-facets.service.spec.ts | 2 +- .../common-services/archive-facets.service.ts | 2 +- .../archive-search-helper.service.ts | 11 +- .../archive-unit-dip.service.ts | 8 +- .../archive-unit-elimination.service.ts | 7 +- .../compute-inherited-rules.service.ts | 5 +- .../update-unit-management-rule.service.ts | 7 +- .../criteria-search.component.spec.ts | 3 +- .../criteria-search.component.ts | 2 +- .../classification-tree.component.html | 6 +- .../filing-holding-scheme.component.ts | 7 +- .../filing-holding-scheme.handler.ts | 335 ------------------ .../leaves-tree/leaves-tree.component.html | 10 +- .../leaves-tree/leaves-tree.component.spec.ts | 28 +- .../leaves-tree/leaves-tree.component.ts | 27 +- .../leaves-tree/leaves-tree.service.ts | 26 +- .../models/dip-request-detail.interface.ts | 2 +- .../reclassification-request.interface.ts | 2 +- .../archive/models/ruleAction.interface.ts | 2 +- .../models/search-response.interface.ts | 7 - .../src/app/archive/models/search.criteria.ts | 172 --------- .../transfer-request-detail.interface.ts | 2 +- .../archive-unit-validator.service.ts | 2 +- .../src/app/core/api/archive-api.service.ts | 8 +- .../app/core/archive-shared-data.service.ts | 13 +- .../management-rules-shared-data.service.ts | 2 +- .../archive-collect.service.ts | 27 +- ...rchive-unit-rules-details-tab.component.ts | 3 +- .../archive-search-collect.component.ts | 49 ++- .../access-rule-search.component.ts | 10 +- .../appraisal-rule-search.component.ts | 11 +- .../archive-search-rules-facets.component.ts | 2 +- .../search-access-rules-facets.component.ts | 5 +- ...search-appraisal-rules-facets.component.ts | 5 +- ...ch-dissemination-rules-facets.component.ts | 5 +- .../search-reuse-rules-facets.component.ts | 5 +- .../search-storage-rules-facets.component.ts | 5 +- .../criteria-search.component.html | 70 ++-- .../criteria-search.component.ts | 2 +- .../dissemination-rule-search.component.ts | 7 +- .../filing-holding-scheme.component.ts | 51 +-- .../leaves-tree/leaves-tree.component.html | 28 ++ .../leaves-tree/leaves-tree.component.spec.ts | 3 +- .../leaves-tree/leaves-tree.component.ts | 259 +++++--------- .../leaves-tree/leaves-tree.service.ts | 215 +++++++++++ .../reuse-rule-search.component.ts | 7 +- .../search-criteria-list.component.spec.ts | 5 +- .../search-criteria-list.component.ts | 9 +- .../search-criteria-saver.component.spec.ts | 5 +- .../search-criteria-saver.component.ts | 4 +- .../search-criteria-saver.service.spec.ts | 4 +- .../simple-criteria-search.component.ts | 6 +- .../storage-rule-search.component.ts | 7 +- ...ption-criteria-search-collect.component.ts | 5 +- .../models/rule-action.interface.ts | 2 +- .../services/archive-facets.service.ts | 25 +- .../services/archive-search-helper.service.ts | 254 ++++++------- .../services/archive-shared-data.service.ts | 13 +- .../management-rules-shared-data.service.ts | 3 +- .../services/search-criteria-saver.service.ts | 3 +- .../collect/core/api/project-api.service.ts | 3 +- .../core/api/transaction-api.service.ts | 25 +- .../src/app/collect/core/models/index.ts | 2 - .../transactions/transactions.service.ts | 3 +- .../src/lib/api/search-unit-api.service.ts | 3 +- .../lib/models/search-response.interface.ts | 7 - .../src/lib/models/search.criteria.ts | 156 -------- .../vitamui-library/src/public-api.ts | 1 - 136 files changed, 1099 insertions(+), 1542 deletions(-) rename ui/{ui-frontend/projects/vitamui-library/src/lib/models/search-criteria-history.interface.ts => ui-frontend-common/src/app/modules/models/criteria/index.ts} (80%) rename ui/{ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/models => ui-frontend-common/src/app/modules/models/criteria}/search-criteria-history.interface.ts (95%) rename ui/{ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/models/search.criteria.ts => ui-frontend-common/src/app/modules/models/criteria/search-criteria.interface.ts} (99%) rename ui/{ui-frontend/projects/archive-search/src/app/archive/models/search-criteria-history.interface.ts => ui-frontend-common/src/app/modules/models/criteria/search-response.interface.ts} (80%) rename ui/{ui-frontend/projects/archive-search/src/app/archive/filing-holding-scheme => ui-frontend-common/src/app/modules/models/nodes}/filing-holding-scheme.handler.spec.ts (97%) rename ui/{ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/components/filing-holding-scheme => ui-frontend-common/src/app/modules/models/nodes}/filing-holding-scheme.handler.ts (74%) create mode 100644 ui/ui-frontend-common/src/app/modules/models/nodes/index.ts rename ui/ui-frontend-common/src/app/modules/{components/vitamui-tree-node => models/nodes}/node.interface.ts (57%) rename ui/ui-frontend-common/src/app/modules/{components/vitamui-tree-node => models/nodes}/node.utils.ts (98%) delete mode 100644 ui/ui-frontend/projects/archive-search/src/app/archive/filing-holding-scheme/filing-holding-scheme.handler.ts delete mode 100644 ui/ui-frontend/projects/archive-search/src/app/archive/models/search-response.interface.ts delete mode 100644 ui/ui-frontend/projects/archive-search/src/app/archive/models/search.criteria.ts create mode 100644 ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/components/filing-holding-scheme/leaves-tree/leaves-tree.service.ts delete mode 100644 ui/ui-frontend/projects/vitamui-library/src/lib/models/search-response.interface.ts delete mode 100644 ui/ui-frontend/projects/vitamui-library/src/lib/models/search.criteria.ts 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 39faad5c925..b7dd4de4ec3 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 @@ -47,8 +47,8 @@ import fr.gouv.vitamui.archives.search.common.dto.UnitDescriptiveMetadataDto; import fr.gouv.vitamui.archives.search.common.dto.VitamUIArchiveUnitResponseDto; import fr.gouv.vitamui.commons.api.domain.AgencyModelDto; -import fr.gouv.vitamui.commons.api.dtos.VitamUiOntologyDto; import fr.gouv.vitamui.commons.api.dtos.SearchCriteriaDto; +import fr.gouv.vitamui.commons.api.dtos.VitamUiOntologyDto; import fr.gouv.vitamui.commons.api.exception.BadRequestException; import fr.gouv.vitamui.commons.api.exception.InternalServerException; import fr.gouv.vitamui.commons.api.exception.UnexpectedDataException; diff --git a/commons/commons-api/src/main/java/fr/gouv/vitamui/commons/api/utils/ArchiveSearchConsts.java b/commons/commons-api/src/main/java/fr/gouv/vitamui/commons/api/utils/ArchiveSearchConsts.java index 2a22e260ab8..e858374f558 100644 --- a/commons/commons-api/src/main/java/fr/gouv/vitamui/commons/api/utils/ArchiveSearchConsts.java +++ b/commons/commons-api/src/main/java/fr/gouv/vitamui/commons/api/utils/ArchiveSearchConsts.java @@ -226,11 +226,13 @@ public enum CriteriaOperators { public static final String PRODUCER_SERVICE = "#originating_agency"; public static final String GUID = "#id"; public static final String ALL_UNIT_UPS = "#allunitups"; + public static final String UNIT_UPS = "#unitups"; public static final String TITLE_OR_DESCRIPTION = "TITLE_OR_DESCRIPTION"; public static final String ELIMINATION_TECHNICAL_ID_APPRAISAL_RULE = "ELIMINATION_TECHNICAL_ID_APPRAISAL_RULE"; public static final String ELIMINATION_GUID = "#elimination.OperationId"; public static final String ALL_ARCHIVE_UNIT_TYPES = "#unitType"; public static final String ALL_ARCHIVE_UNIT_TYPES_CRITERIA = "ALL_ARCHIVE_UNIT_TYPES"; + public static final String ORPHANS_NODE_CRITERIA = "ORPHANS_NODE"; public static final String DESCRIPTION_LEVEL_CRITERIA = "DESCRIPTION_LEVEL"; public static final String DESCRIPTION_LEVEL = "DescriptionLevel"; public static final String ARCHIVE_UNIT_OBJECTS = "#object"; diff --git a/commons/commons-api/src/main/java/fr/gouv/vitamui/commons/api/utils/MetadataSearchCriteriaUtils.java b/commons/commons-api/src/main/java/fr/gouv/vitamui/commons/api/utils/MetadataSearchCriteriaUtils.java index f6513783388..fe9c268f491 100644 --- a/commons/commons-api/src/main/java/fr/gouv/vitamui/commons/api/utils/MetadataSearchCriteriaUtils.java +++ b/commons/commons-api/src/main/java/fr/gouv/vitamui/commons/api/utils/MetadataSearchCriteriaUtils.java @@ -70,6 +70,7 @@ import static fr.gouv.vitamui.commons.api.utils.ArchiveSearchConsts.CriteriaCategory.NODES; import static fr.gouv.vitamui.commons.api.utils.ArchiveSearchConsts.CriteriaCategory.REUSE_RULE; import static fr.gouv.vitamui.commons.api.utils.ArchiveSearchConsts.CriteriaOperators.EQ; +import static fr.gouv.vitamui.commons.api.utils.ArchiveSearchConsts.CriteriaOperators.MISSING; import static fr.gouv.vitamui.commons.api.utils.ArchiveSearchConsts.DEFAULT_DEPTH; import static fr.gouv.vitamui.commons.api.utils.ArchiveSearchConsts.FACETS_COMPUTE_RULES_AU_NUMBER; import static fr.gouv.vitamui.commons.api.utils.ArchiveSearchConsts.FACETS_COUNT_BY_NODE; @@ -1045,6 +1046,9 @@ public static void fillQueryFromCriteriaList(BooleanQuery queryToFill, List searchValues) throws InvalidCreateOperationException { BooleanQuery subQueryAnd = and(); @@ -1275,8 +1284,10 @@ public static void handleSimpleFieldCriteria(BooleanQuery queryToFill, SearchCri SIMPLE_FIELDS_VALUES_MAPPING.get(searchCriteria.getCriteria()) : searchCriteria.getCriteria(); - List stringValues = searchCriteria.getValues().stream().map(CriteriaValue::getValue) - .collect(Collectors.toList()); + List stringValues = + searchCriteria.getValues().stream().filter(Objects::nonNull) + .map(CriteriaValue::getValue).filter(Objects::nonNull) + .collect(Collectors.toList()); if (isADateToReplace(searchCriteria)) { String stringDate = searchCriteria.getValues().get(0).getValue(); LocalDateTime date = LocalDateTime.parse(stringDate, ArchiveSearchConsts.ISO_FRENCH_FORMATER); diff --git a/ui/ui-frontend-common/package.json b/ui/ui-frontend-common/package.json index a7194b21221..f5e8b4b4369 100644 --- a/ui/ui-frontend-common/package.json +++ b/ui/ui-frontend-common/package.json @@ -1,6 +1,6 @@ { "name": "ui-frontend-common", - "version": "2.1.57", + "version": "2.1.58", "main": "src/index.ts", "pki": { "path": "../../dev-deployment/environments/certs/server/hosts/localhost", diff --git a/ui/ui-frontend-common/src/app/modules/components/vitamui-tree-node/index.ts b/ui/ui-frontend-common/src/app/modules/components/vitamui-tree-node/index.ts index ad0bbda8b42..5005f4be9e2 100644 --- a/ui/ui-frontend-common/src/app/modules/components/vitamui-tree-node/index.ts +++ b/ui/ui-frontend-common/src/app/modules/components/vitamui-tree-node/index.ts @@ -34,7 +34,5 @@ * 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 * from './node.interface'; -export * from './node.utils'; export * from './vitamui-tree-node.component'; export * from './vitamui-tree-node.module'; diff --git a/ui/ui-frontend-common/src/app/modules/components/vitamui-tree-node/vitamui-tree-node.component.ts b/ui/ui-frontend-common/src/app/modules/components/vitamui-tree-node/vitamui-tree-node.component.ts index cfcc5126111..b92188b70c6 100644 --- a/ui/ui-frontend-common/src/app/modules/components/vitamui-tree-node/vitamui-tree-node.component.ts +++ b/ui/ui-frontend-common/src/app/modules/components/vitamui-tree-node/vitamui-tree-node.component.ts @@ -25,7 +25,7 @@ * accept its terms. */ import { AfterContentChecked, ChangeDetectorRef, Component, EventEmitter, Input, Output } from '@angular/core'; -import { FilingHoldingSchemeNode } from './node.interface'; +import { FilingHoldingSchemeNode } from '../../models/nodes'; @Component({ selector: 'vitamui-tree-node', diff --git a/ui/ui-frontend/projects/vitamui-library/src/lib/models/search-criteria-history.interface.ts b/ui/ui-frontend-common/src/app/modules/models/criteria/index.ts similarity index 80% rename from ui/ui-frontend/projects/vitamui-library/src/lib/models/search-criteria-history.interface.ts rename to ui/ui-frontend-common/src/app/modules/models/criteria/index.ts index c3c77b543bb..d5a36661a4a 100644 --- a/ui/ui-frontend/projects/vitamui-library/src/lib/models/search-criteria-history.interface.ts +++ b/ui/ui-frontend-common/src/app/modules/models/criteria/index.ts @@ -34,23 +34,9 @@ * 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. */ - -import { Id } from 'ui-frontend-common'; -import { CriteriaValue } from './search.criteria'; - -export interface SearchCriteriaHistory extends Id { - name: string; - userId?: string; - savingDate: string; - searchCriteriaList: SearchCriteriaEltements[]; -} - -export interface SearchCriteriaEltements { - criteria: string; - operator: string; - keyTranslated: boolean; - valueTranslated: boolean; - values: CriteriaValue[]; - category: string; - dataType: string; -} +export * from './criteria.enums'; +export * from './criteria.interface'; +export * from './criterion.interface'; +export * from './search-criteria-history.interface'; +export * from './search-criteria.interface'; +export * from './search-response.interface'; diff --git a/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/models/search-criteria-history.interface.ts b/ui/ui-frontend-common/src/app/modules/models/criteria/search-criteria-history.interface.ts similarity index 95% rename from ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/models/search-criteria-history.interface.ts rename to ui/ui-frontend-common/src/app/modules/models/criteria/search-criteria-history.interface.ts index c3c77b543bb..da3dac7d592 100644 --- a/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/models/search-criteria-history.interface.ts +++ b/ui/ui-frontend-common/src/app/modules/models/criteria/search-criteria-history.interface.ts @@ -35,8 +35,8 @@ * knowledge of the CeCILL-C license and that you accept its terms. */ -import { Id } from 'ui-frontend-common'; -import { CriteriaValue } from './search.criteria'; +import { Id } from '../id.interface'; +import { CriteriaValue } from './search-criteria.interface'; export interface SearchCriteriaHistory extends Id { name: string; diff --git a/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/models/search.criteria.ts b/ui/ui-frontend-common/src/app/modules/models/criteria/search-criteria.interface.ts similarity index 99% rename from ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/models/search.criteria.ts rename to ui/ui-frontend-common/src/app/modules/models/criteria/search-criteria.interface.ts index 9eee2aa0b5f..1062cffb5eb 100644 --- a/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/models/search.criteria.ts +++ b/ui/ui-frontend-common/src/app/modules/models/criteria/search-criteria.interface.ts @@ -34,6 +34,7 @@ * 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 SearchCriteriaStatusEnum { NOT_INCLUDED = 'NOT_INCLUDED', INCLUDED = 'INCLUDED', @@ -105,6 +106,7 @@ export interface SearchCriteriaEltDto { values: CriteriaValue[]; dataType: string; } + export interface SearchCriteriaDto { criteriaList: SearchCriteriaEltDto[]; pageNumber: number; @@ -126,10 +128,12 @@ export interface ResultFacetList { name: string; buckets: ResultBucket[]; } + export interface ResultBucket { value: string; count: number; } + export interface ResultFacet { node: string; count: number; @@ -144,9 +148,11 @@ export interface SearchCriteriaCategory { name: string; index: number; } + export interface CriteriaValue { id: string; value?: string; + label?: string; beginInterval?: string; endInterval?: string; } @@ -165,8 +171,8 @@ export class ArchiveSearchResultFacets { export class RuleFacets { waitingToRecalculateRulesListFacets: ResultFacet[]; expiredRulesListFacets: ResultFacet[]; - unexpiredRulesListFacets: ResultFacet[]; rulesListFacets: ResultFacet[]; finalActionsFacets?: ResultFacet[]; noRulesFacets: ResultFacet[]; + unexpiredRulesListFacets: ResultFacet[]; } diff --git a/ui/ui-frontend/projects/archive-search/src/app/archive/models/search-criteria-history.interface.ts b/ui/ui-frontend-common/src/app/modules/models/criteria/search-response.interface.ts similarity index 80% rename from ui/ui-frontend/projects/archive-search/src/app/archive/models/search-criteria-history.interface.ts rename to ui/ui-frontend-common/src/app/modules/models/criteria/search-response.interface.ts index c3c77b543bb..2cbc2903524 100644 --- a/ui/ui-frontend/projects/archive-search/src/app/archive/models/search-criteria-history.interface.ts +++ b/ui/ui-frontend-common/src/app/modules/models/criteria/search-response.interface.ts @@ -35,22 +35,10 @@ * knowledge of the CeCILL-C license and that you accept its terms. */ -import { Id } from 'ui-frontend-common'; -import { CriteriaValue } from './search.criteria'; +import { Unit } from '../units'; -export interface SearchCriteriaHistory extends Id { - name: string; - userId?: string; - savingDate: string; - searchCriteriaList: SearchCriteriaEltements[]; -} - -export interface SearchCriteriaEltements { - criteria: string; - operator: string; - keyTranslated: boolean; - valueTranslated: boolean; - values: CriteriaValue[]; - category: string; - dataType: string; +export interface SearchResponse { + $hits: any; + $results: T[]; + $facetResults?: any[]; } diff --git a/ui/ui-frontend-common/src/app/modules/models/index.ts b/ui/ui-frontend-common/src/app/modules/models/index.ts index 14ec5b860f2..0b569e921ab 100644 --- a/ui/ui-frontend-common/src/app/modules/models/index.ts +++ b/ui/ui-frontend-common/src/app/modules/models/index.ts @@ -44,9 +44,7 @@ export * from './application/index'; export * from './breadcrumb/breadcrumb.interface'; export * from './collect/index'; export * from './content-disposition.enum'; -export * from './criteria/criteria.enums'; -export * from './criteria/criteria.interface'; -export * from './criteria/criterion.interface'; +export * from './criteria/index'; export * from './customer/index'; export * from './externalparamprofile/index'; export * from './group/index'; @@ -54,6 +52,7 @@ export * from './id.interface'; export * from './ingest-contract/index'; export * from './logbook/index'; export * from './managementContract/index'; +export * from './nodes/index'; export * from './ontology/index'; export * from './operation/index'; export * from './position/index'; diff --git a/ui/ui-frontend/projects/archive-search/src/app/archive/filing-holding-scheme/filing-holding-scheme.handler.spec.ts b/ui/ui-frontend-common/src/app/modules/models/nodes/filing-holding-scheme.handler.spec.ts similarity index 97% rename from ui/ui-frontend/projects/archive-search/src/app/archive/filing-holding-scheme/filing-holding-scheme.handler.spec.ts rename to ui/ui-frontend-common/src/app/modules/models/nodes/filing-holding-scheme.handler.spec.ts index d86efe4147d..a6168fd6676 100644 --- a/ui/ui-frontend/projects/archive-search/src/app/archive/filing-holding-scheme/filing-holding-scheme.handler.spec.ts +++ b/ui/ui-frontend-common/src/app/modules/models/nodes/filing-holding-scheme.handler.spec.ts @@ -24,9 +24,11 @@ * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you * accept its terms. */ -import { DescriptionLevel, FilingHoldingSchemeNode, MatchingNodesNumbers, Unit } from 'ui-frontend-common'; -import { ResultFacet } from '../models/search.criteria'; +import { DescriptionLevel } from '../../description-level.enum'; +import { ResultFacet } from '../criteria'; +import { Unit } from '../units'; import { FilingHoldingSchemeHandler } from './filing-holding-scheme.handler'; +import { FilingHoldingSchemeNode, MatchingNodesNumbers } from './node.interface'; export function newNode( currentId: string, @@ -336,12 +338,12 @@ describe('FilingHoldingSchemeHandler', () => { }); describe('filterUnknownFacets', () => { it('should return an empty array if the newFacets array is full of already known facets', () => { - const oldFacets: ResultFacet[] = [{ node: 'node-0', count: 1 }, { node: 'node-1', count: 65 },]; - const newFacets: ResultFacet[] = [{ node: 'node-0', count: 5 }, { node: 'node-1', count: 42 },]; + const oldFacets: ResultFacet[] = [{ node: 'node-0', count: 1 }, { node: 'node-1', count: 65 }, ]; + const newFacets: ResultFacet[] = [{ node: 'node-0', count: 5 }, { node: 'node-1', count: 42 }, ]; expect(FilingHoldingSchemeHandler.filterUnknownFacets(oldFacets, newFacets)).toEqual([]); }); it('should return all the facets in the newFacets array if there are no known facets', () => { - const oldFacets: ResultFacet[] = [{ node: 'node-0', count: 1 }, { node: 'node-1', count: 65 },]; + const oldFacets: ResultFacet[] = [{ node: 'node-0', count: 1 }, { node: 'node-1', count: 65 }, ]; const newFacets = [{ node: 'node-2', count: 5 }]; expect(FilingHoldingSchemeHandler.filterUnknownFacets(oldFacets, newFacets)).toEqual(newFacets); }); @@ -351,7 +353,7 @@ describe('FilingHoldingSchemeHandler', () => { expect(FilingHoldingSchemeHandler.filterUnknownFacets(oldFacets, newFacets)).toEqual(newFacets); }); it('should return an empty array if the newFacets array is empty', () => { - const oldFacets: ResultFacet[] = [{ node: 'node-0', count: 1 }, { node: 'node-1', count: 65 },]; + const oldFacets: ResultFacet[] = [{ node: 'node-0', count: 1 }, { node: 'node-1', count: 65 }, ]; const newFacets: ResultFacet[] = []; expect(FilingHoldingSchemeHandler.filterUnknownFacets(oldFacets, newFacets)).toEqual([]); }); @@ -366,12 +368,12 @@ describe('FilingHoldingSchemeHandler', () => { }); it('should return all the facets in the facets array if there are no known nodes', () => { const nodes: FilingHoldingSchemeNode[] = []; - const facets: ResultFacet[] = [newResultFacet('node-1'), newResultFacet('node-2'),]; + const facets: ResultFacet[] = [newResultFacet('node-1'), newResultFacet('node-2'), ]; const unknownFacets: ResultFacet[] = FilingHoldingSchemeHandler.filterUnknownFacetsIds(nodes, facets); expect(unknownFacets).toEqual(facets); }); it('should return only the facets in the facets array that have nodes that are not in the knownNodes array', () => { - const unknowFacet = newResultFacet('node-2') + const unknowFacet = newResultFacet('node-2'); const nodes: FilingHoldingSchemeNode[] = [newNode('node-1')]; const facets: ResultFacet[] = [newResultFacet('node-1'), unknowFacet]; const unknownFacets: ResultFacet[] = FilingHoldingSchemeHandler.filterUnknownFacetsIds(nodes, facets); @@ -442,7 +444,7 @@ describe('FilingHoldingSchemeHandler', () => { }); it('should return the sum of the counts of all the nodes in the array if the array is not empty', () => { const nodes: FilingHoldingSchemeNode[] = [ - newTreeNode('node-1', 1, [newTreeNode('node-1-1', 1), newTreeNode('node-1-2', 1),]), + newTreeNode('node-1', 1, [newTreeNode('node-1-1', 1), newTreeNode('node-1-2', 1), ]), newTreeNode('node-2', 2), newTreeNode('node-3', 3), newTreeNode('node-4', 1), diff --git a/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/components/filing-holding-scheme/filing-holding-scheme.handler.ts b/ui/ui-frontend-common/src/app/modules/models/nodes/filing-holding-scheme.handler.ts similarity index 74% rename from ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/components/filing-holding-scheme/filing-holding-scheme.handler.ts rename to ui/ui-frontend-common/src/app/modules/models/nodes/filing-holding-scheme.handler.ts index 3f328073616..48df377203c 100644 --- a/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/components/filing-holding-scheme/filing-holding-scheme.handler.ts +++ b/ui/ui-frontend-common/src/app/modules/models/nodes/filing-holding-scheme.handler.ts @@ -23,14 +23,17 @@ * * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you * accept its terms. + * */ -import { copyNodeWithoutChildren, DescriptionLevel, FilingHoldingSchemeNode, MatchingNodesNumbers, Unit } from 'ui-frontend-common'; -import { ResultFacet } from '../../models/search.criteria'; -import { isEmpty } from "underscore"; +import { isEmpty } from 'underscore'; +import { DescriptionLevel } from '../../description-level.enum'; +import { ResultFacet } from '../criteria'; +import { Unit } from '../units'; +import { FilingHoldingSchemeNode, MatchingNodesNumbers } from './node.interface'; +import { copyNodeWithoutChildren } from './node.utils'; -const ORPHANS_NODE = 'ORPHANS_NODE'; +export const ORPHANS_NODE_ID = 'ORPHANS_NODE'; -// TODO: merge with node.utils export class FilingHoldingSchemeHandler { public static foundNodeAndSetCheck(nodes: FilingHoldingSchemeNode[], checked: boolean, nodeId: string): boolean { @@ -65,7 +68,8 @@ export class FilingHoldingSchemeHandler { } public static getCountSum(nodes: FilingHoldingSchemeNode[]): number { - return nodes ? nodes.reduce((sum, node) => sum + node.count, 0) : 0; + const byAddingCounts = (sum, node) => sum + node.count; + return nodes ? nodes.reduce(byAddingCounts, 0) : 0; } public static setCountRecursively(nodes: FilingHoldingSchemeNode[], facets: ResultFacet[]): number { @@ -74,7 +78,7 @@ export class FilingHoldingSchemeHandler { } let nodesUpdated = 0; for (const node of nodes) { - if (this.isOrphansNode(node)) { + if (FilingHoldingSchemeHandler.isOrphansNode(node)) { continue; } nodesUpdated += FilingHoldingSchemeHandler.setCountOnNode(node, facets); @@ -84,7 +88,7 @@ export class FilingHoldingSchemeHandler { return nodesUpdated; } - public static reCalculateCountRecursively(parentNode: FilingHoldingSchemeNode,): void { + public static reCalculateCountRecursively(parentNode: FilingHoldingSchemeNode): void { if (parentNode.count < 1) { // not a match return; @@ -94,29 +98,29 @@ export class FilingHoldingSchemeHandler { } let count = 0; for (const node of parentNode.children) { - this.reCalculateCountRecursively(node); + FilingHoldingSchemeHandler.reCalculateCountRecursively(node); count += node.count; } if (count < parentNode.count) { return; } - if (!this.isOrphansNode(parentNode)) { - count = count + 1;// self match + if (!FilingHoldingSchemeHandler.isOrphansNode(parentNode)) { + count = count + 1; // self match } parentNode.count = count; } public static isOrphansNode(node: FilingHoldingSchemeNode): boolean { - return node.vitamId === ORPHANS_NODE + return node.vitamId === ORPHANS_NODE_ID; } public static addToOrphansNode(nodes: FilingHoldingSchemeNode[], parentNodes: FilingHoldingSchemeNode[], - nodeTitle: string,) { - const orphansNumberFromFacets = this.getCountSum(nodes) + nodes.length; + nodeTitle: string) { + const orphansNumberFromFacets = FilingHoldingSchemeHandler.getCountSum(nodes) + nodes.length; const orphansNode = parentNodes[0]; - this.addOrphansNodeFromTree(parentNodes, nodeTitle, orphansNumberFromFacets); - if (isEmpty(orphansNode.children)) { + FilingHoldingSchemeHandler.addOrphansNodeFromTree(parentNodes, nodeTitle, orphansNumberFromFacets); + if (orphansNode.children.length < 1) { orphansNode.children = nodes; orphansNode.count = orphansNumberFromFacets; return; @@ -133,24 +137,47 @@ export class FilingHoldingSchemeHandler { public static addOrphansNodeFromTree(parentNodes: FilingHoldingSchemeNode[], nodeTitle: string, orphansNumber: number) { - if (isEmpty(parentNodes) || !this.isOrphansNode(parentNodes[0])) { + if (parentNodes.length < 1 || !FilingHoldingSchemeHandler.isOrphansNode(parentNodes[0])) { const orphanNode: FilingHoldingSchemeNode = { checked: false, children: [], - id: ORPHANS_NODE, + id: ORPHANS_NODE_ID, title: nodeTitle, - type: ORPHANS_NODE, - vitamId: ORPHANS_NODE, + vitamId: ORPHANS_NODE_ID, count: orphansNumber, - } - parentNodes.unshift(orphanNode) + }; + parentNodes.unshift(orphanNode); return; } } + public static keepEndNodesWithResultsOnly(nodes: FilingHoldingSchemeNode[]): FilingHoldingSchemeNode[] { + if (!nodes) { + return []; + } + const leaves: FilingHoldingSchemeNode[] = []; + for (const node of nodes) { + if (node.count < 1) { + continue; + } + if (isEmpty(node.children)) { + leaves.push(copyNodeWithoutChildren(node)); + continue; + } + const childResult: FilingHoldingSchemeNode[] = FilingHoldingSchemeHandler.keepEndNodesWithResultsOnly(node.children); + const addedCount = childResult.reduce((accumulator, schemeNode) => accumulator + schemeNode.count, 0); + if (addedCount < node.count) { + const nodeCopy = copyNodeWithoutChildren(node); + nodeCopy.children = childResult; + leaves.push(nodeCopy); + } + leaves.push(...childResult); + } + return leaves; + } - public static keepEndNodesWithResultsOnly(nodes: FilingHoldingSchemeNode[], - attachmentUnits: Unit[]): FilingHoldingSchemeNode[] { + public static keepEndNodesWithResultsOnlyAndCheckAttach(nodes: FilingHoldingSchemeNode[], + attachmentUnits: Unit[]): FilingHoldingSchemeNode[] { if (!nodes) { return []; } @@ -166,7 +193,7 @@ export class FilingHoldingSchemeHandler { leaves.push(copyNodeWithoutChildren(node)); continue; } - const childResult: FilingHoldingSchemeNode[] = FilingHoldingSchemeHandler.keepEndNodesWithResultsOnly(node.children, + const childResult: FilingHoldingSchemeNode[] = FilingHoldingSchemeHandler.keepEndNodesWithResultsOnlyAndCheckAttach(node.children, attachmentUnits); const addedCount = childResult.reduce((accumulator, schemeNode) => accumulator + schemeNode.count, 0); if (addedCount < node.count) { @@ -198,7 +225,7 @@ export class FilingHoldingSchemeHandler { units: Unit[], initCount: boolean = false ): MatchingNodesNumbers { - return this.addChildren(parentNode, units, initCount, false); + return FilingHoldingSchemeHandler.addChildren(parentNode, units, initCount, false); } public static addChildren( @@ -270,7 +297,8 @@ export class FilingHoldingSchemeHandler { } public static filterUnknownFacets(knownFacets: ResultFacet[], newFacets: ResultFacet[]): ResultFacet[] { - return newFacets.filter((newFacet) => knownFacets.findIndex((knownFacet) => knownFacet.node === newFacet.node) === -1); + const keepOnlyUnkonwn = (newFacet) => knownFacets.findIndex((knownFacet) => knownFacet.node === newFacet.node) === -1; + return newFacets.filter(keepOnlyUnkonwn); } public static filterUnknownFacetsIds(nodes: FilingHoldingSchemeNode[], facets: ResultFacet[]): ResultFacet[] { @@ -282,7 +310,6 @@ export class FilingHoldingSchemeHandler { return { id: unit['#id'], title: unit.Title ? unit.Title : unit.Title_ ? (unit.Title_.fr ? unit.Title_.fr : unit.Title_.en) : unit.Title_.en, - type: unit['#unitType'], unitType: unit['#unitType'], descriptionLevel: unit.DescriptionLevel, children: [], @@ -292,6 +319,9 @@ export class FilingHoldingSchemeHandler { canLoadMoreChildren: unit.DescriptionLevel !== DescriptionLevel.ITEM, count: 0, hasObject: !!unit['#object'], + + type: unit['#unitType'], + hidden: false, }; } @@ -302,46 +332,39 @@ export class FilingHoldingSchemeHandler { continue; } const unit = units[i]; - if (this.isParent(parentNode, unit) || (!parentNode && this.isNullIOrUnknowId(unit, units))) { - const outNode: FilingHoldingSchemeNode = { - id: unit['#id'], - vitamId: unit['#id'], - title: unit.Title ? unit.Title : unit.Title_ ? (unit.Title_.fr ? unit.Title_.fr : unit.Title_.en) : unit.Title_.en, - type: unit.DescriptionLevel, - unitType: unit['#unitType'], - descriptionLevel: unit.DescriptionLevel, - children: [], - checked: false, - hidden: false, - hasObject: !!unit['#object'], - }; + if (FilingHoldingSchemeHandler.isParent(parentNode, unit) + || (!parentNode && FilingHoldingSchemeHandler.isNullIOrUnknowId(unit, units))) { + const outNode: FilingHoldingSchemeNode = FilingHoldingSchemeHandler.convertUAToNode(unit); units[i] = undefined; - outNode.children = this.buildNestedTreeLevels(units, locale, outNode); + outNode.children = FilingHoldingSchemeHandler.buildNestedTreeLevels(units, locale, outNode); nodes.push(outNode); } } - return nodes.sort(this.byTitle(locale)); + return nodes.sort(FilingHoldingSchemeHandler.byTitle(locale)); } public static isParent(parentNode: FilingHoldingSchemeNode, unit: Unit): boolean { - return (parentNode && parentNode.vitamId && unit['#unitups'] && unit['#unitups'][0] === parentNode.vitamId) + return (parentNode && parentNode.vitamId && unit['#unitups'] && unit['#unitups'][0] === parentNode.vitamId); } public static isNullIOrUnknowId(unit: Unit, units: Unit[]): boolean { - return (!unit['#unitups'] || !unit['#unitups'].length || !this.idExists(units, unit['#unitups'][0])) + return (!unit['#unitups'] || !unit['#unitups'].length || !FilingHoldingSchemeHandler.idExists(units, unit['#unitups'][0])); } public static idExists(units: Unit[], id: string): boolean { - return !!units.find((unit) => unit && unit['#id'] === id); + const byId = (unit) => unit && unit['#id'] === id; + return !!units.find(byId); } public static byTitle(locale: string): (a: FilingHoldingSchemeNode, b: FilingHoldingSchemeNode) => number { - return (a, b) => { + // noinspection UnnecessaryLocalVariableJS to avoid Lambda not supported. + const byTitleFuction = (a, b) => { if (!a || !b || !a.title || !b.title) { return 0; } return a.title.localeCompare(b.title, locale, { numeric: true }); }; + return byTitleFuction; } } diff --git a/ui/ui-frontend-common/src/app/modules/models/nodes/index.ts b/ui/ui-frontend-common/src/app/modules/models/nodes/index.ts new file mode 100644 index 00000000000..00925c47de8 --- /dev/null +++ b/ui/ui-frontend-common/src/app/modules/models/nodes/index.ts @@ -0,0 +1,31 @@ +/* + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2015-2022) + * + * contact.vitam@culture.gouv.fr + * + * This software is a computer program whose purpose is to implement a digital archiving back-office system managing + * high volumetry securely and efficiently. + * + * This software is governed by the CeCILL 2.1 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 2.1 license as + * circulated by CEA, CNRS and INRIA at the following URL "https://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 2.1 license and that you + * accept its terms. + * + */ + +export * from './filing-holding-scheme.handler'; +export * from './node.interface'; +export * from './node.utils'; diff --git a/ui/ui-frontend-common/src/app/modules/components/vitamui-tree-node/node.interface.ts b/ui/ui-frontend-common/src/app/modules/models/nodes/node.interface.ts similarity index 57% rename from ui/ui-frontend-common/src/app/modules/components/vitamui-tree-node/node.interface.ts rename to ui/ui-frontend-common/src/app/modules/models/nodes/node.interface.ts index 5e0fa93bd68..ca699616216 100644 --- a/ui/ui-frontend-common/src/app/modules/components/vitamui-tree-node/node.interface.ts +++ b/ui/ui-frontend-common/src/app/modules/models/nodes/node.interface.ts @@ -1,41 +1,32 @@ /* - * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2020) - * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2015-2022) * - * contact@programmevitam.fr + * contact.vitam@culture.gouv.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 a computer program whose purpose is to implement a digital archiving back-office system managing + * high volumetry securely and efficiently. * - * 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". + * This software is governed by the CeCILL 2.1 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 2.1 license as + * circulated by CEA, CNRS and INRIA at the following URL "https://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. + * 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. + * 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 2.1 license and that you + * accept its terms. * - * 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. */ -import { Id } from '../../models'; +import { Id } from '../index'; export interface FilingHoldingSchemeNode extends Id { title: string; diff --git a/ui/ui-frontend-common/src/app/modules/components/vitamui-tree-node/node.utils.ts b/ui/ui-frontend-common/src/app/modules/models/nodes/node.utils.ts similarity index 98% rename from ui/ui-frontend-common/src/app/modules/components/vitamui-tree-node/node.utils.ts rename to ui/ui-frontend-common/src/app/modules/models/nodes/node.utils.ts index aa1edd5f2f7..aa619ff32e2 100644 --- a/ui/ui-frontend-common/src/app/modules/components/vitamui-tree-node/node.utils.ts +++ b/ui/ui-frontend-common/src/app/modules/models/nodes/node.utils.ts @@ -1,4 +1,4 @@ -/** +/* * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2015-2022) * * contact.vitam@culture.gouv.fr @@ -23,9 +23,10 @@ * * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you * accept its terms. + * */ -import { unitTypeToVitamuiIcon } from '../../models'; import { VitamuiIcons } from '../../vitamui-icons.enum'; +import { unitTypeToVitamuiIcon } from '../index'; import { FilingHoldingSchemeNode } from './node.interface'; export function nodeToVitamuiIcon(node: FilingHoldingSchemeNode): VitamuiIcons { diff --git a/ui/ui-frontend-common/src/assets/shared-i18n/en.json b/ui/ui-frontend-common/src/assets/shared-i18n/en.json index 352e90794c5..dcaf1788151 100644 --- a/ui/ui-frontend-common/src/assets/shared-i18n/en.json +++ b/ui/ui-frontend-common/src/assets/shared-i18n/en.json @@ -3234,7 +3234,6 @@ "HTTP_STATUS_CODE_EXPECTATION_FAILED": "The platform configuration does not allow you to perform this action, please contact your administrator.", "SERVER_ERROR": "A technical error has occurred: internal error" }, - "ARCHIVE_SEARCH": { "ACCESS_CONTRACT_NOT_FOUND": "No contract associated with current user", "ACCESS_CONTRACT_NOT_FOUND_IN_VITAM": "Error fetching contract from vitam", @@ -3448,13 +3447,14 @@ "WITHOUT_RULES": "That without defined rules" } }, - "FILING_SHCEMA": { - "LOAD_MORE_UNITS": "See more...", + "FILING_SCHEMA": { "NO_TREES_NO_PLANS_FOR_ACCESS_CONTRACT": "No trees or plans founds for the selected access contract", "SHOW_ENTIRE_TREE": "Show the entire tree", "SHOW_TREE_PARENT": "Show only result", "TREE_LEAVES_TITLE": "Attachment position(s)", - "TREE_TITLE": "Trees and plans" + "TREE_TITLE": "Trees and plans", + "LOAD_MORE_UNITS": "Load more results", + "ORPHANS_NODE": "Without attachment" }, "HIDE_SEARCH_CRITERIA": "hide the search filters", "LAUNCH_SEARCH_ACTION": "Launch the search", @@ -3530,6 +3530,7 @@ }, "DUA_TITLE": "Administrative useful life", "FIELDS": { + "ORPHANS_NODE": "Position", "ALL_ARCHIVE_UNIT_TYPES": "Type", "ARCHIVE_UNIT_FILING_UNIT": "Filing plan", "ARCHIVE_UNIT_HOLDING_UNIT": "Positioning tree", @@ -3971,12 +3972,12 @@ "WAITING_ACK": "Waiting Ack" }, "FILING_SCHEMA": { - "LOAD_MORE_UNITS": "Load more results", "NO_TREES_NO_PLANS_FOR_ACCESS_CONTRACT": "No trees or plans available for the access contract", "SHOW_ENTIRE_TREE": "Show the entire tree", "SHOW_TREE_PARENT": "Show only results", "TREE_LEAVES_TITLE": "Attachment position", - "TREE_TITLE": "Trees and plans" + "TREE_TITLE": "Trees and plans", + "LOAD_MORE_UNITS": "Load more results" }, "HIDE_SEARCH_CRITERIA": "Masquer les filtres de recherche", "LAUNCH_SEARCH_ACTION": "Launch the search", @@ -4075,6 +4076,7 @@ }, "DUA_TITLE": "Administrative useful life", "FIELDS": { + "ORPHANS_NODE": "Position", "ALL_ARCHIVE_UNIT_TYPES": "Type", "ARCHIVE_UNIT_FILING_UNIT": "Filing plan", "ARCHIVE_UNIT_HOLDING_UNIT": "Positioning tree", diff --git a/ui/ui-frontend-common/src/assets/shared-i18n/fr.json b/ui/ui-frontend-common/src/assets/shared-i18n/fr.json index 27f5930b185..e4805108bba 100644 --- a/ui/ui-frontend-common/src/assets/shared-i18n/fr.json +++ b/ui/ui-frontend-common/src/assets/shared-i18n/fr.json @@ -4122,7 +4122,6 @@ "HTTP_STATUS_CODE_EXPECTATION_FAILED": "La configuration de la plateforme ne vous permet pas d'executer cette action, merci de contacter votre administrateur.", "SERVER_ERROR": "Une erreur technique est survenue : erreur interne" }, - "COLLECT": { "UNIT_OBJECT_QUALIFIER_TYPE": { "BinaryMaster": "Original numérique", @@ -4307,6 +4306,7 @@ "ORIGIN_INHERITE_AT_LEAST_ONE": "Héritées" }, "FIELDS": { + "ORPHANS_NODE": "Position", "ID": "ID", "TITLE_OR_DESCRIPTION": "Intitulé ou Description", "NODE": "Position", @@ -4561,7 +4561,7 @@ } }, "FILING_SCHEMA": { - "NO_TREES_NO_PLANS_FOR_ACCESS_CONTRACT": "Aucun Arbre ou Plan trouvés avec le contrat choisi", + "NO_TREES_NO_PLANS_FOR_ACCESS_CONTRACT": "Aucun arbre ou plan trouvés avec le contrat choisi", "SHOW_ENTIRE_TREE": "Afficher l'arborescence au complet", "SHOW_TREE_PARENT": "Afficher seulement les résultats", "TREE_TITLE": "Arbres et plans", @@ -4698,7 +4698,6 @@ "SAVE": "ENREGISTRER", "EDIT": "MODIFIER" }, - "ARCHIVE_SEARCH": { "UNIT_OBJECT_QUALIFIER_TYPE": { "BinaryMaster": "Original numérique", @@ -4886,6 +4885,7 @@ "ORIGIN_INHERITE_AT_LEAST_ONE": "Héritées" }, "FIELDS": { + "ORPHANS_NODE": "Position", "ID": "ID", "TITLE_OR_DESCRIPTION": "Intitulé ou Description", "NODE": "Position", @@ -5163,13 +5163,14 @@ "TYPE": "Type" } }, - "FILING_SHCEMA": { - "NO_TREES_NO_PLANS_FOR_ACCESS_CONTRACT": "Aucun Arbre ou Plan trouvés avec le contrat choisi", + "FILING_SCHEMA": { + "NO_TREES_NO_PLANS_FOR_ACCESS_CONTRACT": "Aucun arbre ou plan trouvés avec le contrat choisi", "SHOW_ENTIRE_TREE": "Afficher l'arborescence au complet", "SHOW_TREE_PARENT": "Afficher seulement les résultats", "TREE_TITLE": "Arbres et plans", "TREE_LEAVES_TITLE": "Position(s) de rattachement", - "LOAD_MORE_UNITS": "Voir plus..." + "LOAD_MORE_UNITS": "Charger plus d'éléments", + "ORPHANS_NODE": "Sans rattachement" }, "RETRIVE_EXACT_COUNT": "Afficher le nombre exact", "MORE_THAN": "+ de ", diff --git a/ui/ui-frontend/package.json b/ui/ui-frontend/package.json index adf7bd8e264..42c96a531ba 100644 --- a/ui/ui-frontend/package.json +++ b/ui/ui-frontend/package.json @@ -138,7 +138,7 @@ "serialize-javascript": "^5.0.1", "timers": "^0.1.1", "tslib": "^2.0.3", - "ui-frontend-common": "file:../ui-frontend-common/ui-frontend-common-2.1.57.tgz", + "ui-frontend-common": "file:../ui-frontend-common/ui-frontend-common-2.1.58.tgz", "underscore": "^1.13.1", "utf-8-validate": "^5.0.2", "uuid": "^7.0.2", diff --git a/ui/ui-frontend/projects/archive-search/src/app/archive/archive-preview/archive-unit-rules-details-tab/archive-unit-rules-details-tab.component.ts b/ui/ui-frontend/projects/archive-search/src/app/archive/archive-preview/archive-unit-rules-details-tab/archive-unit-rules-details-tab.component.ts index 4301533e717..21cc0bae9d7 100644 --- a/ui/ui-frontend/projects/archive-search/src/app/archive/archive-preview/archive-unit-rules-details-tab/archive-unit-rules-details-tab.component.ts +++ b/ui/ui-frontend/projects/archive-search/src/app/archive/archive-preview/archive-unit-rules-details-tab/archive-unit-rules-details-tab.component.ts @@ -39,9 +39,8 @@ import { animate, AUTO_STYLE, state, style, transition, trigger } from '@angular import { Component, Input, OnChanges, OnDestroy, OnInit, SimpleChanges } from '@angular/core'; import { TranslateService } from '@ngx-translate/core'; import { Subscription } from 'rxjs'; -import { CriteriaDataType, CriteriaOperator, Unit } from 'ui-frontend-common'; +import { CriteriaDataType, CriteriaOperator, SearchCriteriaEltDto, SearchCriteriaTypeEnum, Unit } from 'ui-frontend-common'; import { ArchiveService } from '../../archive.service'; -import { SearchCriteriaEltDto, SearchCriteriaTypeEnum } from '../../models/search.criteria'; const PAGE_SIZE = 10; const CURRENT_PAGE = 0; diff --git a/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/additional-actions-search/dip-request-create/dip-request-create.component.ts b/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/additional-actions-search/dip-request-create/dip-request-create.component.ts index 1ce01079124..6229e6fe1c9 100644 --- a/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/additional-actions-search/dip-request-create/dip-request-create.component.ts +++ b/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/additional-actions-search/dip-request-create/dip-request-create.component.ts @@ -40,11 +40,10 @@ import { FormBuilder, FormGroup, Validators } from '@angular/forms'; import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog'; import { TranslateService } from '@ngx-translate/core'; import { Subscription } from 'rxjs'; -import { ConfirmDialogService, Logger, StartupService } from 'ui-frontend-common'; +import { ConfirmDialogService, Logger, SearchCriteriaEltDto, StartupService } from 'ui-frontend-common'; import * as uuid from 'uuid'; import { ArchiveService } from '../../../archive.service'; import { ExportDIPCriteriaList, ExportDIPRequestDetail } from '../../../models/dip-request-detail.interface'; -import { SearchCriteriaEltDto } from '../../../models/search.criteria'; @Component({ selector: 'app-dip-request-create', diff --git a/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/additional-actions-search/management-rules/archive-unit-rules/add-management-rules/add-management-rules.component.spec.ts b/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/additional-actions-search/management-rules/archive-unit-rules/add-management-rules/add-management-rules.component.spec.ts index 72fee10ee04..5327d245fad 100644 --- a/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/additional-actions-search/management-rules/archive-unit-rules/add-management-rules/add-management-rules.component.spec.ts +++ b/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/additional-actions-search/management-rules/archive-unit-rules/add-management-rules/add-management-rules.component.spec.ts @@ -34,12 +34,15 @@ import { MatDialog, MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dial import { MatSnackBarModule } from '@angular/material/snack-bar'; import { RouterTestingModule } from '@angular/router/testing'; import { TranslateLoader, TranslateModule } from '@ngx-translate/core'; -import { UpdateUnitManagementRuleService } from 'projects/archive-search/src/app/archive/common-services/update-unit-management-rule.service'; -import { SearchCriteriaDto, SearchCriteriaTypeEnum } from 'projects/archive-search/src/app/archive/models/search.criteria'; +import { + UpdateUnitManagementRuleService +} from 'projects/archive-search/src/app/archive/common-services/update-unit-management-rule.service'; import { ManagementRulesValidatorService } from 'projects/archive-search/src/app/archive/validators/management-rules-validator.service'; import { ManagementRulesSharedDataService } from 'projects/archive-search/src/app/core/management-rules-shared-data.service'; import { Observable, of } from 'rxjs'; -import { BASE_URL, CriteriaDataType, CriteriaOperator, InjectorModule, LoggerModule, WINDOW_LOCATION } from 'ui-frontend-common'; +import { + BASE_URL, CriteriaDataType, CriteriaOperator, InjectorModule, LoggerModule, SearchCriteriaDto, SearchCriteriaTypeEnum, WINDOW_LOCATION +} from 'ui-frontend-common'; import { VitamUICommonTestModule } from 'ui-frontend-common/testing'; import { ActionsRules, ManagementRules, RuleCategoryAction } from '../../../../../models/ruleAction.interface'; import { AddManagementRulesComponent } from './add-management-rules.component'; diff --git a/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/additional-actions-search/management-rules/archive-unit-rules/add-management-rules/add-management-rules.component.ts b/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/additional-actions-search/management-rules/archive-unit-rules/add-management-rules/add-management-rules.component.ts index f448e567e1f..8955716a430 100644 --- a/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/additional-actions-search/management-rules/archive-unit-rules/add-management-rules/add-management-rules.component.ts +++ b/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/additional-actions-search/management-rules/archive-unit-rules/add-management-rules/add-management-rules.component.ts @@ -42,13 +42,12 @@ import { TranslateService } from '@ngx-translate/core'; import { cloneDeep } from 'lodash'; import { merge, Subscription } from 'rxjs'; import { debounceTime, filter, map } from 'rxjs/operators'; -import { CriteriaDataType, CriteriaOperator, diff, Rule, RuleService } from 'ui-frontend-common'; +import { CriteriaDataType, CriteriaOperator, diff, Rule, RuleService, SearchCriteriaDto, SearchCriteriaEltDto } from 'ui-frontend-common'; import { ManagementRulesSharedDataService } from '../../../../../../core/management-rules-shared-data.service'; import { ArchiveService } from '../../../../../archive.service'; import { UpdateUnitManagementRuleService } from '../../../../../common-services/update-unit-management-rule.service'; import { ArchiveSearchConstsEnum } from '../../../../../models/archive-search-consts-enum'; import { ManagementRules, RuleAction, RuleActionsEnum, RuleCategoryAction } from '../../../../../models/ruleAction.interface'; -import { SearchCriteriaDto, SearchCriteriaEltDto } from '../../../../../models/search.criteria'; import { ManagementRulesValidatorService } from '../../../../../validators/management-rules-validator.service'; const MANAGEMENT_RULE_IDENTIFIER = 'MANAGEMENT_RULE_IDENTIFIER'; diff --git a/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/additional-actions-search/management-rules/archive-unit-rules/archive-unit-rules.component.spec.ts b/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/additional-actions-search/management-rules/archive-unit-rules/archive-unit-rules.component.spec.ts index 773461dbfbc..1ce3b0d8e4a 100644 --- a/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/additional-actions-search/management-rules/archive-unit-rules/archive-unit-rules.component.spec.ts +++ b/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/additional-actions-search/management-rules/archive-unit-rules/archive-unit-rules.component.spec.ts @@ -34,12 +34,11 @@ import { RouterTestingModule } from '@angular/router/testing'; import { TranslateLoader, TranslateModule } from '@ngx-translate/core'; import { ManagementRulesSharedDataService } from 'projects/archive-search/src/app/core/management-rules-shared-data.service'; import { Observable, of } from 'rxjs'; -import { BASE_URL, InjectorModule, LoggerModule, WINDOW_LOCATION } from 'ui-frontend-common'; +import { BASE_URL, InjectorModule, LoggerModule, SearchCriteriaDto, WINDOW_LOCATION } from 'ui-frontend-common'; import { VitamUICommonTestModule } from 'ui-frontend-common/testing'; import { UpdateUnitManagementRuleService } from '../../../../common-services/update-unit-management-rule.service'; import { RuleTypeEnum } from '../../../../models/rule-type-enum'; import { ActionsRules, ManagementRules, RuleCategoryAction } from '../../../../models/ruleAction.interface'; -import { SearchCriteriaDto } from '../../../../models/search.criteria'; import { ArchiveUnitRulesComponent } from './archive-unit-rules.component'; const translations: any = { TEST: 'Mock translate test' }; diff --git a/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/additional-actions-search/management-rules/archive-unit-rules/block-rules-inheritance/block-rules-inheritance.component.ts b/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/additional-actions-search/management-rules/archive-unit-rules/block-rules-inheritance/block-rules-inheritance.component.ts index eaa10da5a61..e2682fb55bc 100644 --- a/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/additional-actions-search/management-rules/archive-unit-rules/block-rules-inheritance/block-rules-inheritance.component.ts +++ b/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/additional-actions-search/management-rules/archive-unit-rules/block-rules-inheritance/block-rules-inheritance.component.ts @@ -31,10 +31,9 @@ import { MatDialog } from '@angular/material/dialog'; import { ManagementRulesSharedDataService } from 'projects/archive-search/src/app/core/management-rules-shared-data.service'; import { merge, Subscription } from 'rxjs'; import { debounceTime, filter, map } from 'rxjs/operators'; -import { diff, Rule, RuleService } from 'ui-frontend-common'; +import { diff, Rule, RuleService, SearchCriteriaDto } from 'ui-frontend-common'; import { ArchiveSearchConstsEnum } from '../../../../../models/archive-search-consts-enum'; import { ManagementRules, RuleAction, RuleActionsEnum, RuleCategoryAction } from '../../../../../models/ruleAction.interface'; -import { SearchCriteriaDto } from '../../../../../models/search.criteria'; import { ManagementRulesValidatorService } from '../../../../../validators/management-rules-validator.service'; @Component({ diff --git a/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/additional-actions-search/management-rules/archive-unit-rules/delete-unit-rules/delete-unit-rules.component.spec.ts b/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/additional-actions-search/management-rules/archive-unit-rules/delete-unit-rules/delete-unit-rules.component.spec.ts index f23f89452ac..7fa94ea1b0b 100644 --- a/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/additional-actions-search/management-rules/archive-unit-rules/delete-unit-rules/delete-unit-rules.component.spec.ts +++ b/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/additional-actions-search/management-rules/archive-unit-rules/delete-unit-rules/delete-unit-rules.component.spec.ts @@ -34,12 +34,15 @@ import { MatDialog, MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dial import { MatSnackBarModule } from '@angular/material/snack-bar'; import { RouterTestingModule } from '@angular/router/testing'; import { TranslateLoader, TranslateModule } from '@ngx-translate/core'; -import { UpdateUnitManagementRuleService } from 'projects/archive-search/src/app/archive/common-services/update-unit-management-rule.service'; -import { SearchCriteriaDto, SearchCriteriaTypeEnum } from 'projects/archive-search/src/app/archive/models/search.criteria'; +import { + UpdateUnitManagementRuleService +} from 'projects/archive-search/src/app/archive/common-services/update-unit-management-rule.service'; import { ManagementRulesValidatorService } from 'projects/archive-search/src/app/archive/validators/management-rules-validator.service'; import { ManagementRulesSharedDataService } from 'projects/archive-search/src/app/core/management-rules-shared-data.service'; import { Observable, of } from 'rxjs'; -import { BASE_URL, CriteriaDataType, CriteriaOperator, InjectorModule, LoggerModule, WINDOW_LOCATION } from 'ui-frontend-common'; +import { + BASE_URL, CriteriaDataType, CriteriaOperator, InjectorModule, LoggerModule, SearchCriteriaDto, SearchCriteriaTypeEnum, WINDOW_LOCATION +} from 'ui-frontend-common'; import { VitamUICommonTestModule } from 'ui-frontend-common/testing'; import { ActionsRules, ManagementRules, RuleCategoryAction } from '../../../../../models/ruleAction.interface'; import { DeleteUnitRulesComponent } from './delete-unit-rules.component'; diff --git a/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/additional-actions-search/management-rules/archive-unit-rules/delete-unit-rules/delete-unit-rules.component.ts b/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/additional-actions-search/management-rules/archive-unit-rules/delete-unit-rules/delete-unit-rules.component.ts index 01b14951664..94270522708 100644 --- a/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/additional-actions-search/management-rules/archive-unit-rules/delete-unit-rules/delete-unit-rules.component.ts +++ b/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/additional-actions-search/management-rules/archive-unit-rules/delete-unit-rules/delete-unit-rules.component.ts @@ -43,12 +43,11 @@ import { cloneDeep } from 'lodash'; import { ManagementRulesSharedDataService } from 'projects/archive-search/src/app/core/management-rules-shared-data.service'; import { merge, Subscription } from 'rxjs'; import { debounceTime, filter, map } from 'rxjs/operators'; -import { CriteriaDataType, CriteriaOperator, diff, Rule, RuleService } from 'ui-frontend-common'; +import { CriteriaDataType, CriteriaOperator, diff, Rule, RuleService, SearchCriteriaDto, SearchCriteriaEltDto } from 'ui-frontend-common'; import { ArchiveService } from '../../../../../archive.service'; import { UpdateUnitManagementRuleService } from '../../../../../common-services/update-unit-management-rule.service'; import { ArchiveSearchConstsEnum } from '../../../../../models/archive-search-consts-enum'; import { ManagementRules, RuleAction, RuleActionsEnum, RuleCategoryAction } from '../../../../../models/ruleAction.interface'; -import { SearchCriteriaDto, SearchCriteriaEltDto } from '../../../../../models/search.criteria'; import { ManagementRulesValidatorService } from '../../../../../validators/management-rules-validator.service'; const MANAGEMENT_RULE_IDENTIFIER = 'MANAGEMENT_RULE_IDENTIFIER'; diff --git a/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/additional-actions-search/management-rules/archive-unit-rules/unlock-category-inheritance/unlock-category-inheritance.component.spec.ts b/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/additional-actions-search/management-rules/archive-unit-rules/unlock-category-inheritance/unlock-category-inheritance.component.spec.ts index 1485fe2dc51..7845064b815 100644 --- a/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/additional-actions-search/management-rules/archive-unit-rules/unlock-category-inheritance/unlock-category-inheritance.component.spec.ts +++ b/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/additional-actions-search/management-rules/archive-unit-rules/unlock-category-inheritance/unlock-category-inheritance.component.spec.ts @@ -34,12 +34,11 @@ import { RouterTestingModule } from '@angular/router/testing'; import { TranslateLoader, TranslateModule } from '@ngx-translate/core'; import { ManagementRulesSharedDataService } from 'projects/archive-search/src/app/core/management-rules-shared-data.service'; import { Observable, of } from 'rxjs'; -import { BASE_URL, InjectorModule, LoggerModule, WINDOW_LOCATION } from 'ui-frontend-common'; +import { BASE_URL, InjectorModule, LoggerModule, PagedResult, SearchCriteriaDto, WINDOW_LOCATION } from 'ui-frontend-common'; import { VitamUICommonTestModule } from 'ui-frontend-common/testing'; import { UpdateUnitManagementRuleService } from '../../../../../common-services/update-unit-management-rule.service'; import { RuleTypeEnum } from '../../../../../models/rule-type-enum'; import { ActionsRules, ManagementRules, RuleActionsEnum, RuleCategoryAction } from '../../../../../models/ruleAction.interface'; -import { PagedResult, SearchCriteriaDto } from '../../../../../models/search.criteria'; import { UnlockCategoryInheritanceComponent } from './unlock-category-inheritance.component'; const translations: any = { TEST: 'Mock translate test' }; diff --git a/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/additional-actions-search/management-rules/archive-unit-rules/unlock-category-inheritance/unlock-category-inheritance.component.ts b/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/additional-actions-search/management-rules/archive-unit-rules/unlock-category-inheritance/unlock-category-inheritance.component.ts index 2a3e9e87b55..3070c21e5b9 100644 --- a/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/additional-actions-search/management-rules/archive-unit-rules/unlock-category-inheritance/unlock-category-inheritance.component.ts +++ b/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/additional-actions-search/management-rules/archive-unit-rules/unlock-category-inheritance/unlock-category-inheritance.component.ts @@ -32,12 +32,11 @@ import { cloneDeep } from 'lodash'; import { ManagementRulesSharedDataService } from 'projects/archive-search/src/app/core/management-rules-shared-data.service'; import { Subscription } from 'rxjs'; import { filter } from 'rxjs/operators'; -import { CriteriaDataType, CriteriaOperator } from 'ui-frontend-common'; +import { CriteriaDataType, CriteriaOperator, SearchCriteriaDto, SearchCriteriaEltDto } from 'ui-frontend-common'; import { ArchiveService } from '../../../../../archive.service'; import { UpdateUnitManagementRuleService } from '../../../../../common-services/update-unit-management-rule.service'; import { ArchiveSearchConstsEnum } from '../../../../../models/archive-search-consts-enum'; import { ActionsRules, ManagementRules, RuleActionsEnum, RuleCategoryAction } from '../../../../../models/ruleAction.interface'; -import { SearchCriteriaDto, SearchCriteriaEltDto } from '../../../../../models/search.criteria'; const ORIGIN_HAS_AT_LEAST_ONE = 'ORIGIN_HAS_AT_LEAST_ONE'; const MANAGEMENT_RULE_INHERITED_CRITERIA = 'MANAGEMENT_RULE_INHERITED_CRITERIA'; diff --git a/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/additional-actions-search/management-rules/archive-unit-rules/unlock-rules-inheritance/unlock-rules-inheritance.component.spec.ts b/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/additional-actions-search/management-rules/archive-unit-rules/unlock-rules-inheritance/unlock-rules-inheritance.component.spec.ts index 10ac2425677..8ef9666e533 100644 --- a/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/additional-actions-search/management-rules/archive-unit-rules/unlock-rules-inheritance/unlock-rules-inheritance.component.spec.ts +++ b/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/additional-actions-search/management-rules/archive-unit-rules/unlock-rules-inheritance/unlock-rules-inheritance.component.spec.ts @@ -34,12 +34,15 @@ import { MatDialog, MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dial import { MatSnackBarModule } from '@angular/material/snack-bar'; import { RouterTestingModule } from '@angular/router/testing'; import { TranslateLoader, TranslateModule } from '@ngx-translate/core'; -import { UpdateUnitManagementRuleService } from 'projects/archive-search/src/app/archive/common-services/update-unit-management-rule.service'; -import { SearchCriteriaDto, SearchCriteriaTypeEnum } from 'projects/archive-search/src/app/archive/models/search.criteria'; +import { + UpdateUnitManagementRuleService +} from 'projects/archive-search/src/app/archive/common-services/update-unit-management-rule.service'; import { ManagementRulesValidatorService } from 'projects/archive-search/src/app/archive/validators/management-rules-validator.service'; import { ManagementRulesSharedDataService } from 'projects/archive-search/src/app/core/management-rules-shared-data.service'; import { Observable, of } from 'rxjs'; -import { BASE_URL, CriteriaDataType, CriteriaOperator, InjectorModule, LoggerModule, WINDOW_LOCATION } from 'ui-frontend-common'; +import { + BASE_URL, CriteriaDataType, CriteriaOperator, InjectorModule, LoggerModule, SearchCriteriaDto, SearchCriteriaTypeEnum, WINDOW_LOCATION +} from 'ui-frontend-common'; import { VitamUICommonTestModule } from 'ui-frontend-common/testing'; import { ActionsRules, ManagementRules, RuleCategoryAction } from '../../../../../models/ruleAction.interface'; import { UnlockRulesInheritanceComponent } from './unlock-rules-inheritance.component'; diff --git a/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/additional-actions-search/management-rules/archive-unit-rules/unlock-rules-inheritance/unlock-rules-inheritance.component.ts b/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/additional-actions-search/management-rules/archive-unit-rules/unlock-rules-inheritance/unlock-rules-inheritance.component.ts index 54a088a71b5..0909852c272 100644 --- a/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/additional-actions-search/management-rules/archive-unit-rules/unlock-rules-inheritance/unlock-rules-inheritance.component.ts +++ b/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/additional-actions-search/management-rules/archive-unit-rules/unlock-rules-inheritance/unlock-rules-inheritance.component.ts @@ -30,15 +30,16 @@ import { FormBuilder, FormGroup, Validators } from '@angular/forms'; import { MatDialog } from '@angular/material/dialog'; import { TranslateService } from '@ngx-translate/core'; import { cloneDeep } from 'lodash'; -import { UpdateUnitManagementRuleService } from 'projects/archive-search/src/app/archive/common-services/update-unit-management-rule.service'; +import { + UpdateUnitManagementRuleService +} from 'projects/archive-search/src/app/archive/common-services/update-unit-management-rule.service'; import { ManagementRulesSharedDataService } from 'projects/archive-search/src/app/core/management-rules-shared-data.service'; import { merge, Subscription } from 'rxjs'; import { debounceTime, filter, map } from 'rxjs/operators'; -import { CriteriaDataType, CriteriaOperator, diff, Rule, RuleService } from 'ui-frontend-common'; +import { CriteriaDataType, CriteriaOperator, diff, Rule, RuleService, SearchCriteriaDto, SearchCriteriaEltDto } from 'ui-frontend-common'; import { ArchiveService } from '../../../../../archive.service'; import { ArchiveSearchConstsEnum } from '../../../../../models/archive-search-consts-enum'; import { ManagementRules, RuleAction, RuleActionsEnum, RuleCategoryAction } from '../../../../../models/ruleAction.interface'; -import { SearchCriteriaDto, SearchCriteriaEltDto } from '../../../../../models/search.criteria'; import { ManagementRulesValidatorService } from '../../../../../validators/management-rules-validator.service'; const ORIGIN_HAS_AT_LEAST_ONE = 'ORIGIN_HAS_AT_LEAST_ONE'; diff --git a/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/additional-actions-search/management-rules/archive-unit-rules/update-unit-rules/update-unit-rules.component.spec.ts b/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/additional-actions-search/management-rules/archive-unit-rules/update-unit-rules/update-unit-rules.component.spec.ts index 47ff0a78467..514592845f1 100644 --- a/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/additional-actions-search/management-rules/archive-unit-rules/update-unit-rules/update-unit-rules.component.spec.ts +++ b/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/additional-actions-search/management-rules/archive-unit-rules/update-unit-rules/update-unit-rules.component.spec.ts @@ -34,12 +34,15 @@ import { MatDialog, MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dial import { MatSnackBarModule } from '@angular/material/snack-bar'; import { RouterTestingModule } from '@angular/router/testing'; import { TranslateLoader, TranslateModule } from '@ngx-translate/core'; -import { UpdateUnitManagementRuleService } from 'projects/archive-search/src/app/archive/common-services/update-unit-management-rule.service'; -import { SearchCriteriaDto, SearchCriteriaTypeEnum } from 'projects/archive-search/src/app/archive/models/search.criteria'; +import { + UpdateUnitManagementRuleService +} from 'projects/archive-search/src/app/archive/common-services/update-unit-management-rule.service'; import { ManagementRulesValidatorService } from 'projects/archive-search/src/app/archive/validators/management-rules-validator.service'; import { ManagementRulesSharedDataService } from 'projects/archive-search/src/app/core/management-rules-shared-data.service'; import { Observable, of } from 'rxjs'; -import { BASE_URL, CriteriaDataType, CriteriaOperator, InjectorModule, LoggerModule, WINDOW_LOCATION } from 'ui-frontend-common'; +import { + BASE_URL, CriteriaDataType, CriteriaOperator, InjectorModule, LoggerModule, SearchCriteriaDto, SearchCriteriaTypeEnum, WINDOW_LOCATION +} from 'ui-frontend-common'; import { VitamUICommonTestModule } from 'ui-frontend-common/testing'; import { ActionsRules, ManagementRules, RuleCategoryAction } from '../../../../../models/ruleAction.interface'; import { UpdateUnitRulesComponent } from './update-unit-rules.component'; diff --git a/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/additional-actions-search/management-rules/archive-unit-rules/update-unit-rules/update-unit-rules.component.ts b/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/additional-actions-search/management-rules/archive-unit-rules/update-unit-rules/update-unit-rules.component.ts index 33a221bb4ec..d3291dc410e 100644 --- a/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/additional-actions-search/management-rules/archive-unit-rules/update-unit-rules/update-unit-rules.component.ts +++ b/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/additional-actions-search/management-rules/archive-unit-rules/update-unit-rules/update-unit-rules.component.ts @@ -42,13 +42,12 @@ import { TranslateService } from '@ngx-translate/core'; import { cloneDeep } from 'lodash'; import { merge, Subscription } from 'rxjs'; import { debounceTime, filter, map } from 'rxjs/operators'; -import { CriteriaDataType, CriteriaOperator, diff, Rule, RuleService } from 'ui-frontend-common'; +import { CriteriaDataType, CriteriaOperator, diff, Rule, RuleService, SearchCriteriaDto, SearchCriteriaEltDto } from 'ui-frontend-common'; import { ManagementRulesSharedDataService } from '../../../../../../core/management-rules-shared-data.service'; import { ArchiveService } from '../../../../../archive.service'; import { UpdateUnitManagementRuleService } from '../../../../../common-services/update-unit-management-rule.service'; import { ArchiveSearchConstsEnum } from '../../../../../models/archive-search-consts-enum'; import { ManagementRules, RuleAction, RuleActionsEnum, RuleCategoryAction } from '../../../../../models/ruleAction.interface'; -import { SearchCriteriaDto, SearchCriteriaEltDto } from '../../../../../models/search.criteria'; import { ManagementRulesValidatorService } from '../../../../../validators/management-rules-validator.service'; const MANAGEMENT_RULE_IDENTIFIER = 'MANAGEMENT_RULE_IDENTIFIER'; diff --git a/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/additional-actions-search/management-rules/management-rules.component.spec.ts b/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/additional-actions-search/management-rules/management-rules.component.spec.ts index 78f49e799e6..9936104c587 100644 --- a/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/additional-actions-search/management-rules/management-rules.component.spec.ts +++ b/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/additional-actions-search/management-rules/management-rules.component.spec.ts @@ -44,11 +44,10 @@ import { ActivatedRoute } from '@angular/router'; import { RouterTestingModule } from '@angular/router/testing'; import { TranslateLoader, TranslateModule } from '@ngx-translate/core'; import { Observable, of } from 'rxjs'; -import { BASE_URL, InjectorModule, LoggerModule, StartupService, WINDOW_LOCATION } from 'ui-frontend-common'; +import { BASE_URL, InjectorModule, LoggerModule, SearchCriteriaDto, StartupService, WINDOW_LOCATION } from 'ui-frontend-common'; import { ManagementRulesSharedDataService } from '../../../../core/management-rules-shared-data.service'; import { ArchiveService } from '../../../archive.service'; import { ActionsRules, ManagementRules, RuleCategoryAction } from '../../../models/ruleAction.interface'; -import { SearchCriteriaDto } from '../../../models/search.criteria'; import { ManagementRulesComponent } from './management-rules.component'; const translations: any = { TEST: 'Mock translate test' }; diff --git a/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/additional-actions-search/management-rules/management-rules.component.ts b/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/additional-actions-search/management-rules/management-rules.component.ts index f4856ed3aa6..baf79616fc6 100644 --- a/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/additional-actions-search/management-rules/management-rules.component.ts +++ b/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/additional-actions-search/management-rules/management-rules.component.ts @@ -41,19 +41,14 @@ import { ActivatedRoute, Router } from '@angular/router'; import { TranslateService } from '@ngx-translate/core'; import { Subscription } from 'rxjs'; import { filter } from 'rxjs/operators'; -import { Logger, StartupService } from 'ui-frontend-common'; +import { Logger, SearchCriteriaDto, SearchCriteriaEltDto, StartupService } from 'ui-frontend-common'; import { ManagementRulesSharedDataService } from '../../../../core/management-rules-shared-data.service'; import { ArchiveService } from '../../../archive.service'; import { ArchiveSearchConstsEnum } from '../../../models/archive-search-consts-enum'; import { RuleTypeEnum } from '../../../models/rule-type-enum'; import { - ActionsRules, - RuleActions, - RuleActionsEnum, - RuleCategoryAction, - RuleSearchCriteriaDto + ActionsRules, RuleActions, RuleActionsEnum, RuleCategoryAction, RuleSearchCriteriaDto } from '../../../models/ruleAction.interface'; -import { SearchCriteriaDto, SearchCriteriaEltDto } from '../../../models/search.criteria'; const ARCHIVE_UNIT_HOLDING_UNIT = 'ARCHIVE_UNIT_HOLDING_UNIT'; @Component({ @@ -363,7 +358,7 @@ export class ManagementRulesComponent implements OnInit, OnChanges, OnDestroy { (managementRule.actionType === RuleActionsEnum.BLOCK_CATEGORY_INHERITANCE || managementRule.actionType === RuleActionsEnum.UNLOCK_CATEGORY_INHERITANCE) )?.ruleCategoryAction.preventInheritance; - + const preventRulesIdToAdd: string[] = data.find( (managementRule) => managementRule.category === RuleTypeEnum.REUSERULE && managementRule.actionType === RuleActionsEnum.ADD_RULES @@ -798,7 +793,7 @@ export class ManagementRulesComponent implements OnInit, OnChanges, OnDestroy { (managementRule.actionType === RuleActionsEnum.BLOCK_CATEGORY_INHERITANCE || managementRule.actionType === RuleActionsEnum.UNLOCK_CATEGORY_INHERITANCE) )?.ruleCategoryAction.preventInheritance; - + const preventRulesIdToAdd: string[] = data.find( (managementRule) => managementRule.category === RuleTypeEnum.STORAGERULE && managementRule.actionType === RuleActionsEnum.ADD_RULES @@ -808,7 +803,7 @@ export class ManagementRulesComponent implements OnInit, OnChanges, OnDestroy { (managementRule) => managementRule.category === RuleTypeEnum.STORAGERULE && managementRule.actionType === RuleActionsEnum.DELETE_RULES )?.ruleCategoryAction?.preventRulesIdToRemove; - + if (data.findIndex((rule) => rule.category === RuleTypeEnum.STORAGERULE && rule.actionType === RuleActionsEnum.ADD_RULES) !== -1) { this.ruleCategoryDuaActionsToAdd = data.find( (rule) => rule.category === RuleTypeEnum.STORAGERULE && rule.actionType === RuleActionsEnum.ADD_RULES diff --git a/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/additional-actions-search/reclassification/reclassification.component.spec.ts b/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/additional-actions-search/reclassification/reclassification.component.spec.ts index e6afc0f5106..ee47a5abffb 100644 --- a/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/additional-actions-search/reclassification/reclassification.component.spec.ts +++ b/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/additional-actions-search/reclassification/reclassification.component.spec.ts @@ -38,18 +38,11 @@ import { RouterTestingModule } from '@angular/router/testing'; import { TranslateModule } from '@ngx-translate/core'; import { of } from 'rxjs'; import { - BASE_URL, - ConfirmDialogService, - CriteriaDataType, - CriteriaOperator, - InjectorModule, - LoggerModule, - StartupService, - WINDOW_LOCATION, + BASE_URL, ConfirmDialogService, CriteriaDataType, CriteriaOperator, InjectorModule, LoggerModule, SearchCriteriaDto, + SearchCriteriaTypeEnum, StartupService, WINDOW_LOCATION, } from 'ui-frontend-common'; import { VitamUICommonTestModule } from 'ui-frontend-common/testing'; import { ArchiveService } from '../../../archive.service'; -import { SearchCriteriaDto, SearchCriteriaTypeEnum } from '../../../models/search.criteria'; import { ArchiveUnitValidatorService } from '../../../validators/archive-unit-validator.service'; import { ReclassificationComponent } from './reclassification.component'; diff --git a/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/additional-actions-search/reclassification/reclassification.component.ts b/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/additional-actions-search/reclassification/reclassification.component.ts index 36480328a3b..891c2907de4 100644 --- a/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/additional-actions-search/reclassification/reclassification.component.ts +++ b/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/additional-actions-search/reclassification/reclassification.component.ts @@ -35,15 +35,15 @@ import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog'; import { TranslateService } from '@ngx-translate/core'; import { intersection } from 'lodash'; import { Subscription } from 'rxjs'; -import { ConfirmDialogService, CriteriaDataType, CriteriaOperator, Logger, Option, StartupService } from 'ui-frontend-common'; +import { + ConfirmDialogService, CriteriaDataType, CriteriaOperator, Logger, Option, PagedResult, SearchCriteriaDto, SearchCriteriaTypeEnum, + StartupService +} from 'ui-frontend-common'; import { ArchiveSharedDataService } from '../../../../core/archive-shared-data.service'; import { ArchiveService } from '../../../archive.service'; import { - ReclassificationAction, - ReclassificationCriteriaDto, - ReclassificationQueryActionType + ReclassificationAction, ReclassificationCriteriaDto, ReclassificationQueryActionType } from '../../../models/reclassification-request.interface'; -import { PagedResult, SearchCriteriaDto, SearchCriteriaTypeEnum } from '../../../models/search.criteria'; import { ArchiveUnitValidatorService } from '../../../validators/archive-unit-validator.service'; const PROGRESS_BAR_MULTIPLICATOR = 100; diff --git a/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/additional-actions-search/transfer-request-modal/transfer-request-modal.component.ts b/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/additional-actions-search/transfer-request-modal/transfer-request-modal.component.ts index 6ee32b9a45a..1ce39dcc9d1 100644 --- a/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/additional-actions-search/transfer-request-modal/transfer-request-modal.component.ts +++ b/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/additional-actions-search/transfer-request-modal/transfer-request-modal.component.ts @@ -29,9 +29,8 @@ import { FormBuilder, FormGroup, Validators } from '@angular/forms'; import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog'; import { TranslateService } from '@ngx-translate/core'; import { Subscription } from 'rxjs'; -import { ConfirmDialogService, Logger, StartupService } from 'ui-frontend-common'; +import { ConfirmDialogService, Logger, SearchCriteriaEltDto, StartupService } from 'ui-frontend-common'; import { ArchiveService } from '../../../archive.service'; -import { SearchCriteriaEltDto } from '../../../models/search.criteria'; import { TransferRequestDto, TransferRequestParameters } from '../../../models/transfer-request-detail.interface'; @Component({ diff --git a/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/archive-search-by-mgt-rules/access-rule-search/access-rule-search.component.spec.ts b/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/archive-search-by-mgt-rules/access-rule-search/access-rule-search.component.spec.ts index d8bd8f3bacd..14414dd5d73 100644 --- a/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/archive-search-by-mgt-rules/access-rule-search/access-rule-search.component.spec.ts +++ b/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/archive-search-by-mgt-rules/access-rule-search/access-rule-search.component.spec.ts @@ -36,9 +36,10 @@ import { RouterTestingModule } from '@angular/router/testing'; import { TranslateModule } from '@ngx-translate/core'; import { ArchiveSharedDataService } from 'projects/archive-search/src/app/core/archive-shared-data.service'; import { of } from 'rxjs'; -import { BASE_URL, CriteriaDataType, CriteriaOperator, InjectorModule, LoggerModule, WINDOW_LOCATION } from 'ui-frontend-common'; +import { + BASE_URL, CriteriaDataType, CriteriaOperator, CriteriaValue, InjectorModule, LoggerModule, WINDOW_LOCATION +} from 'ui-frontend-common'; import { VitamUICommonTestModule } from 'ui-frontend-common/testing'; -import { CriteriaValue } from '../../../models/search.criteria'; import { RuleValidator } from '../../rule.validator'; import { AccessRuleSearchComponent } from './access-rule-search.component'; diff --git a/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/archive-search-by-mgt-rules/access-rule-search/access-rule-search.component.ts b/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/archive-search-by-mgt-rules/access-rule-search/access-rule-search.component.ts index 4dc69bd50ec..27158f39222 100644 --- a/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/archive-search-by-mgt-rules/access-rule-search/access-rule-search.component.ts +++ b/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/archive-search-by-mgt-rules/access-rule-search/access-rule-search.component.ts @@ -3,10 +3,11 @@ import { FormBuilder, FormGroup } from '@angular/forms'; import { MatDialog } from '@angular/material/dialog'; import { merge, Subscription } from 'rxjs'; import { debounceTime, filter, map } from 'rxjs/operators'; -import { ActionOnCriteria, CriteriaDataType, CriteriaOperator, diff } from 'ui-frontend-common'; +import { + ActionOnCriteria, CriteriaDataType, CriteriaOperator, CriteriaValue, diff, SearchCriteriaEltDto, SearchCriteriaTypeEnum +} from 'ui-frontend-common'; import { ArchiveSharedDataService } from '../../../../core/archive-shared-data.service'; import { ArchiveSearchConstsEnum } from '../../../models/archive-search-consts-enum'; -import { CriteriaValue, SearchCriteriaEltDto, SearchCriteriaTypeEnum } from '../../../models/search.criteria'; import { RuleValidator } from '../../rule.validator'; const RULE_TYPE_SUFFIX = '_ACCESS_RULE'; diff --git a/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/archive-search-by-mgt-rules/appraisal-rule-search/appraisal-rule-search.component.spec.ts b/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/archive-search-by-mgt-rules/appraisal-rule-search/appraisal-rule-search.component.spec.ts index 5a8c9ee1914..9358e671ade 100644 --- a/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/archive-search-by-mgt-rules/appraisal-rule-search/appraisal-rule-search.component.spec.ts +++ b/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/archive-search-by-mgt-rules/appraisal-rule-search/appraisal-rule-search.component.spec.ts @@ -36,9 +36,10 @@ import { RouterTestingModule } from '@angular/router/testing'; import { TranslateModule } from '@ngx-translate/core'; import { ArchiveSharedDataService } from 'projects/archive-search/src/app/core/archive-shared-data.service'; import { of } from 'rxjs'; -import { BASE_URL, CriteriaDataType, CriteriaOperator, InjectorModule, LoggerModule, WINDOW_LOCATION } from 'ui-frontend-common'; +import { + BASE_URL, CriteriaDataType, CriteriaOperator, CriteriaValue, InjectorModule, LoggerModule, WINDOW_LOCATION +} from 'ui-frontend-common'; import { VitamUICommonTestModule } from 'ui-frontend-common/testing'; -import { CriteriaValue } from '../../../models/search.criteria'; import { RuleValidator } from '../../rule.validator'; import { AppraisalRuleSearchComponent } from './appraisal-rule-search.component'; diff --git a/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/archive-search-by-mgt-rules/appraisal-rule-search/appraisal-rule-search.component.ts b/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/archive-search-by-mgt-rules/appraisal-rule-search/appraisal-rule-search.component.ts index 4f603aa99a6..1c077f93a3f 100644 --- a/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/archive-search-by-mgt-rules/appraisal-rule-search/appraisal-rule-search.component.ts +++ b/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/archive-search-by-mgt-rules/appraisal-rule-search/appraisal-rule-search.component.ts @@ -3,10 +3,11 @@ import { FormBuilder, FormGroup } from '@angular/forms'; import { MatDialog } from '@angular/material/dialog'; import { merge, Subscription } from 'rxjs'; import { debounceTime, filter, map } from 'rxjs/operators'; -import { ActionOnCriteria, CriteriaDataType, CriteriaOperator, diff } from 'ui-frontend-common'; +import { + ActionOnCriteria, CriteriaDataType, CriteriaOperator, CriteriaValue, diff, SearchCriteriaEltDto, SearchCriteriaTypeEnum +} from 'ui-frontend-common'; import { ArchiveSharedDataService } from '../../../../core/archive-shared-data.service'; import { ArchiveSearchConstsEnum } from '../../../models/archive-search-consts-enum'; -import { CriteriaValue, SearchCriteriaEltDto, SearchCriteriaTypeEnum } from '../../../models/search.criteria'; import { RuleValidator } from '../../rule.validator'; const RULE_TYPE_SUFFIX = '_APPRAISAL_RULE'; diff --git a/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/archive-search-by-mgt-rules/dissemination-rule-search/dissemination-rule-search.component.spec.ts b/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/archive-search-by-mgt-rules/dissemination-rule-search/dissemination-rule-search.component.spec.ts index 0f47b22b8a9..bacaeb92845 100644 --- a/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/archive-search-by-mgt-rules/dissemination-rule-search/dissemination-rule-search.component.spec.ts +++ b/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/archive-search-by-mgt-rules/dissemination-rule-search/dissemination-rule-search.component.spec.ts @@ -36,9 +36,10 @@ import { RouterTestingModule } from '@angular/router/testing'; import { TranslateModule } from '@ngx-translate/core'; import { ArchiveSharedDataService } from 'projects/archive-search/src/app/core/archive-shared-data.service'; import { of } from 'rxjs'; -import { BASE_URL, CriteriaDataType, CriteriaOperator, InjectorModule, LoggerModule, WINDOW_LOCATION } from 'ui-frontend-common'; +import { + BASE_URL, CriteriaDataType, CriteriaOperator, CriteriaValue, InjectorModule, LoggerModule, WINDOW_LOCATION +} from 'ui-frontend-common'; import { VitamUICommonTestModule } from 'ui-frontend-common/testing'; -import { CriteriaValue } from '../../../models/search.criteria'; import { RuleValidator } from '../../rule.validator'; import { DisseminationRuleSearchComponent } from './dissemination-rule-search.component'; diff --git a/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/archive-search-by-mgt-rules/dissemination-rule-search/dissemination-rule-search.component.ts b/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/archive-search-by-mgt-rules/dissemination-rule-search/dissemination-rule-search.component.ts index e08cd5f076b..fb6d3c363e9 100644 --- a/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/archive-search-by-mgt-rules/dissemination-rule-search/dissemination-rule-search.component.ts +++ b/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/archive-search-by-mgt-rules/dissemination-rule-search/dissemination-rule-search.component.ts @@ -40,10 +40,11 @@ import { FormBuilder, FormGroup } from '@angular/forms'; import { MatDialog } from '@angular/material/dialog'; import { merge, Subscription } from 'rxjs'; import { debounceTime, filter, map } from 'rxjs/operators'; -import { ActionOnCriteria, CriteriaDataType, CriteriaOperator, diff } from 'ui-frontend-common'; +import { + ActionOnCriteria, CriteriaDataType, CriteriaOperator, CriteriaValue, diff, SearchCriteriaEltDto, SearchCriteriaTypeEnum +} from 'ui-frontend-common'; import { ArchiveSharedDataService } from '../../../../core/archive-shared-data.service'; import { ArchiveSearchConstsEnum } from '../../../models/archive-search-consts-enum'; -import { CriteriaValue, SearchCriteriaEltDto, SearchCriteriaTypeEnum } from '../../../models/search.criteria'; import { RuleValidator } from '../../rule.validator'; const RULE_TYPE_SUFFIX = '_DISSEMINATION_RULE'; diff --git a/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/archive-search-by-mgt-rules/reuse-rule-search/reuse-rule-search.component.spec.ts b/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/archive-search-by-mgt-rules/reuse-rule-search/reuse-rule-search.component.spec.ts index 19855bccfc9..e114533d904 100644 --- a/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/archive-search-by-mgt-rules/reuse-rule-search/reuse-rule-search.component.spec.ts +++ b/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/archive-search-by-mgt-rules/reuse-rule-search/reuse-rule-search.component.spec.ts @@ -36,9 +36,10 @@ import { RouterTestingModule } from '@angular/router/testing'; import { TranslateModule } from '@ngx-translate/core'; import { ArchiveSharedDataService } from 'projects/archive-search/src/app/core/archive-shared-data.service'; import { of } from 'rxjs'; -import { BASE_URL, CriteriaDataType, CriteriaOperator, InjectorModule, LoggerModule, WINDOW_LOCATION } from 'ui-frontend-common'; +import { + BASE_URL, CriteriaDataType, CriteriaOperator, CriteriaValue, InjectorModule, LoggerModule, WINDOW_LOCATION +} from 'ui-frontend-common'; import { VitamUICommonTestModule } from 'ui-frontend-common/testing'; -import { CriteriaValue } from '../../../models/search.criteria'; import { RuleValidator } from '../../rule.validator'; import { ReuseRuleSearchComponent } from './reuse-rule-search.component'; diff --git a/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/archive-search-by-mgt-rules/reuse-rule-search/reuse-rule-search.component.ts b/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/archive-search-by-mgt-rules/reuse-rule-search/reuse-rule-search.component.ts index 1dac6ab314f..943364eb380 100644 --- a/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/archive-search-by-mgt-rules/reuse-rule-search/reuse-rule-search.component.ts +++ b/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/archive-search-by-mgt-rules/reuse-rule-search/reuse-rule-search.component.ts @@ -40,10 +40,11 @@ import { FormBuilder, FormGroup } from '@angular/forms'; import { MatDialog } from '@angular/material/dialog'; import { merge, Subscription } from 'rxjs'; import { debounceTime, filter, map } from 'rxjs/operators'; -import { ActionOnCriteria, CriteriaDataType, CriteriaOperator, diff } from 'ui-frontend-common'; +import { + ActionOnCriteria, CriteriaDataType, CriteriaOperator, CriteriaValue, diff, SearchCriteriaEltDto, SearchCriteriaTypeEnum +} from 'ui-frontend-common'; import { ArchiveSharedDataService } from '../../../../core/archive-shared-data.service'; import { ArchiveSearchConstsEnum } from '../../../models/archive-search-consts-enum'; -import { CriteriaValue, SearchCriteriaEltDto, SearchCriteriaTypeEnum } from '../../../models/search.criteria'; import { RuleValidator } from '../../rule.validator'; const RULE_TYPE_SUFFIX = '_REUSE_RULE'; diff --git a/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/archive-search-by-mgt-rules/storage-rule-search/storage-rule-search.component.spec.ts b/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/archive-search-by-mgt-rules/storage-rule-search/storage-rule-search.component.spec.ts index a494409e366..a0ec74142a2 100644 --- a/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/archive-search-by-mgt-rules/storage-rule-search/storage-rule-search.component.spec.ts +++ b/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/archive-search-by-mgt-rules/storage-rule-search/storage-rule-search.component.spec.ts @@ -36,9 +36,10 @@ import { RouterTestingModule } from '@angular/router/testing'; import { TranslateModule } from '@ngx-translate/core'; import { ArchiveSharedDataService } from 'projects/archive-search/src/app/core/archive-shared-data.service'; import { of } from 'rxjs'; -import { BASE_URL, CriteriaDataType, CriteriaOperator, InjectorModule, LoggerModule, WINDOW_LOCATION } from 'ui-frontend-common'; +import { + BASE_URL, CriteriaDataType, CriteriaOperator, CriteriaValue, InjectorModule, LoggerModule, WINDOW_LOCATION +} from 'ui-frontend-common'; import { VitamUICommonTestModule } from 'ui-frontend-common/testing'; -import { CriteriaValue } from '../../../models/search.criteria'; import { RuleValidator } from '../../rule.validator'; import { StorageRuleSearchComponent } from './storage-rule-search.component'; diff --git a/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/archive-search-by-mgt-rules/storage-rule-search/storage-rule-search.component.ts b/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/archive-search-by-mgt-rules/storage-rule-search/storage-rule-search.component.ts index aa037614883..44fe4a28d54 100644 --- a/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/archive-search-by-mgt-rules/storage-rule-search/storage-rule-search.component.ts +++ b/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/archive-search-by-mgt-rules/storage-rule-search/storage-rule-search.component.ts @@ -40,10 +40,11 @@ import { FormBuilder, FormGroup } from '@angular/forms'; import { MatDialog } from '@angular/material/dialog'; import { merge, Subscription } from 'rxjs'; import { debounceTime, filter, map } from 'rxjs/operators'; -import { ActionOnCriteria, CriteriaDataType, CriteriaOperator, diff } from 'ui-frontend-common'; +import { + ActionOnCriteria, CriteriaDataType, CriteriaOperator, CriteriaValue, diff, SearchCriteriaEltDto, SearchCriteriaTypeEnum +} from 'ui-frontend-common'; import { ArchiveSharedDataService } from '../../../../core/archive-shared-data.service'; import { ArchiveSearchConstsEnum } from '../../../models/archive-search-consts-enum'; -import { CriteriaValue, SearchCriteriaEltDto, SearchCriteriaTypeEnum } from '../../../models/search.criteria'; import { RuleValidator } from '../../rule.validator'; const RULE_TYPE_SUFFIX = '_STORAGE_RULE'; diff --git a/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/archive-search-rules-facets/archive-search-rules-facets.component.ts b/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/archive-search-rules-facets/archive-search-rules-facets.component.ts index ce2b13abf83..747a2f865af 100644 --- a/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/archive-search-rules-facets/archive-search-rules-facets.component.ts +++ b/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/archive-search-rules-facets/archive-search-rules-facets.component.ts @@ -36,7 +36,7 @@ */ import { Component, Input, OnInit } from '@angular/core'; -import { RuleFacets } from '../../models/search.criteria'; +import { RuleFacets } from 'ui-frontend-common'; @Component({ selector: 'app-archive-search-rules-facets', diff --git a/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/archive-search-rules-facets/search-access-rules-facets/search-access-rules-facets.component.ts b/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/archive-search-rules-facets/search-access-rules-facets/search-access-rules-facets.component.ts index e0ef198ebec..abb0fcb9176 100644 --- a/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/archive-search-rules-facets/search-access-rules-facets/search-access-rules-facets.component.ts +++ b/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/archive-search-rules-facets/search-access-rules-facets/search-access-rules-facets.component.ts @@ -38,11 +38,10 @@ import { DatePipe } from '@angular/common'; import { Component, Input, OnChanges, OnInit } from '@angular/core'; import { TranslateService } from '@ngx-translate/core'; -import { Colors } from 'ui-frontend-common'; +import { Colors, RuleFacets } from 'ui-frontend-common'; import { FacetDetails } from 'ui-frontend-common/app/modules/models/operation/facet-details.interface'; import { ArchiveFacetsService } from '../../../common-services/archive-facets.service'; import { ArchiveSearchConstsEnum } from '../../../models/archive-search-consts-enum'; -import { RuleFacets } from '../../../models/search.criteria'; @Component({ selector: 'app-search-access-rules-facets', @@ -146,7 +145,7 @@ export class SearchAccessRulesFacetsComponent implements OnInit, OnChanges { private handleWaitingToRecalculateRulesFacets(): number { let archiveUnitWithRules = 0; if (this.accessRuleFacets.waitingToRecalculateRulesListFacets && this.accessRuleFacets.waitingToRecalculateRulesListFacets.length > 0) { - let facetComputedUnits = this.accessRuleFacets.waitingToRecalculateRulesListFacets.filter((elt) => elt.node === 'true'); + const facetComputedUnits = this.accessRuleFacets.waitingToRecalculateRulesListFacets.filter((elt) => elt.node === 'true'); let computedCount = 0; if (facetComputedUnits.length > 0) { diff --git a/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/archive-search-rules-facets/search-appraisal-rules-facets/search-appraisal-rules-facets.component.ts b/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/archive-search-rules-facets/search-appraisal-rules-facets/search-appraisal-rules-facets.component.ts index 9a6a64ffeae..880cc69d961 100644 --- a/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/archive-search-rules-facets/search-appraisal-rules-facets/search-appraisal-rules-facets.component.ts +++ b/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/archive-search-rules-facets/search-appraisal-rules-facets/search-appraisal-rules-facets.component.ts @@ -38,11 +38,10 @@ import { DatePipe } from '@angular/common'; import { Component, Input, OnChanges, OnInit } from '@angular/core'; import { TranslateService } from '@ngx-translate/core'; -import { Colors } from 'ui-frontend-common'; +import { Colors, RuleFacets } from 'ui-frontend-common'; import { FacetDetails } from 'ui-frontend-common/app/modules/models/operation/facet-details.interface'; import { ArchiveFacetsService } from '../../../common-services/archive-facets.service'; import { ArchiveSearchConstsEnum } from '../../../models/archive-search-consts-enum'; -import { RuleFacets } from '../../../models/search.criteria'; @Component({ selector: 'app-search-appraisal-rules-facets', @@ -210,7 +209,7 @@ export class SearchAppraisalRulesFacetsComponent implements OnInit, OnChanges { this.appraisalRuleFacets.waitingToRecalculateRulesListFacets && this.appraisalRuleFacets.waitingToRecalculateRulesListFacets.length > 0 ) { - let facetComputedUnits = this.appraisalRuleFacets.waitingToRecalculateRulesListFacets.filter((elt) => elt.node === 'true'); + const facetComputedUnits = this.appraisalRuleFacets.waitingToRecalculateRulesListFacets.filter((elt) => elt.node === 'true'); let computedCount = 0; if (facetComputedUnits.length > 0) { diff --git a/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/archive-search-rules-facets/search-dissemination-rules-facets/search-dissemination-rules-facets.component.ts b/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/archive-search-rules-facets/search-dissemination-rules-facets/search-dissemination-rules-facets.component.ts index 1e07f0c754f..4b7063351c8 100644 --- a/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/archive-search-rules-facets/search-dissemination-rules-facets/search-dissemination-rules-facets.component.ts +++ b/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/archive-search-rules-facets/search-dissemination-rules-facets/search-dissemination-rules-facets.component.ts @@ -38,11 +38,10 @@ import { DatePipe } from '@angular/common'; import { Component, Input, OnChanges, OnInit } from '@angular/core'; import { TranslateService } from '@ngx-translate/core'; -import { Colors } from 'ui-frontend-common'; +import { Colors, RuleFacets } from 'ui-frontend-common'; import { FacetDetails } from 'ui-frontend-common/app/modules/models/operation/facet-details.interface'; import { ArchiveFacetsService } from '../../../common-services/archive-facets.service'; import { ArchiveSearchConstsEnum } from '../../../models/archive-search-consts-enum'; -import { RuleFacets } from '../../../models/search.criteria'; @Component({ selector: 'app-search-dissemination-rules-facets', @@ -157,7 +156,7 @@ export class SearchDisseminationRulesFacetsComponent implements OnInit, OnChange this.disseminationRuleFacets.waitingToRecalculateRulesListFacets && this.disseminationRuleFacets.waitingToRecalculateRulesListFacets.length > 0 ) { - let facetComputedUnits = this.disseminationRuleFacets.waitingToRecalculateRulesListFacets.filter((elt) => elt.node === 'true'); + const facetComputedUnits = this.disseminationRuleFacets.waitingToRecalculateRulesListFacets.filter((elt) => elt.node === 'true'); let computedCount = 0; if (facetComputedUnits.length > 0) { diff --git a/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/archive-search-rules-facets/search-reuse-rules-facets/search-reuse-rules-facets.component.ts b/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/archive-search-rules-facets/search-reuse-rules-facets/search-reuse-rules-facets.component.ts index e2e3284041d..d7a26952975 100644 --- a/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/archive-search-rules-facets/search-reuse-rules-facets/search-reuse-rules-facets.component.ts +++ b/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/archive-search-rules-facets/search-reuse-rules-facets/search-reuse-rules-facets.component.ts @@ -38,11 +38,10 @@ import { DatePipe } from '@angular/common'; import { Component, Input, OnChanges, OnInit } from '@angular/core'; import { TranslateService } from '@ngx-translate/core'; -import { Colors } from 'ui-frontend-common'; +import { Colors, RuleFacets } from 'ui-frontend-common'; import { FacetDetails } from 'ui-frontend-common/app/modules/models/operation/facet-details.interface'; import { ArchiveFacetsService } from '../../../common-services/archive-facets.service'; import { ArchiveSearchConstsEnum } from '../../../models/archive-search-consts-enum'; -import { RuleFacets } from '../../../models/search.criteria'; @Component({ selector: 'app-search-reuse-rules-facets', @@ -154,7 +153,7 @@ export class SearchReuseRulesFacetsComponent implements OnInit, OnChanges { private handleWaitingToRecalculateRulesFacets(): number { let archiveUnitWithRules = 0; if (this.reuseRuleFacets.waitingToRecalculateRulesListFacets && this.reuseRuleFacets.waitingToRecalculateRulesListFacets.length > 0) { - let facetComputedUnits = this.reuseRuleFacets.waitingToRecalculateRulesListFacets.filter((elt) => elt.node === 'true'); + const facetComputedUnits = this.reuseRuleFacets.waitingToRecalculateRulesListFacets.filter((elt) => elt.node === 'true'); let computedCount = 0; if (facetComputedUnits.length > 0) { diff --git a/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/archive-search-rules-facets/search-storage-rules-facets/search-storage-rules-facets.component.ts b/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/archive-search-rules-facets/search-storage-rules-facets/search-storage-rules-facets.component.ts index 6c58188588d..8f93142bbda 100644 --- a/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/archive-search-rules-facets/search-storage-rules-facets/search-storage-rules-facets.component.ts +++ b/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/archive-search-rules-facets/search-storage-rules-facets/search-storage-rules-facets.component.ts @@ -38,11 +38,10 @@ import { DatePipe } from '@angular/common'; import { Component, Input, OnChanges, OnInit } from '@angular/core'; import { TranslateService } from '@ngx-translate/core'; -import { Colors } from 'ui-frontend-common'; +import { Colors, RuleFacets } from 'ui-frontend-common'; import { FacetDetails } from 'ui-frontend-common/app/modules/models/operation/facet-details.interface'; import { ArchiveFacetsService } from '../../../common-services/archive-facets.service'; import { ArchiveSearchConstsEnum } from '../../../models/archive-search-consts-enum'; -import { RuleFacets } from '../../../models/search.criteria'; @Component({ selector: 'app-search-storage-rules-facets', @@ -199,7 +198,7 @@ export class SearchStorageRulesFacetsComponent implements OnInit, OnChanges { this.storageRuleFacets.waitingToRecalculateRulesListFacets && this.storageRuleFacets.waitingToRecalculateRulesListFacets.length > 0 ) { - let facetComputedUnits = this.storageRuleFacets.waitingToRecalculateRulesListFacets.filter((elt) => elt.node === 'true'); + const facetComputedUnits = this.storageRuleFacets.waitingToRecalculateRulesListFacets.filter((elt) => elt.node === 'true'); let computedCount = 0; if (facetComputedUnits.length > 0) { diff --git a/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/archive-search.component.spec.ts b/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/archive-search.component.spec.ts index 904d10d7ba5..4376c4959b8 100644 --- a/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/archive-search.component.spec.ts +++ b/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/archive-search.component.spec.ts @@ -51,7 +51,9 @@ import { RouterTestingModule } from '@angular/router/testing'; import { TranslateLoader, TranslateModule } from '@ngx-translate/core'; import { environment } from 'projects/archive-search/src/environments/environment'; import { Observable, of } from 'rxjs'; -import { BASE_URL, InjectorModule, LoggerModule, VitamuiRoles, WINDOW_LOCATION } from 'ui-frontend-common'; +import { + BASE_URL, InjectorModule, LoggerModule, PagedResult, SearchCriteriaStatusEnum, VitamuiRoles, WINDOW_LOCATION +} from 'ui-frontend-common'; import { ArchiveSharedDataService } from '../../core/archive-shared-data.service'; import { ArchiveService } from '../archive.service'; import { ArchiveSearchHelperService } from '../common-services/archive-search-helper.service'; @@ -59,7 +61,6 @@ import { ArchiveUnitDipService } from '../common-services/archive-unit-dip.servi import { ArchiveUnitEliminationService } from '../common-services/archive-unit-elimination.service'; import { ComputeInheritedRulesService } from '../common-services/compute-inherited-rules.service'; import { UpdateUnitManagementRuleService } from '../common-services/update-unit-management-rule.service'; -import { PagedResult, SearchCriteriaStatusEnum } from '../models/search.criteria'; import { VitamUISnackBar } from '../shared/vitamui-snack-bar'; import { ArchiveSearchComponent } from './archive-search.component'; import { TransferAcknowledgmentComponent } from './transfer-acknowledgment/transfer-acknowledgment.component'; 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 78cbbc21b9a..f5bff101066 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 @@ -36,7 +36,12 @@ import { ActivatedRoute, Router } from '@angular/router'; import { TranslateService } from '@ngx-translate/core'; import { merge, Subject, Subscription } from 'rxjs'; import { debounceTime, filter } from 'rxjs/operators'; -import { CriteriaDataType, CriteriaOperator, Direction, FilingHoldingSchemeNode, Logger, Unit, VitamuiRoles } from 'ui-frontend-common'; +import { + ArchiveSearchResultFacets, CriteriaDataType, CriteriaOperator, CriteriaValue, Direction, FilingHoldingSchemeNode, Logger, ORPHANS_NODE_ID, + PagedResult, SearchCriteria, SearchCriteriaAddAction, SearchCriteriaCategory, SearchCriteriaEltDto, SearchCriteriaEltements, + SearchCriteriaHistory, SearchCriteriaMgtRuleEnum, SearchCriteriaRemoveAction, SearchCriteriaStatusEnum, SearchCriteriaTypeEnum, Unit, + VitamuiRoles +} from 'ui-frontend-common'; import { ArchiveSharedDataService } from '../../core/archive-shared-data.service'; import { ManagementRulesSharedDataService } from '../../core/management-rules-shared-data.service'; import { ArchiveService } from '../archive.service'; @@ -47,11 +52,6 @@ import { ArchiveUnitEliminationService } from '../common-services/archive-unit-e import { ComputeInheritedRulesService } from '../common-services/compute-inherited-rules.service'; import { UpdateUnitManagementRuleService } from '../common-services/update-unit-management-rule.service'; import { ActionsRules } from '../models/ruleAction.interface'; -import { SearchCriteriaEltements, SearchCriteriaHistory } from '../models/search-criteria-history.interface'; -import { - ArchiveSearchResultFacets, CriteriaValue, PagedResult, SearchCriteria, SearchCriteriaAddAction, SearchCriteriaCategory, - SearchCriteriaEltDto, SearchCriteriaMgtRuleEnum, SearchCriteriaRemoveAction, SearchCriteriaStatusEnum, SearchCriteriaTypeEnum, -} from '../models/search.criteria'; import { ReclassificationComponent } from './additional-actions-search/reclassification/reclassification.component'; import { SearchCriteriaSaverComponent } from './search-criteria-saver/search-criteria-saver.component'; import { TransferAcknowledgmentComponent } from './transfer-acknowledgment/transfer-acknowledgment.component'; @@ -101,7 +101,31 @@ export class ArchiveSearchComponent implements OnInit, OnChanges, OnDestroy, Aft this.subscriptions.add( this.archiveExchangeDataService.getNodes().subscribe((node) => { - if (node.checked) { + if (!node.checked) { + node.count = null; + if (node.id === ORPHANS_NODE_ID) { + this.removeCriteria(ORPHANS_NODE_ID, { id: node.id, value: node.id }, false); + } else { + this.removeCriteria('NODE', { id: node.id, value: node.id }, false); + } + return; + } + if (node.id === ORPHANS_NODE_ID) { + this.archiveHelperService.addCriteria( + this.searchCriterias, + this.searchCriteriaKeys, + this.nbQueryCriteria, + ORPHANS_NODE_ID, + { id: ORPHANS_NODE_ID, value: ORPHANS_NODE_ID }, + node.title, + true, + CriteriaOperator.MISSING, + SearchCriteriaTypeEnum.FIELDS, + false, + CriteriaDataType.STRING, + false + ); + } else { this.archiveHelperService.addCriteria( this.searchCriterias, this.searchCriteriaKeys, @@ -116,9 +140,6 @@ export class ArchiveSearchComponent implements OnInit, OnChanges, OnDestroy, Aft CriteriaDataType.STRING, false ); - } else { - node.count = null; - this.removeCriteria('NODE', { id: node.id, value: node.id }, false); } }) ); diff --git a/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/search-criteria-list/search-criteria-list.component.spec.ts b/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/search-criteria-list/search-criteria-list.component.spec.ts index 4792cf301b6..0bf39dfc6e6 100644 --- a/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/search-criteria-list/search-criteria-list.component.spec.ts +++ b/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/search-criteria-list/search-criteria-list.component.spec.ts @@ -42,10 +42,11 @@ import { ActivatedRoute } from '@angular/router'; import { RouterTestingModule } from '@angular/router/testing'; import { TranslateLoader, TranslateModule } from '@ngx-translate/core'; import { Observable, of } from 'rxjs'; -import { CriteriaDataType, CriteriaOperator, InjectorModule, LoggerModule } from 'ui-frontend-common'; +import { + CriteriaDataType, CriteriaOperator, InjectorModule, LoggerModule, SearchCriteriaEltements, SearchCriteriaHistory +} from 'ui-frontend-common'; import { environment } from '../../../../environments/environment'; import { ArchiveSharedDataService } from '../../../core/archive-shared-data.service'; -import { SearchCriteriaEltements, SearchCriteriaHistory } from '../../models/search-criteria-history.interface'; import { VitamUISnackBar } from '../../shared/vitamui-snack-bar'; import { SearchCriteriaListComponent } from './search-criteria-list.component'; import { SearchCriteriaListService } from './search-criteria-list.service'; diff --git a/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/search-criteria-list/search-criteria-list.component.ts b/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/search-criteria-list/search-criteria-list.component.ts index 2a70e458799..9fd87dc45f7 100644 --- a/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/search-criteria-list/search-criteria-list.component.ts +++ b/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/search-criteria-list/search-criteria-list.component.ts @@ -39,9 +39,8 @@ import { MatDialog } from '@angular/material/dialog'; import { TranslateService } from '@ngx-translate/core'; import { Subject, Subscription } from 'rxjs'; import { filter } from 'rxjs/operators'; -import { Direction } from 'ui-frontend-common'; +import { Direction, SearchCriteriaHistory } from 'ui-frontend-common'; import { ArchiveSharedDataService } from '../../../core/archive-shared-data.service'; -import { SearchCriteriaHistory } from '../../models/search-criteria-history.interface'; import { VitamUISnackBar, VitamUISnackBarComponent } from '../../shared/vitamui-snack-bar'; import { ConfirmActionComponent } from './confirm-action/confirm-action.component'; import { SearchCriteriaListService } from './search-criteria-list.service'; diff --git a/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/search-criteria-list/search-criteria-list.service.ts b/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/search-criteria-list/search-criteria-list.service.ts index b829db10833..425dfdfd172 100644 --- a/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/search-criteria-list/search-criteria-list.service.ts +++ b/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/search-criteria-list/search-criteria-list.service.ts @@ -37,9 +37,8 @@ import { HttpClient } from '@angular/common/http'; import { Injectable } from '@angular/core'; import { Observable } from 'rxjs'; -import { SearchService } from 'ui-frontend-common'; +import { SearchCriteriaHistory, SearchService } from 'ui-frontend-common'; import { ArchiveApiService } from '../../../core/api/archive-api.service'; -import { SearchCriteriaHistory } from '../../models/search-criteria-history.interface'; @Injectable({ providedIn: 'root' diff --git a/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/search-criteria-saver/search-criteria-saver.component.spec.ts b/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/search-criteria-saver/search-criteria-saver.component.spec.ts index 7714f26d417..c870a2a8ee9 100644 --- a/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/search-criteria-saver/search-criteria-saver.component.spec.ts +++ b/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/search-criteria-saver/search-criteria-saver.component.spec.ts @@ -46,11 +46,11 @@ import { ActivatedRoute } from '@angular/router'; import { RouterTestingModule } from '@angular/router/testing'; import { TranslateLoader, TranslateModule } from '@ngx-translate/core'; import { Observable, of } from 'rxjs'; -import { CriteriaDataType, CriteriaOperator, InjectorModule, LoggerModule } from 'ui-frontend-common'; +import { + CriteriaDataType, CriteriaOperator, InjectorModule, LoggerModule, SearchCriteriaEltements, SearchCriteriaHistory, SearchCriteriaTypeEnum +} from 'ui-frontend-common'; import { environment } from '../../../../environments/environment.prod'; import { ArchiveSharedDataService } from '../../../core/archive-shared-data.service'; -import { SearchCriteriaEltements, SearchCriteriaHistory } from '../../models/search-criteria-history.interface'; -import { SearchCriteriaTypeEnum } from '../../models/search.criteria'; import { VitamUISnackBar } from '../../shared/vitamui-snack-bar'; import { SearchCriteriaSaverComponent } from './search-criteria-saver.component'; import { SearchCriteriaSaverService } from './search-criteria-saver.service'; diff --git a/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/search-criteria-saver/search-criteria-saver.component.ts b/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/search-criteria-saver/search-criteria-saver.component.ts index 36420562244..089e5c036a4 100644 --- a/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/search-criteria-saver/search-criteria-saver.component.ts +++ b/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/search-criteria-saver/search-criteria-saver.component.ts @@ -41,10 +41,8 @@ import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog'; import { MatSnackBar } from '@angular/material/snack-bar'; import { TranslatePipe } from '@ngx-translate/core'; import { Subscription } from 'rxjs'; -import { ConfirmDialogService, Direction } from 'ui-frontend-common'; +import { ConfirmDialogService, Direction, SearchCriteria, SearchCriteriaHistory, SearchCriteriaTypeEnum } from 'ui-frontend-common'; import { ArchiveSharedDataService } from '../../../core/archive-shared-data.service'; -import { SearchCriteriaHistory } from '../../models/search-criteria-history.interface'; -import { SearchCriteria, SearchCriteriaTypeEnum } from '../../models/search.criteria'; import { VitamUISnackBarComponent } from '../../shared/vitamui-snack-bar'; import { SearchCriteriaSaverService } from './search-criteria-saver.service'; diff --git a/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/search-criteria-saver/search-criteria-saver.service.spec.ts b/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/search-criteria-saver/search-criteria-saver.service.spec.ts index 4b5a5c2966e..83bc85dffc9 100644 --- a/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/search-criteria-saver/search-criteria-saver.service.spec.ts +++ b/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/search-criteria-saver/search-criteria-saver.service.spec.ts @@ -28,8 +28,7 @@ import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing'; import { Type } from '@angular/core'; import { TestBed } from '@angular/core/testing'; -import { BASE_URL } from 'ui-frontend-common'; -import { SearchCriteriaHistory } from '../../models/search-criteria-history.interface'; +import { BASE_URL, SearchCriteriaHistory } from 'ui-frontend-common'; import { SearchCriteriaSaverService } from './search-criteria-saver.service'; diff --git a/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/search-criteria-saver/search-criteria-saver.service.ts b/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/search-criteria-saver/search-criteria-saver.service.ts index 7f8d11828ef..4e1d1987904 100644 --- a/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/search-criteria-saver/search-criteria-saver.service.ts +++ b/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/search-criteria-saver/search-criteria-saver.service.ts @@ -34,12 +34,11 @@ * 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. */ -import {HttpClient} from '@angular/common/http'; +import { HttpClient } from '@angular/common/http'; import { Injectable } from '@angular/core'; -import {Observable} from 'rxjs'; -import {SearchService} from 'ui-frontend-common'; -import {ArchiveApiService} from '../../../core/api/archive-api.service'; -import {SearchCriteriaHistory} from '../../models/search-criteria-history.interface'; +import { Observable } from 'rxjs'; +import { SearchCriteriaHistory, SearchService } from 'ui-frontend-common'; +import { ArchiveApiService } from '../../../core/api/archive-api.service'; @Injectable({ providedIn: 'root' diff --git a/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/simple-criteria-search/simple-criteria-search.component.spec.ts b/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/simple-criteria-search/simple-criteria-search.component.spec.ts index 65460952ebe..9ce4b11887c 100644 --- a/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/simple-criteria-search/simple-criteria-search.component.spec.ts +++ b/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/simple-criteria-search/simple-criteria-search.component.spec.ts @@ -33,11 +33,10 @@ import { FormBuilder } from '@angular/forms'; import { MatDialog } from '@angular/material/dialog'; import { TranslateModule } from '@ngx-translate/core'; import { of } from 'rxjs'; -import { BASE_URL, CriteriaDataType, CriteriaOperator, InjectorModule } from 'ui-frontend-common'; +import { BASE_URL, CriteriaDataType, CriteriaOperator, CriteriaValue, InjectorModule } from 'ui-frontend-common'; import { ArchiveSharedDataService } from '../../../core/archive-shared-data.service'; import { ManagementRulesSharedDataService } from '../../../core/management-rules-shared-data.service'; import { ArchiveService } from '../../archive.service'; -import { CriteriaValue } from '../../models/search.criteria'; import { SimpleCriteriaSearchComponent } from './simple-criteria-search.component'; describe('SimpleCriteriaSearchComponent', () => { diff --git a/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/simple-criteria-search/simple-criteria-search.component.ts b/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/simple-criteria-search/simple-criteria-search.component.ts index 2162d7eb884..9fbaedf136e 100644 --- a/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/simple-criteria-search/simple-criteria-search.component.ts +++ b/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/simple-criteria-search/simple-criteria-search.component.ts @@ -40,12 +40,14 @@ import { MatDialog } from '@angular/material/dialog'; import { TranslateService } from '@ngx-translate/core'; import { merge } from 'rxjs'; import { debounceTime, filter, map } from 'rxjs/operators'; -import { ActionOnCriteria, CriteriaDataType, CriteriaOperator, diff, Ontology, OntologyService } from 'ui-frontend-common'; +import { + ActionOnCriteria, CriteriaDataType, CriteriaOperator, CriteriaValue, diff, Ontology, OntologyService, SearchCriteriaEltDto, + SearchCriteriaTypeEnum +} from 'ui-frontend-common'; import { ArchiveSharedDataService } from '../../../core/archive-shared-data.service'; import { ManagementRulesSharedDataService } from '../../../core/management-rules-shared-data.service'; import { ArchiveService } from '../../archive.service'; import { ArchiveSearchConstsEnum } from '../../models/archive-search-consts-enum'; -import { CriteriaValue, SearchCriteriaEltDto, SearchCriteriaTypeEnum } from '../../models/search.criteria'; const FINAL_ACTION_TYPE = 'FINAL_ACTION_TYPE'; const ARCHIVE_UNIT_FILING_UNIT = 'ARCHIVE_UNIT_FILING_UNIT'; diff --git a/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/title-and-description-criteria-search/title-and-description-criteria-search.component.spec.ts b/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/title-and-description-criteria-search/title-and-description-criteria-search.component.spec.ts index dfe0eba7e52..e5958a895a2 100644 --- a/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/title-and-description-criteria-search/title-and-description-criteria-search.component.spec.ts +++ b/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/title-and-description-criteria-search/title-and-description-criteria-search.component.spec.ts @@ -40,9 +40,8 @@ import { FormBuilder } from '@angular/forms'; import { MatDialog } from '@angular/material/dialog'; import { TranslateModule } from '@ngx-translate/core'; import { of } from 'rxjs'; -import { CriteriaOperator, InjectorModule } from 'ui-frontend-common'; +import { CriteriaOperator, CriteriaValue, InjectorModule } from 'ui-frontend-common'; import { ArchiveSharedDataService } from '../../../core/archive-shared-data.service'; -import { CriteriaValue } from '../../models/search.criteria'; import { TitleAndDescriptionCriteriaSearchComponent } from './title-and-description-criteria-search.component'; describe('TitleAndDescriptionCriteriaSearchComponent', () => { diff --git a/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/title-and-description-criteria-search/title-and-description-criteria-search.component.ts b/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/title-and-description-criteria-search/title-and-description-criteria-search.component.ts index 57c7140e17c..2808037ebac 100644 --- a/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/title-and-description-criteria-search/title-and-description-criteria-search.component.ts +++ b/ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/title-and-description-criteria-search/title-and-description-criteria-search.component.ts @@ -39,10 +39,9 @@ import { FormBuilder, FormGroup } from '@angular/forms'; import { MatDialog } from '@angular/material/dialog'; import { merge } from 'rxjs'; import { debounceTime, filter, map } from 'rxjs/operators'; -import { CriteriaDataType, CriteriaOperator, diff } from 'ui-frontend-common'; +import { CriteriaDataType, CriteriaOperator, CriteriaValue, diff, SearchCriteriaTypeEnum } from 'ui-frontend-common'; import { ArchiveSharedDataService } from '../../../core/archive-shared-data.service'; import { ArchiveSearchConstsEnum } from '../../models/archive-search-consts-enum'; -import { CriteriaValue, SearchCriteriaTypeEnum } from '../../models/search.criteria'; const TITLE_OR_DESCRIPTION = 'TITLE_OR_DESCRIPTION'; 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 17d2ec564f4..6d9f6c896c2 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 @@ -41,14 +41,13 @@ import { Observable, of, throwError, TimeoutError } from 'rxjs'; import { catchError, map } from 'rxjs/operators'; import { AccessContract, AccessContractApiService, ApiUnitObject, CriteriaDataType, CriteriaOperator, FilingHoldingSchemeNode, Ontology, - SearchService, SecurityService, Unit, + PagedResult, SearchCriteria, SearchCriteriaDto, SearchCriteriaEltDto, SearchCriteriaTypeEnum, SearchResponse, SearchService, + SecurityService, Unit } from 'ui-frontend-common'; import { ArchiveApiService } from '../core/api/archive-api.service'; import { ExportDIPCriteriaList } from './models/dip-request-detail.interface'; import { ReclassificationCriteriaDto } from './models/reclassification-request.interface'; import { RuleSearchCriteriaDto } from './models/ruleAction.interface'; -import { SearchResponse } from './models/search-response.interface'; -import { PagedResult, SearchCriteria, SearchCriteriaDto, SearchCriteriaEltDto, SearchCriteriaTypeEnum } from './models/search.criteria'; import { TransferRequestDto } from './models/transfer-request-detail.interface'; import { UnitDescriptiveMetadataDto } from './models/unitDescriptiveMetadata.interface'; import { VitamUISnackBarComponent } from './shared/vitamui-snack-bar'; diff --git a/ui/ui-frontend/projects/archive-search/src/app/archive/common-services/archive-facets.service.spec.ts b/ui/ui-frontend/projects/archive-search/src/app/archive/common-services/archive-facets.service.spec.ts index 6f83c3b43bf..436e4b64023 100644 --- a/ui/ui-frontend/projects/archive-search/src/app/archive/common-services/archive-facets.service.spec.ts +++ b/ui/ui-frontend/projects/archive-search/src/app/archive/common-services/archive-facets.service.spec.ts @@ -36,7 +36,7 @@ */ import { HttpClientTestingModule } from '@angular/common/http/testing'; import { TestBed } from '@angular/core/testing'; -import { ResultFacet, ResultFacetList } from '../models/search.criteria'; +import { ResultFacet, ResultFacetList } from 'ui-frontend-common'; import { ArchiveFacetsService } from './archive-facets.service'; describe('ArchiveFacetsService', () => { diff --git a/ui/ui-frontend/projects/archive-search/src/app/archive/common-services/archive-facets.service.ts b/ui/ui-frontend/projects/archive-search/src/app/archive/common-services/archive-facets.service.ts index 1c8fd8b0516..117a7abd70f 100644 --- a/ui/ui-frontend/projects/archive-search/src/app/archive/common-services/archive-facets.service.ts +++ b/ui/ui-frontend/projects/archive-search/src/app/archive/common-services/archive-facets.service.ts @@ -35,8 +35,8 @@ * knowledge of the CeCILL-C license and that you accept its terms. */ import { Injectable } from '@angular/core'; +import { ArchiveSearchResultFacets, ResultFacet, ResultFacetList, RuleFacets, SearchCriteriaMgtRuleEnum } from 'ui-frontend-common'; import { ArchiveSearchConstsEnum } from '../models/archive-search-consts-enum'; -import { ArchiveSearchResultFacets, ResultFacet, ResultFacetList, RuleFacets, SearchCriteriaMgtRuleEnum } from '../models/search.criteria'; @Injectable({ providedIn: 'root', diff --git a/ui/ui-frontend/projects/archive-search/src/app/archive/common-services/archive-search-helper.service.ts b/ui/ui-frontend/projects/archive-search/src/app/archive/common-services/archive-search-helper.service.ts index 79c067d3482..b9af5d28def 100644 --- a/ui/ui-frontend/projects/archive-search/src/app/archive/common-services/archive-search-helper.service.ts +++ b/ui/ui-frontend/projects/archive-search/src/app/archive/common-services/archive-search-helper.service.ts @@ -27,12 +27,13 @@ import { Injectable } from '@angular/core'; import { MatSnackBar } from '@angular/material/snack-bar'; -import { ActionOnCriteria, CriteriaDataType, CriteriaOperator, FilingHoldingSchemeNode } from 'ui-frontend-common'; +import { + ActionOnCriteria, CriteriaDataType, CriteriaOperator, CriteriaValue, FilingHoldingSchemeNode, ORPHANS_NODE_ID, SearchCriteria, + SearchCriteriaEltDto, + SearchCriteriaStatusEnum, SearchCriteriaTypeEnum, SearchCriteriaValue +} from 'ui-frontend-common'; import { ArchiveSharedDataService } from '../../core/archive-shared-data.service'; import { ArchiveService } from '../archive.service'; -import { - CriteriaValue, SearchCriteria, SearchCriteriaEltDto, SearchCriteriaStatusEnum, SearchCriteriaTypeEnum, SearchCriteriaValue, -} from '../models/search.criteria'; import { VitamUISnackBarComponent } from '../shared/vitamui-snack-bar'; const ALL_ARCHIVE_UNIT_TYPES = 'ALL_ARCHIVE_UNIT_TYPES'; @@ -281,7 +282,7 @@ export class ArchiveSearchHelperService { searchCriterias.set(keyElt, val); } nbQueryCriteria--; - if (emit === true && key === 'NODE') { + if (emit === true && key === 'NODE' || key === ORPHANS_NODE_ID) { this.archiveExchangeDataService.emitNodeTarget(valueElt.value); } diff --git a/ui/ui-frontend/projects/archive-search/src/app/archive/common-services/archive-unit-dip.service.ts b/ui/ui-frontend/projects/archive-search/src/app/archive/common-services/archive-unit-dip.service.ts index c5feb968f8f..747fc69b6bb 100644 --- a/ui/ui-frontend/projects/archive-search/src/app/archive/common-services/archive-unit-dip.service.ts +++ b/ui/ui-frontend/projects/archive-search/src/app/archive/common-services/archive-unit-dip.service.ts @@ -28,10 +28,12 @@ import { Injectable, TemplateRef } from '@angular/core'; import { MatDialog } from '@angular/material/dialog'; import { TranslateService } from '@ngx-translate/core'; import { filter } from 'rxjs/operators'; -import { ArchiveSearchComponent } from '../archive-search/archive-search.component'; +import { SearchCriteriaEltDto } from 'ui-frontend-common'; import { DipRequestCreateComponent } from '../archive-search/additional-actions-search/dip-request-create/dip-request-create.component'; -import { SearchCriteriaEltDto } from '../models/search.criteria'; -import { TransferRequestModalComponent } from '../archive-search/additional-actions-search/transfer-request-modal/transfer-request-modal.component'; +import { + TransferRequestModalComponent +} from '../archive-search/additional-actions-search/transfer-request-modal/transfer-request-modal.component'; +import { ArchiveSearchComponent } from '../archive-search/archive-search.component'; const DEFAULT_RESULT_THRESHOLD = 10000; const PAGE_SIZE = 10; diff --git a/ui/ui-frontend/projects/archive-search/src/app/archive/common-services/archive-unit-elimination.service.ts b/ui/ui-frontend/projects/archive-search/src/app/archive/common-services/archive-unit-elimination.service.ts index d9b7ace7bbf..7d849c78d32 100644 --- a/ui/ui-frontend/projects/archive-search/src/app/archive/common-services/archive-unit-elimination.service.ts +++ b/ui/ui-frontend/projects/archive-search/src/app/archive/common-services/archive-unit-elimination.service.ts @@ -31,10 +31,9 @@ import { MatSnackBar } from '@angular/material/snack-bar'; import { TranslateService } from '@ngx-translate/core'; import { Subscription } from 'rxjs'; import { filter } from 'rxjs/operators'; -import { StartupService } from 'ui-frontend-common'; +import { SearchCriteriaEltDto, StartupService } from 'ui-frontend-common'; import { ArchiveSearchComponent } from '../archive-search/archive-search.component'; import { ArchiveService } from '../archive.service'; -import { SearchCriteriaEltDto } from '../models/search.criteria'; import { ArchiveSearchHelperService } from './archive-search-helper.service'; const DEFAULT_RESULT_THRESHOLD = 10000; @@ -53,7 +52,7 @@ export class ArchiveUnitEliminationService { } launchEliminationAnalysisModal( - listOfUACriteriaSearch: SearchCriteriaEltDto[], + listOfUACriteriaSearch: SearchCriteriaEltDto[], selectedItemCountKnown: boolean, itemSelected: number, tenantIdentifier: number, @@ -86,7 +85,7 @@ export class ArchiveUnitEliminationService { } private launchEliminationAnalysis( - listOfUACriteriaSearch: SearchCriteriaEltDto[], + listOfUACriteriaSearch: SearchCriteriaEltDto[], tenantIdentifier: number, currentPage: number ) { diff --git a/ui/ui-frontend/projects/archive-search/src/app/archive/common-services/compute-inherited-rules.service.ts b/ui/ui-frontend/projects/archive-search/src/app/archive/common-services/compute-inherited-rules.service.ts index 02bdd7af357..cab44091be9 100644 --- a/ui/ui-frontend/projects/archive-search/src/app/archive/common-services/compute-inherited-rules.service.ts +++ b/ui/ui-frontend/projects/archive-search/src/app/archive/common-services/compute-inherited-rules.service.ts @@ -30,10 +30,9 @@ import { MatDialog } from '@angular/material/dialog'; import { MatSnackBar } from '@angular/material/snack-bar'; import { TranslateService } from '@ngx-translate/core'; import { filter } from 'rxjs/operators'; -import { CriteriaDataType, CriteriaOperator, StartupService } from 'ui-frontend-common'; +import { CriteriaDataType, CriteriaOperator, SearchCriteriaEltDto, SearchCriteriaTypeEnum, StartupService } from 'ui-frontend-common'; import { ArchiveSearchComponent } from '../archive-search/archive-search.component'; import { ArchiveService } from '../archive.service'; -import { SearchCriteriaEltDto, SearchCriteriaTypeEnum } from '../models/search.criteria'; import { ArchiveSearchHelperService } from './archive-search-helper.service'; const ARCHIVE_UNIT_HOLDING_UNIT = 'ARCHIVE_UNIT_HOLDING_UNIT'; @@ -51,7 +50,7 @@ export class ComputeInheritedRulesService { ) {} launchComputedInheritedRulesModal( - listOfUACriteriaSearch: SearchCriteriaEltDto[], + listOfUACriteriaSearch: SearchCriteriaEltDto[], numberOfHoldingUnitTypeOnComputedRules: number, tenantIdentifier: number, currentPage: number, diff --git a/ui/ui-frontend/projects/archive-search/src/app/archive/common-services/update-unit-management-rule.service.ts b/ui/ui-frontend/projects/archive-search/src/app/archive/common-services/update-unit-management-rule.service.ts index f4f08856e42..a5abd75a24c 100644 --- a/ui/ui-frontend/projects/archive-search/src/app/archive/common-services/update-unit-management-rule.service.ts +++ b/ui/ui-frontend/projects/archive-search/src/app/archive/common-services/update-unit-management-rule.service.ts @@ -31,11 +31,10 @@ import { Router } from '@angular/router'; import { TranslateService } from '@ngx-translate/core'; import { Subscription } from 'rxjs'; import { filter } from 'rxjs/operators'; -import { CriteriaDataType, CriteriaOperator } from 'ui-frontend-common'; +import { CriteriaDataType, CriteriaOperator, SearchCriteriaEltDto, SearchCriteriaTypeEnum } from 'ui-frontend-common'; import { ManagementRulesSharedDataService } from '../../core/management-rules-shared-data.service'; import { ArchiveSearchComponent } from '../archive-search/archive-search.component'; import { ArchiveService } from '../archive.service'; -import { SearchCriteriaEltDto, SearchCriteriaTypeEnum } from '../models/search.criteria'; const ARCHIVE_UNIT_HOLDING_UNIT = 'ARCHIVE_UNIT_HOLDING_UNIT'; const PAGE_SIZE = 10; @@ -57,7 +56,7 @@ export class UpdateUnitManagementRuleService { goToUpdateManagementRule( listOfUACriteriaSearch: SearchCriteriaEltDto[], - criteriaSearchList: SearchCriteriaEltDto[], + criteriaSearchList: SearchCriteriaEltDto[], currentPage: number, tenantIdentifier: number, numberOfHoldingUnitType: number, @@ -112,7 +111,7 @@ export class UpdateUnitManagementRuleService { private updateManagementRule( listOfUACriteriaSearch: SearchCriteriaEltDto[], - criteriaSearchList: SearchCriteriaEltDto[], + criteriaSearchList: SearchCriteriaEltDto[], currentPage: number, tenantIdentifier: number, numberOfHoldingUnitType: number, diff --git a/ui/ui-frontend/projects/archive-search/src/app/archive/criteria-search/criteria-search.component.spec.ts b/ui/ui-frontend/projects/archive-search/src/app/archive/criteria-search/criteria-search.component.spec.ts index e0ccff3ebf7..25d76b63147 100644 --- a/ui/ui-frontend/projects/archive-search/src/app/archive/criteria-search/criteria-search.component.spec.ts +++ b/ui/ui-frontend/projects/archive-search/src/app/archive/criteria-search/criteria-search.component.spec.ts @@ -35,9 +35,8 @@ import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; import { RouterTestingModule } from '@angular/router/testing'; import { TranslateModule } from '@ngx-translate/core'; import { environment } from 'projects/archive-search/src/environments/environment'; -import { BASE_URL, InjectorModule, LoggerModule, WINDOW_LOCATION } from 'ui-frontend-common'; +import { BASE_URL, InjectorModule, LoggerModule, SearchCriteriaTypeEnum, WINDOW_LOCATION } from 'ui-frontend-common'; import { VitamUICommonTestModule } from 'ui-frontend-common/testing'; -import { SearchCriteriaTypeEnum } from '../models/search.criteria'; import { CriteriaSearchComponent } from './criteria-search.component'; describe('CriteriaSearchComponent', () => { diff --git a/ui/ui-frontend/projects/archive-search/src/app/archive/criteria-search/criteria-search.component.ts b/ui/ui-frontend/projects/archive-search/src/app/archive/criteria-search/criteria-search.component.ts index c9d783056c3..3d84d05b7db 100644 --- a/ui/ui-frontend/projects/archive-search/src/app/archive/criteria-search/criteria-search.component.ts +++ b/ui/ui-frontend/projects/archive-search/src/app/archive/criteria-search/criteria-search.component.ts @@ -1,5 +1,5 @@ import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core'; -import { CriteriaValue, SearchCriteria, SearchCriteriaTypeEnum } from '../models/search.criteria'; +import { CriteriaValue, SearchCriteria, SearchCriteriaTypeEnum } from 'ui-frontend-common'; @Component({ selector: 'app-criteria-search', diff --git a/ui/ui-frontend/projects/archive-search/src/app/archive/filing-holding-scheme/classification-tree/classification-tree.component.html b/ui/ui-frontend/projects/archive-search/src/app/archive/filing-holding-scheme/classification-tree/classification-tree.component.html index 58c1ac23130..58475e6d24c 100644 --- a/ui/ui-frontend/projects/archive-search/src/app/archive/filing-holding-scheme/classification-tree/classification-tree.component.html +++ b/ui/ui-frontend/projects/archive-search/src/app/archive/filing-holding-scheme/classification-tree/classification-tree.component.html @@ -1,7 +1,7 @@
- {{ 'ARCHIVE_SEARCH.FILING_SHCEMA.TREE_TITLE' | translate }} + {{ 'ARCHIVE_SEARCH.FILING_SCHEMA.TREE_TITLE' | translate }}
@@ -62,13 +62,13 @@
- {{ 'ARCHIVE_SEARCH.FILING_SHCEMA.NO_TREES_NO_PLANS_FOR_ACCESS_CONTRACT' | translate }} + {{ 'ARCHIVE_SEARCH.FILING_SCHEMA.NO_TREES_NO_PLANS_FOR_ACCESS_CONTRACT' | translate }}
{{ - (this.showEveryNodes ? 'ARCHIVE_SEARCH.FILING_SHCEMA.SHOW_TREE_PARENT' : 'ARCHIVE_SEARCH.FILING_SHCEMA.SHOW_ENTIRE_TREE') + (this.showEveryNodes ? 'ARCHIVE_SEARCH.FILING_SCHEMA.SHOW_TREE_PARENT' : 'ARCHIVE_SEARCH.FILING_SCHEMA.SHOW_ENTIRE_TREE') | translate }} diff --git a/ui/ui-frontend/projects/archive-search/src/app/archive/filing-holding-scheme/filing-holding-scheme.component.ts b/ui/ui-frontend/projects/archive-search/src/app/archive/filing-holding-scheme/filing-holding-scheme.component.ts index 136a1809a8c..c277e97e23f 100644 --- a/ui/ui-frontend/projects/archive-search/src/app/archive/filing-holding-scheme/filing-holding-scheme.component.ts +++ b/ui/ui-frontend/projects/archive-search/src/app/archive/filing-holding-scheme/filing-holding-scheme.component.ts @@ -29,12 +29,13 @@ import { Component, EventEmitter, Input, OnDestroy, OnInit, Output } from '@angu import { MatTreeNestedDataSource } from '@angular/material/tree'; import { ActivatedRoute } from '@angular/router'; import { Subscription } from 'rxjs'; -import { CriteriaDataType, CriteriaOperator, FilingHoldingSchemeNode, Unit } from 'ui-frontend-common'; +import { + CriteriaDataType, CriteriaOperator, FilingHoldingSchemeHandler, FilingHoldingSchemeNode, PagedResult, ResultFacet, SearchCriteriaDto, + SearchCriteriaTypeEnum, Unit +} from 'ui-frontend-common'; import { ArchiveSharedDataService } from '../../core/archive-shared-data.service'; import { ArchiveService } from '../archive.service'; import { NodeData } from '../models/nodedata.interface'; -import { PagedResult, ResultFacet, SearchCriteriaDto, SearchCriteriaTypeEnum } from '../models/search.criteria'; -import { FilingHoldingSchemeHandler } from './filing-holding-scheme.handler'; @Component({ selector: 'app-filing-holding-scheme', diff --git a/ui/ui-frontend/projects/archive-search/src/app/archive/filing-holding-scheme/filing-holding-scheme.handler.ts b/ui/ui-frontend/projects/archive-search/src/app/archive/filing-holding-scheme/filing-holding-scheme.handler.ts deleted file mode 100644 index b6f2c7289bd..00000000000 --- a/ui/ui-frontend/projects/archive-search/src/app/archive/filing-holding-scheme/filing-holding-scheme.handler.ts +++ /dev/null @@ -1,335 +0,0 @@ -/* - * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2015-2022) - * - * contact.vitam@culture.gouv.fr - * - * This software is a computer program whose purpose is to implement a digital archiving back-office system managing - * high volumetry securely and efficiently. - * - * This software is governed by the CeCILL 2.1 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 2.1 license as - * circulated by CEA, CNRS and INRIA at the following URL "https://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 2.1 license and that you - * accept its terms. - */ -import { copyNodeWithoutChildren, DescriptionLevel, FilingHoldingSchemeNode, MatchingNodesNumbers, Unit } from 'ui-frontend-common'; -import { ResultFacet } from '../models/search.criteria'; - -const ORPHANS_NODE = 'ORPHANS_NODE'; - -// TODO: merge with node.utils -export class FilingHoldingSchemeHandler { - - public static foundNodeAndSetCheck(nodes: FilingHoldingSchemeNode[], checked: boolean, nodeId: string): boolean { - if (nodes.length < 1) { - return false; - } - let nodeHasBeenChecked = false; - for (const node of nodes) { - if (node.id === nodeId) { - node.checked = checked; - nodeHasBeenChecked = true; - } else if (node.children) { - nodeHasBeenChecked = FilingHoldingSchemeHandler.foundNodeAndSetCheck(node.children, checked, nodeId); - } - if (nodeHasBeenChecked) { - break; - } - } - return nodeHasBeenChecked; - } - - public static setCountOnNode(node: FilingHoldingSchemeNode, facets: ResultFacet[]): number { - node.count = 0; - for (const facet of facets) { - if (node.id === facet.node) { - node.count = facet.count; - node.hidden = false; - return 1; - } - } - return 0; - } - - public static getCountSum(nodes: FilingHoldingSchemeNode[]): number { - return nodes ? nodes.reduce((sum, node) => sum + node.count, 0) : 0; - } - - public static setCountRecursively(nodes: FilingHoldingSchemeNode[], facets: ResultFacet[]): number { - if (!nodes || nodes.length < 1) { - return 0; - } - let nodesUpdated = 0; - for (const node of nodes) { - if (this.isOrphansNode(node)) { - continue; - } - nodesUpdated += FilingHoldingSchemeHandler.setCountOnNode(node, facets); - nodesUpdated += FilingHoldingSchemeHandler.setCountRecursively(node.children, facets); - node.hidden = nodesUpdated === 0; - } - return nodesUpdated; - } - - public static reCalculateCountRecursively(parentNode: FilingHoldingSchemeNode,): void { - if (parentNode.count < 1) { - // not a match - return; - } - if (!parentNode.children) { - parentNode.children = []; - } - let count = 0; - for (const node of parentNode.children) { - this.reCalculateCountRecursively(node); - count += node.count; - } - if (count < parentNode.count) { - return; - } - if (!this.isOrphansNode(parentNode)) { - count = count + 1;// self match - } - parentNode.count = count; - } - - public static isOrphansNode(node: FilingHoldingSchemeNode): boolean { - return node.vitamId === ORPHANS_NODE - } - - public static addToOrphansNode(nodes: FilingHoldingSchemeNode[], - parentNodes: FilingHoldingSchemeNode[], - nodeTitle: string,) { - const orphansNumberFromFacets = this.getCountSum(nodes) + nodes.length; - const orphansNode = parentNodes[0]; - this.addOrphansNodeFromTree(parentNodes, nodeTitle, orphansNumberFromFacets); - if (orphansNode.children.length < 1) { - orphansNode.children = nodes; - orphansNode.count = orphansNumberFromFacets; - return; - } - for (const node of nodes) { - const existingNode: FilingHoldingSchemeNode = FilingHoldingSchemeHandler.foundChild(parentNodes[0], node.id); - if (!existingNode) { - orphansNode.children.push(node); - } - } - } - - - public static addOrphansNodeFromTree(parentNodes: FilingHoldingSchemeNode[], - nodeTitle: string, - orphansNumber: number) { - if (parentNodes.length < 1 || !this.isOrphansNode(parentNodes[0])) { - const orphanNode: FilingHoldingSchemeNode = { - checked: false, - children: [], - id: ORPHANS_NODE, - title: nodeTitle, - type: ORPHANS_NODE, - vitamId: ORPHANS_NODE, - count: orphansNumber, - } - parentNodes.unshift(orphanNode) - return; - } - } - - public static keepEndNodesWithResultsOnly(nodes: FilingHoldingSchemeNode[]): FilingHoldingSchemeNode[] { - if (!nodes) { - return []; - } - const leaves: FilingHoldingSchemeNode[] = []; - for (const node of nodes) { - if (node.count < 1) { - continue; - } - if (!node.children || node.children.length < 1) { - leaves.push(copyNodeWithoutChildren(node)); - continue; - } - const childResult: FilingHoldingSchemeNode[] = FilingHoldingSchemeHandler.keepEndNodesWithResultsOnly(node.children); - const addedCount = childResult.reduce((accumulator, schemeNode) => accumulator + schemeNode.count, 0); - if (addedCount < node.count) { - const nodeCopy = copyNodeWithoutChildren(node); - nodeCopy.children = childResult; - leaves.push(nodeCopy); - } - leaves.push(...childResult); - } - return leaves; - } - - public static unitHasDirectParent(unit: Unit, parentId: string): boolean { - return unit['#unitups'].findIndex((unitupId) => unitupId === parentId) !== -1; - } - - public static foundChild(parentNode: FilingHoldingSchemeNode, childId: string): FilingHoldingSchemeNode { - if (!parentNode.children) { - parentNode.children = []; - } - return parentNode.children.find((nodeChild) => nodeChild && nodeChild.id === childId); - } - - public static addOrphans( - parentNode: FilingHoldingSchemeNode, - units: Unit[], - initCount: boolean = false - ): MatchingNodesNumbers { - return this.addChildren(parentNode, units, initCount, false); - } - - public static addChildren( - parentNode: FilingHoldingSchemeNode, - units: Unit[], - initCount: boolean = false, - checkPaternity: boolean = true - ): MatchingNodesNumbers { - const matchingNodes = new MatchingNodesNumbers(); - if (!parentNode.children) { - parentNode.children = []; - } - for (let unitIndex = 0; unitIndex < units.length; unitIndex++) { - const unit = units[unitIndex]; - if (!unit) { - continue; - } - if (checkPaternity && !FilingHoldingSchemeHandler.unitHasDirectParent(unit, parentNode.id)) { - continue; - } - let child: FilingHoldingSchemeNode = FilingHoldingSchemeHandler.foundChild(parentNode, unit['#id']); - if (!child) { - // adding child only if it didn't exist - child = FilingHoldingSchemeHandler.convertUAToNode(unit); - parentNode.children.push(child); - matchingNodes.addNode(child); - if (initCount) { - child.count = 1; - } else { - child.count = 0; - } - } else if (initCount && child.count < 1) { - child.count = 1; - matchingNodes.incrementUpdated(); - } else { - matchingNodes.incrementFoundButUnchanged(); - } - units[unitIndex] = null; - } - return matchingNodes; - } - - public static addChildrenRecursively( - parentNodes: FilingHoldingSchemeNode[], - units: Unit[], - initCount: boolean = false - ): MatchingNodesNumbers { - const matchingNodesNumbers = new MatchingNodesNumbers(); - if (!parentNodes || parentNodes.length < 1) { - return matchingNodesNumbers; - } - for (const parentNode of parentNodes) { - matchingNodesNumbers.mergeWith(FilingHoldingSchemeHandler.addChildren(parentNode, units, initCount)); - matchingNodesNumbers.mergeWith(FilingHoldingSchemeHandler.addChildrenRecursively(parentNode.children, units, initCount)); - } - return matchingNodesNumbers; - } - - public static getGraphIds(nodes: FilingHoldingSchemeNode[]): string[] { - if (!nodes || nodes.length < 1) return []; - const knownIds: string[] = []; - for (const node of nodes) { - knownIds.push(node.id); - knownIds.push(...FilingHoldingSchemeHandler.getGraphIds(node.children)); - } - return knownIds; - } - - public static filterUnknownFacets(knownFacets: ResultFacet[], newFacets: ResultFacet[]): ResultFacet[] { - return newFacets.filter((newFacet) => knownFacets.findIndex((knownFacet) => knownFacet.node === newFacet.node) === -1); - } - - public static filterUnknownFacetsIds(nodes: FilingHoldingSchemeNode[], facets: ResultFacet[]): ResultFacet[] { - const knownIds = FilingHoldingSchemeHandler.getGraphIds(nodes); - return facets.filter((facet) => !knownIds.includes(facet.node)); - } - - public static convertUAToNode(unit: Unit): FilingHoldingSchemeNode { - return { - id: unit['#id'], - title: unit.Title ? unit.Title : unit.Title_ ? (unit.Title_.fr ? unit.Title_.fr : unit.Title_.en) : unit.Title_.en, - type: unit['#unitType'], - unitType: unit['#unitType'], - descriptionLevel: unit.DescriptionLevel, - children: [], - vitamId: unit['#id'], - checked: false, - isLoadingChildren: false, - canLoadMoreChildren: unit.DescriptionLevel !== DescriptionLevel.ITEM, - count: 0, - hasObject: !!unit['#object'], - }; - } - - public static buildNestedTreeLevels(units: Unit[], locale: string, parentNode?: FilingHoldingSchemeNode): FilingHoldingSchemeNode[] { - const nodes: FilingHoldingSchemeNode[] = []; - for (let i = 0; i < units.length; i++) { - if (units[i] === undefined) { - continue; - } - const unit = units[i]; - if (this.isParent(parentNode, unit) || (!parentNode && this.isNullIOrUnknowId(unit, units))) { - const outNode: FilingHoldingSchemeNode = { - id: unit['#id'], - vitamId: unit['#id'], - title: unit.Title ? unit.Title : unit.Title_ ? (unit.Title_.fr ? unit.Title_.fr : unit.Title_.en) : unit.Title_.en, - type: unit.DescriptionLevel, - unitType: unit['#unitType'], - descriptionLevel: unit.DescriptionLevel, - children: [], - checked: false, - hidden: false, - hasObject: !!unit['#object'], - }; - units[i] = undefined; - outNode.children = this.buildNestedTreeLevels(units, locale, outNode); - nodes.push(outNode); - } - } - return nodes.sort(this.byTitle(locale)); - } - - public static isParent(parentNode: FilingHoldingSchemeNode, unit: Unit): boolean { - return (parentNode && parentNode.vitamId && unit['#unitups'] && unit['#unitups'][0] === parentNode.vitamId) - } - - public static isNullIOrUnknowId(unit: Unit, units: Unit[]): boolean { - return (!unit['#unitups'] || !unit['#unitups'].length || !this.idExists(units, unit['#unitups'][0])) - } - - - public static idExists(units: Unit[], id: string): boolean { - return !!units.find((unit) => unit && unit['#id'] === id); - } - - public static byTitle(locale: string): (a: FilingHoldingSchemeNode, b: FilingHoldingSchemeNode) => number { - return (a, b) => { - if (!a || !b || !a.title || !b.title) { - return 0; - } - return a.title.localeCompare(b.title, locale, { numeric: true }); - }; - } -} diff --git a/ui/ui-frontend/projects/archive-search/src/app/archive/filing-holding-scheme/leaves-tree/leaves-tree.component.html b/ui/ui-frontend/projects/archive-search/src/app/archive/filing-holding-scheme/leaves-tree/leaves-tree.component.html index 74b01ad381a..e80b204f59c 100644 --- a/ui/ui-frontend/projects/archive-search/src/app/archive/filing-holding-scheme/leaves-tree/leaves-tree.component.html +++ b/ui/ui-frontend/projects/archive-search/src/app/archive/filing-holding-scheme/leaves-tree/leaves-tree.component.html @@ -1,7 +1,7 @@
- {{ 'ARCHIVE_SEARCH.FILING_SHCEMA.TREE_LEAVES_TITLE' | translate }} + {{ 'ARCHIVE_SEARCH.FILING_SCHEMA.TREE_LEAVES_TITLE' | translate }}
@@ -35,7 +35,7 @@
@@ -82,7 +82,7 @@ @@ -113,7 +113,7 @@ @@ -125,7 +125,7 @@ diff --git a/ui/ui-frontend/projects/archive-search/src/app/archive/filing-holding-scheme/leaves-tree/leaves-tree.component.spec.ts b/ui/ui-frontend/projects/archive-search/src/app/archive/filing-holding-scheme/leaves-tree/leaves-tree.component.spec.ts index 5ba05d990e4..c4f36d21152 100644 --- a/ui/ui-frontend/projects/archive-search/src/app/archive/filing-holding-scheme/leaves-tree/leaves-tree.component.spec.ts +++ b/ui/ui-frontend/projects/archive-search/src/app/archive/filing-holding-scheme/leaves-tree/leaves-tree.component.spec.ts @@ -34,12 +34,10 @@ import { MatTreeModule, MatTreeNestedDataSource } from '@angular/material/tree'; import { RouterTestingModule } from '@angular/router/testing'; import { TranslateLoader, TranslateModule } from '@ngx-translate/core'; import { Observable, of } from 'rxjs'; -import { DescriptionLevel, FilingHoldingSchemeNode, InjectorModule, LoggerModule } from 'ui-frontend-common'; +import { DescriptionLevel, FilingHoldingSchemeNode, InjectorModule, LoggerModule, PagedResult, ResultFacet } from 'ui-frontend-common'; import { ArchiveSharedDataService } from '../../../core/archive-shared-data.service'; import { ArchiveService } from '../../archive.service'; import { ArchiveFacetsService } from '../../common-services/archive-facets.service'; -import { PagedResult, ResultFacet } from '../../models/search.criteria'; -import { newTreeNode } from '../filing-holding-scheme.handler.spec'; import { LeavesTreeComponent } from './leaves-tree.component'; const translations: any = { TEST: 'Mock translate test' }; @@ -50,6 +48,28 @@ class FakeLoader implements TranslateLoader { } } +export function newNode( + currentId: string, + currentChildren: FilingHoldingSchemeNode[] = [], + currentDescriptionLevel: DescriptionLevel = DescriptionLevel.ITEM, + currentCount?: number +): FilingHoldingSchemeNode { + return { + id: currentId, + title: currentId, + unitType: 'INGEST', + descriptionLevel: currentDescriptionLevel, + checked: false, + children: currentChildren, + vitamId: 'whatever', + count: currentCount, + }; +} + +export function newTreeNode(currentId: string, count: number, currentChildren: FilingHoldingSchemeNode[] = []): FilingHoldingSchemeNode { + return newNode(currentId, currentChildren, DescriptionLevel.RECORD_GRP, count); +} + describe('LeavesTreeComponent', () => { let component: LeavesTreeComponent; let fixture: ComponentFixture; @@ -299,7 +319,7 @@ describe('LeavesTreeComponent', () => { // Then expect(elementTitle.length).toBe(1); - expect(elementTitle[0].textContent).toContain('ARCHIVE_SEARCH.FILING_SHCEMA.TREE_LEAVES_TITLE'); + expect(elementTitle[0].textContent).toContain('ARCHIVE_SEARCH.FILING_SCHEMA.TREE_LEAVES_TITLE'); }); }); }); diff --git a/ui/ui-frontend/projects/archive-search/src/app/archive/filing-holding-scheme/leaves-tree/leaves-tree.component.ts b/ui/ui-frontend/projects/archive-search/src/app/archive/filing-holding-scheme/leaves-tree/leaves-tree.component.ts index 7932cfdb015..7ed2b3556ea 100644 --- a/ui/ui-frontend/projects/archive-search/src/app/archive/filing-holding-scheme/leaves-tree/leaves-tree.component.ts +++ b/ui/ui-frontend/projects/archive-search/src/app/archive/filing-holding-scheme/leaves-tree/leaves-tree.component.ts @@ -29,11 +29,13 @@ import { Component, EventEmitter, Inject, Input, LOCALE_ID, OnChanges, OnDestroy import { MatTreeNestedDataSource } from '@angular/material/tree'; import { TranslateService } from '@ngx-translate/core'; import { Subscription } from 'rxjs'; -import { DescriptionLevel, FilingHoldingSchemeNode, nodeToVitamuiIcon, Unit } from 'ui-frontend-common'; +import { + DescriptionLevel, FilingHoldingSchemeHandler, FilingHoldingSchemeNode, nodeToVitamuiIcon, PagedResult, ResultFacet, SearchCriteriaDto, + Unit +} from 'ui-frontend-common'; +import { isEmpty } from 'underscore'; import { ArchiveSharedDataService } from '../../../core/archive-shared-data.service'; import { ArchiveFacetsService } from '../../common-services/archive-facets.service'; -import { PagedResult, ResultFacet, SearchCriteriaDto } from '../../models/search.criteria'; -import { FilingHoldingSchemeHandler } from '../filing-holding-scheme.handler'; import { LeavesTreeService } from './leaves-tree.service'; @Component({ @@ -90,7 +92,7 @@ export class LeavesTreeComponent implements OnInit, OnChanges, OnDestroy { const nodes = FilingHoldingSchemeHandler.buildNestedTreeLevels(pageResult.results, this.locale); FilingHoldingSchemeHandler.setCountRecursively(nodes, unknonwFacets); FilingHoldingSchemeHandler.addToOrphansNode(nodes, this.nestedDataSourceLeaves.data, - this.translateService.instant('Sans rattachement')); + this.translateService.instant('ARCHIVE_SEARCH.FILING_SCHEMA.ORPHANS_NODE')); this.refreshTreeNodes(); this.loadingNodesDetails = false; }); @@ -98,7 +100,7 @@ export class LeavesTreeComponent implements OnInit, OnChanges, OnDestroy { const orphans = this.searchRequestTotalResults - this.searchRequestResultsInFilingPlan; if (orphans > 0) { FilingHoldingSchemeHandler.addOrphansNodeFromTree(this.nestedDataSourceLeaves.data, - this.translateService.instant('Sans rattachement'), orphans); + this.translateService.instant('ARCHIVE_SEARCH.FILING_SCHEMA.ORPHANS_NODE'), orphans); } } @@ -163,7 +165,7 @@ export class LeavesTreeComponent implements OnInit, OnChanges, OnDestroy { } private loadNodesDetailsFromFacetsIdsAndAddThem(parentNodes: FilingHoldingSchemeNode[], facets: ResultFacet[]) { - if (facets.length < 1) { + if (isEmpty(facets)) { return; } this.loadingNodesDetails = true; @@ -193,18 +195,7 @@ export class LeavesTreeComponent implements OnInit, OnChanges, OnDestroy { } private firstToggle(node: FilingHoldingSchemeNode): boolean { - if (node.toggled) { - return false; - } - node.toggled = true; - if (!node.children) { - node.children = []; - } - node.paginatedMatchingChildrenLoaded = 0; - node.canLoadMoreMatchingChildren = true; - node.paginatedChildrenLoaded = 0; - node.canLoadMoreChildren = true; - return true; + return this.leavesTreeService.firstToggle(node) } toggleOrphan(node: FilingHoldingSchemeNode) { diff --git a/ui/ui-frontend/projects/archive-search/src/app/archive/filing-holding-scheme/leaves-tree/leaves-tree.service.ts b/ui/ui-frontend/projects/archive-search/src/app/archive/filing-holding-scheme/leaves-tree/leaves-tree.service.ts index 2e3de7ed49f..bfa247bf201 100644 --- a/ui/ui-frontend/projects/archive-search/src/app/archive/filing-holding-scheme/leaves-tree/leaves-tree.service.ts +++ b/ui/ui-frontend/projects/archive-search/src/app/archive/filing-holding-scheme/leaves-tree/leaves-tree.service.ts @@ -1,10 +1,11 @@ import { Injectable } from '@angular/core'; import { Observable } from 'rxjs'; import { first, map } from 'rxjs/operators'; -import { CriteriaDataType, CriteriaOperator, FilingHoldingSchemeNode, Unit } from 'ui-frontend-common'; +import { + CriteriaDataType, CriteriaOperator, FilingHoldingSchemeHandler, FilingHoldingSchemeNode, PagedResult, ResultFacet, SearchCriteriaDto, + SearchCriteriaEltDto, SearchCriteriaTypeEnum, Unit +} from 'ui-frontend-common'; import { ArchiveService } from '../../archive.service'; -import { PagedResult, ResultFacet, SearchCriteriaDto, SearchCriteriaEltDto, SearchCriteriaTypeEnum } from '../../models/search.criteria'; -import { FilingHoldingSchemeHandler } from '../filing-holding-scheme.handler'; const DEFAULT_UNIT_PAGE_SIZE = 10; @@ -17,6 +18,21 @@ export class LeavesTreeService { constructor(private archiveService: ArchiveService,) {} + public firstToggle(node: FilingHoldingSchemeNode): boolean { + if (node.toggled) { + return false; + } + node.toggled = true; + if (!node.children) { + node.children = []; + } + node.paginatedMatchingChildrenLoaded = 0; + node.canLoadMoreMatchingChildren = true; + node.paginatedChildrenLoaded = 0; + node.canLoadMoreChildren = true; + return true; + } + private prepareSearch(parentNode: FilingHoldingSchemeNode, matchingSearch: boolean): boolean { if (matchingSearch && !parentNode.canLoadMoreMatchingChildren) { return false; @@ -31,10 +47,10 @@ export class LeavesTreeService { parentNode.isLoadingChildren = false; if (matchingSearch) { parentNode.paginatedMatchingChildrenLoaded += pageResult.results.length; - parentNode.canLoadMoreMatchingChildren = parentNode.children.length < pageResult.totalResults; + parentNode.canLoadMoreMatchingChildren = parentNode.paginatedMatchingChildrenLoaded < pageResult.totalResults; } else { parentNode.paginatedChildrenLoaded += pageResult.results.length; - parentNode.canLoadMoreChildren = parentNode.children.length < pageResult.totalResults; + parentNode.canLoadMoreChildren = parentNode.paginatedChildrenLoaded < pageResult.totalResults; } } diff --git a/ui/ui-frontend/projects/archive-search/src/app/archive/models/dip-request-detail.interface.ts b/ui/ui-frontend/projects/archive-search/src/app/archive/models/dip-request-detail.interface.ts index 86225f2bf8f..5867225797b 100644 --- a/ui/ui-frontend/projects/archive-search/src/app/archive/models/dip-request-detail.interface.ts +++ b/ui/ui-frontend/projects/archive-search/src/app/archive/models/dip-request-detail.interface.ts @@ -24,7 +24,7 @@ * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you * accept its terms. */ -import {SearchCriteriaEltDto} from './search.criteria'; +import { SearchCriteriaEltDto } from 'ui-frontend-common'; export interface ExportDIPRequestDetail { messageRequestIdentifier: string; diff --git a/ui/ui-frontend/projects/archive-search/src/app/archive/models/reclassification-request.interface.ts b/ui/ui-frontend/projects/archive-search/src/app/archive/models/reclassification-request.interface.ts index 98b4ec842db..7dc118c2678 100644 --- a/ui/ui-frontend/projects/archive-search/src/app/archive/models/reclassification-request.interface.ts +++ b/ui/ui-frontend/projects/archive-search/src/app/archive/models/reclassification-request.interface.ts @@ -35,7 +35,7 @@ * knowledge of the CeCILL-C license and that you accept its terms. */ -import { SearchCriteriaDto } from './search.criteria'; +import { SearchCriteriaDto } from 'ui-frontend-common'; export interface ReclassificationCriteriaDto { searchCriteriaDto: SearchCriteriaDto; 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 e67179c6178..22728982bd8 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 @@ -35,7 +35,7 @@ * knowledge of the CeCILL-C license and that you accept its terms. */ -import { SearchCriteriaDto } from './search.criteria'; +import { SearchCriteriaDto } from 'ui-frontend-common'; export interface ActionsRules { ruleType: string; diff --git a/ui/ui-frontend/projects/archive-search/src/app/archive/models/search-response.interface.ts b/ui/ui-frontend/projects/archive-search/src/app/archive/models/search-response.interface.ts deleted file mode 100644 index 69fa38a0820..00000000000 --- a/ui/ui-frontend/projects/archive-search/src/app/archive/models/search-response.interface.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { Unit } from 'ui-frontend-common'; - -export interface SearchResponse { - $hits: any; - $results: T[]; - $facetResults?: any[]; -} diff --git a/ui/ui-frontend/projects/archive-search/src/app/archive/models/search.criteria.ts b/ui/ui-frontend/projects/archive-search/src/app/archive/models/search.criteria.ts deleted file mode 100644 index 7e6afeb8f15..00000000000 --- a/ui/ui-frontend/projects/archive-search/src/app/archive/models/search.criteria.ts +++ /dev/null @@ -1,172 +0,0 @@ -/* - * 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 SearchCriteriaStatusEnum { - NOT_INCLUDED = 'NOT_INCLUDED', - INCLUDED = 'INCLUDED', - IN_PROGRESS = 'IN_PROGRESS', -} - -export enum SearchCriteriaTypeEnum { - FIELDS = 'FIELDS', - APPRAISAL_RULE = 'APPRAISAL_RULE', - ACCESS_RULE = 'ACCESS_RULE', - CLASSIFICATION_RULE = 'CLASSIFICATION_RULE', - DISSEMINATION_RULE = 'DISSEMINATION_RULE', - REUSE_RULE = 'REUSE_RULE', - STORAGE_RULE = 'STORAGE_RULE', - HOLD_RULE = 'HOLD_RULE', - NODES = 'NODES', -} - -export enum SearchCriteriaMgtRuleEnum { - APPRAISAL_RULE = 'APPRAISAL_RULE', - ACCESS_RULE = 'ACCESS_RULE', - CLASSIFICATION_RULE = 'CLASSIFICATION_RULE', - DISSEMINATION_RULE = 'DISSEMINATION_RULE', - REUSE_RULE = 'REUSE_RULE', - STORAGE_RULE = 'STORAGE_RULE', - HOLD_RULE = 'HOLD_RULE', -} - -export interface SearchCriteriaValue { - value?: CriteriaValue; - label?: string; - valueShown?: boolean; - status: SearchCriteriaStatusEnum; - keyTranslated: boolean; - valueTranslated: boolean; -} - -export interface SearchCriteriaAddAction { - keyElt: string; - valueElt: CriteriaValue; - labelElt: string; - keyTranslated: boolean; - operator: string; - category: SearchCriteriaTypeEnum; - valueTranslated: boolean; - dataType: string; -} - -export interface SearchCriteriaRemoveAction { - keyElt: string; - valueElt: CriteriaValue; - action: 'REMOVE' | 'ADD'; -} - -export interface SearchCriteria { - key: string; - operator: string; - category: SearchCriteriaTypeEnum; - values: SearchCriteriaValue[]; - keyTranslated: boolean; - valueTranslated: boolean; - dataType: string; -} - -export interface SearchCriteriaEltDto { - criteria: string; - operator: string; - category: string; - values: CriteriaValue[]; - dataType: string; -} -export interface SearchCriteriaDto { - criteriaList: SearchCriteriaEltDto[]; - pageNumber: number; - size: number; - sortingCriteria?: SearchCriteriaSort; - language?: string; - trackTotalHits?: boolean; - computeFacets?: boolean; -} - -export interface PagedResult { - results: any[]; - pageNumbers: number; - totalResults: number; - facets?: ResultFacetList[]; -} - -export interface ResultFacetList { - name: string; - buckets: ResultBucket[]; -} -export interface ResultBucket { - value: string; - count: number; -} -export interface ResultFacet { - node: string; - count: number; -} - -export interface SearchCriteriaSort { - criteria: string; - sorting: 'ASC' | 'DESC'; -} - -export interface SearchCriteriaCategory { - name: string; - index: number; -} -export interface CriteriaValue { - id: string; - value?: string; - label?: string; - beginInterval?: string; - endInterval?: string; -} - -export class ArchiveSearchResultFacets { - nodesFacets?: ResultFacet[]; - appraisalRuleFacets?: RuleFacets; - accessRuleFacets?: RuleFacets; - storageRuleFacets?: RuleFacets; - reuseRuleFacets?: RuleFacets; - disseminationRuleFacets?: RuleFacets; - holdRuleFacets?: RuleFacets; - classificationRuleFacets?: RuleFacets; -} - -export class RuleFacets { - waitingToRecalculateRulesListFacets: ResultFacet[]; - expiredRulesListFacets: ResultFacet[]; - rulesListFacets: ResultFacet[]; - finalActionsFacets?: ResultFacet[]; - noRulesFacets: ResultFacet[]; -} diff --git a/ui/ui-frontend/projects/archive-search/src/app/archive/models/transfer-request-detail.interface.ts b/ui/ui-frontend/projects/archive-search/src/app/archive/models/transfer-request-detail.interface.ts index 785cf748f4f..f528d15d2e1 100644 --- a/ui/ui-frontend/projects/archive-search/src/app/archive/models/transfer-request-detail.interface.ts +++ b/ui/ui-frontend/projects/archive-search/src/app/archive/models/transfer-request-detail.interface.ts @@ -24,7 +24,7 @@ * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you * accept its terms. */ -import {SearchCriteriaEltDto} from './search.criteria'; +import { SearchCriteriaEltDto } from 'ui-frontend-common'; export interface TransferRequestDto { transferRequestParameters: TransferRequestParameters; diff --git a/ui/ui-frontend/projects/archive-search/src/app/archive/validators/archive-unit-validator.service.ts b/ui/ui-frontend/projects/archive-search/src/app/archive/validators/archive-unit-validator.service.ts index d8e4c8b22bf..3fdc284129a 100644 --- a/ui/ui-frontend/projects/archive-search/src/app/archive/validators/archive-unit-validator.service.ts +++ b/ui/ui-frontend/projects/archive-search/src/app/archive/validators/archive-unit-validator.service.ts @@ -40,9 +40,9 @@ import { AbstractControl, AsyncValidatorFn } from '@angular/forms'; import { cloneDeep } from 'lodash'; import { of, timer } from 'rxjs'; import { map, switchMap, take } from 'rxjs/operators'; +import { SearchCriteriaDto } from 'ui-frontend-common'; import { ArchiveSharedDataService } from '../../core/archive-shared-data.service'; import { ArchiveService } from '../archive.service'; -import { SearchCriteriaDto } from '../models/search.criteria'; @Injectable() export class ArchiveUnitValidatorService { 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 51275885d8f..6b733a293f4 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 @@ -38,13 +38,13 @@ import { HttpClient, HttpHeaders } from '@angular/common/http'; import { Inject, Injectable } from '@angular/core'; import { Observable } from 'rxjs'; import { tap } from 'rxjs/operators'; -import { ApiUnitObject, BASE_URL, BaseHttpClient, Ontology, PageRequest, PaginatedResponse, Unit } from 'ui-frontend-common'; +import { + ApiUnitObject, BaseHttpClient, BASE_URL, Ontology, PageRequest, PaginatedResponse, SearchCriteriaDto, SearchCriteriaHistory, + SearchResponse, Unit +} from 'ui-frontend-common'; import { ExportDIPCriteriaList } from '../../archive/models/dip-request-detail.interface'; import { ReclassificationCriteriaDto } from '../../archive/models/reclassification-request.interface'; import { RuleSearchCriteriaDto } from '../../archive/models/ruleAction.interface'; -import { SearchCriteriaHistory } from '../../archive/models/search-criteria-history.interface'; -import { SearchResponse } from '../../archive/models/search-response.interface'; -import { SearchCriteriaDto } from '../../archive/models/search.criteria'; import { TransferRequestDto } from '../../archive/models/transfer-request-detail.interface'; import { UnitDescriptiveMetadataDto } from '../../archive/models/unitDescriptiveMetadata.interface'; diff --git a/ui/ui-frontend/projects/archive-search/src/app/core/archive-shared-data.service.ts b/ui/ui-frontend/projects/archive-search/src/app/core/archive-shared-data.service.ts index 5f2c63b15e6..cbe9a6fa053 100644 --- a/ui/ui-frontend/projects/archive-search/src/app/core/archive-shared-data.service.ts +++ b/ui/ui-frontend/projects/archive-search/src/app/core/archive-shared-data.service.ts @@ -36,15 +36,11 @@ */ import { Injectable } from '@angular/core'; import { BehaviorSubject, Observable } from 'rxjs'; -import { Direction, FilingHoldingSchemeNode, Unit } from 'ui-frontend-common'; -import { NodeData } from '../archive/models/nodedata.interface'; -import { SearchCriteriaHistory } from '../archive/models/search-criteria-history.interface'; import { - ResultFacet, - SearchCriteriaAddAction, - SearchCriteriaDto, - SearchCriteriaRemoveAction -} from '../archive/models/search.criteria'; + Direction, FilingHoldingSchemeNode, ResultFacet, SearchCriteriaAddAction, SearchCriteriaDto, SearchCriteriaHistory, + SearchCriteriaRemoveAction, Unit +} from 'ui-frontend-common'; +import { NodeData } from '../archive/models/nodedata.interface'; @Injectable({ providedIn: 'root', @@ -84,7 +80,6 @@ export class ArchiveSharedDataService { private ruleCategory = new BehaviorSubject(''); - currentNode = this.sourceNode.asObservable(); facetsObservable = this.facetsSubject.asObservable(); toggleObservable = this.toggleSubject.asObservable(); toggleReverseObservable = this.toggleReverseSubject.asObservable(); 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 410d42dd191..25006db2f78 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,8 +37,8 @@ import { Injectable } from '@angular/core'; import { BehaviorSubject, Observable } from 'rxjs'; +import { SearchCriteriaDto, SearchCriteriaEltDto } from 'ui-frontend-common'; import { ActionsRules, ManagementRules } from '../archive/models/ruleAction.interface'; -import { SearchCriteriaDto, SearchCriteriaEltDto } from '../archive/models/search.criteria'; @Injectable({ providedIn: 'root', diff --git a/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-collect.service.ts b/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-collect.service.ts index 1023e2a70ba..1acb51209e9 100644 --- a/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-collect.service.ts +++ b/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-collect.service.ts @@ -42,11 +42,11 @@ import { SearchUnitApiService } from 'projects/vitamui-library/src/lib/api/searc import { Observable, of, throwError, TimeoutError } from 'rxjs'; import { catchError, map } from 'rxjs/operators'; import { - AccessContract, AccessContractApiService, ApiUnitObject, FilingHoldingSchemeNode, Ontology, SearchService, Transaction, Unit, + AccessContract, AccessContractApiService, ApiUnitObject, FilingHoldingSchemeNode, Ontology, PagedResult, SearchCriteriaDto, + SearchCriteriaEltDto, SearchResponse, SearchService, Transaction, Unit, } from 'ui-frontend-common'; import { ProjectsApiService } from '../core/api/project-api.service'; import { TransactionApiService } from '../core/api/transaction-api.service'; -import { PagedResult, SearchCriteriaDto, SearchCriteriaEltDto, SearchResponse } from '../core/models'; @Injectable({ providedIn: 'root', @@ -101,11 +101,9 @@ export class ArchiveCollectService extends SearchService { return this.projectsApiService.getLastTransactionByProjectId(projectId).pipe(map((result) => result)); } - searchArchiveUnitsByCriteria(criteriaDto: SearchCriteriaDto, transactionId: string, origin?: string): Observable { + searchArchiveUnitsByCriteria(criteriaDto: SearchCriteriaDto, transactionId: string): Observable { const headers = new HttpHeaders().append('Content-Type', 'application/json'); if (!!transactionId) { - console.log(' searchArchiveUnitsByCriteria from ' + origin) - console.log(' transactionId: ' + transactionId) return this.transactionApiService.searchArchiveUnitsByCriteria(criteriaDto, transactionId, headers).pipe( // timeout(TIMEOUT_SEC), catchError((error) => { @@ -116,15 +114,10 @@ export class ArchiveCollectService extends SearchService { return of({ $hits: null, $results: [] }); }), map((results) => { - console.log(' buildPagedResults from ' + origin) - console.log(' transactionId =' + transactionId) - console.log(' criteriaDto = ' + JSON.stringify(criteriaDto)) - console.log(JSON.stringify(results)) return ArchiveCollectService.buildPagedResults(results) }) ); } else { - console.log('ArchiveCollectService NO transactionId -> return shit') return of({ pageNumbers: 1, results: [], totalResults: 0 }); } } @@ -136,9 +129,7 @@ export class ArchiveCollectService extends SearchService { size: 1, trackTotalHits: true, }; - - console.log('ArchiveSearchCollectComponent getTotalTrackHitsByCriteria') - return this.searchArchiveUnitsByCriteria(searchCriteria, transactionId, 'ArchiveSearchCollectComponent getTotalTrackHitsByCriteria') + return this.searchArchiveUnitsByCriteria(searchCriteria, transactionId) .pipe( map((pagedResult: PagedResult) => pagedResult.totalResults), catchError(() => of(-1)) @@ -151,7 +142,7 @@ export class ArchiveCollectService extends SearchService { } getAccessContractById(accessContract: string): Observable { - let headers = new HttpHeaders().append('Content-Type', 'application/json'); + const headers = new HttpHeaders().append('Content-Type', 'application/json'); return this.accessContractApiService.getAccessContractById(accessContract, headers); } @@ -196,7 +187,7 @@ export class ArchiveCollectService extends SearchService { } exportCsvSearchArchiveUnitsByCriteria(criteriaDto: SearchCriteriaDto, projectId: string) { - let headers = new HttpHeaders().append('Content-Type', 'application/json'); + const headers = new HttpHeaders().append('Content-Type', 'application/json'); return this.transactionApiService.exportCsvSearchArchiveUnitsByCriteria(criteriaDto, projectId, headers).subscribe( (file) => { @@ -238,13 +229,13 @@ export class ArchiveCollectService extends SearchService { } getReferentialUnitDetails(unitId: string): Observable { - let headers = new HttpHeaders().append('Content-Type', 'application/json'); + const headers = new HttpHeaders().append('Content-Type', 'application/json'); return this.searchUnitApiService.getById(unitId, headers); } getCollectUnitDetails(unitId: string): Observable { - let headers = new HttpHeaders().append('Content-Type', 'application/json'); + const headers = new HttpHeaders().append('Content-Type', 'application/json'); return this.transactionApiService.getCollectUnitById(unitId, headers); } @@ -300,7 +291,7 @@ export class ArchiveCollectService extends SearchService { } selectUnitWithInheritedRules(transactionId: string, criteriaDto: SearchCriteriaDto): Observable { - let headers = new HttpHeaders().append('Content-Type', 'application/json'); + const headers = new HttpHeaders().append('Content-Type', 'application/json'); return this.transactionApiService.selectUnitWithInheritedRules(transactionId, criteriaDto, headers); } diff --git a/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-preview/archive-unit-rules-details-tab/archive-unit-rules-details-tab.component.ts b/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-preview/archive-unit-rules-details-tab/archive-unit-rules-details-tab.component.ts index 3fd20e2e0de..d8f1eced925 100644 --- a/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-preview/archive-unit-rules-details-tab/archive-unit-rules-details-tab.component.ts +++ b/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-preview/archive-unit-rules-details-tab/archive-unit-rules-details-tab.component.ts @@ -39,8 +39,7 @@ import { animate, AUTO_STYLE, state, style, transition, trigger } from '@angular import { Component, Input, SimpleChanges } from '@angular/core'; import { TranslateService } from '@ngx-translate/core'; import { Subscription } from 'rxjs'; -import { CriteriaDataType, CriteriaOperator, Unit } from 'ui-frontend-common'; -import { SearchCriteriaEltDto, SearchCriteriaTypeEnum } from '../../../core/models'; +import { CriteriaDataType, CriteriaOperator, SearchCriteriaEltDto, SearchCriteriaTypeEnum, Unit } from 'ui-frontend-common'; import { ArchiveCollectService } from '../../archive-collect.service'; const PAGE_SIZE = 10; diff --git a/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-collect.component.ts b/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-collect.component.ts index 0c39e38f692..a82a0c75b0c 100644 --- a/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-collect.component.ts +++ b/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-collect.component.ts @@ -34,13 +34,12 @@ import { TranslateService } from '@ngx-translate/core'; import { BehaviorSubject, merge, Observable, Subject, Subscription } from 'rxjs'; import { debounceTime, map, mergeMap, tap } from 'rxjs/operators'; import { - AccessContract, CriteriaDataType, CriteriaOperator, Direction, ExternalParameters, ExternalParametersService, FilingHoldingSchemeNode, - GlobalEventService, SidenavPage, Transaction, TransactionStatus, Unit, + AccessContract, ArchiveSearchResultFacets, CriteriaDataType, CriteriaOperator, CriteriaValue, Direction, ExternalParameters, + ExternalParametersService, FilingHoldingSchemeNode, GlobalEventService, ORPHANS_NODE_ID, PagedResult, SearchCriteria, + SearchCriteriaCategory, SearchCriteriaEltDto, SearchCriteriaEltements, SearchCriteriaHistory, SearchCriteriaMgtRuleEnum, + SearchCriteriaStatusEnum, SearchCriteriaTypeEnum, SidenavPage, Transaction, TransactionStatus, Unit, } from 'ui-frontend-common'; -import { - ArchiveSearchResultFacets, CriteriaValue, PagedResult, SearchCriteria, SearchCriteriaCategory, SearchCriteriaEltDto, - SearchCriteriaEltements, SearchCriteriaHistory, SearchCriteriaMgtRuleEnum, SearchCriteriaStatusEnum, SearchCriteriaTypeEnum, -} from '../core/models'; +import { isEmpty } from 'underscore'; import { ArchiveCollectService } from './archive-collect.service'; import { SearchCriteriaSaverComponent } from './archive-search-criteria/components/search-criteria-saver/search-criteria-saver.component'; import { ArchiveFacetsService } from './archive-search-criteria/services/archive-facets.service'; @@ -172,7 +171,31 @@ export class ArchiveSearchCollectComponent extends SidenavPage implements O this.subscriptions.add( this.archiveExchangeDataService.getNodes().subscribe((node) => { - if (node.checked) { + if (!node.checked) { + node.count = null; + if (node.id === ORPHANS_NODE_ID) { + this.removeCriteria(ORPHANS_NODE_ID, { id: node.id, value: node.id }, false); + } else { + this.removeCriteria('NODE', { id: node.id, value: node.id }, false); + } + return; + } + if (node.id === ORPHANS_NODE_ID) { + this.archiveHelperService.addCriteria( + this.searchCriterias, + this.searchCriteriaKeys, + this.nbQueryCriteria, + ORPHANS_NODE_ID, + { id: ORPHANS_NODE_ID, value: ORPHANS_NODE_ID }, + node.title, + true, + CriteriaOperator.MISSING, + SearchCriteriaTypeEnum.FIELDS, + false, + CriteriaDataType.STRING, + false + ); + } else { this.archiveHelperService.addCriteria( this.searchCriterias, this.searchCriteriaKeys, @@ -187,9 +210,6 @@ export class ArchiveSearchCollectComponent extends SidenavPage implements O CriteriaDataType.STRING, false ); - } else { - node.count = null; - this.removeCriteria('NODE', { id: node.id, value: node.id }, false); } }) ); @@ -383,8 +403,7 @@ export class ArchiveSearchCollectComponent extends SidenavPage implements O computeFacets: includeFacets, }; this.archiveExchangeDataService.emitLastSearchCriteriaDtoSubject(searchCriteria); - console.log('ArchiveSearchCollectComponent searchArchiveUnits') - this.archiveUnitCollectService.searchArchiveUnitsByCriteria(searchCriteria, this.transaction ? this.transaction.id : null, 'ArchiveSearchCollectComponent searchArchiveUnits') + this.archiveUnitCollectService.searchArchiveUnitsByCriteria(searchCriteria, this.transaction ? this.transaction.id : null) .subscribe( (pagedResult: PagedResult) => { if (includeFacets) { @@ -395,12 +414,11 @@ export class ArchiveSearchCollectComponent extends SidenavPage implements O } if (this.currentPage === 0) { this.archiveUnits = pagedResult.results; + this.searchHasResults = !isEmpty(pagedResult.results); this.archiveSearchResultFacets.nodesFacets = this.archiveFacetsService.extractNodesFacetsResults(pagedResult.facets); this.archiveExchangeDataService.emitFacets(this.archiveSearchResultFacets.nodesFacets); - this.searchHasResults = true; this.totalResults = pagedResult.totalResults; } else if (pagedResult.results) { - this.searchHasResults = true; pagedResult.results.forEach((elt) => this.archiveUnits.push(elt)); } this.pageNumbers = pagedResult.pageNumbers; @@ -717,8 +735,7 @@ export class ArchiveSearchCollectComponent extends SidenavPage implements O this.loadExactCount(); - console.log('ArchiveSearchCollectComponent launchComputingManagementRulesFacets') - this.archiveUnitCollectService.searchArchiveUnitsByCriteria(searchCriteria, !!this.transaction ? this.transaction.id : null, 'ArchiveSearchCollectComponent launchComputingManagementRulesFacets').subscribe( + this.archiveUnitCollectService.searchArchiveUnitsByCriteria(searchCriteria, !!this.transaction ? this.transaction.id : null).subscribe( (pagedResult: PagedResult) => { this.archiveSearchResultFacets = this.archiveFacetsService.extractRulesFacetsResults(pagedResult.facets); this.pendingComputeFacets = false; diff --git a/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/components/access-rule-search/access-rule-search.component.ts b/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/components/access-rule-search/access-rule-search.component.ts index 2f34795558a..8f55674efe4 100644 --- a/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/components/access-rule-search/access-rule-search.component.ts +++ b/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/components/access-rule-search/access-rule-search.component.ts @@ -39,10 +39,11 @@ import { FormBuilder, FormGroup } from '@angular/forms'; import { MatDialog } from '@angular/material/dialog'; import { merge, Subscription } from 'rxjs'; import { debounceTime, filter, map } from 'rxjs/operators'; -import { ActionOnCriteria, CriteriaDataType, CriteriaOperator, diff } from 'ui-frontend-common'; -import { ArchiveSharedDataService } from '../../services/archive-shared-data.service'; +import { + ActionOnCriteria, CriteriaDataType, CriteriaOperator, CriteriaValue, diff, SearchCriteriaEltDto, SearchCriteriaTypeEnum +} from 'ui-frontend-common'; import { ArchiveSearchConstsEnum } from '../../models/archive-search-consts-enum'; -import { CriteriaValue, SearchCriteriaEltDto, SearchCriteriaTypeEnum } from '../../models/search.criteria'; +import { ArchiveSharedDataService } from '../../services/archive-shared-data.service'; import { RuleValidator } from '../../services/rule.validator'; const RULE_TYPE_SUFFIX = '_ACCESS_RULE'; @@ -397,12 +398,15 @@ export class AccessRuleSearchComponent implements OnInit, OnDestroy { get accessRuleIdentifier() { return this.accessRuleCriteriaForm.controls.accessRuleIdentifier; } + get accessRuleTitle() { return this.accessRuleCriteriaForm.controls.accessRuleTitle; } + get accessRuleStartDate() { return this.accessRuleCriteriaForm.controls.accessRuleStartDate; } + get accessRuleEndDate() { return this.accessRuleCriteriaForm.controls.accessRuleEndDate; } diff --git a/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/components/appraisal-rule-search/appraisal-rule-search.component.ts b/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/components/appraisal-rule-search/appraisal-rule-search.component.ts index 4427c60e745..e7f087b2f41 100644 --- a/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/components/appraisal-rule-search/appraisal-rule-search.component.ts +++ b/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/components/appraisal-rule-search/appraisal-rule-search.component.ts @@ -39,10 +39,11 @@ import { FormBuilder, FormGroup } from '@angular/forms'; import { MatDialog } from '@angular/material/dialog'; import { merge, Subscription } from 'rxjs'; import { debounceTime, filter, map } from 'rxjs/operators'; -import { ActionOnCriteria, CriteriaDataType, CriteriaOperator, diff } from 'ui-frontend-common'; -import { ArchiveSharedDataService } from '../../services/archive-shared-data.service'; +import { + ActionOnCriteria, CriteriaDataType, CriteriaOperator, CriteriaValue, diff, SearchCriteriaEltDto, SearchCriteriaTypeEnum +} from 'ui-frontend-common'; import { ArchiveSearchConstsEnum } from '../../models/archive-search-consts-enum'; -import { CriteriaValue, SearchCriteriaEltDto, SearchCriteriaTypeEnum } from '../../models/search.criteria'; +import { ArchiveSharedDataService } from '../../services/archive-shared-data.service'; import { RuleValidator } from '../../services/rule.validator'; const RULE_TYPE_SUFFIX = '_APPRAISAL_RULE'; @@ -503,15 +504,19 @@ export class AppraisalRuleSearchComponent implements OnInit, OnDestroy { get appraisalRuleIdentifier() { return this.appraisalRuleCriteriaForm.controls.appraisalRuleIdentifier; } + get appraisalRuleTitle() { return this.appraisalRuleCriteriaForm.controls.appraisalRuleTitle; } + get appraisalRuleStartDate() { return this.appraisalRuleCriteriaForm.controls.appraisalRuleStartDate; } + get appraisalRuleEndDate() { return this.appraisalRuleCriteriaForm.controls.appraisalRuleEndDate; } + get appraisalRuleEliminationIdentifier() { return this.appraisalRuleCriteriaForm.controls.appraisalRuleEliminationIdentifier; } diff --git a/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/components/archive-search-rules-facets/archive-search-rules-facets.component.ts b/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/components/archive-search-rules-facets/archive-search-rules-facets.component.ts index 89378a7f5de..f93ee806f01 100644 --- a/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/components/archive-search-rules-facets/archive-search-rules-facets.component.ts +++ b/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/components/archive-search-rules-facets/archive-search-rules-facets.component.ts @@ -35,7 +35,7 @@ knowledge of the CeCILL-C license and that you accept its terms. */ import { Component, Input, OnInit } from '@angular/core'; -import { RuleFacets } from '../../models/search.criteria'; +import { RuleFacets } from 'ui-frontend-common'; @Component({ selector: 'app-archive-search-rules-facets', diff --git a/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/components/archive-search-rules-facets/search-access-rules-facets/search-access-rules-facets.component.ts b/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/components/archive-search-rules-facets/search-access-rules-facets/search-access-rules-facets.component.ts index 8a409fde23c..622031204a8 100644 --- a/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/components/archive-search-rules-facets/search-access-rules-facets/search-access-rules-facets.component.ts +++ b/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/components/archive-search-rules-facets/search-access-rules-facets/search-access-rules-facets.component.ts @@ -37,10 +37,9 @@ knowledge of the CeCILL-C license and that you accept its terms. import { DatePipe } from '@angular/common'; import { Component, Input, OnChanges, OnInit } from '@angular/core'; import { TranslateService } from '@ngx-translate/core'; -import { Colors } from 'ui-frontend-common'; +import { Colors, RuleFacets } from 'ui-frontend-common'; import { FacetDetails } from 'ui-frontend-common/app/modules/models/operation/facet-details.interface'; import { ArchiveSearchConstsEnum } from '../../../models/archive-search-consts-enum'; -import { RuleFacets } from '../../../models/search.criteria'; import { ArchiveFacetsService } from '../../../services/archive-facets.service'; @Component({ @@ -145,7 +144,7 @@ export class SearchAccessRulesFacetsComponent implements OnInit, OnChanges { private handleWaitingToRecalculateRulesFacets(): number { let archiveUnitWithRules = 0; if (this.accessRuleFacets.waitingToRecalculateRulesListFacets && this.accessRuleFacets.waitingToRecalculateRulesListFacets.length > 0) { - let facetComputedUnits = this.accessRuleFacets.waitingToRecalculateRulesListFacets.filter((elt) => elt.node === 'true'); + const facetComputedUnits = this.accessRuleFacets.waitingToRecalculateRulesListFacets.filter((elt) => elt.node === 'true'); let computedCount = 0; if (facetComputedUnits.length > 0) { diff --git a/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/components/archive-search-rules-facets/search-appraisal-rules-facets/search-appraisal-rules-facets.component.ts b/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/components/archive-search-rules-facets/search-appraisal-rules-facets/search-appraisal-rules-facets.component.ts index c34f957e122..4ce2c7ddcae 100644 --- a/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/components/archive-search-rules-facets/search-appraisal-rules-facets/search-appraisal-rules-facets.component.ts +++ b/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/components/archive-search-rules-facets/search-appraisal-rules-facets/search-appraisal-rules-facets.component.ts @@ -37,10 +37,9 @@ knowledge of the CeCILL-C license and that you accept its terms. import { DatePipe } from '@angular/common'; import { Component, Input, OnChanges, OnInit } from '@angular/core'; import { TranslateService } from '@ngx-translate/core'; -import { Colors } from 'ui-frontend-common'; +import { Colors, RuleFacets } from 'ui-frontend-common'; import { FacetDetails } from 'ui-frontend-common/app/modules/models/operation/facet-details.interface'; import { ArchiveSearchConstsEnum } from '../../../models/archive-search-consts-enum'; -import { RuleFacets } from '../../../models/search.criteria'; import { ArchiveFacetsService } from '../../../services/archive-facets.service'; @Component({ @@ -209,7 +208,7 @@ export class SearchAppraisalRulesFacetsComponent implements OnInit, OnChanges { this.appraisalRuleFacets.waitingToRecalculateRulesListFacets && this.appraisalRuleFacets.waitingToRecalculateRulesListFacets.length > 0 ) { - let facetComputedUnits = this.appraisalRuleFacets.waitingToRecalculateRulesListFacets.filter((elt) => elt.node === 'true'); + const facetComputedUnits = this.appraisalRuleFacets.waitingToRecalculateRulesListFacets.filter((elt) => elt.node === 'true'); let computedCount = 0; if (facetComputedUnits.length > 0) { diff --git a/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/components/archive-search-rules-facets/search-dissemination-rules-facets/search-dissemination-rules-facets.component.ts b/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/components/archive-search-rules-facets/search-dissemination-rules-facets/search-dissemination-rules-facets.component.ts index f404acc7507..ab7089eff8f 100644 --- a/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/components/archive-search-rules-facets/search-dissemination-rules-facets/search-dissemination-rules-facets.component.ts +++ b/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/components/archive-search-rules-facets/search-dissemination-rules-facets/search-dissemination-rules-facets.component.ts @@ -37,10 +37,9 @@ knowledge of the CeCILL-C license and that you accept its terms. import { DatePipe } from '@angular/common'; import { Component, Input, OnChanges, OnInit } from '@angular/core'; import { TranslateService } from '@ngx-translate/core'; -import { Colors } from 'ui-frontend-common'; +import { Colors, RuleFacets } from 'ui-frontend-common'; import { FacetDetails } from 'ui-frontend-common/app/modules/models/operation/facet-details.interface'; import { ArchiveSearchConstsEnum } from '../../../models/archive-search-consts-enum'; -import { RuleFacets } from '../../../models/search.criteria'; import { ArchiveFacetsService } from '../../../services/archive-facets.service'; @Component({ @@ -156,7 +155,7 @@ export class SearchDisseminationRulesFacetsComponent implements OnInit, OnChange this.disseminationRuleFacets.waitingToRecalculateRulesListFacets && this.disseminationRuleFacets.waitingToRecalculateRulesListFacets.length > 0 ) { - let facetComputedUnits = this.disseminationRuleFacets.waitingToRecalculateRulesListFacets.filter((elt) => elt.node === 'true'); + const facetComputedUnits = this.disseminationRuleFacets.waitingToRecalculateRulesListFacets.filter((elt) => elt.node === 'true'); let computedCount = 0; if (facetComputedUnits.length > 0) { diff --git a/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/components/archive-search-rules-facets/search-reuse-rules-facets/search-reuse-rules-facets.component.ts b/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/components/archive-search-rules-facets/search-reuse-rules-facets/search-reuse-rules-facets.component.ts index 4331bbaa9a1..15cf161ff67 100644 --- a/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/components/archive-search-rules-facets/search-reuse-rules-facets/search-reuse-rules-facets.component.ts +++ b/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/components/archive-search-rules-facets/search-reuse-rules-facets/search-reuse-rules-facets.component.ts @@ -37,10 +37,9 @@ knowledge of the CeCILL-C license and that you accept its terms. import { DatePipe } from '@angular/common'; import { Component, Input, OnChanges, OnInit } from '@angular/core'; import { TranslateService } from '@ngx-translate/core'; -import { Colors } from 'ui-frontend-common'; +import { Colors, RuleFacets } from 'ui-frontend-common'; import { FacetDetails } from 'ui-frontend-common/app/modules/models/operation/facet-details.interface'; import { ArchiveSearchConstsEnum } from '../../../models/archive-search-consts-enum'; -import { RuleFacets } from '../../../models/search.criteria'; import { ArchiveFacetsService } from '../../../services/archive-facets.service'; @Component({ @@ -153,7 +152,7 @@ export class SearchReuseRulesFacetsComponent implements OnInit, OnChanges { private handleWaitingToRecalculateRulesFacets(): number { let archiveUnitWithRules = 0; if (this.reuseRuleFacets.waitingToRecalculateRulesListFacets && this.reuseRuleFacets.waitingToRecalculateRulesListFacets.length > 0) { - let facetComputedUnits = this.reuseRuleFacets.waitingToRecalculateRulesListFacets.filter((elt) => elt.node === 'true'); + const facetComputedUnits = this.reuseRuleFacets.waitingToRecalculateRulesListFacets.filter((elt) => elt.node === 'true'); let computedCount = 0; if (facetComputedUnits.length > 0) { diff --git a/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/components/archive-search-rules-facets/search-storage-rules-facets/search-storage-rules-facets.component.ts b/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/components/archive-search-rules-facets/search-storage-rules-facets/search-storage-rules-facets.component.ts index 367f86f8fcf..9bfcea88e8d 100644 --- a/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/components/archive-search-rules-facets/search-storage-rules-facets/search-storage-rules-facets.component.ts +++ b/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/components/archive-search-rules-facets/search-storage-rules-facets/search-storage-rules-facets.component.ts @@ -37,10 +37,9 @@ knowledge of the CeCILL-C license and that you accept its terms. import { DatePipe } from '@angular/common'; import { Component, Input, OnChanges, OnInit } from '@angular/core'; import { TranslateService } from '@ngx-translate/core'; -import { Colors } from 'ui-frontend-common'; +import { Colors, RuleFacets } from 'ui-frontend-common'; import { FacetDetails } from 'ui-frontend-common/app/modules/models/operation/facet-details.interface'; import { ArchiveSearchConstsEnum } from '../../../models/archive-search-consts-enum'; -import { RuleFacets } from '../../../models/search.criteria'; import { ArchiveFacetsService } from '../../../services/archive-facets.service'; @Component({ @@ -198,7 +197,7 @@ export class SearchStorageRulesFacetsComponent implements OnInit, OnChanges { this.storageRuleFacets.waitingToRecalculateRulesListFacets && this.storageRuleFacets.waitingToRecalculateRulesListFacets.length > 0 ) { - let facetComputedUnits = this.storageRuleFacets.waitingToRecalculateRulesListFacets.filter((elt) => elt.node === 'true'); + const facetComputedUnits = this.storageRuleFacets.waitingToRecalculateRulesListFacets.filter((elt) => elt.node === 'true'); let computedCount = 0; if (facetComputedUnits.length > 0) { diff --git a/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/components/criteria-search/criteria-search.component.html b/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/components/criteria-search/criteria-search.component.html index 16644083bd2..a64e3e9ed0d 100644 --- a/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/components/criteria-search/criteria-search.component.html +++ b/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/components/criteria-search/criteria-search.component.html @@ -30,9 +30,9 @@ {{ (criteriaValue.keyTranslated - ? ('COLLECT.SEARCH_CRITERIA_FILTER.' + getCategoryName(criteriaVal.category) + '.' + - criteriaVal.key | translate) - : criteriaVal.key) + ' : ' + ? ('COLLECT.SEARCH_CRITERIA_FILTER.' + getCategoryName(criteriaVal.category) + '.' + + criteriaVal.key | translate) + : criteriaVal.key) + ' : ' }} {{ criteriaValue.value.value | date: 'dd/MM/yyyy' }} @@ -93,9 +93,9 @@ {{ (criteriaValue.keyTranslated - ? ('COLLECT.SEARCH_CRITERIA_FILTER.' + getCategoryName(criteriaVal.category) + '.' + - criteriaVal.key | translate) - : criteriaVal.key) + ' : ' + ? ('COLLECT.SEARCH_CRITERIA_FILTER.' + getCategoryName(criteriaVal.category) + '.' + + criteriaVal.key | translate) + : criteriaVal.key) + ' : ' }} @@ -172,8 +172,8 @@ > {{ (criteriaVal.operator === 'EQ' - ? ('COLLECT.SEARCH_CRITERIA_FILTER.FIELDS.GUID_TO_INCLUDE' | translate) - : ('COLLECT.SEARCH_CRITERIA_FILTER.FIELDS.GUID_TO_EXCLUDE' | translate)) + + ? ('COLLECT.SEARCH_CRITERIA_FILTER.FIELDS.GUID_TO_INCLUDE' | translate) + : ('COLLECT.SEARCH_CRITERIA_FILTER.FIELDS.GUID_TO_EXCLUDE' | translate)) + ' : ' + criteriaVal.values[criteriaVal.values.length - 1].label }} @@ -201,8 +201,8 @@ > {{ (criteriaVal.operator === 'EQ' - ? ('COLLECT.SEARCH_CRITERIA_FILTER.FIELDS.GUIDS_TO_INCLUDE' | translate) - : ('COLLECT.SEARCH_CRITERIA_FILTER.FIELDS.GUIDS_TO_EXCLUDE' | translate)) + + ? ('COLLECT.SEARCH_CRITERIA_FILTER.FIELDS.GUIDS_TO_INCLUDE' | translate) + : ('COLLECT.SEARCH_CRITERIA_FILTER.FIELDS.GUIDS_TO_EXCLUDE' | translate)) + ' : ' + criteriaVal.values.length }} @@ -239,9 +239,8 @@ -
{{ (criteriaValue.keyTranslated - ? ('COLLECT.SEARCH_CRITERIA_FILTER.' + getCategoryName(criteriaVal.category) + '.' + - criteriaVal.key - | translate) - : criteriaVal.key) + ' : ' + ? ('COLLECT.SEARCH_CRITERIA_FILTER.' + getCategoryName(criteriaVal.category) + '.' + criteriaVal.key| translate) + : criteriaVal.key) + ' : ' }} {{ criteriaValue.valueTranslated - ? ('COLLECT.SEARCH_CRITERIA_FILTER.' + getCategoryName(criteriaVal.category) + '.' + - criteriaValue.label - | translate) - : (criteriaValue.label | truncate: 50) + ? ('COLLECT.SEARCH_CRITERIA_FILTER.' + getCategoryName(criteriaVal.category) + '.' + criteriaValue.label| translate) + : (criteriaValue.label | truncate: 50) }}
-
- -
- -
{{ 'COLLECT.SEARCH_CRITERIA_OR' | translate }}
diff --git a/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/components/criteria-search/criteria-search.component.ts b/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/components/criteria-search/criteria-search.component.ts index 90b9931beda..03eab53ef48 100644 --- a/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/components/criteria-search/criteria-search.component.ts +++ b/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/components/criteria-search/criteria-search.component.ts @@ -35,7 +35,7 @@ knowledge of the CeCILL-C license and that you accept its terms. */ import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core'; -import { CriteriaValue, SearchCriteria, SearchCriteriaTypeEnum } from '../../models/search.criteria'; +import { CriteriaValue, SearchCriteria, SearchCriteriaTypeEnum } from 'ui-frontend-common'; @Component({ selector: 'app-criteria-search', diff --git a/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/components/dissemination-rule-search/dissemination-rule-search.component.ts b/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/components/dissemination-rule-search/dissemination-rule-search.component.ts index 29db70f1874..99407561ad1 100644 --- a/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/components/dissemination-rule-search/dissemination-rule-search.component.ts +++ b/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/components/dissemination-rule-search/dissemination-rule-search.component.ts @@ -39,10 +39,11 @@ import { FormBuilder, FormGroup } from '@angular/forms'; import { MatDialog } from '@angular/material/dialog'; import { merge, Subscription } from 'rxjs'; import { debounceTime, filter, map } from 'rxjs/operators'; -import { ActionOnCriteria, CriteriaDataType, CriteriaOperator, diff } from 'ui-frontend-common'; -import { ArchiveSharedDataService } from '../../services/archive-shared-data.service'; +import { + ActionOnCriteria, CriteriaDataType, CriteriaOperator, CriteriaValue, diff, SearchCriteriaEltDto, SearchCriteriaTypeEnum +} from 'ui-frontend-common'; import { ArchiveSearchConstsEnum } from '../../models/archive-search-consts-enum'; -import { CriteriaValue, SearchCriteriaEltDto, SearchCriteriaTypeEnum } from '../../models/search.criteria'; +import { ArchiveSharedDataService } from '../../services/archive-shared-data.service'; import { RuleValidator } from '../../services/rule.validator'; const RULE_TYPE_SUFFIX = '_DISSEMINATION_RULE'; diff --git a/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/components/filing-holding-scheme/filing-holding-scheme.component.ts b/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/components/filing-holding-scheme/filing-holding-scheme.component.ts index 8ef287f7162..dae84ee2498 100644 --- a/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/components/filing-holding-scheme/filing-holding-scheme.component.ts +++ b/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/components/filing-holding-scheme/filing-holding-scheme.component.ts @@ -28,13 +28,15 @@ import { NestedTreeControl } from '@angular/cdk/tree'; import { Component, EventEmitter, Input, OnChanges, OnDestroy, OnInit, Output, SimpleChanges } from '@angular/core'; import { MatTreeNestedDataSource } from '@angular/material/tree'; import { Subscription } from 'rxjs'; -import { CriteriaDataType, CriteriaOperator, Direction, FilingHoldingSchemeNode, StartupService, Unit } from 'ui-frontend-common'; +import { + CriteriaDataType, CriteriaOperator, Direction, FilingHoldingSchemeHandler, FilingHoldingSchemeNode, PagedResult, ResultFacet, + SearchCriteriaEltDto, SearchCriteriaTypeEnum, StartupService, Unit +} from 'ui-frontend-common'; +import { isEmpty } from 'underscore'; import { ArchiveCollectService } from '../../../archive-collect.service'; import { NodeData } from '../../models/nodedata.interface'; -import { PagedResult, ResultFacet, SearchCriteriaEltDto, SearchCriteriaTypeEnum } from '../../models/search.criteria'; import { Pair, VitamInternalFields } from '../../models/utils'; import { ArchiveSharedDataService } from '../../services/archive-shared-data.service'; -import { FilingHoldingSchemeHandler } from './filing-holding-scheme.handler'; @Component({ selector: 'app-filing-holding-scheme', @@ -46,6 +48,7 @@ export class FilingHoldingSchemeComponent implements OnInit, OnChanges, OnDestro @Input() transactionId: string; @Input() searchHasMatches = false; @Input() searchRequestTotalResults: number; + @Output() showArchiveUnitDetails = new EventEmitter(); @Output() switchView: EventEmitter = new EventEmitter(); @@ -80,11 +83,10 @@ export class FilingHoldingSchemeComponent implements OnInit, OnChanges, OnDestro this.initialNodesState(); this.subscribeOnNodeSelectionToSetCheck(); this.subscribeOnFacetsChanges(); + this.initFilingHoldingSchemeTree(); } ngOnChanges(_: SimpleChanges): void { - this.loadingHolding = true; - this.initFilingHoldingSchemeTree(); } ngOnDestroy(): void { @@ -145,18 +147,16 @@ export class FilingHoldingSchemeComponent implements OnInit, OnChanges, OnDestro trackTotalHits: false, computeFacets: false, }; - console.log('FilingHoldingSchemeComponent initialRattachementUnitIdsState') this.archiveService - .searchArchiveUnitsByCriteria(searchCriteria, this.transactionId, 'FilingHoldingSchemeComponent initialRattachementUnitIdsState') + .searchArchiveUnitsByCriteria(searchCriteria, this.transactionId) .subscribe((pagedResult: PagedResult) => { this.filterNodesToLeavesOnly(pagedResult.results); }); } private filterNodesToLeavesOnly(units: Unit[]) { - console.log('FilingHoldingSchemeComponent filterNodesToLeavesOnly') const list: any[] = []; - const unflattedNodes = FilingHoldingSchemeHandler.keepEndNodesWithResultsOnly(this.fullNodes, units); + const unflattedNodes = FilingHoldingSchemeHandler.keepEndNodesWithResultsOnlyAndCheckAttach(this.fullNodes, units); unflattedNodes.forEach((unitParent) => { const collectAttachmentUnit = units.find((unit) => unit[VitamInternalFields.MANAGEMENT].UpdateOperation.SystemId === unitParent.id); if (collectAttachmentUnit) { @@ -177,12 +177,23 @@ export class FilingHoldingSchemeComponent implements OnInit, OnChanges, OnDestro list.push(outNode); } }); + let orphanNode; + if (!isEmpty(this.nestedDataSourceLeaves.data) && FilingHoldingSchemeHandler.isOrphansNode(this.nestedDataSourceLeaves.data[0])) { + orphanNode = this.nestedDataSourceLeaves.data[0]; + } if (list.length > 0) { - this.nestedDataSourceLeaves.data.push(...list); + this.nestedDataSourceLeaves.data = list; this.showEveryNodes = true; } else { + this.nestedDataSourceLeaves.data = []; this.showEveryNodes = false; } + if (orphanNode) { + this.nestedDataSourceLeaves.data.unshift(orphanNode); + const tmp = this.nestedDataSourceLeaves.data; + this.nestedDataSourceLeaves.data = null; + this.nestedDataSourceLeaves.data = tmp; + } } private initialNodesState(): void { @@ -199,17 +210,15 @@ export class FilingHoldingSchemeComponent implements OnInit, OnChanges, OnDestro initFilingHoldingSchemeTree() { this.loadingHolding = true; - this.subscriptions.add( - this.archiveService.loadFilingHoldingSchemeTree(this.tenantIdentifier).subscribe((nodes) => { - // Disable checkbox use to prevent add unit to search criteria - this.disableCheckingUnitsRecursive(nodes); - this.fullNodes = nodes; - this.nestedDataSourceFull.data = nodes; - this.nestedTreeControlFull.dataNodes = nodes; - this.archiveSharedDataService.emitFilingHoldingNodes(nodes); - this.loadingHolding = false; - }) - ); + this.archiveService.loadFilingHoldingSchemeTree(this.tenantIdentifier).subscribe((nodes) => { + // Disable checkbox use to prevent add unit to search criteria + this.disableCheckingUnitsRecursive(nodes); + this.fullNodes = nodes; + this.nestedDataSourceFull.data = nodes; + this.nestedTreeControlFull.dataNodes = nodes; + this.archiveSharedDataService.emitFilingHoldingNodes(nodes); + this.loadingHolding = false; + }); } disableCheckingUnitsRecursive(nodes: FilingHoldingSchemeNode[]) { diff --git a/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/components/filing-holding-scheme/leaves-tree/leaves-tree.component.html b/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/components/filing-holding-scheme/leaves-tree/leaves-tree.component.html index 83441540413..88e8f615bdf 100644 --- a/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/components/filing-holding-scheme/leaves-tree/leaves-tree.component.html +++ b/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/components/filing-holding-scheme/leaves-tree/leaves-tree.component.html @@ -62,6 +62,34 @@ + +
+ + + + {{ node.count | number : '1.0' }} + +
+ +
+
{ node.toggled = undefined; @@ -104,7 +101,7 @@ export class LeavesTreeComponent implements OnInit, OnChanges, OnDestroy { this.refreshTreeNodes(); } else { if (this.searchCriterias) { - this.loadNodesDetailsFromFacetsIds(this.searchRequestResultFacets) + this.leavesTreeService.loadNodesDetailsFromFacetsIds(this.searchRequestResultFacets) .subscribe((detailsPageResult) => { FilingHoldingSchemeHandler.addChildrenRecursively(this.nestedDataSourceLeaves.data, detailsPageResult.results); FilingHoldingSchemeHandler.setCountRecursively(this.nestedDataSourceLeaves.data, this.searchRequestResultFacets); @@ -115,27 +112,28 @@ export class LeavesTreeComponent implements OnInit, OnChanges, OnDestroy { } } } + if (changes.transactionId) { + this.leavesTreeService.setTransactionId(this.transactionId); + } } addOrphansNode() { const unknonwFacets = FilingHoldingSchemeHandler.filterUnknownFacetsIds(this.nestedDataSourceLeaves.data, this.searchRequestResultFacets); if (!isEmpty(unknonwFacets)) { - console.log('addOrphansNode unknonwFacets') - this.loadNodesDetailsFromFacetsIds(unknonwFacets) + this.leavesTreeService.loadNodesDetailsFromFacetsIds(unknonwFacets) .subscribe((pageResult) => { const nodes = FilingHoldingSchemeHandler.buildNestedTreeLevels(pageResult.results, this.locale); FilingHoldingSchemeHandler.setCountRecursively(nodes, unknonwFacets); FilingHoldingSchemeHandler.addToOrphansNode(nodes, this.nestedDataSourceLeaves.data, - this.translateService.instant('Sans rattachement')); + this.translateService.instant('ARCHIVE_SEARCH.FILING_SCHEMA.ORPHANS_NODE')); this.refreshTreeNodes(); this.loadingNodesDetails = false; }); } - console.log(' this.searchRequestTotalResults = ' + this.searchRequestTotalResults) if (this.searchRequestTotalResults > 0 && isEmpty(this.nestedDataSourceLeaves.data)) { FilingHoldingSchemeHandler.addOrphansNodeFromTree(this.nestedDataSourceLeaves.data, - this.translateService.instant('Sans rattachement'), this.searchRequestTotalResults); + this.translateService.instant('ARCHIVE_SEARCH.FILING_SCHEMA.ORPHANS_NODE'), this.searchRequestTotalResults); } } @@ -147,158 +145,76 @@ export class LeavesTreeComponent implements OnInit, OnChanges, OnDestroy { this.addToSearchCriteria.emit(node); } - private prepareSearch(parentNode: FilingHoldingSchemeNode, matchingSearch: boolean): boolean { - if (matchingSearch && !parentNode.canLoadMoreMatchingChildren) { - return false; - } else if (!matchingSearch && !parentNode.canLoadMoreChildren) { - return false; - } - parentNode.isLoadingChildren = true; - return true; + private searchUnderNode(parentNode: FilingHoldingSchemeNode) { + this.leavesTreeService.searchUnderNode(parentNode, this.searchCriterias) + .subscribe((pageResult) => { + const matchingNodesNumbers = FilingHoldingSchemeHandler.addChildren(parentNode, pageResult.results); + this.compareAddedNodeWithKnownFacets(matchingNodesNumbers.nodesAddedList); + this.refreshTreeNodes(); + }); } - private loadNodesDetailsFromFacetsIds(facets: ResultFacet[]): Observable { - this.loadingNodesDetails = true; - const searchCriteria: SearchCriteriaDto = { - pageNumber: 0, - size: facets.length, - criteriaList: [ - { - criteria: VitamInternalFields.ID, - operator: CriteriaOperator.IN, - category: SearchCriteriaTypeEnum.FIELDS, - values: facets.map((facet) => { - return { id: facet.node, value: facet.node }; - }), - dataType: CriteriaDataType.STRING, - }, - ], - sortingCriteria: this.searchCriterias?.sortingCriteria, - trackTotalHits: false, - computeFacets: false, - }; - // Can be improve with a projection (only nodes fields are needed) - return this.sendSearchArchiveUnitsByCriteria(searchCriteria); + private searchOrphansWithSearchCriterias(parentNode: FilingHoldingSchemeNode) { + this.leavesTreeService.searchOrphansWithSearchCriterias(parentNode, this.searchCriterias) + .subscribe((pageResult) => { + FilingHoldingSchemeHandler.addOrphans(parentNode, pageResult.results, true); + this.refreshTreeNodes(); + }); } - private searchWithSearchCriteriasForFacets(parentNodes: FilingHoldingSchemeNode[]): void { - if (isEmpty(parentNodes)) { - return; - } - const newCriteriaList = [...this.searchCriterias.criteriaList]; - newCriteriaList.push({ - criteria: VitamInternalFields.ALL_UNIT_UPS, - operator: CriteriaOperator.EQ, - category: SearchCriteriaTypeEnum.FIELDS, - values: parentNodes.map((node) => { - return { id: node.id, value: node.id }; - }), - dataType: CriteriaDataType.STRING, - }); - // Can be improved: we only need the facets, not the units - const searchCriteria: SearchCriteriaDto = { - pageNumber: 0, - size: 1, - criteriaList: newCriteriaList, - sortingCriteria: this.searchCriterias.sortingCriteria, - trackTotalHits: false, - computeFacets: false, - }; - this.sendSearchArchiveUnitsByCriteria(searchCriteria).subscribe((pageResult) => { - this.checkFacetsAndLoadUnknowns(parentNodes, pageResult); - }); + private searchUnderNodeWithSearchCriterias(parentNode: FilingHoldingSchemeNode) { + this.leavesTreeService.searchUnderNodeWithSearchCriterias(parentNode, this.searchCriterias) + .subscribe((pageResult) => { + FilingHoldingSchemeHandler.addChildren(parentNode, pageResult.results, true); + const newFacets: ResultFacet[] = this.extractAndAddNewFacets(pageResult); + this.loadNodesDetailsFromFacetsIdsAndAddThem([parentNode], newFacets); + this.refreshTreeNodes(); + }); } - private searchUnderNode(parentNode: FilingHoldingSchemeNode) { - if (!this.prepareSearch(parentNode, false)) { + private loadNodesDetailsFromFacetsIdsAndAddThem(parentNodes: FilingHoldingSchemeNode[], facets: ResultFacet[]) { + if (isEmpty(facets)) { return; } - // Manage criteriaList - const updatedCriteriaList = [...this.searchCriterias.criteriaList]; - updatedCriteriaList.push({ - criteria: VitamInternalFields.UNIT_UPS, - operator: CriteriaOperator.IN, - category: SearchCriteriaTypeEnum.FIELDS, - values: [{ id: parentNode.id, value: parentNode.id }], - dataType: CriteriaDataType.STRING, - }); - - const searchCriteria: SearchCriteriaDto = { - pageNumber: Math.floor(parentNode.paginatedChildrenLoaded / this.DEFAULT_UNIT_PAGE_SIZE), - size: this.DEFAULT_UNIT_PAGE_SIZE, - criteriaList: updatedCriteriaList, - sortingCriteria: this.searchCriterias.sortingCriteria, - trackTotalHits: false, - computeFacets: false, - }; - this.subscriptions.add( - this.sendSearchArchiveUnitsByCriteria(searchCriteria).subscribe((pageResult) => { - const matchingNodesNumbers = FilingHoldingSchemeHandler.addChildren(parentNode, pageResult.results); - parentNode.paginatedChildrenLoaded += pageResult.results.length; - parentNode.canLoadMoreChildren = parentNode.children.length < pageResult.totalResults; - parentNode.isLoadingChildren = false; + this.loadingNodesDetails = true; + this.leavesTreeService.loadNodesDetailsFromFacetsIds(facets) + .subscribe((pageResult) => { + FilingHoldingSchemeHandler.addChildrenRecursively(parentNodes, pageResult.results, true); + FilingHoldingSchemeHandler.setCountRecursively(parentNodes, facets); this.refreshTreeNodes(); - this.searchWithSearchCriteriasForFacets(matchingNodesNumbers.nodesAddedList); - }) - ); + this.loadingNodesDetails = false; + }); } - private searchUnderNodeWithSearchCriterias(parentNode: FilingHoldingSchemeNode) { - if (!this.prepareSearch(parentNode, true)) { - return; + private extractAndAddNewFacets(pageResult: PagedResult): ResultFacet[] { + // Warning: count decrease on top nodes when search is made on a deeper nodes. + const resultFacets: ResultFacet[] = this.archiveFacetsService.extractNodesFacetsResults(pageResult.facets); + const newFacets: ResultFacet[] = FilingHoldingSchemeHandler.filterUnknownFacets(this.searchRequestResultFacets, resultFacets); + if (newFacets.length > 0) { + this.searchRequestResultFacets.push(...newFacets); } - const newCriteriaList = [...this.searchCriterias.criteriaList]; - newCriteriaList.push({ - criteria: VitamInternalFields.ALL_UNIT_UPS, - operator: CriteriaOperator.EQ, - category: SearchCriteriaTypeEnum.FIELDS, - values: [{ id: parentNode.id, value: parentNode.id }], - dataType: CriteriaDataType.STRING, - }); - const searchCriteria: SearchCriteriaDto = { - pageNumber: Math.floor(parentNode.paginatedMatchingChildrenLoaded / this.DEFAULT_UNIT_PAGE_SIZE), - size: this.DEFAULT_UNIT_PAGE_SIZE, - criteriaList: newCriteriaList, - sortingCriteria: this.searchCriterias.sortingCriteria, - trackTotalHits: false, - computeFacets: false, - }; - this.sendSearchArchiveUnitsByCriteria(searchCriteria).subscribe((pageResult) => { - const matchingNodesNumbers = FilingHoldingSchemeHandler.addChildren(parentNode, pageResult.results, true); - parentNode.paginatedMatchingChildrenLoaded += matchingNodesNumbers.nodesAdded + matchingNodesNumbers.nodesUpdated; - parentNode.canLoadMoreMatchingChildren = matchingNodesNumbers.nodesAdded + matchingNodesNumbers.nodesUpdated !== 0; - if (parentNode.paginatedMatchingChildrenLoaded >= pageResult.totalResults) { - parentNode.canLoadMoreMatchingChildren = false; - } - this.checkFacetsAndLoadUnknowns([parentNode], pageResult); - parentNode.isLoadingChildren = false; - this.refreshTreeNodes(); - }); + return newFacets; } - private checkFacetsAndLoadUnknowns(parentNodes: FilingHoldingSchemeNode[], pageResult: PagedResult) { - const filteredFacets = this.archiveFacetsService - .extractNodesFacetsResults(pageResult.facets) - .filter((facet) => this.searchRequestResultFacets.findIndex((originalFacet) => originalFacet.node === facet.node) === -1); - // Warning: count decrease on top nodes when search is made on a deeper nodes. - if (isEmpty(filteredFacets)) { - return; - } - FilingHoldingSchemeHandler.setCountRecursively(parentNodes, filteredFacets); - const unknownFacets = FilingHoldingSchemeHandler.filterUnknownFacetsIds(parentNodes, filteredFacets); - if (unknownFacets && unknownFacets.length > 1) { - this.loadNodesDetailsFromFacetsIds(unknownFacets).subscribe((detailsPageResult) => { - FilingHoldingSchemeHandler.addChildrenRecursively(parentNodes, detailsPageResult.results); - FilingHoldingSchemeHandler.setCountRecursively(parentNodes, unknownFacets); - this.refreshTreeNodes(); - this.loadingNodesDetails = false; - }); + private compareAddedNodeWithKnownFacets(nodes: FilingHoldingSchemeNode[]) { + for (const node of nodes) { + const matchingFacet = this.searchRequestResultFacets.find((resultFacet) => resultFacet.node === node.id); + if (!matchingFacet) { + continue; + } + if (node.count < matchingFacet.count) { + node.count = matchingFacet.count; + } } } - private sendSearchArchiveUnitsByCriteria(searchCriteria: SearchCriteriaDto): Observable { - console.log('LeavesTreeComponent sendSearchArchiveUnitsByCriteria') - return this.archiveCollectService.searchArchiveUnitsByCriteria(searchCriteria, this.transactionId, 'LeavesTreeComponent sendSearchArchiveUnitsByCriteria').pipe(first()); + private searchOrphans(parentNode: FilingHoldingSchemeNode) { + this.leavesTreeService.searchOrphans(parentNode, this.searchCriterias) + .subscribe((results: Unit[]) => { + const matchingNodesNumbers = FilingHoldingSchemeHandler.addOrphans(parentNode, results); + this.compareAddedNodeWithKnownFacets(matchingNodesNumbers.nodesAddedList); + this.refreshTreeNodes(); + }); } private refreshTreeNodes() { @@ -308,18 +224,19 @@ export class LeavesTreeComponent implements OnInit, OnChanges, OnDestroy { } private firstToggle(node: FilingHoldingSchemeNode): boolean { - if (node.toggled === undefined) { - node.toggled = true; - if (!node.children) { - node.children = []; - } - node.paginatedMatchingChildrenLoaded = node.children.length; - node.canLoadMoreMatchingChildren = true; - node.paginatedChildrenLoaded = 0; - node.canLoadMoreChildren = true; - return true; + return this.leavesTreeService.firstToggle(node) + } + + toggleOrphan(node: FilingHoldingSchemeNode) { + const isExpanded = this.nestedTreeControlLeaves.isExpanded(node); + this.nestedTreeControlLeaves.toggle(node); + if (isExpanded) { + return; + } + if (this.firstToggle(node)) { + this.searchOrphans(node); + this.searchOrphansWithSearchCriterias(node); } - return false; } toggleLeave(node: FilingHoldingSchemeNode) { @@ -334,6 +251,14 @@ export class LeavesTreeComponent implements OnInit, OnChanges, OnDestroy { } } + toggleLoadMoreOrphans(node: FilingHoldingSchemeNode) { + if (!this.nestedTreeControlLeaves.isExpanded(node)) { + return; + } + this.searchOrphans(node); + this.searchOrphansWithSearchCriterias(node); + } + toggleLoadMore(node: FilingHoldingSchemeNode) { if (!this.nestedTreeControlLeaves.isExpanded(node)) { return; @@ -350,11 +275,15 @@ export class LeavesTreeComponent implements OnInit, OnChanges, OnDestroy { } nodeIsUAWithChildren(_: number, node: FilingHoldingSchemeNode): boolean { - return node.type === 'INGEST' && node.descriptionLevel !== DescriptionLevel.ITEM; + return node.unitType === 'INGEST' && node.descriptionLevel !== DescriptionLevel.ITEM; } nodeIsUAWithoutChildren(_: number, node: FilingHoldingSchemeNode): boolean { - return node.type === 'INGEST' && node.descriptionLevel === DescriptionLevel.ITEM; + return node.unitType === 'INGEST' && node.descriptionLevel === DescriptionLevel.ITEM; + } + + nodeIsOrphanNode(_: number, node: FilingHoldingSchemeNode): boolean { + return FilingHoldingSchemeHandler.isOrphansNode(node); } nodeHasPositiveCount(node: FilingHoldingSchemeNode): boolean { diff --git a/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/components/filing-holding-scheme/leaves-tree/leaves-tree.service.ts b/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/components/filing-holding-scheme/leaves-tree/leaves-tree.service.ts new file mode 100644 index 00000000000..17d6ddc564f --- /dev/null +++ b/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/components/filing-holding-scheme/leaves-tree/leaves-tree.service.ts @@ -0,0 +1,215 @@ +import { Injectable } from '@angular/core'; +import { Observable } from 'rxjs'; +import { first, map } from 'rxjs/operators'; +import { + CriteriaDataType, CriteriaOperator, FilingHoldingSchemeHandler, FilingHoldingSchemeNode, PagedResult, ResultFacet, SearchCriteriaDto, + SearchCriteriaEltDto, SearchCriteriaTypeEnum, Unit +} from 'ui-frontend-common'; +import { ArchiveCollectService } from '../../../../archive-collect.service'; + +const DEFAULT_UNIT_PAGE_SIZE = 10; + +const ALLUNITSUPS = '#allunitups'; + +@Injectable({ + providedIn: 'root', +}) +export class LeavesTreeService { + + private transactionId: string; + + constructor(private archiveCollectService: ArchiveCollectService,) {} + + public firstToggle(node: FilingHoldingSchemeNode): boolean { + if (node.toggled) { + return false; + } + node.toggled = true; + if (!node.children) { + node.children = []; + } + node.paginatedMatchingChildrenLoaded = 0; + node.canLoadMoreMatchingChildren = true; + node.paginatedChildrenLoaded = 0; + node.canLoadMoreChildren = true; + return true; + } + + private prepareSearch(parentNode: FilingHoldingSchemeNode, matchingSearch: boolean): boolean { + if (matchingSearch && !parentNode.canLoadMoreMatchingChildren) { + return false; + } else if (!matchingSearch && !parentNode.canLoadMoreChildren) { + return false; + } + parentNode.isLoadingChildren = true; + return true; + } + + public finishSearch(parentNode: FilingHoldingSchemeNode, pageResult: PagedResult, matchingSearch: boolean): void { + parentNode.isLoadingChildren = false; + if (matchingSearch) { + parentNode.paginatedMatchingChildrenLoaded += pageResult.results.length; + parentNode.canLoadMoreMatchingChildren = parentNode.paginatedMatchingChildrenLoaded < pageResult.totalResults; + } else { + parentNode.paginatedChildrenLoaded += pageResult.results.length; + parentNode.canLoadMoreChildren = parentNode.paginatedChildrenLoaded < pageResult.totalResults; + } + } + + recalculateCount(nodes: FilingHoldingSchemeNode[]): void { + for (const node of nodes) { + FilingHoldingSchemeHandler.reCalculateCountRecursively(node); + } + } + + hasCountAnomaly(parentNode: FilingHoldingSchemeNode): boolean { + const sum = FilingHoldingSchemeHandler.getCountSum(parentNode.children) + if (sum >= parentNode.count) { + parentNode.count = sum + 1; + return true; + } + return false; + } + + searchOrphans(parentNode: FilingHoldingSchemeNode, searchCriterias: SearchCriteriaDto): Observable { + if (!this.prepareSearch(parentNode, false)) { + return; + } + const newCriteriaList: SearchCriteriaEltDto[] = [ + { + criteria: '#unitups', + operator: CriteriaOperator.MISSING, + category: SearchCriteriaTypeEnum.FIELDS, + values: [], + dataType: CriteriaDataType.STRING, + }, + ]; + const searchCriteria: SearchCriteriaDto = { + pageNumber: Math.floor(parentNode.paginatedChildrenLoaded / DEFAULT_UNIT_PAGE_SIZE), + size: DEFAULT_UNIT_PAGE_SIZE, + criteriaList: newCriteriaList, + sortingCriteria: searchCriterias.sortingCriteria, + trackTotalHits: false, + computeFacets: false, + }; + return this.sendSearchArchiveUnitsByCriteria(searchCriteria) + .pipe(map((pageResult) => { + this.finishSearch(parentNode, pageResult, false); + return pageResult.results; + })); + } + + searchOrphansWithSearchCriterias(parentNode: FilingHoldingSchemeNode, searchCriterias: SearchCriteriaDto): Observable { + if (!this.prepareSearch(parentNode, true)) { + return; + } + const newCriteriaList = [...searchCriterias.criteriaList]; + newCriteriaList.push({ + criteria: '#allunitups', + operator: CriteriaOperator.MISSING, + category: SearchCriteriaTypeEnum.FIELDS, + values: [], + dataType: CriteriaDataType.STRING, + }); + const searchCriteria: SearchCriteriaDto = { + pageNumber: Math.floor(parentNode.paginatedMatchingChildrenLoaded / DEFAULT_UNIT_PAGE_SIZE), + size: DEFAULT_UNIT_PAGE_SIZE, + criteriaList: newCriteriaList, + sortingCriteria: searchCriterias.sortingCriteria, + trackTotalHits: false, + computeFacets: false, + }; + return this.sendSearchArchiveUnitsByCriteria(searchCriteria) + .pipe(map(pageResult => { + this.finishSearch(parentNode, pageResult, true); + return pageResult; + })); + } + + searchUnderNode(parentNode: FilingHoldingSchemeNode, searchCriterias: SearchCriteriaDto): Observable { + if (!this.prepareSearch(parentNode, false)) { + return; + } + const searchCriteria: SearchCriteriaDto = { + pageNumber: Math.floor(parentNode.paginatedChildrenLoaded / DEFAULT_UNIT_PAGE_SIZE), + size: DEFAULT_UNIT_PAGE_SIZE, + criteriaList: [ + { + criteria: '#unitups', + operator: CriteriaOperator.IN, + category: SearchCriteriaTypeEnum.FIELDS, + values: [{ id: parentNode.id, value: parentNode.id }], + dataType: CriteriaDataType.STRING, + }, + ], + sortingCriteria: searchCriterias.sortingCriteria, + trackTotalHits: false, + computeFacets: false, + }; + return this.sendSearchArchiveUnitsByCriteria(searchCriteria) + .pipe(map(pageResult => { + this.finishSearch(parentNode, pageResult, false); + return pageResult; + })); + } + + searchUnderNodeWithSearchCriterias(parentNode: FilingHoldingSchemeNode, searchCriterias: SearchCriteriaDto): Observable { + if (!this.prepareSearch(parentNode, true)) { + return; + } + const newCriteriaList = [...searchCriterias.criteriaList]; + newCriteriaList.push({ + criteria: ALLUNITSUPS, + operator: CriteriaOperator.EQ, + category: SearchCriteriaTypeEnum.FIELDS, + values: [{ id: parentNode.id, value: parentNode.id }], + dataType: CriteriaDataType.STRING, + }); + const searchCriteria: SearchCriteriaDto = { + pageNumber: Math.floor(parentNode.paginatedMatchingChildrenLoaded / DEFAULT_UNIT_PAGE_SIZE), + size: DEFAULT_UNIT_PAGE_SIZE, + criteriaList: newCriteriaList, + sortingCriteria: searchCriterias.sortingCriteria, + trackTotalHits: false, + computeFacets: false, + }; + return this.sendSearchArchiveUnitsByCriteria(searchCriteria) + .pipe(map(pageResult => { + this.finishSearch(parentNode, pageResult, true); + return pageResult; + })); + } + + + loadNodesDetailsFromFacetsIds(facets: ResultFacet[]): Observable { + const searchCriteria: SearchCriteriaDto = { + pageNumber: 0, + size: facets.length, + criteriaList: [ + { + criteria: '#id', + operator: CriteriaOperator.IN, + category: SearchCriteriaTypeEnum.FIELDS, + values: facets.map((facet) => { + return { id: facet.node, value: facet.node }; + }), + dataType: CriteriaDataType.STRING, + }, + ], + trackTotalHits: false, + computeFacets: false, + }; + // Can be improve with a projection (only nodes fields are needed) + return this.sendSearchArchiveUnitsByCriteria(searchCriteria) + .pipe() + } + + sendSearchArchiveUnitsByCriteria(searchCriteria: SearchCriteriaDto): Observable { + return this.archiveCollectService.searchArchiveUnitsByCriteria(searchCriteria, this.transactionId).pipe(first()); + } + + setTransactionId(transactionId: string) { + this.transactionId = transactionId; + } + +} diff --git a/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/components/reuse-rule-search/reuse-rule-search.component.ts b/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/components/reuse-rule-search/reuse-rule-search.component.ts index 4bec893164d..3a7764767f0 100644 --- a/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/components/reuse-rule-search/reuse-rule-search.component.ts +++ b/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/components/reuse-rule-search/reuse-rule-search.component.ts @@ -39,10 +39,11 @@ import { FormBuilder, FormGroup } from '@angular/forms'; import { MatDialog } from '@angular/material/dialog'; import { merge, Subscription } from 'rxjs'; import { debounceTime, filter, map } from 'rxjs/operators'; -import { ActionOnCriteria, CriteriaDataType, CriteriaOperator, diff } from 'ui-frontend-common'; -import { ArchiveSharedDataService } from '../../services/archive-shared-data.service'; +import { + ActionOnCriteria, CriteriaDataType, CriteriaOperator, CriteriaValue, diff, SearchCriteriaEltDto, SearchCriteriaTypeEnum +} from 'ui-frontend-common'; import { ArchiveSearchConstsEnum } from '../../models/archive-search-consts-enum'; -import { CriteriaValue, SearchCriteriaEltDto, SearchCriteriaTypeEnum } from '../../models/search.criteria'; +import { ArchiveSharedDataService } from '../../services/archive-shared-data.service'; import { RuleValidator } from '../../services/rule.validator'; const RULE_TYPE_SUFFIX = '_REUSE_RULE'; diff --git a/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/components/search-criteria-list/search-criteria-list.component.spec.ts b/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/components/search-criteria-list/search-criteria-list.component.spec.ts index 3c6015498bf..a4d80905787 100644 --- a/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/components/search-criteria-list/search-criteria-list.component.spec.ts +++ b/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/components/search-criteria-list/search-criteria-list.component.spec.ts @@ -43,9 +43,10 @@ import { RouterTestingModule } from '@angular/router/testing'; import { TranslateLoader, TranslateModule } from '@ngx-translate/core'; import { environment } from 'projects/collect/src/environments/environment'; import { Observable, of } from 'rxjs'; -import { CriteriaDataType, CriteriaOperator, InjectorModule, LoggerModule } from 'ui-frontend-common'; +import { + CriteriaDataType, CriteriaOperator, InjectorModule, LoggerModule, SearchCriteriaEltements, SearchCriteriaHistory +} from 'ui-frontend-common'; import { VitamUISnackBar } from '../../../../shared/vitamui-snack-bar'; -import { SearchCriteriaEltements, SearchCriteriaHistory } from '../../models/search-criteria-history.interface'; import { VitamInternalFields } from '../../models/utils'; import { ArchiveSharedDataService } from '../../services/archive-shared-data.service'; import { SearchCriteriaSaverService } from '../../services/search-criteria-saver.service'; diff --git a/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/components/search-criteria-list/search-criteria-list.component.ts b/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/components/search-criteria-list/search-criteria-list.component.ts index 9b742d9e4cf..ceabc6ee55f 100644 --- a/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/components/search-criteria-list/search-criteria-list.component.ts +++ b/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/components/search-criteria-list/search-criteria-list.component.ts @@ -38,13 +38,12 @@ import { MatDialog } from '@angular/material/dialog'; import { TranslateService } from '@ngx-translate/core'; import { Subject, Subscription } from 'rxjs'; import { filter } from 'rxjs/operators'; -import { Direction } from 'ui-frontend-common'; +import { Direction, SearchCriteriaHistory } from 'ui-frontend-common'; +import { VitamUISnackBar } from '../../../../shared/vitamui-snack-bar'; +import { VitamUISnackBarComponent } from '../../../../shared/vitamui-snack-bar'; import { ArchiveSharedDataService } from '../../services/archive-shared-data.service'; -import { SearchCriteriaHistory } from '../../models/search-criteria-history.interface'; -import { ConfirmActionComponent } from './confirm-action/confirm-action.component'; import { SearchCriteriaSaverService } from '../../services/search-criteria-saver.service'; -import { VitamUISnackBarComponent } from '../../../../shared/vitamui-snack-bar/vitamui-snack-bar.component'; -import { VitamUISnackBar } from '../../../../shared/vitamui-snack-bar'; +import { ConfirmActionComponent } from './confirm-action/confirm-action.component'; @Component({ selector: 'app-search-criteria-list', diff --git a/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/components/search-criteria-saver/search-criteria-saver.component.spec.ts b/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/components/search-criteria-saver/search-criteria-saver.component.spec.ts index d2fc0bae1cc..ceef14befb0 100644 --- a/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/components/search-criteria-saver/search-criteria-saver.component.spec.ts +++ b/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/components/search-criteria-saver/search-criteria-saver.component.spec.ts @@ -47,9 +47,10 @@ import { RouterTestingModule } from '@angular/router/testing'; import { TranslateLoader, TranslateModule } from '@ngx-translate/core'; import { environment } from 'projects/collect/src/environments/environment'; import { Observable, of } from 'rxjs'; -import { CriteriaDataType, CriteriaOperator, InjectorModule, LoggerModule } from 'ui-frontend-common'; +import { + CriteriaDataType, CriteriaOperator, InjectorModule, LoggerModule, SearchCriteriaEltements, SearchCriteriaHistory +} from 'ui-frontend-common'; import { VitamUISnackBar } from '../../../../shared/vitamui-snack-bar'; -import { SearchCriteriaEltements, SearchCriteriaHistory } from '../../models/search-criteria-history.interface'; import { VitamInternalFields } from '../../models/utils'; import { ArchiveSharedDataService } from '../../services/archive-shared-data.service'; import { SearchCriteriaSaverService } from '../../services/search-criteria-saver.service'; diff --git a/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/components/search-criteria-saver/search-criteria-saver.component.ts b/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/components/search-criteria-saver/search-criteria-saver.component.ts index 4a1d52e676c..e1c0f7461be 100644 --- a/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/components/search-criteria-saver/search-criteria-saver.component.ts +++ b/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/components/search-criteria-saver/search-criteria-saver.component.ts @@ -40,10 +40,8 @@ import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog'; import { MatSnackBar } from '@angular/material/snack-bar'; import { TranslatePipe } from '@ngx-translate/core'; import { Subscription } from 'rxjs'; -import { ConfirmDialogService, Direction } from 'ui-frontend-common'; +import { ConfirmDialogService, Direction, SearchCriteria, SearchCriteriaHistory, SearchCriteriaTypeEnum } from 'ui-frontend-common'; import { VitamUISnackBarComponent } from '../../../../shared/vitamui-snack-bar'; -import { SearchCriteriaHistory } from '../../models/search-criteria-history.interface'; -import { SearchCriteria, SearchCriteriaTypeEnum } from '../../models/search.criteria'; import { ArchiveSharedDataService } from '../../services/archive-shared-data.service'; import { SearchCriteriaSaverService } from '../../services/search-criteria-saver.service'; diff --git a/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/components/search-criteria-saver/search-criteria-saver.service.spec.ts b/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/components/search-criteria-saver/search-criteria-saver.service.spec.ts index 13bb3b8dcdd..1ec83f8d263 100644 --- a/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/components/search-criteria-saver/search-criteria-saver.service.spec.ts +++ b/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/components/search-criteria-saver/search-criteria-saver.service.spec.ts @@ -37,9 +37,7 @@ knowledge of the CeCILL-C license and that you accept its terms. import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing'; import { Type } from '@angular/core'; import { TestBed } from '@angular/core/testing'; -import { BASE_URL } from 'ui-frontend-common'; -import { SearchCriteriaHistory } from '../../models/search-criteria-history.interface'; - +import { BASE_URL, SearchCriteriaHistory } from 'ui-frontend-common'; import { SearchCriteriaSaverService } from '../../services/search-criteria-saver.service'; describe('SearchCriteriaSaverService', () => { diff --git a/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/components/simple-criteria-search/simple-criteria-search.component.ts b/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/components/simple-criteria-search/simple-criteria-search.component.ts index 51b7db0a75b..c51ecd52acf 100644 --- a/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/components/simple-criteria-search/simple-criteria-search.component.ts +++ b/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/components/simple-criteria-search/simple-criteria-search.component.ts @@ -39,10 +39,12 @@ import { MatDialog } from '@angular/material/dialog'; import { TranslateService } from '@ngx-translate/core'; import { merge } from 'rxjs'; import { debounceTime, filter, map } from 'rxjs/operators'; -import { ActionOnCriteria, CriteriaDataType, CriteriaOperator, Ontology, OntologyService, diff } from 'ui-frontend-common'; +import { + ActionOnCriteria, CriteriaDataType, CriteriaOperator, CriteriaValue, diff, Ontology, OntologyService, SearchCriteriaEltDto, + SearchCriteriaTypeEnum +} from 'ui-frontend-common'; import { ArchiveCollectService } from '../../../archive-collect.service'; import { ArchiveSearchConstsEnum } from '../../models/archive-search-consts-enum'; -import { CriteriaValue, SearchCriteriaEltDto, SearchCriteriaTypeEnum } from '../../models/search.criteria'; import { ArchiveSharedDataService } from '../../services/archive-shared-data.service'; import { ManagementRulesSharedDataService } from '../../services/management-rules-shared-data.service'; diff --git a/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/components/storage-rule-search/storage-rule-search.component.ts b/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/components/storage-rule-search/storage-rule-search.component.ts index 79bec64871f..aec81325768 100644 --- a/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/components/storage-rule-search/storage-rule-search.component.ts +++ b/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/components/storage-rule-search/storage-rule-search.component.ts @@ -39,10 +39,11 @@ import { FormBuilder, FormGroup } from '@angular/forms'; import { MatDialog } from '@angular/material/dialog'; import { merge, Subscription } from 'rxjs'; import { debounceTime, filter, map } from 'rxjs/operators'; -import { ActionOnCriteria, CriteriaDataType, CriteriaOperator, diff } from 'ui-frontend-common'; -import { ArchiveSharedDataService } from '../../services/archive-shared-data.service'; +import { + ActionOnCriteria, CriteriaDataType, CriteriaOperator, CriteriaValue, diff, SearchCriteriaEltDto, SearchCriteriaTypeEnum +} from 'ui-frontend-common'; import { ArchiveSearchConstsEnum } from '../../models/archive-search-consts-enum'; -import { CriteriaValue, SearchCriteriaEltDto, SearchCriteriaTypeEnum } from '../../models/search.criteria'; +import { ArchiveSharedDataService } from '../../services/archive-shared-data.service'; import { RuleValidator } from '../../services/rule.validator'; const RULE_TYPE_SUFFIX = '_STORAGE_RULE'; diff --git a/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/components/title-and-description-criteria-search-collect/title-and-description-criteria-search-collect.component.ts b/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/components/title-and-description-criteria-search-collect/title-and-description-criteria-search-collect.component.ts index 898c9333261..9391a720326 100644 --- a/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/components/title-and-description-criteria-search-collect/title-and-description-criteria-search-collect.component.ts +++ b/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/components/title-and-description-criteria-search-collect/title-and-description-criteria-search-collect.component.ts @@ -39,10 +39,9 @@ import { FormBuilder, FormGroup } from '@angular/forms'; import { MatDialog } from '@angular/material/dialog'; import { merge } from 'rxjs'; import { debounceTime, filter, map } from 'rxjs/operators'; -import { CriteriaDataType, CriteriaOperator, diff } from 'ui-frontend-common'; -import { ArchiveSharedDataService } from '../../services/archive-shared-data.service'; +import { CriteriaDataType, CriteriaOperator, CriteriaValue, diff, SearchCriteriaTypeEnum } from 'ui-frontend-common'; import { ArchiveSearchConstsEnum } from '../../models/archive-search-consts-enum'; -import { CriteriaValue, SearchCriteriaTypeEnum } from '../../models/search.criteria'; +import { ArchiveSharedDataService } from '../../services/archive-shared-data.service'; const TITLE_OR_DESCRIPTION = 'TITLE_OR_DESCRIPTION'; diff --git a/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/models/rule-action.interface.ts b/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/models/rule-action.interface.ts index 6b81c5cca3d..62171d3adea 100644 --- a/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/models/rule-action.interface.ts +++ b/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/models/rule-action.interface.ts @@ -34,7 +34,7 @@ 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. */ -import { SearchCriteriaDto } from './search.criteria'; +import { SearchCriteriaDto } from 'ui-frontend-common'; export interface ActionsRules { ruleType: string; diff --git a/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/services/archive-facets.service.ts b/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/services/archive-facets.service.ts index 7d3ce62f7be..63b04923903 100644 --- a/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/services/archive-facets.service.ts +++ b/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/services/archive-facets.service.ts @@ -34,26 +34,20 @@ 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. */ import { Injectable } from '@angular/core'; +import { ArchiveSearchResultFacets, ResultFacet, ResultFacetList, RuleFacets, SearchCriteriaMgtRuleEnum, } from 'ui-frontend-common'; import { ArchiveSearchConstsEnum } from '../models/archive-search-consts-enum'; -import { - ArchiveSearchResultFacets, - ResultFacet, - ResultFacetList, - RuleFacets, - SearchCriteriaMgtRuleEnum, -} from './../models/search.criteria'; @Injectable({ providedIn: 'root', }) export class ArchiveFacetsService { - RULES_COMPUTED_NUMBER_PREFIX: string = 'RULES_COMPUTED_NUMBER_'; - FINAL_ACTION_COMPUTED_PREFIX: string = 'FINAL_ACTION_COMPUTED_'; - EXPIRED_RULES_COMPUTED_PREFIX: string = 'EXPIRED_RULES_COMPUTED_'; - UNEXPIRED_RULES_COMPUTED_PREFIX: string = 'UNEXPIRED_RULES_COMPUTED_'; - COUNT_WITHOUT_RULES_PREFIX: string = 'COUNT_WITHOUT_RULES_'; - COMPUTE_RULES_AU_NUMBER: string = 'COMPUTE_RULES_AU_NUMBER'; - COUNT_BY_NODE: string = 'COUNT_BY_NODE'; + RULES_COMPUTED_NUMBER_PREFIX = 'RULES_COMPUTED_NUMBER_'; + FINAL_ACTION_COMPUTED_PREFIX = 'FINAL_ACTION_COMPUTED_'; + EXPIRED_RULES_COMPUTED_PREFIX = 'EXPIRED_RULES_COMPUTED_'; + UNEXPIRED_RULES_COMPUTED_PREFIX = 'UNEXPIRED_RULES_COMPUTED_'; + COUNT_WITHOUT_RULES_PREFIX = 'COUNT_WITHOUT_RULES_'; + COMPUTE_RULES_AU_NUMBER = 'COMPUTE_RULES_AU_NUMBER'; + COUNT_BY_NODE = 'COUNT_BY_NODE'; extractNodesFacetsResults(facetResults: ResultFacetList[]): ResultFacet[] { const nodesFacets: ResultFacet[] = []; @@ -71,7 +65,7 @@ export class ArchiveFacetsService { } extractRulesFacetsResults(facetResults: ResultFacetList[]): ArchiveSearchResultFacets { - let archiveSearchResultFacets: ArchiveSearchResultFacets = new ArchiveSearchResultFacets(); + const archiveSearchResultFacets: ArchiveSearchResultFacets = new ArchiveSearchResultFacets(); if (facetResults) { archiveSearchResultFacets.appraisalRuleFacets = this.extractRulesFacetsResultsByCategory( @@ -111,6 +105,7 @@ export class ArchiveFacetsService { } return archiveSearchResultFacets; } + private extractRulesFacetsResultsByCategory(facetResults: ResultFacetList[], category: string): RuleFacets { const rulesFacets = new RuleFacets(); if (facetResults && facetResults.length > 0) { diff --git a/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/services/archive-search-helper.service.ts b/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/services/archive-search-helper.service.ts index 03c0fb74766..40dd501623b 100644 --- a/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/services/archive-search-helper.service.ts +++ b/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/services/archive-search-helper.service.ts @@ -36,16 +36,11 @@ knowledge of the CeCILL-C license and that you accept its terms. import { Injectable } from '@angular/core'; import { MatSnackBar } from '@angular/material/snack-bar'; -import { ActionOnCriteria, CriteriaDataType, CriteriaOperator, FilingHoldingSchemeNode } from 'ui-frontend-common'; -import { VitamUISnackBarComponent } from '../../../shared/vitamui-snack-bar'; import { - CriteriaValue, - SearchCriteria, - SearchCriteriaEltDto, - SearchCriteriaStatusEnum, - SearchCriteriaTypeEnum, - SearchCriteriaValue, -} from '../models/search.criteria'; + ActionOnCriteria, CriteriaDataType, CriteriaOperator, CriteriaValue, FilingHoldingSchemeNode, ORPHANS_NODE_ID, SearchCriteria, + SearchCriteriaEltDto, SearchCriteriaStatusEnum, SearchCriteriaTypeEnum, SearchCriteriaValue +} from 'ui-frontend-common'; +import { VitamUISnackBarComponent } from '../../../shared/vitamui-snack-bar'; import { ArchiveSharedDataService } from './archive-shared-data.service'; const ALL_ARCHIVE_UNIT_TYPES = 'ALL_ARCHIVE_UNIT_TYPES'; @@ -70,119 +65,122 @@ export class ArchiveSearchHelperService { dataType: string, emit: boolean ) { - if (keyElt && valueElt) { - if (valueElt && valueElt.id === ORIGIN_WAITING_RECALCULATE) { - this.addCriteria( - searchCriterias, - searchCriteriaKeys, - nbQueryCriteria, - WAITING_RECALCULATE, - { id: WAITING_RECALCULATE, value: 'true' }, - labelElt, - keyTranslated, - operator, - SearchCriteriaTypeEnum.FIELDS, - valueTranslated, - dataType, - emit + if (!keyElt) { + return; + } + if (valueElt && valueElt.id === ORIGIN_WAITING_RECALCULATE) { + this.addCriteria( + searchCriterias, + searchCriteriaKeys, + nbQueryCriteria, + WAITING_RECALCULATE, + { id: WAITING_RECALCULATE, value: 'true' }, + labelElt, + keyTranslated, + operator, + SearchCriteriaTypeEnum.FIELDS, + valueTranslated, + dataType, + emit + ); + if (category === SearchCriteriaTypeEnum.ACCESS_RULE) { + this.archiveExchangeDataService.sendAppraisalFromMainSearchCriteriaAction({ keyElt, valueElt, action: ActionOnCriteria.ADD }); + } + if (category === SearchCriteriaTypeEnum.APPRAISAL_RULE) { + this.archiveExchangeDataService.sendAccessFromMainSearchCriteriaAction({ keyElt, valueElt, action: ActionOnCriteria.ADD }); + } + if (category === SearchCriteriaTypeEnum.STORAGE_RULE) { + this.archiveExchangeDataService.sendStorageFromMainSearchCriteriaAction({ keyElt, valueElt, action: ActionOnCriteria.ADD }); + } + if (category === SearchCriteriaTypeEnum.REUSE_RULE) { + this.archiveExchangeDataService.sendReuseFromMainSearchCriteriaAction({ keyElt, valueElt, action: ActionOnCriteria.ADD }); + } + if (category === SearchCriteriaTypeEnum.DISSEMINATION_RULE) { + this.archiveExchangeDataService.sendDisseminationFromMainSearchCriteriaAction({ keyElt, valueElt, action: ActionOnCriteria.ADD }); + } + return; + } + if (!searchCriterias) { + return; + } + nbQueryCriteria++; + let criteria: SearchCriteria; + if (searchCriterias.has(keyElt)) { + criteria = searchCriterias.get(keyElt); + let values = criteria.values; + if (!values || values.length === 0) { + values = []; + } + if (valueElt) { + const filtredValues = values.filter((elt) => + criteria.dataType === CriteriaDataType.STRING || criteria.dataType === CriteriaDataType.DATE + ? elt.value.value === valueElt?.value + : elt.value.beginInterval === valueElt.beginInterval && elt.value.endInterval === valueElt.endInterval ); - - if (category === SearchCriteriaTypeEnum.ACCESS_RULE) { - this.archiveExchangeDataService.sendAppraisalFromMainSearchCriteriaAction({ keyElt, valueElt, action: ActionOnCriteria.ADD }); - } - if (category === SearchCriteriaTypeEnum.APPRAISAL_RULE) { - this.archiveExchangeDataService.sendAccessFromMainSearchCriteriaAction({ keyElt, valueElt, action: ActionOnCriteria.ADD }); - } - if (category === SearchCriteriaTypeEnum.STORAGE_RULE) { - this.archiveExchangeDataService.sendStorageFromMainSearchCriteriaAction({ keyElt, valueElt, action: ActionOnCriteria.ADD }); - } - if (category === SearchCriteriaTypeEnum.REUSE_RULE) { - this.archiveExchangeDataService.sendReuseFromMainSearchCriteriaAction({ keyElt, valueElt, action: ActionOnCriteria.ADD }); - } - - if (category === SearchCriteriaTypeEnum.DISSEMINATION_RULE) { - this.archiveExchangeDataService.sendDisseminationFromMainSearchCriteriaAction({ keyElt, valueElt, action: ActionOnCriteria.ADD }); - } - } else if (searchCriterias) { - nbQueryCriteria++; - let criteria: SearchCriteria; - if (searchCriterias.has(keyElt)) { - criteria = searchCriterias.get(keyElt); - let values = criteria.values; - if (!values || values.length === 0) { - values = []; - } - - const filtredValues = values.filter((elt) => - criteria.dataType === CriteriaDataType.STRING || criteria.dataType === CriteriaDataType.DATE - ? elt.value.value === valueElt.value - : elt.value.beginInterval === valueElt.beginInterval && elt.value.endInterval === valueElt.endInterval - ); - if (filtredValues.length === 0) { - values.push({ - value: valueElt, - label: labelElt, - valueShown: true, - status: SearchCriteriaStatusEnum.NOT_INCLUDED, - keyTranslated, - valueTranslated, - }); - criteria.values = values; - searchCriterias.set(keyElt, criteria); - } - } else { - if (searchCriteriaKeys.indexOf(keyElt) === -1) { - if (category === SearchCriteriaTypeEnum.NODES) { - searchCriteriaKeys.unshift(keyElt); - } else { - searchCriteriaKeys.push(keyElt); - } - } - const values = []; + if (filtredValues.length === 0) { values.push({ value: valueElt, label: labelElt, - id: valueElt.id, valueShown: true, status: SearchCriteriaStatusEnum.NOT_INCLUDED, keyTranslated, valueTranslated, }); - const criteriaToAdd = { - key: keyElt, - values, - operator, - category, - keyTranslated, - valueTranslated, - dataType, - }; - searchCriterias.set(keyElt, criteriaToAdd); - } - if (emit === true && category === SearchCriteriaTypeEnum.APPRAISAL_RULE) { - this.archiveExchangeDataService.sendAppraisalFromMainSearchCriteriaAction({ keyElt, valueElt, action: ActionOnCriteria.ADD }); - } - if (emit === true && category === SearchCriteriaTypeEnum.ACCESS_RULE) { - this.archiveExchangeDataService.sendAccessFromMainSearchCriteriaAction({ keyElt, valueElt, action: ActionOnCriteria.ADD }); - } - if (emit === true && category === SearchCriteriaTypeEnum.STORAGE_RULE) { - this.archiveExchangeDataService.sendStorageFromMainSearchCriteriaAction({ keyElt, valueElt, action: ActionOnCriteria.ADD }); } - if (emit === true && category === SearchCriteriaTypeEnum.REUSE_RULE) { - this.archiveExchangeDataService.sendReuseFromMainSearchCriteriaAction({ - keyElt, - valueElt, - action: ActionOnCriteria.ADD, - }); - } - if (emit === true && category === SearchCriteriaTypeEnum.DISSEMINATION_RULE) { - this.archiveExchangeDataService.sendDisseminationFromMainSearchCriteriaAction({ - keyElt, - valueElt, - action: ActionOnCriteria.ADD, - }); + criteria.values = values; + searchCriterias.set(keyElt, criteria); + } + } else { + if (searchCriteriaKeys.indexOf(keyElt) === -1) { + if (category === SearchCriteriaTypeEnum.NODES) { + searchCriteriaKeys.unshift(keyElt); + } else { + searchCriteriaKeys.push(keyElt); } } + const values = []; + values.push({ + value: valueElt, + label: labelElt, + id: valueElt?.id, + valueShown: true, + status: SearchCriteriaStatusEnum.NOT_INCLUDED, + keyTranslated, + valueTranslated, + }); + const criteriaToAdd = { + key: keyElt, + values, + operator, + category, + keyTranslated, + valueTranslated, + dataType, + }; + searchCriterias.set(keyElt, criteriaToAdd); + } + if (emit === true && category === SearchCriteriaTypeEnum.APPRAISAL_RULE) { + this.archiveExchangeDataService.sendAppraisalFromMainSearchCriteriaAction({ keyElt, valueElt, action: ActionOnCriteria.ADD }); + } + if (emit === true && category === SearchCriteriaTypeEnum.ACCESS_RULE) { + this.archiveExchangeDataService.sendAccessFromMainSearchCriteriaAction({ keyElt, valueElt, action: ActionOnCriteria.ADD }); + } + if (emit === true && category === SearchCriteriaTypeEnum.STORAGE_RULE) { + this.archiveExchangeDataService.sendStorageFromMainSearchCriteriaAction({ keyElt, valueElt, action: ActionOnCriteria.ADD }); + } + if (emit === true && category === SearchCriteriaTypeEnum.REUSE_RULE) { + this.archiveExchangeDataService.sendReuseFromMainSearchCriteriaAction({ + keyElt, + valueElt, + action: ActionOnCriteria.ADD, + }); + } + if (emit === true && category === SearchCriteriaTypeEnum.DISSEMINATION_RULE) { + this.archiveExchangeDataService.sendDisseminationFromMainSearchCriteriaAction({ + keyElt, + valueElt, + action: ActionOnCriteria.ADD, + }); } } @@ -278,10 +276,12 @@ export class ArchiveSearchHelperService { nbQueryCriteria ); } - searchCriterias.forEach((val, key) => { + searchCriterias.forEach((searchCriteria, key) => { if (key === keyElt) { - let values = val.values; - values = values.filter((item) => item.value.id !== valueElt.id); + let values = searchCriteria.values; + if (valueElt) { + values = values.filter((item) => item.value.id !== valueElt.id); + } if (values.length === 0) { searchCriteriaKeys.forEach((element, index) => { if (element === keyElt) { @@ -290,50 +290,50 @@ export class ArchiveSearchHelperService { }); searchCriterias.delete(keyElt); } else { - val.values = values; - searchCriterias.set(keyElt, val); + searchCriteria.values = values; + searchCriterias.set(keyElt, searchCriteria); } nbQueryCriteria--; - if (emit === true && key === 'NODE') { + if (emit === true && (key === 'NODE' || key === ORPHANS_NODE_ID)) { this.archiveExchangeDataService.emitNodeTarget(valueElt.value); } - if (emit === true && val.category === SearchCriteriaTypeEnum.APPRAISAL_RULE) { + if (emit === true && searchCriteria.category === SearchCriteriaTypeEnum.APPRAISAL_RULE) { this.archiveExchangeDataService.sendAppraisalFromMainSearchCriteriaAction({ keyElt, valueElt, action: ActionOnCriteria.REMOVE, }); } - if (emit === true && val.category === SearchCriteriaTypeEnum.ACCESS_RULE) { + if (emit === true && searchCriteria.category === SearchCriteriaTypeEnum.ACCESS_RULE) { this.archiveExchangeDataService.sendAccessFromMainSearchCriteriaAction({ keyElt, valueElt, action: ActionOnCriteria.REMOVE, }); } - if (emit === true && val.category === SearchCriteriaTypeEnum.STORAGE_RULE) { + if (emit === true && searchCriteria.category === SearchCriteriaTypeEnum.STORAGE_RULE) { this.archiveExchangeDataService.sendStorageFromMainSearchCriteriaAction({ keyElt, valueElt, action: ActionOnCriteria.REMOVE, }); } - if (emit === true && val.category === SearchCriteriaTypeEnum.REUSE_RULE) { + if (emit === true && searchCriteria.category === SearchCriteriaTypeEnum.REUSE_RULE) { this.archiveExchangeDataService.sendReuseFromMainSearchCriteriaAction({ keyElt, valueElt, action: ActionOnCriteria.REMOVE, }); } - if (emit === true && val.category === SearchCriteriaTypeEnum.DISSEMINATION_RULE) { + if (emit === true && searchCriteria.category === SearchCriteriaTypeEnum.DISSEMINATION_RULE) { this.archiveExchangeDataService.sendDisseminationFromMainSearchCriteriaAction({ keyElt, valueElt, action: ActionOnCriteria.REMOVE, }); } - if (emit === true && val.category === SearchCriteriaTypeEnum.FIELDS && val.key === ALL_ARCHIVE_UNIT_TYPES) { + if (emit === true && searchCriteria.category === SearchCriteriaTypeEnum.FIELDS && searchCriteria.key === ALL_ARCHIVE_UNIT_TYPES) { this.archiveExchangeDataService.sendRemoveFromChildSearchCriteriaAction({ keyElt, valueElt, @@ -358,6 +358,7 @@ export class ArchiveSearchHelperService { }); }); } + openSnackBarForWorkflow(snackBar: MatSnackBar, message: string, serviceUrl?: string) { snackBar.openFromComponent(VitamUISnackBarComponent, { panelClass: 'vitamui-snack-bar', @@ -401,6 +402,7 @@ export class ArchiveSearchHelperService { } return defaultFacetTabIndex; } + checkIfRulesFacetsCanBeComputed(searchCriterias: Map): boolean { let hasMgtRuleCriteria = false; if (searchCriterias && searchCriterias.size > 0) { @@ -448,7 +450,7 @@ export class ArchiveSearchHelperService { criteria.values.forEach((elt) => { strValues.push(elt.value); }); - let replacedCriteria = criteria.key.replace('_' + managementRuleType, ''); + const replacedCriteria = criteria.key.replace('_' + managementRuleType, ''); criteriaSearchList.push({ criteria: replacedCriteria, @@ -527,9 +529,11 @@ export class ArchiveSearchHelperService { isAppraisalRuleCriteria(criteria: SearchCriteria): boolean { return SearchCriteriaTypeEnum[criteria.category] === SearchCriteriaTypeEnum.APPRAISAL_RULE; } + isAccessRuleCriteria(criteria: SearchCriteria): boolean { return SearchCriteriaTypeEnum[criteria.category] === SearchCriteriaTypeEnum.ACCESS_RULE; } + isStorageRuleCriteria(criteria: SearchCriteria): boolean { return SearchCriteriaTypeEnum[criteria.category] === SearchCriteriaTypeEnum.STORAGE_RULE; } @@ -537,15 +541,19 @@ export class ArchiveSearchHelperService { isClassificationRuleCriteria(criteria: SearchCriteria): boolean { return SearchCriteriaTypeEnum[criteria.category] === SearchCriteriaTypeEnum.CLASSIFICATION_RULE; } + isDisseminationRuleCriteria(criteria: SearchCriteria): boolean { return SearchCriteriaTypeEnum[criteria.category] === SearchCriteriaTypeEnum.DISSEMINATION_RULE; } + isReuseRuleCriteria(criteria: SearchCriteria): boolean { return SearchCriteriaTypeEnum[criteria.category] === SearchCriteriaTypeEnum.REUSE_RULE; } + isWaitingToRecalculateCriteria(criteriaKey: string): boolean { return criteriaKey === 'WAITING_RECALCULATE' || criteriaKey === 'ORIGIN_WAITING_RECALCULATE'; } + isEliminationTenchnicalIdCriteria(criteriaKey: string): boolean { return criteriaKey === 'ELIMINATION_TECHNICAL_ID_APPRAISAL_RULE'; } diff --git a/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/services/archive-shared-data.service.ts b/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/services/archive-shared-data.service.ts index 3f3585965e7..64972a10e82 100644 --- a/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/services/archive-shared-data.service.ts +++ b/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/services/archive-shared-data.service.ts @@ -35,10 +35,11 @@ knowledge of the CeCILL-C license and that you accept its terms. */ import { Injectable } from '@angular/core'; import { BehaviorSubject, Observable } from 'rxjs'; -import {Direction, FilingHoldingSchemeNode, Unit} from 'ui-frontend-common'; +import { + Direction, FilingHoldingSchemeNode, ResultFacet, SearchCriteriaAddAction, SearchCriteriaDto, SearchCriteriaHistory, + SearchCriteriaRemoveAction, Unit +} from 'ui-frontend-common'; import { NodeData } from '../models/nodedata.interface'; -import { SearchCriteriaHistory } from '../models/search-criteria-history.interface'; -import { ResultFacet, SearchCriteriaAddAction, SearchCriteriaDto, SearchCriteriaRemoveAction } from '../models/search.criteria'; @Injectable({ providedIn: 'root', @@ -99,12 +100,6 @@ export class ArchiveSharedDataService { reuseFromMainSearchCriteriaObservable = this.searchReuseCriteriaActionFromMainSubject.asObservable(); disseminationFromMainSearchCriteriaObservable = this.searchDisseminationCriteriaActionFromMainSubject.asObservable(); - removeFromApraisalSearchCriteriaObservable = this.searchCriteriaRemoveFromChildSubject.asObservable(); - - filingHoldingNodes = this.filingHoldingNodesSubject.asObservable(); - - entireNodesObservable = this.entireNodes.asObservable(); - constructor() {} emitRuleCategory(ruleCategory: string) { diff --git a/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/services/management-rules-shared-data.service.ts b/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/services/management-rules-shared-data.service.ts index 1772e5d54f1..eedcb211511 100644 --- a/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/services/management-rules-shared-data.service.ts +++ b/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/services/management-rules-shared-data.service.ts @@ -37,9 +37,8 @@ knowledge of the CeCILL-C license and that you accept its terms. import { HttpHeaders } from '@angular/common/http'; import { Injectable } from '@angular/core'; import { BehaviorSubject, Observable } from 'rxjs'; -import { Rule, RuleApiService } from 'ui-frontend-common'; +import { Rule, RuleApiService, SearchCriteriaDto, SearchCriteriaEltDto } from 'ui-frontend-common'; import { ActionsRules, ManagementRules } from '../models/rule-action.interface'; -import { SearchCriteriaDto, SearchCriteriaEltDto } from '../models/search.criteria'; @Injectable({ providedIn: 'root', diff --git a/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/services/search-criteria-saver.service.ts b/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/services/search-criteria-saver.service.ts index e1eba6a30a1..68edac46534 100644 --- a/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/services/search-criteria-saver.service.ts +++ b/ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/services/search-criteria-saver.service.ts @@ -36,9 +36,8 @@ knowledge of the CeCILL-C license and that you accept its terms. import { HttpClient } from '@angular/common/http'; import { Injectable } from '@angular/core'; import { Observable } from 'rxjs'; -import { SearchService } from 'ui-frontend-common'; +import { SearchCriteriaHistory, SearchService } from 'ui-frontend-common'; import { ProjectsApiService } from '../../../core/api/project-api.service'; -import { SearchCriteriaHistory } from '../models/search-criteria-history.interface'; @Injectable({ providedIn: 'root' diff --git a/ui/ui-frontend/projects/collect/src/app/collect/core/api/project-api.service.ts b/ui/ui-frontend/projects/collect/src/app/collect/core/api/project-api.service.ts index 2d78ab42096..c5d6c057dfd 100644 --- a/ui/ui-frontend/projects/collect/src/app/collect/core/api/project-api.service.ts +++ b/ui/ui-frontend/projects/collect/src/app/collect/core/api/project-api.service.ts @@ -37,8 +37,7 @@ knowledge of the CeCILL-C license and that you accept its terms. import { HttpClient, HttpHeaders } from '@angular/common/http'; import { Inject, Injectable } from '@angular/core'; import { Observable } from 'rxjs'; -import { BaseHttpClient, BASE_URL, PageRequest, PaginatedResponse, Project, Transaction } from 'ui-frontend-common'; -import { SearchCriteriaHistory } from '../models'; +import { BaseHttpClient, BASE_URL, PageRequest, PaginatedResponse, Project, SearchCriteriaHistory, Transaction } from 'ui-frontend-common'; @Injectable({ providedIn: 'root', diff --git a/ui/ui-frontend/projects/collect/src/app/collect/core/api/transaction-api.service.ts b/ui/ui-frontend/projects/collect/src/app/collect/core/api/transaction-api.service.ts index 63bf3b88a58..daa05958e12 100644 --- a/ui/ui-frontend/projects/collect/src/app/collect/core/api/transaction-api.service.ts +++ b/ui/ui-frontend/projects/collect/src/app/collect/core/api/transaction-api.service.ts @@ -34,21 +34,12 @@ 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. */ -import {HttpClient, HttpHeaders} from '@angular/common/http'; -import {Inject, Injectable} from '@angular/core'; -import {Observable} from 'rxjs'; +import { HttpClient, HttpHeaders } from '@angular/common/http'; +import { Inject, Injectable } from '@angular/core'; +import { Observable } from 'rxjs'; import { - ApiUnitObject, - BASE_URL, - BaseHttpClient, - Ontology, - PageRequest, - PaginatedResponse, - Transaction, - Unit + ApiUnitObject, BaseHttpClient, BASE_URL, Ontology, PageRequest, PaginatedResponse, SearchCriteriaDto, SearchResponse, Transaction, Unit } from 'ui-frontend-common'; -import {SearchResponse} from '../../archive-search-collect/archive-search-criteria/models/search-response.interface'; -import {SearchCriteriaDto} from '../../archive-search-collect/archive-search-criteria/models/search.criteria'; @Injectable({ providedIn: 'root', @@ -102,11 +93,11 @@ export class TransactionApiService extends BaseHttpClient { // Manage Archive Units getCollectUnitById(unitId: string, headers?: HttpHeaders) { - return this.http.get(this.apiUrl + '/archive-units/archiveunit/' + unitId, {headers}); + return this.http.get(this.apiUrl + '/archive-units/archiveunit/' + unitId, { headers }); } searchArchiveUnitsByCriteria(criteriaDto: SearchCriteriaDto, tranasctionId: string, headers?: HttpHeaders): Observable { - return this.http.post(`${this.apiUrl}/archive-units/${tranasctionId}/search`, criteriaDto, {headers}); + return this.http.post(`${this.apiUrl}/archive-units/${tranasctionId}/search`, criteriaDto, { headers }); } exportCsvSearchArchiveUnitsByCriteria(criteriaDto: SearchCriteriaDto, tranasctionId: string, headers?: HttpHeaders): Observable { @@ -118,7 +109,7 @@ export class TransactionApiService extends BaseHttpClient { // Get the technical group object of a unit getObjectGroupDetailsById(objectId: string, headers?: HttpHeaders): Observable { - return this.http.get(this.apiUrl + '/objects/' + objectId, {headers, responseType: 'json'}); + return this.http.get(this.apiUrl + '/objects/' + objectId, { headers, responseType: 'json' }); } getExternalOntologiesList(): Observable { @@ -126,6 +117,6 @@ export class TransactionApiService extends BaseHttpClient { } selectUnitWithInheritedRules(tranasctionId: string, criteriaDto: SearchCriteriaDto, headers?: HttpHeaders): Observable { - return this.http.post(`${this.apiUrl}/${tranasctionId}/unit-with-inherited-rules`, criteriaDto, {headers}); + return this.http.post(`${this.apiUrl}/${tranasctionId}/unit-with-inherited-rules`, criteriaDto, { headers }); } } diff --git a/ui/ui-frontend/projects/collect/src/app/collect/core/models/index.ts b/ui/ui-frontend/projects/collect/src/app/collect/core/models/index.ts index 5b8010abf11..98bbf4ddbf7 100644 --- a/ui/ui-frontend/projects/collect/src/app/collect/core/models/index.ts +++ b/ui/ui-frontend/projects/collect/src/app/collect/core/models/index.ts @@ -1,5 +1,3 @@ export * from '../../archive-search-collect/archive-search-criteria/models/archive-search-consts-enum'; export * from '../../archive-search-collect/archive-search-criteria/models/nodedata.interface'; -export * from '../../archive-search-collect/archive-search-criteria/models/search.criteria'; -export * from '../../archive-search-collect/archive-search-criteria/models/search-criteria-history.interface'; export * from '../../archive-search-collect/archive-search-criteria/models/search-response.interface'; diff --git a/ui/ui-frontend/projects/collect/src/app/collect/transactions/transactions.service.ts b/ui/ui-frontend/projects/collect/src/app/collect/transactions/transactions.service.ts index 6c9dab0d819..a664002fd88 100644 --- a/ui/ui-frontend/projects/collect/src/app/collect/transactions/transactions.service.ts +++ b/ui/ui-frontend/projects/collect/src/app/collect/transactions/transactions.service.ts @@ -54,8 +54,7 @@ export class TransactionsService extends SearchService { return this.project$; } - public search(pageRequest: PageRequest = null): Observable { - console.log(pageRequest); + public search(_: PageRequest = null): Observable { return this.transactions$; } diff --git a/ui/ui-frontend/projects/vitamui-library/src/lib/api/search-unit-api.service.ts b/ui/ui-frontend/projects/vitamui-library/src/lib/api/search-unit-api.service.ts index 91454dcacf4..c01457338ab 100644 --- a/ui/ui-frontend/projects/vitamui-library/src/lib/api/search-unit-api.service.ts +++ b/ui/ui-frontend/projects/vitamui-library/src/lib/api/search-unit-api.service.ts @@ -2,8 +2,7 @@ import { HttpClient, HttpHeaders } from '@angular/common/http'; import { Inject, Injectable } from '@angular/core'; import { Observable } from 'rxjs'; -import { BASE_URL } from 'ui-frontend-common'; -import { SearchResponse } from '../models/search-response.interface'; +import { BASE_URL, SearchResponse } from 'ui-frontend-common'; @Injectable({ providedIn: 'root' diff --git a/ui/ui-frontend/projects/vitamui-library/src/lib/models/search-response.interface.ts b/ui/ui-frontend/projects/vitamui-library/src/lib/models/search-response.interface.ts deleted file mode 100644 index 60a771ed9f6..00000000000 --- a/ui/ui-frontend/projects/vitamui-library/src/lib/models/search-response.interface.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { Unit } from './unit.interface'; - -export interface SearchResponse { - $hits: any; - $results: T[]; - $facetResults?: any[]; -} diff --git a/ui/ui-frontend/projects/vitamui-library/src/lib/models/search.criteria.ts b/ui/ui-frontend/projects/vitamui-library/src/lib/models/search.criteria.ts deleted file mode 100644 index 30e28c8136e..00000000000 --- a/ui/ui-frontend/projects/vitamui-library/src/lib/models/search.criteria.ts +++ /dev/null @@ -1,156 +0,0 @@ -/* - * 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 SearchCriteriaStatusEnum { - NOT_INCLUDED = 'NOT_INCLUDED', - INCLUDED = 'INCLUDED', - IN_PROGRESS = 'IN_PROGRESS', -} - -export enum SearchCriteriaTypeEnum { - FIELDS = 'FIELDS', - APPRAISAL_RULE = 'APPRAISAL_RULE', - ACCESS_RULE = 'ACCESS_RULE', - CLASSIFICATION_RULE = 'CLASSIFICATION_RULE', - DISSEMINATION_RULE = 'DISSEMINATION_RULE', - REUSE_RULE = 'REUSE_RULE', - STORAGE_RULE = 'STORAGE_RULE', - HOLD_RULE = 'HOLD_RULE', - NODES = 'NODES', -} - -export interface SearchCriteriaValue { - value?: CriteriaValue; - label?: string; - valueShown?: boolean; - status: SearchCriteriaStatusEnum; - keyTranslated: boolean; - valueTranslated: boolean; -} - -export interface SearchCriteriaAddAction { - keyElt: string; - valueElt: CriteriaValue; - labelElt: string; - keyTranslated: boolean; - operator: string; - category: SearchCriteriaTypeEnum; - valueTranslated: boolean; - dataType: string; -} - -export interface SearchCriteriaRemoveAction { - keyElt: string; - valueElt: CriteriaValue; - action: 'REMOVE' | 'ADD'; -} - -export interface SearchCriteria { - key: string; - operator: string; - category: SearchCriteriaTypeEnum; - values: SearchCriteriaValue[]; - keyTranslated: boolean; - valueTranslated: boolean; - dataType: string; -} - -export interface SearchCriteriaEltDto { - criteria: string; - operator: string; - category: string; - values: CriteriaValue[]; - dataType: string; -} -export interface SearchCriteriaDto { - criteriaList: SearchCriteriaEltDto[]; - pageNumber: number; - size: number; - sortingCriteria?: SearchCriteriaSort; - language?: string; - trackTotalHits?: boolean; - computeFacets?: boolean; -} - -export interface PagedResult { - results: any[]; - pageNumbers: number; - totalResults: number; - facets?: ResultFacetList[]; -} - -export interface ResultFacetList { - name: string; - buckets: ResultBucket[]; -} -export interface ResultBucket { - value: string; - count: number; -} -export interface ResultFacet { - node: string; - count: number; -} - -export interface SearchCriteriaSort { - criteria: string; - sorting: 'ASC' | 'DESC'; -} - -export interface SearchCriteriaCategory { - name: string; - index: number; -} -export interface CriteriaValue { - id: string; - value?: string; - beginInterval?: string; - endInterval?: string; -} - -export class ArchiveSearchResultFacets { - nodesFacets?: ResultFacet[]; - appraisalRuleFacets?: RuleFacets; - accessRuleFacets?: RuleFacets; -} - -export class RuleFacets { - waitingToRecalculateRulesListFacets: ResultFacet[]; - expiredRulesListFacets: ResultFacet[]; - rulesListFacets: ResultFacet[]; - finalActionsFacets?: ResultFacet[]; - noRulesFacets: ResultFacet[]; -} diff --git a/ui/ui-frontend/projects/vitamui-library/src/public-api.ts b/ui/ui-frontend/projects/vitamui-library/src/public-api.ts index fe1ad0fe9a6..007c1a822bd 100644 --- a/ui/ui-frontend/projects/vitamui-library/src/public-api.ts +++ b/ui/ui-frontend/projects/vitamui-library/src/public-api.ts @@ -42,7 +42,6 @@ export * from './lib/models/ontology'; export * from './lib/models/precise-date-query.interface'; export * from './lib/models/search-criteria.interface'; export * from './lib/models/search-query.interface'; -export * from './lib/models/search-response.interface'; export * from './lib/models/unit.interface'; export * from './lib/models/year-month-query.interface'; /* SERVICES */