diff --git a/ui/ui-frontend/projects/pastis/src/app/core/classes/models.ts b/ui/ui-frontend/projects/pastis/src/app/core/classes/models.ts index da5251b51b27b584c2ec2b8a60d7012b50645ebb..8764048e900ace6f4c61f98b01feaa692c79f0d0 100644 --- a/ui/ui-frontend/projects/pastis/src/app/core/classes/models.ts +++ b/ui/ui-frontend/projects/pastis/src/app/core/classes/models.ts @@ -43,6 +43,7 @@ export interface CardinalityValues { export interface MetadataHeaders { id: number; nomDuChamp: string; + nomDuChampFr: string; type: string; valeurFixe: string; cardinalite: string[]; diff --git a/ui/ui-frontend/projects/pastis/src/app/core/services/file.service.ts b/ui/ui-frontend/projects/pastis/src/app/core/services/file.service.ts index 619db9f915e04c1443f2eee2526fba30ed4e3294..529a23c8ce7392f989b4a974ab7f8e45c0255eb9 100644 --- a/ui/ui-frontend/projects/pastis/src/app/core/services/file.service.ts +++ b/ui/ui-frontend/projects/pastis/src/app/core/services/file.service.ts @@ -117,40 +117,42 @@ export class FileService implements OnDestroy { Array.prototype.forEach.call(nodes, (node: FileNode) => { node.parent = parent; let nodeName : string = (node.name === 'xml:id') ? 'id' : node.name; - let sedaDataMatch: SedaData; + if (nodeName) { + let sedaDataMatch: SedaData; - // Si le node en cours est une ArchiveUnit, lui même enfant d'une ArchiveUnit... - if (nodeName === 'ArchiveUnit' && this.sedaDataArchiveUnit != undefined) { - // Alors on utilise la définition SEDA de l'ArchiveUnit mère.. - sedaDataMatch = this.sedaDataArchiveUnit; - } else { - // Sinon on recherche la définition SEDA dans l'arbre - sedaDataMatch = sedaData.find(seda => seda.Name === nodeName); - //sedaDataMatch = this.sedaService.getSedaNodeRecursively(sedaData[0],nodeName) - } - if (!sedaDataMatch){ - // Sometimes,the sedaData has no property children, but many siblings (e.g. elements on the same level of the tree) - // In this case, the recursivity must be used on each symbling since the service getSedaNodeRecursively - // expects a tree root element with Children key - for (const element of sedaData) { - let resultRecursity = this.sedaService.getSedaNodeRecursively(element,nodeName); - if (resultRecursity) { - sedaDataMatch = resultRecursity; - break; + // Si le node en cours est une ArchiveUnit, lui même enfant d'une ArchiveUnit... + if (nodeName === 'ArchiveUnit' && this.sedaDataArchiveUnit != undefined) { + // Alors on utilise la définition SEDA de l'ArchiveUnit mère.. + sedaDataMatch = this.sedaDataArchiveUnit; + } else { + // Sinon on recherche la définition SEDA dans l'arbre + sedaDataMatch = sedaData.find(seda => seda.Name === nodeName); + //sedaDataMatch = this.sedaService.getSedaNodeRecursively(sedaData[0],nodeName) + } + if (!sedaDataMatch){ + // Sometimes,the sedaData has no property children, but many siblings (e.g. elements on the same level of the tree) + // In this case, the recursivity must be used on each symbling since the service getSedaNodeRecursively + // expects a tree root element with Children key + for (const element of sedaData) { + let resultRecursity = this.sedaService.getSedaNodeRecursively(element,nodeName); + if (resultRecursity) { + sedaDataMatch = resultRecursity; + break; + } + } + } else { + // Si le node en cours est l'achive ArchiveUnit mère, on la sauvegarde pour l'utiliser pour les ArchivesUnit enfants + if (sedaDataMatch.Name === 'ArchiveUnit' && this.sedaDataArchiveUnit == undefined){ + this.sedaDataArchiveUnit = sedaDataMatch; + // On introduit la récursivité sur les ArchivesUnit + this.sedaDataArchiveUnit.Children.find((c: { Name: string; })=>c.Name=='ArchiveUnit').Children = this.sedaDataArchiveUnit.Children; } } - } else { - // Si le node en cours est l'achive ArchiveUnit mère, on la sauvegarde pour l'utiliser pour les ArchivesUnit enfants - if (sedaDataMatch.Name === 'ArchiveUnit' && this.sedaDataArchiveUnit == undefined){ - this.sedaDataArchiveUnit = sedaDataMatch; - // On introduit la récursivité sur les ArchivesUnit - this.sedaDataArchiveUnit.Children.find((c: { Name: string; })=>c.Name=='ArchiveUnit').Children = this.sedaDataArchiveUnit.Children; + node.sedaData = sedaDataMatch; + if (node.children.length > 0){ + this.linkFileNodeToSedaData(node, node.children,node.sedaData.Children); } } - node.sedaData = sedaDataMatch; - if (node.children.length > 0){ - this.linkFileNodeToSedaData(node, node.children,node.sedaData.Children); - } }); } diff --git a/ui/ui-frontend/projects/pastis/src/app/profile/edit-profile/edit-profile.component.scss b/ui/ui-frontend/projects/pastis/src/app/profile/edit-profile/edit-profile.component.scss index 0d0612d59e99b4f9cee08b084e4419da1a8e8c4c..5c908814a170fa8b65679bedc478454d3e263e31 100644 --- a/ui/ui-frontend/projects/pastis/src/app/profile/edit-profile/edit-profile.component.scss +++ b/ui/ui-frontend/projects/pastis/src/app/profile/edit-profile/edit-profile.component.scss @@ -138,7 +138,18 @@ } .mat-tab-group { - max-height: 500px; + @media screen and (min-height: 950px){ + max-height: 850px; + } + @media screen and (min-height: 700px) and (max-height: 950px){ + max-height: 500px !important; + } + @media screen and (min-height: 550px) and (max-height: 700px){ + max-height: 450px; + } + @media screen and (max-height: 550px){ + max-height: 350px; + } } .mat-tab-body .mat-tab-body-active { diff --git a/ui/ui-frontend/projects/pastis/src/app/profile/edit-profile/edit-profile.component.ts b/ui/ui-frontend/projects/pastis/src/app/profile/edit-profile/edit-profile.component.ts index 5dd013209235feb766b2c02dc4f4893a1500bc46..7f6904b7d6fb7a81cd3ccc63ecc019547e79522b 100644 --- a/ui/ui-frontend/projects/pastis/src/app/profile/edit-profile/edit-profile.component.ts +++ b/ui/ui-frontend/projects/pastis/src/app/profile/edit-profile/edit-profile.component.ts @@ -88,6 +88,7 @@ export class EditProfileComponent implements OnDestroy { dataChange = new BehaviorSubject<FileNode[]>([]); isStandalone: boolean = environment.standalone; + puaMode: boolean; noticeTab: string = 'Notice'; entete: string = 'Entête'; @@ -95,7 +96,7 @@ export class EditProfileComponent implements OnDestroy { unitesArchives: string = 'Unités d\'archives'; objets: string = 'Objets'; noticePuaMode: string = 'Notice'; - unitesArchivesPuaMode: string = 'Unités d\'archive'; + unitesArchivesPuaMode: string = 'Unité d\'archive'; profileTabChildrenToInclude: string[] = []; @@ -133,6 +134,7 @@ export class EditProfileComponent implements OnDestroy { } initAll(){ + this.puaMode = this.profileService.profileMode === 'PA' ? false : true; if(!this.isStandalone){ this.noticeTab = 'PROFILE.EDIT_PROFILE.NOTICE_TAB'; this.entete = 'PROFILE.EDIT_PROFILE.ENTETE'; diff --git a/ui/ui-frontend/projects/pastis/src/app/profile/edit-profile/file-tree-metadata/file-tree-metadata.component.html b/ui/ui-frontend/projects/pastis/src/app/profile/edit-profile/file-tree-metadata/file-tree-metadata.component.html index f2be850a295b49ee004d90d8902f9b0b266db6bf..560736f35f3b024194e16dfe31aa1b255c998f98 100644 --- a/ui/ui-frontend/projects/pastis/src/app/profile/edit-profile/file-tree-metadata/file-tree-metadata.component.html +++ b/ui/ui-frontend/projects/pastis/src/app/profile/edit-profile/file-tree-metadata/file-tree-metadata.component.html @@ -50,10 +50,17 @@ </div> </div> <div class="button-filter"> - <vitamui-common-banner [searchbarPlaceholder]="'PROFILE.EDIT_PROFILE.FILE_TREE_METADATA.SEARCH_PLACEHOLDER' | translate" (search)="applyFilterTier($event)" > + + <vitamui-common-banner [searchbarPlaceholder]="'PROFILE.EDIT_PROFILE.FILE_TREE_METADATA.SEARCH_PLACEHOLDER' | translate" (search)="applyFilterTier($event)" > + <!--Button add metadata--> + <button *ngIf="checkElementType()" class="btn primary ml-5" style="text-transform: uppercase;" + (click)="onAddNode()">{{resolveButtonLabel(clickedNode)}} + </button> </vitamui-common-banner> </div> + + <!--Metatada table container--> <div class="pastis-table-container"> <table mat-table [dataSource]="matDataSource" *ngIf="shouldLoadMetadataTable(); else complexElementWithouChild" @@ -217,12 +224,6 @@ class="complex-element-no-child"> {{'PROFILE.EDIT_PROFILE.FILE_TREE_METADATA.MESSAGE_METADONNEE_SANS_FILLES.PARTIEUN' | translate}} {{clickedNode.name}} {{'PROFILE.EDIT_PROFILE.FILE_TREE_METADATA.MESSAGE_METADONNEE_SANS_FILLES.PARTIEDEUX' | translate}} </div> </ng-template> - <!--Button add metadata--> - <div class="button-container"> - <button *ngIf="checkElementType()" class="btn primary" style="text-transform: uppercase;" - (click)="onAddNode()">{{resolveButtonLabel(clickedNode)}} - </button> - <br><br> - </div> + </mat-sidenav-content> </mat-sidenav-container> diff --git a/ui/ui-frontend/projects/pastis/src/app/profile/edit-profile/file-tree-metadata/file-tree-metadata.component.scss b/ui/ui-frontend/projects/pastis/src/app/profile/edit-profile/file-tree-metadata/file-tree-metadata.component.scss index 3eb9b9f56d87d902b7389f2a59002083e5721434..e92348c611d059f0cd964e4bc5c69a148701a7cb 100644 --- a/ui/ui-frontend/projects/pastis/src/app/profile/edit-profile/file-tree-metadata/file-tree-metadata.component.scss +++ b/ui/ui-frontend/projects/pastis/src/app/profile/edit-profile/file-tree-metadata/file-tree-metadata.component.scss @@ -23,12 +23,16 @@ td { .button-filter { margin-top: 67px; - margin-left: 7%; + margin-left: 74px; margin-bottom: -40px; height: 80px !important; position: relative !important; - width: 38%; + width: 60%; + +} +.mat-drawer-content{ + height: max-content !important; } .item-metadata { @@ -336,7 +340,7 @@ tr:hover .pastis-btn-appear { .pastis-table-container { overflow-x: hidden; - max-height: 425px; + //max-height: 425px; top: 30px; margin-left: 74px; position: relative; @@ -524,7 +528,7 @@ dp-day-calendar .dp-day-calendar-container { text-align: left; } .mat-sidenav-content{ - height: 800px; + padding-bottom: 30px; } .pastis-menu-item-vitam{ diff --git a/ui/ui-frontend/projects/pastis/src/app/profile/edit-profile/file-tree-metadata/file-tree-metadata.component.ts b/ui/ui-frontend/projects/pastis/src/app/profile/edit-profile/file-tree-metadata/file-tree-metadata.component.ts index d30aa26d01634ae81033eaa13732497e7cf51d92..6a5140c123b9e4117c56d61ee00d3b429d45c444 100644 --- a/ui/ui-frontend/projects/pastis/src/app/profile/edit-profile/file-tree-metadata/file-tree-metadata.component.ts +++ b/ui/ui-frontend/projects/pastis/src/app/profile/edit-profile/file-tree-metadata/file-tree-metadata.component.ts @@ -311,7 +311,8 @@ export class FileTreeMetadataComponent { // Application du filtre sur la colonne 'nomDuChamp' correspondant aux noms métadonnées applyFilterTier(filterValue: string) { - this.setupFilter('nomDuChamp'); + let nomDuchamp: string = this.sedaLanguage ? 'nomDuChamp' : 'nomDuChampFr'; + this.setupFilter(nomDuchamp); // Lors d'un reset sur le search component on renvoie un string null. if(filterValue == null) filterValue=''; diff --git a/ui/ui-frontend/projects/pastis/src/app/profile/edit-profile/file-tree-metadata/file-tree-metadata.service.ts b/ui/ui-frontend/projects/pastis/src/app/profile/edit-profile/file-tree-metadata/file-tree-metadata.service.ts index c275c4f843ccef966d98c6dd41ebd2557b62c51f..9f093e014425fba17078db06927dec3a9be051e6 100644 --- a/ui/ui-frontend/projects/pastis/src/app/profile/edit-profile/file-tree-metadata/file-tree-metadata.service.ts +++ b/ui/ui-frontend/projects/pastis/src/app/profile/edit-profile/file-tree-metadata/file-tree-metadata.service.ts @@ -1,25 +1,25 @@ /* -Copyright © CINES - Centre Informatique National pour l'Enseignement Supérieur (2020) +Copyright © CINES - Centre Informatique National pour l'Enseignement Supérieur (2020) [dad@cines.fr] -This software is a computer program whose purpose is to provide -a web application to create, edit, import and export archive +This software is a computer program whose purpose is to provide +a web application to create, edit, import and export archive profiles based on the french SEDA standard (https://redirect.francearchives.fr/seda/). 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, +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". +"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. +liability. In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or developing or reproducing the @@ -28,9 +28,9 @@ 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. +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. @@ -82,22 +82,24 @@ export class FileTreeMetadataService { for (let child of clickedNode.children) { // There are cases where there are no childrenToExclude declared // So we must check if it exists to avoid and undefined of includes error - if (childrenToExclude && !childrenToExclude.includes(child.name) && + if (childrenToExclude && !childrenToExclude.includes(child.name) && child.type !== TypeConstants.attribute) { - data.push({ - id: child.id, - nomDuChamp: child.name, - valeurFixe: child.value, - cardinalite: this.findSedaAllowedCardinalityList(sedaChild, child), - commentaire: child.documentation, - type: child.dataType, - enumeration: child.sedaData.Enumeration, - }) - } else if (!childrenToExclude && child.type !== TypeConstants.attribute){ data.push({ id: child.id, nomDuChamp: child.name, + nomDuChampFr: this.onResolveName(child.name, sedaChild), + valeurFixe: child.value, + cardinalite: this.findSedaAllowedCardinalityList(sedaChild, child), + commentaire: child.documentation, + type: child.dataType, + enumeration: child.sedaData.Enumeration, + }) + } else if (!childrenToExclude && child.type !== TypeConstants.attribute) { + data.push({ + id: child.id, + nomDuChamp: child.name, + nomDuChampFr: this.onResolveName(child.name, sedaChild), valeurFixe: child.value, cardinalite: this.findSedaAllowedCardinalityList(sedaChild, child), commentaire: child.documentation, @@ -111,6 +113,7 @@ export class FileTreeMetadataService { data.push({ id: clickedNode.id, nomDuChamp: clickedNode.name, + nomDuChampFr: this.onResolveName(clickedNode.name, sedaChild), valeurFixe: clickedNode.value, cardinalite: this.findSedaAllowedCardinalityList(sedaChild, clickedNode), commentaire: clickedNode.documentation, @@ -120,25 +123,45 @@ export class FileTreeMetadataService { break; } } - } // No children : it should be a SEDA simple element type without children - // It this case, the retrieved data is the current clicked node data - else { - data.push({ - id: clickedNode.id, - nomDuChamp: clickedNode.name, - valeurFixe: clickedNode.value, - cardinalite: this.findSedaAllowedCardinalityList(sedaChild, clickedNode), - commentaire: clickedNode.documentation, - type: clickedNode.dataType, - enumeration: clickedNode.sedaData.Enumeration, - }) - } + } // No children : it should be a SEDA simple element type without children + // It this case, the retrieved data is the current clicked node data + else { + data.push({ + id: clickedNode.id, + nomDuChamp: clickedNode.name, + nomDuChampFr: this.onResolveName(clickedNode.name, sedaChild), + valeurFixe: clickedNode.value, + cardinalite: this.findSedaAllowedCardinalityList(sedaChild, clickedNode), + commentaire: clickedNode.documentation, + type: clickedNode.dataType, + enumeration: clickedNode.sedaData.Enumeration, + }) + } this.allowedSedaCardinalities.next(allowedCardList); this.selectedCardinalities.next(this.findCardinalities(clickedNode, sedaChild, data)); console.log("Data on fillDataTable", data, "with selected cards :", this.selectedCardinalities.getValue()); return data; } + getSedaNode(elementName: string, sedaChild: SedaData): SedaData { + for (let node of sedaChild.Children) { + if (node.Name === elementName) { + return node + } + } + return null; + } + onResolveName(elementName: string, sedaChild: SedaData) { + let node = this.getSedaNode(elementName, sedaChild); + if (node != null) { + if (node.NameFr) { + return node.NameFr + } + return node.Name + } + return elementName; + } + findSedaAllowedCardinalityList(sedaNode: SedaData, fileNode: FileNode): string[] { let allowedCardinalityListResult: string[] = []; let resultList: string[][] = []; @@ -165,7 +188,7 @@ export class FileTreeMetadataService { this.allowedSedaCardinalities.next(resultList) return allowedCardinalityListResult; - } + } } } else { //console.error("Final CARDINALITY LIST (NO seda children found) : ", allowedCardinalityListResult, " for ", sedaNode.Name); diff --git a/ui/ui-frontend/projects/pastis/src/assets/i18n/fr.json b/ui/ui-frontend/projects/pastis/src/assets/i18n/fr.json index 5c597aa858695ceb4ded0d99f1107ba9a1a5678b..4fb6e02db3e00bc5f4029ac54a406cd50fa21b98 100644 --- a/ui/ui-frontend/projects/pastis/src/assets/i18n/fr.json +++ b/ui/ui-frontend/projects/pastis/src/assets/i18n/fr.json @@ -43,7 +43,7 @@ "UNITES_ARCHIVES": "Unités d'archives", "OBJETS": "Objets", "NOTICE_PUA_MODE": "Notice", - "UNITES_ARCHIVES_PUA_MODE": "Unités d'archives", + "UNITES_ARCHIVES_PUA_MODE": "Unité d'archives", "NOM_PUA": "Nom du profil d unité archivistique", "NOM_PA": "Nom du profil d'archivage", "PROFILE_ID": "Identifiant",