diff --git a/src/app/pages/directory-service/components/active-directory/active-directory.component.spec.ts b/src/app/pages/directory-service/components/active-directory/active-directory.component.spec.ts index 1c7ec9070dd..75d60ae5f65 100644 --- a/src/app/pages/directory-service/components/active-directory/active-directory.component.spec.ts +++ b/src/app/pages/directory-service/components/active-directory/active-directory.component.spec.ts @@ -83,7 +83,7 @@ describe('ActiveDirectoryComponent', () => { }), mockProvider(DialogService, { jobDialog: jest.fn(() => ({ - afterClosed: () => of(null), + afterClosed: () => of({}), })), }), mockProvider(SnackbarService), diff --git a/src/app/pages/directory-service/components/active-directory/active-directory.component.ts b/src/app/pages/directory-service/components/active-directory/active-directory.component.ts index 5baa197f509..d9b8c5c7a7f 100644 --- a/src/app/pages/directory-service/components/active-directory/active-directory.component.ts +++ b/src/app/pages/directory-service/components/active-directory/active-directory.component.ts @@ -126,20 +126,25 @@ export class ActiveDirectoryComponent implements OnInit { onRebuildCachePressed(): void { this.isLoading = true; - this.systemGeneralService.refreshDirServicesCache().pipe(untilDestroyed(this)).subscribe({ - next: () => { - this.isLoading = false; - this.snackbarService.success( - this.translate.instant(helptextActiveDirectory.activedirectory_custactions_clearcache_dialog_message), - ); - this.cdr.markForCheck(); - }, - error: (error: unknown) => { - this.isLoading = false; - this.dialogService.error(this.errorHandler.parseError(error)); - this.cdr.markForCheck(); - }, - }); + this.dialogService + .jobDialog(this.systemGeneralService.refreshDirServicesCache()) + .afterClosed() + .pipe(untilDestroyed(this)).subscribe({ + next: ({ description }) => { + this.isLoading = false; + this.snackbarService.success( + this.translate.instant( + description || helptextActiveDirectory.activedirectory_custactions_clearcache_dialog_message, + ), + ); + this.cdr.markForCheck(); + }, + error: (error: unknown) => { + this.isLoading = false; + this.dialogService.error(this.errorHandler.parseError(error)); + this.cdr.markForCheck(); + }, + }); } onLeaveDomainPressed(): void { diff --git a/src/app/pages/directory-service/components/ldap/ldap.component.spec.ts b/src/app/pages/directory-service/components/ldap/ldap.component.spec.ts index 64fc076f834..7195c6a7106 100644 --- a/src/app/pages/directory-service/components/ldap/ldap.component.spec.ts +++ b/src/app/pages/directory-service/components/ldap/ldap.component.spec.ts @@ -76,7 +76,7 @@ describe('LdapComponent', () => { }), mockProvider(DialogService, { jobDialog: jest.fn(() => ({ - afterClosed: () => of(null), + afterClosed: () => of({}), })), }), mockProvider(SnackbarService), @@ -136,7 +136,7 @@ describe('LdapComponent', () => { const rebuildCacheButton = await loader.getHarness(MatButtonHarness.with({ text: 'Rebuild Directory Service Cache' })); await rebuildCacheButton.click(); - expect(spectator.inject(SystemGeneralService).refreshDirServicesCache).toHaveBeenCalled(); + expect(spectator.inject(DialogService).jobDialog).toHaveBeenCalled(); expect(spectator.inject(SnackbarService).success).toHaveBeenCalledWith( helptextLdap.ldap_custactions_clearcache_dialog_message, ); diff --git a/src/app/pages/directory-service/components/ldap/ldap.component.ts b/src/app/pages/directory-service/components/ldap/ldap.component.ts index 7409b6a0850..aa678c2b31c 100644 --- a/src/app/pages/directory-service/components/ldap/ldap.component.ts +++ b/src/app/pages/directory-service/components/ldap/ldap.component.ts @@ -124,20 +124,23 @@ export class LdapComponent implements OnInit { onRebuildCachePressed(): void { this.isLoading = true; - this.systemGeneralService.refreshDirServicesCache().pipe(untilDestroyed(this)).subscribe({ - next: () => { - this.isLoading = false; - this.snackbar.success( - this.translate.instant(helptextLdap.ldap_custactions_clearcache_dialog_message), - ); - this.cdr.markForCheck(); - }, - error: (error: unknown) => { - this.isLoading = false; - this.dialogService.error(this.errorHandler.parseError(error)); - this.cdr.markForCheck(); - }, - }); + this.dialogService + .jobDialog(this.systemGeneralService.refreshDirServicesCache()) + .afterClosed() + .pipe(untilDestroyed(this)).subscribe({ + next: ({ description }) => { + this.isLoading = false; + this.snackbar.success( + this.translate.instant(description || helptextLdap.ldap_custactions_clearcache_dialog_message), + ); + this.cdr.markForCheck(); + }, + error: (error: unknown) => { + this.isLoading = false; + this.dialogService.error(this.errorHandler.parseError(error)); + this.cdr.markForCheck(); + }, + }); } onSubmit(): void {