diff --git a/apps/red-ui/src/app/components/downloads-list-screen/downloads-list-screen.component.ts b/apps/red-ui/src/app/components/downloads-list-screen/downloads-list-screen.component.ts index 277cf5f1e..a24666a62 100644 --- a/apps/red-ui/src/app/components/downloads-list-screen/downloads-list-screen.component.ts +++ b/apps/red-ui/src/app/components/downloads-list-screen/downloads-list-screen.component.ts @@ -45,9 +45,7 @@ export class DownloadsListScreenComponent extends ListingComponent this._loadData())) - .subscribe(); + setInterval(() => this._loadData(), 5000); } downloadItem(download: DownloadStatus) { diff --git a/apps/red-ui/src/app/modules/admin/dialogs/add-edit-dossier-template-dialog/add-edit-clone-dossier-template-dialog.component.html b/apps/red-ui/src/app/modules/admin/dialogs/add-edit-dossier-template-dialog/add-edit-clone-dossier-template-dialog.component.html index 149a08ad1..139e68309 100644 --- a/apps/red-ui/src/app/modules/admin/dialogs/add-edit-dossier-template-dialog/add-edit-clone-dossier-template-dialog.component.html +++ b/apps/red-ui/src/app/modules/admin/dialogs/add-edit-dossier-template-dialog/add-edit-clone-dossier-template-dialog.component.html @@ -45,7 +45,12 @@
- + @@ -55,7 +60,12 @@
- + diff --git a/apps/red-ui/src/app/modules/admin/dialogs/add-edit-dossier-template-dialog/add-edit-clone-dossier-template-dialog.component.ts b/apps/red-ui/src/app/modules/admin/dialogs/add-edit-dossier-template-dialog/add-edit-clone-dossier-template-dialog.component.ts index 5333e8f7c..55b53c75e 100644 --- a/apps/red-ui/src/app/modules/admin/dialogs/add-edit-dossier-template-dialog/add-edit-clone-dossier-template-dialog.component.ts +++ b/apps/red-ui/src/app/modules/admin/dialogs/add-edit-dossier-template-dialog/add-edit-clone-dossier-template-dialog.component.ts @@ -54,17 +54,6 @@ export class AddEditCloneDossierTemplateDialogComponent extends BaseDialogCompon this._previousValidFrom = this._lastValidFrom = this.form.get('validFrom').value; this._previousValidTo = this._lastValidTo = this.form.get('validTo').value; - - this.addSubscription = this.form.valueChanges.subscribe(value => { - this._applyValidityIntervalConstraints(value); - }); - - this.addSubscription = this.form.controls['validFrom'].valueChanges.subscribe(value => { - this._lastValidFrom = value || this._lastValidFrom; - }); - this.addSubscription = this.form.controls['validTo'].valueChanges.subscribe(value => { - this._lastValidTo = value || this._lastValidTo; - }); } toggleHasValid(extremity: string) { @@ -75,6 +64,7 @@ export class AddEditCloneDossierTemplateDialogComponent extends BaseDialogCompon this.hasValidTo = !this.hasValidTo; this.form.controls['validTo'].setValue(this.hasValidTo ? this._lastValidTo : null); } + this.applyValidityIntervalConstraints(); } async save() { @@ -144,14 +134,14 @@ export class AddEditCloneDossierTemplateDialogComponent extends BaseDialogCompon return this.dossierTemplate?.name; } - private _applyValidityIntervalConstraints(value): boolean { - if (applyIntervalConstraints(value, this._previousValidFrom, this._previousValidTo, this.form, 'validFrom', 'validTo')) { - return true; - } + applyValidityIntervalConstraints(): void { + const formValue = this.form.value; + applyIntervalConstraints(formValue, this._previousValidFrom, this._previousValidTo, this.form, 'validFrom', 'validTo'); this._previousValidFrom = this.form.get('validFrom').value; this._previousValidTo = this.form.get('validTo').value; - return false; + this._lastValidFrom = this._previousValidFrom || this._lastValidFrom; + this._lastValidTo = this._previousValidTo || this._lastValidTo; } private _requiredIfValidator(predicate) { diff --git a/apps/red-ui/src/app/modules/admin/dialogs/add-edit-user-dialog/user-details/user-details.component.html b/apps/red-ui/src/app/modules/admin/dialogs/add-edit-user-dialog/user-details/user-details.component.html index 4ca949f7f..2eeaa6155 100644 --- a/apps/red-ui/src/app/modules/admin/dialogs/add-edit-user-dialog/user-details/user-details.component.html +++ b/apps/red-ui/src/app/modules/admin/dialogs/add-edit-user-dialog/user-details/user-details.component.html @@ -26,7 +26,12 @@
- + {{ translations[role] | translate }}
diff --git a/apps/red-ui/src/app/modules/admin/dialogs/add-edit-user-dialog/user-details/user-details.component.ts b/apps/red-ui/src/app/modules/admin/dialogs/add-edit-user-dialog/user-details/user-details.component.ts index 473d34751..23bbbcd12 100644 --- a/apps/red-ui/src/app/modules/admin/dialogs/add-edit-user-dialog/user-details/user-details.component.ts +++ b/apps/red-ui/src/app/modules/admin/dialogs/add-edit-user-dialog/user-details/user-details.component.ts @@ -62,7 +62,6 @@ export class UserDetailsComponent extends BaseFormComponent implements OnChanges ngOnChanges() { this.form = this._getForm(); - this._setRolesRequirements(); this.initialFormValue = this.form.getRawValue(); } @@ -123,16 +122,14 @@ export class UserDetailsComponent extends BaseFormComponent implements OnChanges }); } - private _setRolesRequirements() { - for (const key of Object.keys(this._ROLE_REQUIREMENTS)) { - this.addSubscription = this.form.controls[key].valueChanges.subscribe(checked => { - if (checked) { - this.form.patchValue({ [this._ROLE_REQUIREMENTS[key]]: true }); - this.form.controls[this._ROLE_REQUIREMENTS[key]].disable(); - } else { - this.form.controls[this._ROLE_REQUIREMENTS[key]].enable(); - } - }); + setRolesRequirements(checked: boolean, role: string): void { + if (Object.keys(this._ROLE_REQUIREMENTS).includes(role)) { + if (checked) { + this.form.patchValue({ [this._ROLE_REQUIREMENTS[role]]: true }); + this.form.controls[this._ROLE_REQUIREMENTS[role]].disable(); + } else { + this.form.controls[this._ROLE_REQUIREMENTS[role]].enable(); + } } } } diff --git a/apps/red-ui/src/app/modules/admin/screens/audit/audit-screen.component.html b/apps/red-ui/src/app/modules/admin/screens/audit/audit-screen.component.html index 25e652fcc..82695b091 100644 --- a/apps/red-ui/src/app/modules/admin/screens/audit/audit-screen.component.html +++ b/apps/red-ui/src/app/modules/admin/screens/audit/audit-screen.component.html @@ -45,7 +45,7 @@
- + {{ translations[category] | translate }} @@ -54,7 +54,7 @@
- +
ยท
- + @@ -86,7 +86,7 @@
- + diff --git a/apps/red-ui/src/app/modules/admin/screens/audit/audit-screen.component.ts b/apps/red-ui/src/app/modules/admin/screens/audit/audit-screen.component.ts index 73701f24c..cf934ce1d 100644 --- a/apps/red-ui/src/app/modules/admin/screens/audit/audit-screen.component.ts +++ b/apps/red-ui/src/app/modules/admin/screens/audit/audit-screen.component.ts @@ -18,7 +18,7 @@ const PAGE_SIZE = 50; styleUrls: ['./audit-screen.component.scss'], providers: [...DefaultListingServices, { provide: ListingComponent, useExisting: forwardRef(() => AuditScreenComponent) }], }) -export class AuditScreenComponent extends ListingComponent implements OnDestroy, OnInit { +export class AuditScreenComponent extends ListingComponent implements OnInit, OnDestroy { readonly ALL_CATEGORIES = 'allCategories'; readonly ALL_USERS = _('audit-screen.all-users'); readonly translations = auditCategoriesTranslations; @@ -45,12 +45,6 @@ export class AuditScreenComponent extends ListingComponent implements OnD private readonly _auditService: AuditService, ) { super(_injector); - - this.addSubscription = this.form.valueChanges.subscribe(async value => { - if (!this._updateDateFilters(value)) { - await this._fetchData(); - } - }); } get totalPages(): number { @@ -68,6 +62,12 @@ export class AuditScreenComponent extends ListingComponent implements OnD await this._fetchData(); } + async filterChange() { + if (!this._updateDateFilters(this.form.value)) { + await this._fetchData(); + } + } + private _getForm(): UntypedFormGroup { return this._formBuilder.group({ category: [this.ALL_CATEGORIES], diff --git a/apps/red-ui/src/app/modules/admin/screens/general-config/smtp-form/smtp-form.component.html b/apps/red-ui/src/app/modules/admin/screens/general-config/smtp-form/smtp-form.component.html index 17402e94d..c6d338f06 100644 --- a/apps/red-ui/src/app/modules/admin/screens/general-config/smtp-form/smtp-form.component.html +++ b/apps/red-ui/src/app/modules/admin/screens/general-config/smtp-form/smtp-form.component.html @@ -83,7 +83,11 @@
- +
{ - if (auth) { - this.openAuthConfigDialog(); - } - }); } async ngOnInit(): Promise { await this._loadData(); } + onToggleAuthentication(checked: boolean): void { + if (checked) { + this.openAuthConfigDialog(); + } + } + openAuthConfigDialog(skipDisableOnCancel?: boolean) { this._dialogService.openDialog('smtpAuthConfig', null, this.form.getRawValue(), null, authConfig => { if (authConfig) { diff --git a/apps/red-ui/src/app/modules/archive/screens/archived-dossiers-screen/archived-dossiers-screen.component.html b/apps/red-ui/src/app/modules/archive/screens/archived-dossiers-screen/archived-dossiers-screen.component.html index 9a6716673..6d031a498 100644 --- a/apps/red-ui/src/app/modules/archive/screens/archived-dossiers-screen/archived-dossiers-screen.component.html +++ b/apps/red-ui/src/app/modules/archive/screens/archived-dossiers-screen/archived-dossiers-screen.component.html @@ -25,3 +25,6 @@ + + + diff --git a/apps/red-ui/src/app/modules/archive/screens/archived-dossiers-screen/archived-dossiers-screen.component.ts b/apps/red-ui/src/app/modules/archive/screens/archived-dossiers-screen/archived-dossiers-screen.component.ts index 2e3089d9e..6ce7fac56 100644 --- a/apps/red-ui/src/app/modules/archive/screens/archived-dossiers-screen/archived-dossiers-screen.component.ts +++ b/apps/red-ui/src/app/modules/archive/screens/archived-dossiers-screen/archived-dossiers-screen.component.ts @@ -18,6 +18,7 @@ export class ArchivedDossiersScreenComponent extends ListingComponent i readonly tableColumnConfigs = this._configService.tableConfig; readonly tableHeaderLabel = _('archived-dossiers-listing.table-header.title'); private readonly _dossierTemplateId: string; + readonly computeFilters$ = this.entitiesService.all$.pipe(tap(() => this._computeAllFilters())); constructor( protected readonly _injector: Injector, @@ -31,7 +32,6 @@ export class ArchivedDossiersScreenComponent extends ListingComponent i } ngOnInit(): void { - this.addSubscription = this.entitiesService.all$.pipe(tap(() => this._computeAllFilters())).subscribe(); this.addSubscription = this._archivedDossiersService.all$ .pipe(tap(dossiers => this.entitiesService.setEntities(dossiers.filter(d => d.dossierTemplateId === this._dossierTemplateId)))) .subscribe(); diff --git a/apps/red-ui/src/app/modules/dossiers-listing/screen/dossiers-listing-screen.component.html b/apps/red-ui/src/app/modules/dossiers-listing/screen/dossiers-listing-screen.component.html index 41d6fd32e..35412d7a6 100644 --- a/apps/red-ui/src/app/modules/dossiers-listing/screen/dossiers-listing-screen.component.html +++ b/apps/red-ui/src/app/modules/dossiers-listing/screen/dossiers-listing-screen.component.html @@ -36,3 +36,6 @@ + + + diff --git a/apps/red-ui/src/app/modules/dossiers-listing/screen/dossiers-listing-screen.component.ts b/apps/red-ui/src/app/modules/dossiers-listing/screen/dossiers-listing-screen.component.ts index b855c5db3..74f629c6b 100644 --- a/apps/red-ui/src/app/modules/dossiers-listing/screen/dossiers-listing-screen.component.ts +++ b/apps/red-ui/src/app/modules/dossiers-listing/screen/dossiers-listing-screen.component.ts @@ -22,6 +22,7 @@ export class DossiersListingScreenComponent extends ListingComponent im readonly tableHeaderLabel = _('dossier-listing.table-header.title'); readonly buttonConfigs: ButtonConfig[]; readonly dossierTemplate: DossierTemplate; + readonly computeFilters$ = this._activeDossiersService.all$.pipe(tap(() => this._computeAllFilters())); @ViewChild('needsWorkFilterTemplate', { read: TemplateRef, static: true, @@ -52,7 +53,6 @@ export class DossiersListingScreenComponent extends ListingComponent im async ngOnInit(): Promise { await this._userPreferenceService.saveLastDossierTemplate(this.dossierTemplate.id); - this.addSubscription = this.entitiesService.all$.pipe(tap(() => this._computeAllFilters())).subscribe(); this.addSubscription = this._activeDossiersService.all$ .pipe(tap(dossiers => this.entitiesService.setEntities(dossiers.filter(d => d.dossierTemplateId === this.dossierTemplate.id)))) .subscribe(); diff --git a/apps/red-ui/src/app/modules/file-preview/components/comments/comments.component.html b/apps/red-ui/src/app/modules/file-preview/components/comments/comments.component.html index c4df98785..764e2454f 100644 --- a/apps/red-ui/src/app/modules/file-preview/components/comments/comments.component.html +++ b/apps/red-ui/src/app/modules/file-preview/components/comments/comments.component.html @@ -34,3 +34,6 @@
+ + + diff --git a/apps/red-ui/src/app/modules/file-preview/components/comments/comments.component.ts b/apps/red-ui/src/app/modules/file-preview/components/comments/comments.component.ts index 7af16c61f..214246329 100644 --- a/apps/red-ui/src/app/modules/file-preview/components/comments/comments.component.ts +++ b/apps/red-ui/src/app/modules/file-preview/components/comments/comments.component.ts @@ -21,6 +21,7 @@ export class CommentsComponent extends AutoUnsubscribe implements OnChanges { readonly trackBy = trackByFactory(); readonly file$: Observable; readonly dossier$: Observable; + hiddenComments$: Observable; @HostBinding('class.hidden') _hidden = true; @ViewChild(InputWithActionComponent) private readonly _input: InputWithActionComponent; @@ -39,14 +40,11 @@ export class CommentsComponent extends AutoUnsubscribe implements OnChanges { } ngOnChanges() { - this.addSubscription = this._commentingService - .isActive$(this.annotation.id) - .pipe( - tap(active => { - this._hidden = !active; - }), - ) - .subscribe(); + this.hiddenComments$ = this._commentingService.isActive$(this.annotation.id).pipe( + tap(active => { + this._hidden = !active; + }), + ); } async addComment(value: string): Promise { diff --git a/apps/red-ui/src/app/modules/shared-dossiers/dialogs/edit-dossier-dialog/edit-dossier-team/edit-dossier-team.component.html b/apps/red-ui/src/app/modules/shared-dossiers/dialogs/edit-dossier-dialog/edit-dossier-team/edit-dossier-team.component.html index a2faa635d..355e02dad 100644 --- a/apps/red-ui/src/app/modules/shared-dossiers/dialogs/edit-dossier-dialog/edit-dossier-team/edit-dossier-team.component.html +++ b/apps/red-ui/src/app/modules/shared-dossiers/dialogs/edit-dossier-dialog/edit-dossier-team/edit-dossier-team.component.html @@ -2,7 +2,7 @@
{{ 'assign-dossier-owner.dialog.single-user' | translate }} - + {{ userId | name }} diff --git a/apps/red-ui/src/app/modules/shared-dossiers/dialogs/edit-dossier-dialog/edit-dossier-team/edit-dossier-team.component.ts b/apps/red-ui/src/app/modules/shared-dossiers/dialogs/edit-dossier-dialog/edit-dossier-team/edit-dossier-team.component.ts index 535effa17..977a431ff 100644 --- a/apps/red-ui/src/app/modules/shared-dossiers/dialogs/edit-dossier-dialog/edit-dossier-team/edit-dossier-team.component.ts +++ b/apps/red-ui/src/app/modules/shared-dossiers/dialogs/edit-dossier-dialog/edit-dossier-team/edit-dossier-team.component.ts @@ -143,6 +143,16 @@ export class EditDossierTeamComponent extends AutoUnsubscribe implements EditDos .map(user => user.id); } + onChangeOwner(ownerId: string) { + if (this.hasOwner) { + if (!this.isApprover(ownerId)) { + this.toggleApprover(ownerId); + } + // If it is an approver, it is already a member, no need to check + this._updateLists(); + } + } + private _setSelectedReviewersList() { const selectedReviewers = this.selectedMembersList.filter(m => this.selectedApproversList.indexOf(m) === -1); this.selectedReviewers$.next(selectedReviewers); @@ -160,15 +170,6 @@ export class EditDossierTeamComponent extends AutoUnsubscribe implements EditDos approvers: [[...this.dossier.approverIds]], members: [[...this.dossier.memberIds]], }); - this.addSubscription = this.form.get('owner').valueChanges.subscribe((ownerId: string) => { - if (this.hasOwner) { - if (!this.isApprover(ownerId)) { - this.toggleApprover(ownerId); - } - // If it is an approver, it is already a member, no need to check - this._updateLists(); - } - }); this._updateLists(); }