Skip to content

Commit db8a500

Browse files
author
Salim Terres
committed
Story #15442 [Search][Rules Update] Frontend improvement for rules update.
1 parent dc47b88 commit db8a500

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,
@@ -139,6 +140,13 @@ export class ManagementRulesComponent implements OnInit, OnChanges, OnDestroy {
139140
ruleCategorySelected: string;
140141
hasExactCount: boolean;
141142
resultNumberToShow: string;
143+
isUpdateInProgress = true;
144+
145+
breadcrumbData: BreadCrumbData[] = [
146+
{ identifier: ApplicationId.PORTAL_APP },
147+
{ identifier: ApplicationId.ARCHIVE_SEARCH_APP },
148+
{ label: this.translate.instant('ARCHIVE_SEARCH.RULES_ACTION.UPDATE_RULE') },
149+
];
142150

143151
private subscriptions = new Subscription();
144152

@@ -595,6 +603,7 @@ export class ManagementRulesComponent implements OnInit, OnChanges, OnDestroy {
595603
}
596604

597605
onSelectAction(rule: string) {
606+
this.isUpdateInProgress = false;
598607
switch (rule) {
599608
case 'ADD_RULES':
600609
if (this.isRuleCategorySelected && !this.isAddValidActions) {
@@ -654,17 +663,22 @@ export class ManagementRulesComponent implements OnInit, OnChanges, OnDestroy {
654663
}
655664

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

670684
submitUpdates() {
@@ -673,6 +687,7 @@ export class ManagementRulesComponent implements OnInit, OnChanges, OnDestroy {
673687
const actionUpdateOnRules: any = {};
674688
const actionDeleteOnRules: any = {};
675689

690+
this.isUpdateInProgress = false;
676691
this.prepareAppraisalRuleActionsObject(actionAddOnRules, actionUpdateOnRules, actionDeleteOnRules);
677692
this.prepareAccessRuleActionsObject(actionAddOnRules, actionUpdateOnRules, actionDeleteOnRules);
678693
this.prepareStorageRuleActionsObject(actionAddOnRules, actionUpdateOnRules, actionDeleteOnRules);
@@ -698,6 +713,7 @@ export class ManagementRulesComponent implements OnInit, OnChanges, OnDestroy {
698713

699714
this.archiveService.updateUnitsRules(ruleSearchCriteriaDto).subscribe(
700715
(response) => {
716+
this.isUpdateInProgress = true;
701717
const ruleActions: ActionsRules[] = [];
702718
this.managementRulesSharedDataService.emitRuleActions(ruleActions);
703719
this.managementRulesSharedDataService.emitManagementRules([]);
@@ -715,6 +731,7 @@ export class ManagementRulesComponent implements OnInit, OnChanges, OnDestroy {
715731
});
716732
},
717733
(error: any) => {
734+
this.isUpdateInProgress = false;
718735
this.logger.error('Error message :', error);
719736
},
720737
);

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)