-
Notifications
You must be signed in to change notification settings - Fork 6
Story #15613: Allow validation and sending of transactions with batch errors #3585
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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<any> 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', | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. En constante ? |
||
| duration: 10_000, | ||
| }); | ||
| }), | ||
| ); | ||
| }), | ||
| ) | ||
| .subscribe((transaction: Transaction) => { | ||
|
|
@@ -1434,5 +1456,9 @@ export class ArchiveSearchCollectComponent extends SidenavPage<any> implements O | |
| }); | ||
| } | ||
|
|
||
| private hasBatchInError(transaction: Transaction): boolean { | ||
| return transaction.batches?.some((b) => b.BatchStatus === 'KO') ?? false; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Utiliser un enum |
||
| } | ||
|
|
||
| protected readonly TransactionStatus = TransactionStatus; | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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', | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,4 +4,8 @@ | |
| justify-content: flex-end; /* ✅ pousse les boutons à droite */ | ||
| } | ||
|
|
||
| .batch-ko-error { | ||
| color: var(--vitamui-red); | ||
| } | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Utiliser des constantes ?