Skip to content

Commit a92c0cd

Browse files
authored
Merge pull request #3374 from ProgrammeVitam/Story_15442
Story #15442 [Search][Rules Update] Frontend improvement for rules update
2 parents 9d58468 + f922292 commit a92c0cd

File tree

7 files changed

+49
-55
lines changed

7 files changed

+49
-55
lines changed

ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/additional-actions-search/management-rules/management-rules.component.css

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
.update-rules-table-head {
2929
display: flex;
3030
align-items: center;
31+
height: 70px;
3132
font-weight: 700;
3233
color: var(--vitamui-grey-900);
3334
margin-bottom: 0.3rem;
@@ -41,9 +42,3 @@
4142
.row-padding {
4243
padding-left: 20px;
4344
}
44-
45-
.details-ua {
46-
text-align: center;
47-
vertical-align: middle;
48-
line-height: 50px;
49-
}

ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/additional-actions-search/management-rules/management-rules.component.html

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<mat-sidenav-container [autosize]="true" [hasBackdrop]="false">
22
<mat-sidenav-content>
33
<div class="vitamui-heading">
4-
<vitamui-title-breadcrumb>
4+
<vitamui-title-breadcrumb [data]="breadcrumbData">
55
<h5>{{ 'ARCHIVE_SEARCH.RULES_ACTION.UPDATE_RULE' | translate }}</h5>
66
</vitamui-title-breadcrumb>
77
</div>
@@ -43,23 +43,17 @@ <h5>{{ 'ARCHIVE_SEARCH.RULES_ACTION.UPDATE_RULE' | translate }}</h5>
4343
</div>
4444
</div>
4545
<div class="col-8 row-padding">
46-
<div class="update-rules-table-head row">
47-
<div class="col-2 clickable" (click)="returnToArchiveSearchPage()">
48-
<span class="text primary"> {{ 'RULES.BACK' | translate }}</span>
49-
</div>
50-
<div class="col-10">
51-
<div class="row">
52-
<div class="col-7">
53-
<span class="details-ua">
54-
{{ 'RULES.UA_SELECTED' | translate: { ua_selected: selectedItemToShow } }}
55-
</span>
56-
</div>
57-
<div class="col-5">
58-
<button class="btn primary" [disabled]="ruleActionsAbsentOrInvalid()" (click)="submitUpdates()">
59-
{{ 'RULES.EXECUTE_RULE_UPDATE' | translate }}
60-
</button>
61-
</div>
62-
</div>
46+
<div class="update-rules-table-head justify-content-between">
47+
<span>
48+
{{ 'RULES.UA_SELECTED' | translate: { ua_selected: selectedItemToShow } }}
49+
</span>
50+
<div class="hgap-3">
51+
<button class="btn primary" [disabled]="ruleActionsAbsentOrInvalid()" (click)="submitUpdates()">
52+
{{ 'RULES.EXECUTE_RULE_UPDATE' | translate }}
53+
</button>
54+
<button class="btn outline outline-primary" (click)="returnToArchiveSearchPage()">
55+
{{ 'RULES.QUIT' | translate }}
56+
</button>
6357
</div>
6458
</div>
6559

ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/additional-actions-search/management-rules/management-rules.component.spec.ts

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -320,15 +320,6 @@ describe('ManagementRulesComponent', () => {
320320
});
321321

322322
describe('DOM', () => {
323-
it('should have 4 rows ', () => {
324-
// When
325-
const nativeElement = fixture.nativeElement;
326-
const elementRow = nativeElement.querySelectorAll('.row');
327-
328-
// Then
329-
expect(elementRow.length).toBe(4);
330-
});
331-
332323
it('should have 2 text titles', () => {
333324
const formTitlesHtmlElements = fixture.nativeElement.querySelectorAll('label');
334325

ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/additional-actions-search/management-rules/management-rules.component.ts

Lines changed: 28 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ import { Observable, Subscription } from 'rxjs';
4242
import { filter, map, shareReplay } from 'rxjs/operators';
4343
import {
4444
ApplicationId,
45+
BreadCrumbData,
4546
Logger,
4647
Option,
4748
Rule,
@@ -140,6 +141,13 @@ export class ManagementRulesComponent implements OnInit, OnChanges, OnDestroy {
140141
ruleCategorySelected: string;
141142
hasExactCount: boolean;
142143
resultNumberToShow: string;
144+
isUpdateInProgress = true;
145+
146+
breadcrumbData: BreadCrumbData[] = [
147+
{ identifier: ApplicationId.PORTAL_APP },
148+
{ identifier: ApplicationId.ARCHIVE_SEARCH_APP },
149+
{ label: this.translate.instant('ARCHIVE_SEARCH.RULES_ACTION.UPDATE_RULE') },
150+
];
143151

144152
private subscriptions = new Subscription();
145153

@@ -597,6 +605,7 @@ export class ManagementRulesComponent implements OnInit, OnChanges, OnDestroy {
597605
}
598606

599607
onSelectAction(rule: string) {
608+
this.isUpdateInProgress = false;
600609
switch (rule) {
601610
case 'ADD_RULES':
602611
if (this.isRuleCategorySelected && !this.isAddValidActions) {
@@ -656,17 +665,22 @@ export class ManagementRulesComponent implements OnInit, OnChanges, OnDestroy {
656665
}
657666

658667
returnToArchiveSearchPage() {
659-
const dialogRef = this.dialog.open(this.confirmLeaveRuleActionsDialog);
660-
661-
this.subscriptions.add(
662-
dialogRef
663-
.afterClosed()
664-
.pipe(filter((result) => !!result))
665-
.subscribe(() => {
666-
this.initializeParameters();
667-
this.location.back();
668-
}),
669-
);
668+
if (this.isUpdateInProgress) {
669+
this.initializeParameters();
670+
this.router.navigate(['/archive-search/tenant/', this.tenantIdentifier]);
671+
} else {
672+
const dialogRef = this.dialog.open(this.confirmLeaveRuleActionsDialog);
673+
674+
this.subscriptions.add(
675+
dialogRef
676+
.afterClosed()
677+
.pipe(filter((result) => !!result))
678+
.subscribe(() => {
679+
this.initializeParameters();
680+
this.location.back();
681+
}),
682+
);
683+
}
670684
}
671685

672686
submitUpdates() {
@@ -675,6 +689,7 @@ export class ManagementRulesComponent implements OnInit, OnChanges, OnDestroy {
675689
const actionUpdateOnRules: any = {};
676690
const actionDeleteOnRules: any = {};
677691

692+
this.isUpdateInProgress = false;
678693
this.prepareAppraisalRuleActionsObject(actionAddOnRules, actionUpdateOnRules, actionDeleteOnRules);
679694
this.prepareAccessRuleActionsObject(actionAddOnRules, actionUpdateOnRules, actionDeleteOnRules);
680695
this.prepareStorageRuleActionsObject(actionAddOnRules, actionUpdateOnRules, actionDeleteOnRules);
@@ -700,6 +715,7 @@ export class ManagementRulesComponent implements OnInit, OnChanges, OnDestroy {
700715

701716
this.archiveService.updateUnitsRules(ruleSearchCriteriaDto).subscribe(
702717
(response) => {
718+
this.isUpdateInProgress = true;
703719
const ruleActions: ActionsRules[] = [];
704720
this.managementRulesSharedDataService.emitRuleActions(ruleActions);
705721
this.managementRulesSharedDataService.emitManagementRules([]);
@@ -717,6 +733,7 @@ export class ManagementRulesComponent implements OnInit, OnChanges, OnDestroy {
717733
});
718734
},
719735
(error: any) => {
736+
this.isUpdateInProgress = false;
720737
this.logger.error('Error message :', error);
721738
},
722739
);

ui/ui-frontend/projects/archive-search/src/app/archive/archive-search/archive-search.component.html

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -485,19 +485,16 @@ <h5>{{ 'ARCHIVE_SEARCH.TITLE_SEARCH' | translate }}</h5>
485485
) | translate: { elementsSize: selectedItemCount }
486486
"
487487
[title]="
488-
(shouldReadSelectedItemCount()
488+
((shouldReadSelectedItemCount()
489489
? selectedItemCount > 1
490490
? 'ARCHIVE_SEARCH.OTHER_ACTIONS.DIALOG_MESSAGE.ACTION_ON_BIG_NUMBERS_MESSAGE_EXACT_COUNT'
491491
: 'ARCHIVE_SEARCH.OTHER_ACTIONS.DIALOG_MESSAGE.ACTION_ON_BIG_NUMBERS_MESSAGE_EXACT_COUNT_ONE'
492492
: 'ARCHIVE_SEARCH.OTHER_ACTIONS.DIALOG_MESSAGE.ACTION_ON_BIG_NUMBERS_MESSAGE_WITHOUT_EXACT_COUNT'
493-
) | translate: { elementsSize: selectedItemCount }
493+
) | translate: { elementsSize: selectedItemCount }) +
494+
'<br>' +
495+
('ARCHIVE_SEARCH.OTHER_ACTIONS.DIALOG_MESSAGE.ACTION_ON_BIG_NUMBERS_MESSAGE_2' | translate)
494496
"
495497
></vitamui-dialog-header>
496-
<mat-dialog-content>
497-
<div class="text large bold">
498-
{{ 'ARCHIVE_SEARCH.OTHER_ACTIONS.DIALOG_MESSAGE.ACTION_ON_BIG_NUMBERS_MESSAGE_2' | translate }}
499-
</div>
500-
</mat-dialog-content>
501498
<mat-dialog-actions>
502499
<button [matDialogClose]="true" class="btn primary btn-confirm-dialog">
503500
{{ 'ARCHIVE_SEARCH.OTHER_ACTIONS.DIALOG_MESSAGE.CONFIRM' | translate }}

ui/ui-frontend/projects/archive-search/src/assets/i18n/en.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@
116116
"SELECT_RULE_CATEGORY": "Select a rule category",
117117
"SELECT_RULE_ACTION": "Select an action",
118118
"OTHER_ACTIONS": "Other actions",
119-
"BACK": "BACK",
119+
"QUIT": "QUIT",
120120
"EXECUTE_RULE_UPDATE": "Start update",
121121
"EXECUTE_RULE_UPDATE_MESSAGE": "The operation to update the management rules has been launched",
122122
"ACTION_ON_RULES": "Action on the rules",
@@ -196,7 +196,7 @@
196196
"DIALOG_MESSAGE": {
197197
"UPDATE_CONFIRM_TITLE_MESSAGE": "Validate rule change(s)",
198198
"DELETE_COMPONENT": "Are you sure you want to delete this rule update block?",
199-
"UPDATE_CONFIRM_MESSAGE": "Attention, you are about to validate the changes of rule(s) on all the archival units taken into account in the requested update. Do you confirm this update?",
199+
"UPDATE_CONFIRM_MESSAGE": "Attention, you are about to validate the changes of rule(s) on all the archival units taken into account in the requested update.<br>Do you confirm this update?",
200200
"EXIT_CONFIRM_MESSAGE": "Are you sure you want to quit updating business rules on {{ua_selected}} selected archival units?"
201201
},
202202
"CATEGORIES_NAME": {

ui/ui-frontend/projects/archive-search/src/assets/i18n/fr.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@
116116
"SELECT_RULE_CATEGORY": "Sélectionnez une catégorie de règle",
117117
"SELECT_RULE_ACTION": "Sélectionnez une action",
118118
"OTHER_ACTIONS": "Autres actions",
119-
"BACK": "RETOUR",
119+
"QUIT": "QUITTER",
120120
"EXECUTE_RULE_UPDATE": "Lancer la mise à jour",
121121
"EXECUTE_RULE_UPDATE_MESSAGE": "L'opération de mise à jour des règles de gestion a bien été lancée",
122122
"ACTION_ON_RULES": "Action sur les règles",
@@ -196,7 +196,7 @@
196196
"DIALOG_MESSAGE": {
197197
"UPDATE_CONFIRM_TITLE_MESSAGE": "Validation de changement(s) de règle(s)",
198198
"DELETE_COMPONENT": "Êtes-vous sûr de vouloir supprimer ce bloc de mise à jour des règles ?",
199-
"UPDATE_CONFIRM_MESSAGE": "Attention, vous êtes sur le point de valider les changements de règle(s) sur l'ensemble des unités archivistiques prises en compte dans la mise à jour demandée. Confirmez-vous cette mise à jour ?",
199+
"UPDATE_CONFIRM_MESSAGE": "Attention, vous êtes sur le point de valider les changements de règle(s) sur l'ensemble des unités archivistiques prises en compte dans la mise à jour demandée.<br>Confirmez-vous cette mise à jour ?",
200200
"EXIT_CONFIRM_MESSAGE": "Êtes-vous sûr de vouloir quitter la mise à jour des règles de gestion sur les {{ua_selected}} unités archivistiques sélectionnées ?"
201201
},
202202
"CATEGORIES_NAME": {

0 commit comments

Comments
 (0)