diff --git a/api/api-collect/collect/src/main/java/fr/gouv/vitamui/collect/common/dto/CollectTransactionDto.java b/api/api-collect/collect/src/main/java/fr/gouv/vitamui/collect/common/dto/CollectTransactionDto.java index 3d85ed5d783..d634e512bf4 100644 --- a/api/api-collect/collect/src/main/java/fr/gouv/vitamui/collect/common/dto/CollectTransactionDto.java +++ b/api/api-collect/collect/src/main/java/fr/gouv/vitamui/collect/common/dto/CollectTransactionDto.java @@ -26,6 +26,7 @@ */ package fr.gouv.vitamui.collect.common.dto; +import fr.gouv.vitam.collect.common.dto.BatchDto; import fr.gouv.vitamui.commons.api.domain.IdDto; import lombok.AllArgsConstructor; import lombok.Builder; @@ -33,6 +34,8 @@ import lombok.EqualsAndHashCode; import lombok.NoArgsConstructor; +import java.util.List; + @Data @AllArgsConstructor @NoArgsConstructor @@ -58,4 +61,5 @@ public class CollectTransactionDto extends IdDto { private String lastUpdate; private String status; private String projectId; + private List batches; } diff --git a/api/api-collect/collect/src/main/java/fr/gouv/vitamui/collect/server/rest/TransactionController.java b/api/api-collect/collect/src/main/java/fr/gouv/vitamui/collect/server/rest/TransactionController.java index fb8761e5859..5fea2671afe 100644 --- a/api/api-collect/collect/src/main/java/fr/gouv/vitamui/collect/server/rest/TransactionController.java +++ b/api/api-collect/collect/src/main/java/fr/gouv/vitamui/collect/server/rest/TransactionController.java @@ -26,6 +26,7 @@ */ package fr.gouv.vitamui.collect.server.rest; +import fr.gouv.vitam.collect.common.enums.TransactionValidationMode; import fr.gouv.vitam.common.exception.VitamClientException; import fr.gouv.vitamui.archives.search.common.dto.ReclassificationCriteriaDto; import fr.gouv.vitamui.collect.common.dto.CollectTransactionDto; @@ -55,6 +56,7 @@ import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestHeader; import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.RestController; import reactor.core.publisher.Mono; @@ -119,12 +121,18 @@ public void abortTransaction(final @PathVariable("id") String id) @Secured(ServicesData.ROLE_CLOSE_TRANSACTIONS) @PutMapping(CommonConstants.PATH_ID + VALIDATE_PATH) - public void validateTransaction(final @PathVariable("id") String id) - throws PreconditionFailedException, VitamClientException { + public void validateTransaction( + final @PathVariable("id") String id, + @RequestParam("validationMode") final TransactionValidationMode validationMode + ) throws PreconditionFailedException, VitamClientException { ParameterChecker.checkParameter(MANDATORY_IDENTIFIER, id); SanityChecker.checkSecureParameter(id); LOGGER.debug(TRANSACTION_ID, id); - transactionService.validateTransaction(id, externalParametersService.buildVitamContextFromExternalParam()); + transactionService.validateTransaction( + id, + externalParametersService.buildVitamContextFromExternalParam(), + validationMode + ); } @Operation(summary = "Get transaction by id") diff --git a/api/api-collect/collect/src/main/java/fr/gouv/vitamui/collect/server/service/TransactionService.java b/api/api-collect/collect/src/main/java/fr/gouv/vitamui/collect/server/service/TransactionService.java index ce4befc59c9..fa9e9d8b709 100644 --- a/api/api-collect/collect/src/main/java/fr/gouv/vitamui/collect/server/service/TransactionService.java +++ b/api/api-collect/collect/src/main/java/fr/gouv/vitamui/collect/server/service/TransactionService.java @@ -34,6 +34,7 @@ import com.fasterxml.jackson.databind.node.ArrayNode; import com.fasterxml.jackson.databind.node.ObjectNode; import fr.gouv.vitam.collect.common.dto.TransactionDto; +import fr.gouv.vitam.collect.common.enums.TransactionValidationMode; import fr.gouv.vitam.common.client.VitamContext; import fr.gouv.vitam.common.exception.InvalidParseOperationException; import fr.gouv.vitam.common.exception.VitamClientException; @@ -90,9 +91,17 @@ public class TransactionService { private static final ObjectMapper mapper = new ObjectMapper(); - public void validateTransaction(String idTransaction, VitamContext vitamContext) throws VitamClientException { + public void validateTransaction( + String idTransaction, + VitamContext vitamContext, + TransactionValidationMode validationMode + ) throws VitamClientException { try { - RequestResponse requestResponse = collectService.validateTransaction(vitamContext, idTransaction); + RequestResponse requestResponse = collectService.validateTransaction( + vitamContext, + idTransaction, + validationMode + ); if (requestResponse.getStatus() != Response.Status.OK.getStatusCode()) { throw new VitamClientException("Error occurs when validating transaction!"); } diff --git a/api/api-collect/collect/src/main/java/fr/gouv/vitamui/collect/server/service/converters/TransactionConverter.java b/api/api-collect/collect/src/main/java/fr/gouv/vitamui/collect/server/service/converters/TransactionConverter.java index 33a8a9622cc..41e1b1ac775 100644 --- a/api/api-collect/collect/src/main/java/fr/gouv/vitamui/collect/server/service/converters/TransactionConverter.java +++ b/api/api-collect/collect/src/main/java/fr/gouv/vitamui/collect/server/service/converters/TransactionConverter.java @@ -60,6 +60,7 @@ public static CollectTransactionDto toVitamUiDto(TransactionDto transactionDto) collectTransactionDto.setLastUpdate(transactionDto.getLastUpdate()); collectTransactionDto.setProjectId(transactionDto.getProjectId()); collectTransactionDto.setName(transactionDto.getName()); + collectTransactionDto.setBatches(transactionDto.getBatches()); return collectTransactionDto; } diff --git a/api/api-collect/collect/src/test/java/fr/gouv/vitamui/collect/server/service/TransactionServiceTest.java b/api/api-collect/collect/src/test/java/fr/gouv/vitamui/collect/server/service/TransactionServiceTest.java index b86b08fafd7..5fd39074a53 100644 --- a/api/api-collect/collect/src/test/java/fr/gouv/vitamui/collect/server/service/TransactionServiceTest.java +++ b/api/api-collect/collect/src/test/java/fr/gouv/vitamui/collect/server/service/TransactionServiceTest.java @@ -33,6 +33,7 @@ import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; import fr.gouv.vitam.collect.common.dto.TransactionDto; +import fr.gouv.vitam.collect.common.enums.TransactionValidationMode; import fr.gouv.vitam.common.client.VitamContext; import fr.gouv.vitam.common.error.VitamError; import fr.gouv.vitam.common.error.VitamErrorDetails; @@ -85,21 +86,27 @@ class TransactionServiceTest { @Test void shouldValidateTransactionWithSuccess() throws VitamClientException { // GIVEN - when(collectService.validateTransaction(vitamContext, TRANSACTION_ID)).thenReturn( - new RequestResponseOK().setHttpCode(200) - ); + when( + collectService.validateTransaction(vitamContext, TRANSACTION_ID, TransactionValidationMode.VALIDATE) + ).thenReturn(new RequestResponseOK().setHttpCode(200)); // THEN - assertDoesNotThrow(() -> transactionService.validateTransaction(TRANSACTION_ID, vitamContext)); + assertDoesNotThrow( + () -> + transactionService.validateTransaction(TRANSACTION_ID, vitamContext, TransactionValidationMode.VALIDATE) + ); } @Test void shouldThrowExceptionWhenValidateTransaction() throws VitamClientException { // GIVEN - when(collectService.validateTransaction(vitamContext, TRANSACTION_ID)).thenThrow(VitamClientException.class); + when( + collectService.validateTransaction(vitamContext, TRANSACTION_ID, TransactionValidationMode.VALIDATE) + ).thenThrow(VitamClientException.class); // THEN assertThrows( VitamClientException.class, - () -> transactionService.validateTransaction(TRANSACTION_ID, vitamContext) + () -> + transactionService.validateTransaction(TRANSACTION_ID, vitamContext, TransactionValidationMode.VALIDATE) ); } diff --git a/commons/commons-vitam/src/main/java/fr/gouv/vitamui/commons/vitam/api/collect/CollectService.java b/commons/commons-vitam/src/main/java/fr/gouv/vitamui/commons/vitam/api/collect/CollectService.java index 5163efc48f5..9c97299de6c 100644 --- a/commons/commons-vitam/src/main/java/fr/gouv/vitamui/commons/vitam/api/collect/CollectService.java +++ b/commons/commons-vitam/src/main/java/fr/gouv/vitamui/commons/vitam/api/collect/CollectService.java @@ -34,6 +34,7 @@ import fr.gouv.vitam.collect.common.dto.ProjectDto; import fr.gouv.vitam.collect.common.dto.TransactionDto; import fr.gouv.vitam.collect.common.dto.UploadSipResult; +import fr.gouv.vitam.collect.common.enums.TransactionValidationMode; import fr.gouv.vitam.collect.external.client.CollectExternalClient; import fr.gouv.vitam.collect.external.exception.CollectExternalClientException; import fr.gouv.vitam.common.CharsetUtils; @@ -345,10 +346,17 @@ public RequestResponse deleteProjectById(final VitamContext vitamConte return result; } - public RequestResponse validateTransaction(final VitamContext vitamContext, final String idTransaction) - throws VitamClientException { + public RequestResponse validateTransaction( + final VitamContext vitamContext, + final String idTransaction, + final TransactionValidationMode validationMode + ) throws VitamClientException { LOGGER.debug(TRANSACTION_ID, idTransaction); - final RequestResponse response = collectExternalClient.closeTransaction(vitamContext, idTransaction); + final RequestResponse response = collectExternalClient.closeTransaction( + vitamContext, + idTransaction, + validationMode + ); VitamRestUtils.checkResponse(response); return response; } 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 ddad446a66e..fedecdd14e5 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 @@ -39,8 +39,8 @@ import { AfterViewInit, Component, OnDestroy, OnInit, TemplateRef, ViewChild } f import { MatDialog, MatDialogConfig } from '@angular/material/dialog'; import { ActivatedRoute } from '@angular/router'; import { TranslateService } from '@ngx-translate/core'; -import { BehaviorSubject, finalize, merge, Observable, Subject, Subscription, zip } from 'rxjs'; -import { debounceTime, filter, map, mergeMap, share, take, tap } from 'rxjs/operators'; +import { BehaviorSubject, finalize, merge, Observable, of, Subject, Subscription, zip } from 'rxjs'; +import { debounceTime, filter, map, mergeMap, share, switchMap, take, tap } from 'rxjs/operators'; import { isEmpty } from 'underscore'; import { AccessContract, @@ -93,6 +93,7 @@ import { NODES, toManagementRuleType, MANAGEMENT_RULE_SHARED_DATA_SERVICE, + ConfirmDialogComponent, } from 'vitamui-library'; import { ArchiveCollectService } from './archive-collect.service'; import { SearchCriteriaSaverComponent } from './archive-search-criteria/components/search-criteria-saver/search-criteria-saver.component'; @@ -103,6 +104,7 @@ import { UpdateUnitsMetadataComponent } from './update-units-metadata/update-uni import { AddUnitsComponent } from './add-units/add-units.component'; import { TransactionsService } from '../transactions/transactions.service'; import { MatCheckboxChange } from '@angular/material/checkbox'; +import { TransactionValidationMode } from '../models/transaction-validation-mode.enum'; const PAGE_SIZE = 10; const ELIMINATION_TECHNICAL_ID = 'ELIMINATION_TECHNICAL_ID'; @@ -1284,14 +1286,34 @@ export class ArchiveSearchCollectComponent extends SidenavPage implements O } validateTransaction() { - this.transactionService - .validate(this.transaction, { isAutomaticIngest: this.isAutomaticIngest }) + const hasBatchError = this.hasBatchInError(this.transaction); + const validationMode = hasBatchError ? TransactionValidationMode.VALIDATE_IGNORE : TransactionValidationMode.VALIDATE; + const confirmation$ = hasBatchError + ? this.dialog + .open(ConfirmDialogComponent, { + disableClose: false, + data: { + title: 'COLLECT.OTHER_ACTIONS.DIALOG_MESSAGE.CONFIRM_FORCE_TRANSACTION_VALIDATION_MESSAGE', + subTitle: 'COLLECT.OTHER_ACTIONS.DIALOG_MESSAGE.CONFIRM_TRANSACTION_VALIDATION', + confirmLabel: 'COLLECT.OTHER_ACTIONS.DIALOG_MESSAGE.CONFIRM_TRANSACTION_VALIDATION', + cancelLabel: 'COLLECT.OTHER_ACTIONS.DIALOG_MESSAGE.CANCEL', + }, + }) + .afterClosed() + .pipe(filter((confirmed) => !!confirmed)) + : of(true); + + confirmation$ .pipe( - finalize(() => { - this.snackBarService.open({ - message: 'COLLECT.VALIDATE_TRANSACTION_VALIDATED', - duration: 10_000, - }); + switchMap(() => { + return this.transactionService.validate(this.transaction, validationMode, { isAutomaticIngest: this.isAutomaticIngest }).pipe( + finalize(() => { + this.snackBarService.open({ + message: 'COLLECT.VALIDATE_TRANSACTION_VALIDATED', + duration: 10_000, + }); + }), + ); }), ) .subscribe((transaction: Transaction) => { @@ -1434,5 +1456,9 @@ export class ArchiveSearchCollectComponent extends SidenavPage implements O }); } + private hasBatchInError(transaction: Transaction): boolean { + return transaction.batches?.some((b) => b.BatchStatus === 'KO') ?? false; + } + protected readonly TransactionStatus = TransactionStatus; } 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 96b167ea5ee..54409681cf0 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 @@ -35,7 +35,7 @@ * knowledge of the CeCILL-C license and that you accept its terms. */ -import { HttpClient, HttpHeaders } from '@angular/common/http'; +import { HttpClient, HttpHeaders, HttpParams } from '@angular/common/http'; import { Inject, Injectable } from '@angular/core'; import { Observable } from 'rxjs'; import { @@ -49,6 +49,7 @@ import { Unit, VitamError, } from 'vitamui-library'; +import { TransactionValidationMode } from '../../models/transaction-validation-mode.enum'; @Injectable({ providedIn: 'root', @@ -71,8 +72,9 @@ export class TransactionApiService extends PaginatedHttpClient { return this.http.get(this.apiUrl + '/' + transactionId); } - validateTransaction(id: string) { - return this.http.put(this.apiUrl + '/' + id + '/validate', {}); + validateTransaction(id: string, validationMode: TransactionValidationMode) { + const params = new HttpParams().set('validationMode', validationMode); + return this.http.put(this.apiUrl + '/' + id + '/validate', {}, { params }); } sendTransaction(id: string) { diff --git a/ui/ui-frontend/projects/collect/src/app/collect/models/transaction-validation-mode.enum.ts b/ui/ui-frontend/projects/collect/src/app/collect/models/transaction-validation-mode.enum.ts new file mode 100644 index 00000000000..79ca09f1afb --- /dev/null +++ b/ui/ui-frontend/projects/collect/src/app/collect/models/transaction-validation-mode.enum.ts @@ -0,0 +1,41 @@ +/* + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * 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 TransactionValidationMode { + VALIDATE = 'VALIDATE', + VALIDATE_IGNORE = 'VALIDATE_IGNORE', + VALIDATE_FORCE = 'VALIDATE_FORCE', +} diff --git a/ui/ui-frontend/projects/collect/src/app/collect/transactions/transaction-list/transaction-list.component.css b/ui/ui-frontend/projects/collect/src/app/collect/transactions/transaction-list/transaction-list.component.css index e25b94ab3e3..3ff43b1a6d5 100644 --- a/ui/ui-frontend/projects/collect/src/app/collect/transactions/transaction-list/transaction-list.component.css +++ b/ui/ui-frontend/projects/collect/src/app/collect/transactions/transaction-list/transaction-list.component.css @@ -4,4 +4,8 @@ justify-content: flex-end; /* ✅ pousse les boutons à droite */ } +.batch-ko-error { + color: var(--vitamui-red); +} + diff --git a/ui/ui-frontend/projects/collect/src/app/collect/transactions/transaction-list/transaction-list.component.html b/ui/ui-frontend/projects/collect/src/app/collect/transactions/transaction-list/transaction-list.component.html index 27024224590..6820844f1e8 100644 --- a/ui/ui-frontend/projects/collect/src/app/collect/transactions/transaction-list/transaction-list.component.html +++ b/ui/ui-frontend/projects/collect/src/app/collect/transactions/transaction-list/transaction-list.component.html @@ -67,7 +67,12 @@
{{ 'COLLECT.INGEST_LIST_TITLE' | translate }}
{{ transaction.messageIdentifier }} {{ transaction.id }} - {{ 'COLLECT.PROJECT_TRANSACTION_PREVIEW.STATUS.' + transaction.status | translate }} + +
{{ 'COLLECT.PROJECT_TRANSACTION_PREVIEW.STATUS.' + transaction.status | translate }}
+ @if (shouldShowBatchError(transaction)) { +
{{ 'COLLECT.BATCH_ERROR_RECORDED' | translate }}
+ } +
@if (transactionIsDownloadable(transaction)) { diff --git a/ui/ui-frontend/projects/collect/src/app/collect/transactions/transaction-list/transaction-list.component.ts b/ui/ui-frontend/projects/collect/src/app/collect/transactions/transaction-list/transaction-list.component.ts index 9a77cfac553..c1af9956f8b 100644 --- a/ui/ui-frontend/projects/collect/src/app/collect/transactions/transaction-list/transaction-list.component.ts +++ b/ui/ui-frontend/projects/collect/src/app/collect/transactions/transaction-list/transaction-list.component.ts @@ -36,11 +36,21 @@ */ import { Component, OnInit } from '@angular/core'; import { ActivatedRoute, Router } from '@angular/router'; -import { BehaviorSubject, finalize } from 'rxjs'; -import { Direction, InfiniteScrollTable, SnackBarService, StartupService, Transaction, TransactionStatus } from 'vitamui-library'; +import { BehaviorSubject, filter, finalize, of, switchMap } from 'rxjs'; +import { + Direction, + InfiniteScrollTable, + SnackBarService, + StartupService, + Transaction, + TransactionStatus, + ConfirmDialogComponent, +} from 'vitamui-library'; import { TransactionsService } from '../transactions.service'; import { ArchiveCollectService } from '../../archive-search-collect/archive-collect.service'; import { ProjectsService } from '../../projects/projects.service'; +import { MatDialog } from '@angular/material/dialog'; +import { TransactionValidationMode } from '../../models/transaction-validation-mode.enum'; @Component({ selector: 'app-transaction-list', @@ -68,6 +78,7 @@ export class TransactionListComponent extends InfiniteScrollTable i private router: Router, private startupService: StartupService, private snackBarService: SnackBarService, + private dialog: MatDialog, ) { super(transactionService); } @@ -112,14 +123,34 @@ export class TransactionListComponent extends InfiniteScrollTable i } validateTransaction(transaction: Transaction) { - this.transactionService - .validate(transaction, { isAutomaticIngest: this.isAutomaticIngest }) + const hasBatchError = this.hasBatchInError(transaction); + const validationMode = hasBatchError ? TransactionValidationMode.VALIDATE_IGNORE : TransactionValidationMode.VALIDATE; + const confirmation$ = hasBatchError + ? this.dialog + .open(ConfirmDialogComponent, { + disableClose: false, + data: { + title: 'COLLECT.OTHER_ACTIONS.DIALOG_MESSAGE.CONFIRM_FORCE_TRANSACTION_VALIDATION_MESSAGE', + subTitle: 'COLLECT.OTHER_ACTIONS.DIALOG_MESSAGE.CONFIRM_TRANSACTION_VALIDATION', + confirmLabel: 'COLLECT.OTHER_ACTIONS.DIALOG_MESSAGE.CONFIRM_TRANSACTION_VALIDATION', + cancelLabel: 'COLLECT.OTHER_ACTIONS.DIALOG_MESSAGE.CANCEL', + }, + }) + .afterClosed() + .pipe(filter((confirmed) => !!confirmed)) + : of(true); + + confirmation$ .pipe( - finalize(() => { - this.snackBarService.open({ - message: 'COLLECT.VALIDATE_TRANSACTION_VALIDATED', - duration: 10_000, - }); + switchMap(() => { + return this.transactionService.validate(transaction, validationMode, { isAutomaticIngest: this.isAutomaticIngest }).pipe( + finalize(() => { + this.snackBarService.open({ + message: 'COLLECT.VALIDATE_TRANSACTION_VALIDATED', + duration: 10_000, + }); + }), + ); }), ) .subscribe({ @@ -206,6 +237,14 @@ export class TransactionListComponent extends InfiniteScrollTable i ); } + private hasBatchInError(transaction: Transaction): boolean { + return transaction.batches?.some((b) => b.BatchStatus === 'KO') ?? false; + } + + shouldShowBatchError(transaction: Transaction): boolean { + return this.hasBatchInError(transaction) && transaction.status === TransactionStatus.OPEN; + } + private checkTransactionsPermissions() { this.archiveCollectService.hasCollectRole('ROLE_ABORT_TRANSACTIONS', Number(this.tenantIdentifier)).subscribe((result) => { this.hasAbortTransactionRole = result; 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 bfd1738a408..029a1949d9b 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 @@ -52,6 +52,7 @@ import { import { ProjectsApiService } from '../core/api/project-api.service'; import { TransactionApiService } from '../core/api/transaction-api.service'; import { pollUntil } from './polling'; +import { TransactionValidationMode } from '../models/transaction-validation-mode.enum'; @Injectable({ providedIn: 'root', @@ -88,8 +89,12 @@ export class TransactionsService extends SearchService { return this.transactionApiService.getTransactionById(transactionById); } - public validate(transaction: Transaction, context = { isAutomaticIngest: false }): Observable { - return this.validateTransaction(transaction.id).pipe( + public validate( + transaction: Transaction, + validationMode: TransactionValidationMode, + context = { isAutomaticIngest: false }, + ): Observable { + return this.validateTransaction(transaction.id, validationMode).pipe( switchMap(() => { const status$ = this.getTransactionById(transaction.id).pipe(map((next) => next.status)); const isValidated = (status: TransactionStatus) => { @@ -107,8 +112,8 @@ export class TransactionsService extends SearchService { ); } - validateTransaction(id: string) { - return this.transactionApiService.validateTransaction(id); + validateTransaction(id: string, validationMode: TransactionValidationMode) { + return this.transactionApiService.validateTransaction(id, validationMode); } sendTransaction(id: string) { diff --git a/ui/ui-frontend/projects/collect/src/assets/i18n/en.json b/ui/ui-frontend/projects/collect/src/assets/i18n/en.json index 3b11e24a281..5ef994ab783 100644 --- a/ui/ui-frontend/projects/collect/src/assets/i18n/en.json +++ b/ui/ui-frontend/projects/collect/src/assets/i18n/en.json @@ -260,7 +260,9 @@ "PLATEFORM_THRESHOLD_REACHED_WARNING_MESSAGE": "Attention, the operation reach the plateform allowed threshold.", "PLATEFORM_THRESHOLD_REACHED_WARNING_MESSAGE_2": "Validate rule change(s) ? ", "PLATEFORM_THRESHOLD_REACHED_ALERT_MESSAGE": "This action is not allowed ont the selected items", - "PLATEFORM_THRESHOLD_REACHED_ALERT_MESSAGE_2": "The operation reach the allowed threshold, Please modify the selection and retry " + "PLATEFORM_THRESHOLD_REACHED_ALERT_MESSAGE_2": "The operation reaches the allowed threshold. Please modify the selection and retry ", + "CONFIRM_TRANSACTION_VALIDATION": "Confirm validation", + "CONFIRM_FORCE_TRANSACTION_VALIDATION_MESSAGE": "During the import of files and metadata, errors were detected. If they have not been resolved, you may be blocked during the submission process. Do you want to proceed with the validation?" } }, "TITLE_TRANSACTIONS_MONITORING": "Transaction monitoring of project", @@ -273,6 +275,7 @@ "VALIDATE_TRANSACTION_VALIDATED": "The ingest request of the project has been validated", "TRANSACTION_ABORTED": "The ingest request of the project has been aborted", "TRANSACTION_REOPENED": "The ingest request of the project has been reopened", + "BATCH_ERROR_RECORDED": "Errors recorded", "PROJECT_TRANSACTION_PREVIEW": { "ACTIONS": { "SHOW_TRANSACTIONS": "go to list transactions", diff --git a/ui/ui-frontend/projects/collect/src/assets/i18n/fr.json b/ui/ui-frontend/projects/collect/src/assets/i18n/fr.json index c3c4b9fc08f..b2c50e9a821 100644 --- a/ui/ui-frontend/projects/collect/src/assets/i18n/fr.json +++ b/ui/ui-frontend/projects/collect/src/assets/i18n/fr.json @@ -260,7 +260,9 @@ "PLATEFORM_THRESHOLD_REACHED_WARNING_MESSAGE": "Attention, l’opération demandée dépasse le seuil de plateforme autorisé.", "PLATEFORM_THRESHOLD_REACHED_WARNING_MESSAGE_2": "Voulez-vous confirmer l’action à réaliser ?", "PLATEFORM_THRESHOLD_REACHED_ALERT_MESSAGE": "L’action demandée n’est pas possible sur cette sélection", - "PLATEFORM_THRESHOLD_REACHED_ALERT_MESSAGE_2": "L’opération demandée dépasse le seuil de plateforme autorisé. Veuillez revoir la sélection des unités archivistiques avant de relancer l’opération" + "PLATEFORM_THRESHOLD_REACHED_ALERT_MESSAGE_2": "L’opération demandée dépasse le seuil de plateforme autorisé. Veuillez revoir la sélection des unités archivistiques avant de relancer l’opération", + "CONFIRM_TRANSACTION_VALIDATION": "Confirmer la validation", + "CONFIRM_FORCE_TRANSACTION_VALIDATION_MESSAGE": "A l’import des fichiers et des métadonnées, des erreurs ont été détectées. \nSi vous ne les avez pas résolues vous pourriez être bloqué au versement. \nConfirmez-vous votre validation ?" } }, "TITLE_TRANSACTIONS_MONITORING": "Suivi des versements du projet", @@ -273,6 +275,7 @@ "VALIDATE_TRANSACTION_VALIDATED": "La demande de versement du projet a été bien validée", "TRANSACTION_ABORTED": "La demande de versement du projet a été bien abandonnée", "TRANSACTION_REOPENED": "La demande de versement du projet a été bien rouverte", + "BATCH_ERROR_RECORDED": "Erreurs enregistrées", "PROJECT_TRANSACTION_PREVIEW": { "ACTIONS": { "SHOW_TRANSACTIONS": "Accéder à la liste des versements du projet", diff --git a/ui/ui-frontend/projects/vitamui-library/src/app/modules/components/confirm-dialog/close-popup-dialog.component.html b/ui/ui-frontend/projects/vitamui-library/src/app/modules/components/common-confirm-dialog/close-popup-dialog.component.html similarity index 100% rename from ui/ui-frontend/projects/vitamui-library/src/app/modules/components/confirm-dialog/close-popup-dialog.component.html rename to ui/ui-frontend/projects/vitamui-library/src/app/modules/components/common-confirm-dialog/close-popup-dialog.component.html diff --git a/ui/ui-frontend/projects/vitamui-library/src/app/modules/components/confirm-dialog/close-popup-dialog.component.scss b/ui/ui-frontend/projects/vitamui-library/src/app/modules/components/common-confirm-dialog/close-popup-dialog.component.scss similarity index 100% rename from ui/ui-frontend/projects/vitamui-library/src/app/modules/components/confirm-dialog/close-popup-dialog.component.scss rename to ui/ui-frontend/projects/vitamui-library/src/app/modules/components/common-confirm-dialog/close-popup-dialog.component.scss diff --git a/ui/ui-frontend/projects/vitamui-library/src/app/modules/components/confirm-dialog/close-popup-dialog.component.spec.ts b/ui/ui-frontend/projects/vitamui-library/src/app/modules/components/common-confirm-dialog/close-popup-dialog.component.spec.ts similarity index 100% rename from ui/ui-frontend/projects/vitamui-library/src/app/modules/components/confirm-dialog/close-popup-dialog.component.spec.ts rename to ui/ui-frontend/projects/vitamui-library/src/app/modules/components/common-confirm-dialog/close-popup-dialog.component.spec.ts diff --git a/ui/ui-frontend/projects/vitamui-library/src/app/modules/components/confirm-dialog/close-popup-dialog.component.ts b/ui/ui-frontend/projects/vitamui-library/src/app/modules/components/common-confirm-dialog/close-popup-dialog.component.ts similarity index 100% rename from ui/ui-frontend/projects/vitamui-library/src/app/modules/components/confirm-dialog/close-popup-dialog.component.ts rename to ui/ui-frontend/projects/vitamui-library/src/app/modules/components/common-confirm-dialog/close-popup-dialog.component.ts diff --git a/ui/ui-frontend/projects/vitamui-library/src/app/modules/components/confirm-dialog/confirm-dialog.component.html b/ui/ui-frontend/projects/vitamui-library/src/app/modules/components/common-confirm-dialog/common-confirm-dialog.component.html similarity index 100% rename from ui/ui-frontend/projects/vitamui-library/src/app/modules/components/confirm-dialog/confirm-dialog.component.html rename to ui/ui-frontend/projects/vitamui-library/src/app/modules/components/common-confirm-dialog/common-confirm-dialog.component.html diff --git a/ui/ui-frontend/projects/vitamui-library/src/app/modules/components/confirm-dialog/confirm-dialog.component.scss b/ui/ui-frontend/projects/vitamui-library/src/app/modules/components/common-confirm-dialog/common-confirm-dialog.component.scss similarity index 100% rename from ui/ui-frontend/projects/vitamui-library/src/app/modules/components/confirm-dialog/confirm-dialog.component.scss rename to ui/ui-frontend/projects/vitamui-library/src/app/modules/components/common-confirm-dialog/common-confirm-dialog.component.scss diff --git a/ui/ui-frontend/projects/vitamui-library/src/app/modules/components/confirm-dialog/confirm-dialog.component.spec.ts b/ui/ui-frontend/projects/vitamui-library/src/app/modules/components/common-confirm-dialog/common-confirm-dialog.component.spec.ts similarity index 86% rename from ui/ui-frontend/projects/vitamui-library/src/app/modules/components/confirm-dialog/confirm-dialog.component.spec.ts rename to ui/ui-frontend/projects/vitamui-library/src/app/modules/components/common-confirm-dialog/common-confirm-dialog.component.spec.ts index b5e575a7532..a725f5fbfde 100644 --- a/ui/ui-frontend/projects/vitamui-library/src/app/modules/components/confirm-dialog/confirm-dialog.component.spec.ts +++ b/ui/ui-frontend/projects/vitamui-library/src/app/modules/components/common-confirm-dialog/common-confirm-dialog.component.spec.ts @@ -38,21 +38,21 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { MatDialogModule } from '@angular/material/dialog'; import { VitamUICommonTestModule } from '../../../../../testing/src'; -import { ConfirmDialogComponent } from './confirm-dialog.component'; +import { CommonConfirmDialogComponent } from './common-confirm-dialog.component'; -describe('ConfirmDialogComponent', () => { - let component: ConfirmDialogComponent; - let fixture: ComponentFixture; +describe('CommonConfirmDialogComponent', () => { + let component: CommonConfirmDialogComponent; + let fixture: ComponentFixture; beforeEach(async () => { await TestBed.configureTestingModule({ imports: [MatDialogModule, VitamUICommonTestModule], - declarations: [ConfirmDialogComponent], + declarations: [CommonConfirmDialogComponent], }).compileComponents(); }); beforeEach(() => { - fixture = TestBed.createComponent(ConfirmDialogComponent); + fixture = TestBed.createComponent(CommonConfirmDialogComponent); component = fixture.componentInstance; fixture.detectChanges(); }); diff --git a/ui/ui-frontend/projects/vitamui-library/src/app/modules/components/common-confirm-dialog/common-confirm-dialog.component.ts b/ui/ui-frontend/projects/vitamui-library/src/app/modules/components/common-confirm-dialog/common-confirm-dialog.component.ts new file mode 100644 index 00000000000..394d480d04a --- /dev/null +++ b/ui/ui-frontend/projects/vitamui-library/src/app/modules/components/common-confirm-dialog/common-confirm-dialog.component.ts @@ -0,0 +1,52 @@ +/* + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * 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. + */ +import { Component, Input } from '@angular/core'; + +@Component({ + selector: 'vitamui-common-confirm-dialog', + templateUrl: './common-confirm-dialog.component.html', + styleUrls: ['./common-confirm-dialog.component.scss'], + standalone: false, +}) +export class CommonConfirmDialogComponent { + @Input() dialogTitle: string; + @Input() dialogSubTitle: string; + @Input() cancelLabel: string; + @Input() confirmLabel: string; + + constructor() {} +} diff --git a/ui/ui-frontend/projects/vitamui-library/src/app/modules/components/confirm-dialog/confirm-dialog.module.ts b/ui/ui-frontend/projects/vitamui-library/src/app/modules/components/common-confirm-dialog/confirm-dialog.module.ts similarity index 91% rename from ui/ui-frontend/projects/vitamui-library/src/app/modules/components/confirm-dialog/confirm-dialog.module.ts rename to ui/ui-frontend/projects/vitamui-library/src/app/modules/components/common-confirm-dialog/confirm-dialog.module.ts index d1e4047f888..704a7f62b48 100644 --- a/ui/ui-frontend/projects/vitamui-library/src/app/modules/components/confirm-dialog/confirm-dialog.module.ts +++ b/ui/ui-frontend/projects/vitamui-library/src/app/modules/components/common-confirm-dialog/confirm-dialog.module.ts @@ -40,12 +40,12 @@ import { MatDialogModule } from '@angular/material/dialog'; import { TranslateModule } from '@ngx-translate/core'; import { ClosePopupDialogComponent } from './close-popup-dialog.component'; -import { ConfirmDialogComponent } from './confirm-dialog.component'; +import { CommonConfirmDialogComponent } from './common-confirm-dialog.component'; import { DialogHeaderComponent } from '../../../../lib/components/dialog/dialog-header/dialog-header.component'; @NgModule({ - declarations: [ConfirmDialogComponent, ClosePopupDialogComponent], + declarations: [CommonConfirmDialogComponent, ClosePopupDialogComponent], imports: [CommonModule, MatDialogModule, TranslateModule, DialogHeaderComponent], - exports: [ConfirmDialogComponent, ClosePopupDialogComponent], + exports: [CommonConfirmDialogComponent, ClosePopupDialogComponent], }) export class ConfirmDialogModule {} diff --git a/ui/ui-frontend/projects/vitamui-library/src/app/modules/components/confirm-dialog/confirm-dialog.service.spec.ts b/ui/ui-frontend/projects/vitamui-library/src/app/modules/components/common-confirm-dialog/confirm-dialog.service.spec.ts similarity index 100% rename from ui/ui-frontend/projects/vitamui-library/src/app/modules/components/confirm-dialog/confirm-dialog.service.spec.ts rename to ui/ui-frontend/projects/vitamui-library/src/app/modules/components/common-confirm-dialog/confirm-dialog.service.spec.ts diff --git a/ui/ui-frontend/projects/vitamui-library/src/app/modules/components/confirm-dialog/confirm-dialog.service.ts b/ui/ui-frontend/projects/vitamui-library/src/app/modules/components/common-confirm-dialog/confirm-dialog.service.ts similarity index 100% rename from ui/ui-frontend/projects/vitamui-library/src/app/modules/components/confirm-dialog/confirm-dialog.service.ts rename to ui/ui-frontend/projects/vitamui-library/src/app/modules/components/common-confirm-dialog/confirm-dialog.service.ts diff --git a/ui/ui-frontend/projects/vitamui-library/src/app/modules/components/confirm-dialog/dialog-input-data.interface.ts b/ui/ui-frontend/projects/vitamui-library/src/app/modules/components/common-confirm-dialog/dialog-input-data.interface.ts similarity index 100% rename from ui/ui-frontend/projects/vitamui-library/src/app/modules/components/confirm-dialog/dialog-input-data.interface.ts rename to ui/ui-frontend/projects/vitamui-library/src/app/modules/components/common-confirm-dialog/dialog-input-data.interface.ts diff --git a/ui/ui-frontend/projects/vitamui-library/src/app/modules/components/confirm-dialog/index.ts b/ui/ui-frontend/projects/vitamui-library/src/app/modules/components/common-confirm-dialog/index.ts similarity index 97% rename from ui/ui-frontend/projects/vitamui-library/src/app/modules/components/confirm-dialog/index.ts rename to ui/ui-frontend/projects/vitamui-library/src/app/modules/components/common-confirm-dialog/index.ts index 6dd1c0c027c..d7d5af6244e 100644 --- a/ui/ui-frontend/projects/vitamui-library/src/app/modules/components/confirm-dialog/index.ts +++ b/ui/ui-frontend/projects/vitamui-library/src/app/modules/components/common-confirm-dialog/index.ts @@ -35,6 +35,6 @@ * knowledge of the CeCILL-C license and that you accept its terms. */ export * from './close-popup-dialog.component'; -export * from './confirm-dialog.component'; +export * from './common-confirm-dialog.component'; export * from './confirm-dialog.module'; export * from './confirm-dialog.service'; diff --git a/ui/ui-frontend/projects/vitamui-library/src/app/modules/components/editable-field/editable-field.module.ts b/ui/ui-frontend/projects/vitamui-library/src/app/modules/components/editable-field/editable-field.module.ts index 43ce3a6c4d4..74608c1978a 100644 --- a/ui/ui-frontend/projects/vitamui-library/src/app/modules/components/editable-field/editable-field.module.ts +++ b/ui/ui-frontend/projects/vitamui-library/src/app/modules/components/editable-field/editable-field.module.ts @@ -46,7 +46,7 @@ import { MatProgressSpinnerModule } from '@angular/material/progress-spinner'; import { MatSelectModule } from '@angular/material/select'; import { TranslateModule } from '@ngx-translate/core'; import { EllipsisDirectiveModule } from '../../directives/ellipsis/ellipsis.directive.module'; -import { ConfirmDialogModule } from '../confirm-dialog/confirm-dialog.module'; +import { ConfirmDialogModule } from '../common-confirm-dialog/confirm-dialog.module'; import { EditableEmailInputComponent } from './editable-email-input/editable-email-input.component'; import { EditableFieldComponent } from './editable-field.component'; import { EditableFileComponent } from './editable-file/editable-file.component'; diff --git a/ui/ui-frontend/projects/vitamui-library/src/app/modules/index.ts b/ui/ui-frontend/projects/vitamui-library/src/app/modules/index.ts index 970d82ff25f..24213000322 100644 --- a/ui/ui-frontend/projects/vitamui-library/src/app/modules/index.ts +++ b/ui/ui-frontend/projects/vitamui-library/src/app/modules/index.ts @@ -81,7 +81,7 @@ export * from './components/badge/badge.component'; export * from './components/chip/chip.component'; export * from './components/elements/elements.component'; export * from './components/collapse/collapse.module'; -export * from './components/confirm-dialog/index'; +export * from './components/common-confirm-dialog/index'; export * from './components/data/data.component'; export * from './components/datepicker/datepicker.component'; export * from './components/download-snack-bar/index'; diff --git a/ui/ui-frontend/projects/vitamui-library/src/app/modules/models/collect/batch.ts b/ui/ui-frontend/projects/vitamui-library/src/app/modules/models/collect/batch.ts new file mode 100644 index 00000000000..d6863028fbf --- /dev/null +++ b/ui/ui-frontend/projects/vitamui-library/src/app/modules/models/collect/batch.ts @@ -0,0 +1,41 @@ +/* + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * 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 interface Batch { + BatchId: string; + BatchStatus: string; + evTypeProc?: string; +} diff --git a/ui/ui-frontend/projects/vitamui-library/src/app/modules/models/collect/transaction.ts b/ui/ui-frontend/projects/vitamui-library/src/app/modules/models/collect/transaction.ts index a895a1e7ca9..ebe43f68fb8 100644 --- a/ui/ui-frontend/projects/vitamui-library/src/app/modules/models/collect/transaction.ts +++ b/ui/ui-frontend/projects/vitamui-library/src/app/modules/models/collect/transaction.ts @@ -35,6 +35,7 @@ * knowledge of the CeCILL-C license and that you accept its terms. */ import { Id } from '../id.interface'; +import { Batch } from './batch'; import { TransactionStatus } from './transaction-status'; export interface Transaction extends Id { @@ -52,4 +53,5 @@ export interface Transaction extends Id { acquisitionInformation?: string; creationDate?: Date; lastUpdate?: Date; + batches?: Batch[]; } diff --git a/ui/ui-frontend/projects/vitamui-library/src/app/modules/subrogation/subrogation.module.ts b/ui/ui-frontend/projects/vitamui-library/src/app/modules/subrogation/subrogation.module.ts index 137f624de10..4fccc702b3d 100644 --- a/ui/ui-frontend/projects/vitamui-library/src/app/modules/subrogation/subrogation.module.ts +++ b/ui/ui-frontend/projects/vitamui-library/src/app/modules/subrogation/subrogation.module.ts @@ -44,7 +44,7 @@ import { MatProgressSpinnerModule } from '@angular/material/progress-spinner'; import { MatSelectModule } from '@angular/material/select'; import { TranslateModule } from '@ngx-translate/core'; -import { ConfirmDialogModule } from '../components/confirm-dialog/confirm-dialog.module'; +import { ConfirmDialogModule } from '../components/common-confirm-dialog/confirm-dialog.module'; import { WINDOW_LOCATION } from '../injection-tokens'; import { PipesModule } from '../pipes/pipes.module'; import { SubrogationBannerComponent } from './subrogation-banner/subrogation-banner.component'; diff --git a/ui/ui-frontend/projects/vitamui-library/src/app/modules/vitamui-common.module.ts b/ui/ui-frontend/projects/vitamui-library/src/app/modules/vitamui-common.module.ts index ba0af3e93c2..461f2eaf6fa 100644 --- a/ui/ui-frontend/projects/vitamui-library/src/app/modules/vitamui-common.module.ts +++ b/ui/ui-frontend/projects/vitamui-library/src/app/modules/vitamui-common.module.ts @@ -48,7 +48,7 @@ import { AuthService } from './auth.service'; import { ChipComponent } from './components/chip/chip.component'; import { CollapseModule } from './components/collapse/collapse.module'; import { CommonTooltipModule } from './components/common-tooltip/common-tooltip.module'; -import { ConfirmDialogModule } from './components/confirm-dialog/confirm-dialog.module'; +import { ConfirmDialogModule } from './components/common-confirm-dialog/confirm-dialog.module'; import { DownloadSnackBarModule } from './components/download-snack-bar/download-snack-bar.module'; import { EditableFieldModule } from './components/editable-field/editable-field.module'; import { FileSelectorComponent } from './components/file-selector/file-selector.component'; diff --git a/ui/ui-frontend/projects/vitamui-library/src/lib/components/dialog/confirm-dialog/confirm-dialog.component.html b/ui/ui-frontend/projects/vitamui-library/src/lib/components/dialog/confirm-dialog/confirm-dialog.component.html new file mode 100644 index 00000000000..8fa74b89d38 --- /dev/null +++ b/ui/ui-frontend/projects/vitamui-library/src/lib/components/dialog/confirm-dialog/confirm-dialog.component.html @@ -0,0 +1,16 @@ + + +@if (data?.message) { + +

{{ data.message | translate }}

+
+} + + + + + diff --git a/ui/ui-frontend/projects/vitamui-library/src/app/modules/components/confirm-dialog/confirm-dialog.component.ts b/ui/ui-frontend/projects/vitamui-library/src/lib/components/dialog/confirm-dialog/confirm-dialog.component.ts similarity index 76% rename from ui/ui-frontend/projects/vitamui-library/src/app/modules/components/confirm-dialog/confirm-dialog.component.ts rename to ui/ui-frontend/projects/vitamui-library/src/lib/components/dialog/confirm-dialog/confirm-dialog.component.ts index 8b6b6752c61..5b3b6e7caa2 100644 --- a/ui/ui-frontend/projects/vitamui-library/src/app/modules/components/confirm-dialog/confirm-dialog.component.ts +++ b/ui/ui-frontend/projects/vitamui-library/src/lib/components/dialog/confirm-dialog/confirm-dialog.component.ts @@ -34,19 +34,21 @@ * 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 { Component, Input } from '@angular/core'; +import { DialogModule } from '@angular/cdk/dialog'; +import { Component, Inject } from '@angular/core'; +import { MAT_DIALOG_DATA, MatDialogModule } from '@angular/material/dialog'; +import { TranslateModule } from '@ngx-translate/core'; +import { DialogHeaderComponent } from '../dialog-header/dialog-header.component'; +import { ConfirmDialogData } from '../../../models/confirm-dialog-data.interface'; @Component({ - selector: 'vitamui-common-confirm-dialog', + selector: 'vitamui-confirm-dialog', + imports: [TranslateModule, DialogModule, MatDialogModule, DialogHeaderComponent], templateUrl: './confirm-dialog.component.html', - styleUrls: ['./confirm-dialog.component.scss'], - standalone: false, }) export class ConfirmDialogComponent { - @Input() dialogTitle: string; - @Input() dialogSubTitle: string; - @Input() cancelLabel: string; - @Input() confirmLabel: string; - - constructor() {} + constructor( + @Inject(MAT_DIALOG_DATA) + public data?: ConfirmDialogData, + ) {} } diff --git a/ui/ui-frontend/projects/vitamui-library/src/lib/models/confirm-dialog-data.interface.ts b/ui/ui-frontend/projects/vitamui-library/src/lib/models/confirm-dialog-data.interface.ts new file mode 100644 index 00000000000..b6592c4c4e5 --- /dev/null +++ b/ui/ui-frontend/projects/vitamui-library/src/lib/models/confirm-dialog-data.interface.ts @@ -0,0 +1,43 @@ +/* + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * 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 interface ConfirmDialogData { + title?: string; + subTitle?: string; + message?: string; + confirmLabel?: string; + cancelLabel?: string; +} diff --git a/ui/ui-frontend/projects/vitamui-library/src/lib/vitamui-library.module.ts b/ui/ui-frontend/projects/vitamui-library/src/lib/vitamui-library.module.ts index 2820ab512c3..ae6484873e1 100644 --- a/ui/ui-frontend/projects/vitamui-library/src/lib/vitamui-library.module.ts +++ b/ui/ui-frontend/projects/vitamui-library/src/lib/vitamui-library.module.ts @@ -60,9 +60,11 @@ import { TranslateWithOptionalTypeSuffixPipe } from '../app/modules/pipes/transl import { SaveBannerComponent } from './components/save-banner/save-banner.component'; import { ConfirmActionComponent } from './components/confirm-action/confirm-action.component'; import { ManagementRuleSearchComponent } from './components/management-rule-search/management-rule-search.component'; +import { ConfirmDialogComponent } from './components/dialog/confirm-dialog/confirm-dialog.component'; const components = [ AlertDialogComponent, + ConfirmDialogComponent, ConfirmActionComponent, DialogHeaderComponent, DialogContentWithStateComponent, 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 74e58cb5d9a..495912099da 100644 --- a/ui/ui-frontend/projects/vitamui-library/src/public-api.ts +++ b/ui/ui-frontend/projects/vitamui-library/src/public-api.ts @@ -54,6 +54,7 @@ export * from './lib/components/vitamui-radio/vitamui-radio.component'; export * from './lib/components/vitamui-radio/vitamui-radio.module'; export * from './lib/components/dialog/alert-dialog/alert-dialog.component'; +export * from './lib/components/dialog/confirm-dialog/confirm-dialog.component'; export * from './lib/components/dialog/dialog-content-with-state/dialog-content-with-state.component'; export * from './lib/components/dialog/dialog-header/dialog-header.component'; export * from './lib/components/dialog/error-dialog/error-dialog.component';