[ACS-8959] Introduce new takeUntilDestroyed operator (#4237)

This commit is contained in:
dominikiwanekhyland
2024-11-21 10:49:49 +01:00
committed by GitHub
parent dec6c41e5c
commit adda597f15
52 changed files with 876 additions and 916 deletions

View File

@@ -25,15 +25,16 @@
import { ContentActionRef } from '@alfresco/adf-extensions';
import { AppStore, getSearchItemsTotalCount } from '@alfresco/aca-shared/store';
import { CommonModule } from '@angular/common';
import { Component, inject, Input, OnDestroy, OnInit, ViewEncapsulation } from '@angular/core';
import { Component, DestroyRef, inject, Input, OnInit, ViewEncapsulation } from '@angular/core';
import { MatSelectModule } from '@angular/material/select';
import { Store } from '@ngrx/store';
import { TranslateModule } from '@ngx-translate/core';
import { combineLatest, Observable, Subject } from 'rxjs';
import { combineLatest, Observable } from 'rxjs';
import { IconComponent, TranslationService } from '@alfresco/adf-core';
import { FormControl, ReactiveFormsModule } from '@angular/forms';
import { switchMap, takeUntil } from 'rxjs/operators';
import { switchMap } from 'rxjs/operators';
import { AppExtensionService } from '@alfresco/aca-shared';
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
@Component({
standalone: true,
@@ -43,7 +44,7 @@ import { AppExtensionService } from '@alfresco/aca-shared';
imports: [CommonModule, TranslateModule, MatSelectModule, IconComponent, ReactiveFormsModule],
encapsulation: ViewEncapsulation.None
})
export class BulkActionsDropdownComponent implements OnInit, OnDestroy {
export class BulkActionsDropdownComponent implements OnInit {
@Input() items: ContentActionRef[];
placeholder: string;
@@ -53,9 +54,9 @@ export class BulkActionsDropdownComponent implements OnInit, OnDestroy {
private readonly store = inject<Store<AppStore>>(Store);
private readonly translationService = inject(TranslationService);
private readonly extensions = inject(AppExtensionService);
private readonly onDestroy$ = new Subject();
private readonly destroyRef = inject(DestroyRef);
private readonly totalItems$: Observable<number> = this.store.select(getSearchItemsTotalCount);
ngOnInit() {
this.totalItems$
.pipe(
@@ -76,23 +77,18 @@ export class BulkActionsDropdownComponent implements OnInit, OnDestroy {
]);
}
}),
takeUntil(this.onDestroy$)
takeUntilDestroyed(this.destroyRef)
)
.subscribe(([placeholder, title]) => {
this.tooltip = title;
this.placeholder = placeholder;
});
this.extensions.bulkActionExecuted$.pipe(takeUntil(this.onDestroy$)).subscribe(() => {
this.extensions.bulkActionExecuted$.pipe(takeUntilDestroyed(this.destroyRef)).subscribe(() => {
this.bulkSelectControl.setValue(null);
});
}
ngOnDestroy() {
this.onDestroy$.next(true);
this.onDestroy$.complete();
}
runAction(actionOption: ContentActionRef) {
this.extensions.runActionById(actionOption.actions.click, {
focusedElementOnCloseSelector: '.adf-context-menu-source'

View File

@@ -24,6 +24,7 @@
import { ToggleSharedComponent } from './toggle-shared.component';
import { of } from 'rxjs';
import { TestBed } from '@angular/core/testing';
describe('ToggleSharedComponent', () => {
let component;
@@ -41,7 +42,9 @@ describe('ToggleSharedComponent', () => {
}
};
component = new ToggleSharedComponent(storeMock);
TestBed.runInInjectionContext(() => {
component = new ToggleSharedComponent(storeMock);
});
});
it('should get Store selection entry on initialization', (done) => {

View File

@@ -22,17 +22,17 @@
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
*/
import { Component, Input, OnDestroy, OnInit, ViewEncapsulation } from '@angular/core';
import { Observable, Subject } from 'rxjs';
import { Component, DestroyRef, inject, Input, OnInit, ViewEncapsulation } from '@angular/core';
import { Observable } from 'rxjs';
import { Store } from '@ngrx/store';
import { SelectionState } from '@alfresco/adf-extensions';
import { AppStore, ShareNodeAction, getAppSelection } from '@alfresco/aca-shared/store';
import { AppStore, getAppSelection, ShareNodeAction } from '@alfresco/aca-shared/store';
import { CommonModule } from '@angular/common';
import { MatMenuModule } from '@angular/material/menu';
import { MatIconModule } from '@angular/material/icon';
import { TranslateModule } from '@ngx-translate/core';
import { MatButtonModule } from '@angular/material/button';
import { takeUntil } from 'rxjs/operators';
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
@Component({
standalone: true,
@@ -41,7 +41,7 @@ import { takeUntil } from 'rxjs/operators';
templateUrl: './toggle-shared.component.html',
encapsulation: ViewEncapsulation.None
})
export class ToggleSharedComponent implements OnInit, OnDestroy {
export class ToggleSharedComponent implements OnInit {
@Input()
data: {
iconButton?: string;
@@ -52,13 +52,13 @@ export class ToggleSharedComponent implements OnInit, OnDestroy {
selectionLabel = '';
isShared = false;
onDestroy$ = new Subject<void>();
private readonly destroyRef = inject(DestroyRef);
constructor(private store: Store<AppStore>) {}
ngOnInit() {
this.selection$ = this.store.select(getAppSelection);
this.selection$.pipe(takeUntil(this.onDestroy$)).subscribe((selectionState) => {
this.selection$.pipe(takeUntilDestroyed(this.destroyRef)).subscribe((selectionState) => {
this.selectionState = selectionState;
this.isShared =
@@ -69,10 +69,6 @@ export class ToggleSharedComponent implements OnInit, OnDestroy {
});
}
ngOnDestroy(): void {
this.onDestroy$.next();
this.onDestroy$.complete();
}
editSharedNode(selection: SelectionState, focusedElementOnCloseSelector: string) {
this.store.dispatch(
new ShareNodeAction(selection.first, {

View File

@@ -22,31 +22,28 @@
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
*/
import { Directive, Output, EventEmitter, OnInit, OnDestroy } from '@angular/core';
import { fromEvent, Subscription } from 'rxjs';
import { DestroyRef, Directive, EventEmitter, inject, OnInit, Output } from '@angular/core';
import { fromEvent } from 'rxjs';
import { filter } from 'rxjs/operators';
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
@Directive({
standalone: true,
selector: '[acaContextMenuOutsideEvent]'
})
export class OutsideEventDirective implements OnInit, OnDestroy {
private subscriptions: Subscription[] = [];
export class OutsideEventDirective implements OnInit {
@Output()
clickOutside: EventEmitter<void> = new EventEmitter();
ngOnInit() {
this.subscriptions = this.subscriptions.concat([
fromEvent(document.body, 'click')
.pipe(filter((event) => !this.findAncestor(event.target as Element)))
.subscribe(() => this.clickOutside.next())
]);
}
private readonly destroyRef = inject(DestroyRef);
ngOnDestroy() {
this.subscriptions.forEach((subscription) => subscription.unsubscribe());
this.subscriptions = [];
ngOnInit() {
fromEvent(document.body, 'click')
.pipe(
filter((event) => !this.findAncestor(event.target as Element)),
takeUntilDestroyed(this.destroyRef)
)
.subscribe(() => this.clickOutside.next());
}
private findAncestor(el: Element): boolean {

View File

@@ -22,7 +22,7 @@
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
*/
import { Component, ViewEncapsulation, OnInit, AfterViewInit, Inject, inject, DestroyRef } from '@angular/core';
import { AfterViewInit, Component, DestroyRef, inject, Inject, OnInit, ViewEncapsulation } from '@angular/core';
import { MatMenuModule } from '@angular/material/menu';
import { DynamicExtensionComponent } from '@alfresco/adf-extensions';
import { ContextMenuOverlayRef } from './context-menu-overlay';

View File

@@ -67,12 +67,13 @@ import { FileSizePipe, InfoDrawerButtonsDirective } from '@alfresco/adf-core';
export class DetailsComponent extends PageComponent implements OnInit, OnDestroy {
nodeId: string;
isLoading: boolean;
onDestroy$ = new Subject<void>();
activeTab = 1;
aspectActions: Array<ContentActionRef> = [];
nodeIcon: string;
canManagePermissions = true;
private readonly onDestroy$: Subject<void> = new Subject<void>();
constructor(private route: ActivatedRoute, private contentApi: ContentApiService, private contentService: ContentService) {
super();
}
@@ -145,9 +146,10 @@ export class DetailsComponent extends PageComponent implements OnInit, OnDestroy
}
ngOnDestroy(): void {
this.store.dispatch(new SetSelectedNodesAction([]));
this.onDestroy$.next();
this.onDestroy$.complete();
this.store.dispatch(new SetSelectedNodesAction([]));
super.ngOnDestroy();
}
private isSmartFolder(): boolean {

View File

@@ -27,10 +27,9 @@ import { IconComponent } from '@alfresco/adf-core';
import { DynamicExtensionComponent } from '@alfresco/adf-extensions';
import { NodeEntry } from '@alfresco/js-api';
import { CommonModule } from '@angular/common';
import { Component, Input, OnDestroy, OnInit, ViewEncapsulation } from '@angular/core';
import { Component, DestroyRef, inject, Input, OnInit, ViewEncapsulation } from '@angular/core';
import { TranslateModule } from '@ngx-translate/core';
import { Subject } from 'rxjs';
import { takeUntil } from 'rxjs/operators';
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
@Component({
selector: 'aca-datatable-cell-badges',
@@ -41,29 +40,24 @@ import { takeUntil } from 'rxjs/operators';
imports: [CommonModule, TranslateModule, DynamicExtensionComponent, IconComponent],
standalone: true
})
export class DatatableCellBadgesComponent implements OnInit, OnDestroy {
export class DatatableCellBadgesComponent implements OnInit {
@Input() node: NodeEntry;
badges: Badge[];
private onDestroy$ = new Subject<boolean>();
private readonly destroyRef = inject(DestroyRef);
constructor(private appExtensionService: AppExtensionService) {}
ngOnInit() {
this.appExtensionService
.getBadges(this.node)
.pipe(takeUntil(this.onDestroy$))
.pipe(takeUntilDestroyed(this.destroyRef))
.subscribe((badges) => {
this.badges = badges;
});
}
ngOnDestroy() {
this.onDestroy$.next(true);
this.onDestroy$.complete();
}
onBadgeClick(badge: Badge) {
if (badge.actions?.click) {
this.appExtensionService.runActionById(badge.actions?.click, this.node);

View File

@@ -23,17 +23,17 @@
*/
import { NameColumnComponent, NodeNameTooltipPipe, NodesApiService } from '@alfresco/adf-content-services';
import { ChangeDetectorRef, Component, ElementRef, OnDestroy, OnInit, ViewEncapsulation } from '@angular/core';
import { ChangeDetectorRef, Component, DestroyRef, ElementRef, inject, OnInit, ViewEncapsulation } from '@angular/core';
import { Actions, ofType } from '@ngrx/effects';
import { Subject } from 'rxjs';
import { filter, takeUntil } from 'rxjs/operators';
import { filter } from 'rxjs/operators';
import { NodeActionTypes } from '@alfresco/aca-shared/store';
import { LockedByComponent, isLocked } from '@alfresco/aca-shared';
import { isLocked, LockedByComponent } from '@alfresco/aca-shared';
import { CommonModule } from '@angular/common';
import { TranslateModule } from '@ngx-translate/core';
import { IconComponent } from '@alfresco/adf-core';
import { DynamicExtensionComponent } from '@alfresco/adf-extensions';
import { DatatableCellBadgesComponent } from '../datatable-cell-badges/datatable-cell-badges.component';
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
@Component({
standalone: true,
@@ -54,12 +54,12 @@ import { DatatableCellBadgesComponent } from '../datatable-cell-badges/datatable
class: 'adf-datatable-content-cell adf-datatable-link adf-name-column aca-custom-name-column'
}
})
export class CustomNameColumnComponent extends NameColumnComponent implements OnInit, OnDestroy {
private onDestroy$$ = new Subject<boolean>();
export class CustomNameColumnComponent extends NameColumnComponent implements OnInit {
isFile: boolean;
isFileWriteLocked: boolean;
private readonly destroy = inject(DestroyRef);
constructor(element: ElementRef, private cd: ChangeDetectorRef, private actions$: Actions, private nodesService: NodesApiService) {
super(element, nodesService);
}
@@ -69,7 +69,7 @@ export class CustomNameColumnComponent extends NameColumnComponent implements On
this.isFile = this.node?.entry && !this.node.entry.isFolder;
this.isFileWriteLocked = isLocked(this.node);
this.nodesService.nodeUpdated.pipe(takeUntil(this.onDestroy$$)).subscribe((node: any) => {
this.nodesService.nodeUpdated.pipe(takeUntilDestroyed(this.destroy)).subscribe((node: any) => {
const row = this.context.row;
if (row) {
const { entry } = row.node;
@@ -91,7 +91,7 @@ export class CustomNameColumnComponent extends NameColumnComponent implements On
.pipe(
ofType<any>(NodeActionTypes.EditOffline),
filter((val) => this.node.entry.id === val.payload.entry.id),
takeUntil(this.onDestroy$$)
takeUntilDestroyed(this.destroy)
)
.subscribe(() => {
this.isFileWriteLocked = isLocked(this.node);
@@ -103,9 +103,4 @@ export class CustomNameColumnComponent extends NameColumnComponent implements On
event.stopPropagation();
this.onClick();
}
ngOnDestroy() {
this.onDestroy$$.next(true);
this.onDestroy$$.complete();
}
}

View File

@@ -31,7 +31,7 @@ import {
} from '@alfresco/adf-core';
import { Component, OnDestroy, OnInit, ViewEncapsulation } from '@angular/core';
import { ActivatedRoute, Params } from '@angular/router';
import { NodeEntry, Node, PathElement } from '@alfresco/js-api';
import { Node, NodeEntry, PathElement } from '@alfresco/js-api';
import { NodeActionsService } from '../../services/node-actions.service';
import {
ContentApiService,
@@ -43,8 +43,8 @@ import {
PaginationDirective,
ToolbarComponent
} from '@alfresco/aca-shared';
import { SetCurrentFolderAction, isAdmin, UploadFileVersionAction, showLoaderSelector } from '@alfresco/aca-shared/store';
import { debounceTime, takeUntil } from 'rxjs/operators';
import { isAdmin, SetCurrentFolderAction, showLoaderSelector, UploadFileVersionAction } from '@alfresco/aca-shared/store';
import { debounceTime } from 'rxjs/operators';
import {
BreadcrumbComponent,
DocumentListComponent,
@@ -59,6 +59,7 @@ import { TranslateModule } from '@ngx-translate/core';
import { DocumentListDirective } from '../../directives/document-list.directive';
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
import { SearchAiInputContainerComponent } from '../knowledge-retrieval/search-ai/search-ai-input-container/search-ai-input-container.component';
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
@Component({
standalone: true,
@@ -109,15 +110,15 @@ export class FilesComponent extends PageComponent implements OnInit, OnDestroy {
this.title = data.title;
this.route.queryParamMap.pipe(takeUntil(this.onDestroy$)).subscribe((queryMap: Params) => {
this.route.queryParamMap.pipe(takeUntilDestroyed(this.destroyRef)).subscribe((queryMap: Params) => {
this.queryParams = queryMap.params;
});
this.route.params.pipe(takeUntil(this.onDestroy$)).subscribe(({ folderId }: Params) => {
this.route.params.pipe(takeUntilDestroyed(this.destroyRef)).subscribe(({ folderId }: Params) => {
const nodeId = folderId || data.defaultNodeId;
this.contentApi
.getNode(nodeId)
.pipe(takeUntil(this.onDestroy$))
.pipe(takeUntilDestroyed(this.destroyRef))
.subscribe(
(node) => {
this.isValidPath = true;
@@ -142,12 +143,12 @@ export class FilesComponent extends PageComponent implements OnInit, OnDestroy {
this.store
.select(isAdmin)
.pipe(takeUntil(this.onDestroy$))
.pipe(takeUntilDestroyed(this.destroyRef))
.subscribe((value) => {
this.isAdmin = value;
});
this.extensions.filesDocumentListPreset$.pipe(takeUntil(this.onDestroy$)).subscribe((preset) => {
this.extensions.filesDocumentListPreset$.pipe(takeUntilDestroyed(this.destroyRef)).subscribe((preset) => {
this.columns = preset;
});

View File

@@ -22,32 +22,32 @@
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
*/
import { Component, Input, OnChanges, OnDestroy, OnInit, ViewEncapsulation } from '@angular/core';
import { Component, DestroyRef, inject, Input, OnChanges, OnInit, ViewEncapsulation } from '@angular/core';
import {
UntypedFormGroup,
UntypedFormControl,
Validators,
FormGroupDirective,
NgForm,
FormsModule,
ReactiveFormsModule,
FormControl,
ValidationErrors
FormGroupDirective,
FormsModule,
NgForm,
ReactiveFormsModule,
UntypedFormControl,
UntypedFormGroup,
ValidationErrors,
Validators
} from '@angular/forms';
import { QueriesApi, SiteEntry, SitePaging } from '@alfresco/js-api';
import { Store } from '@ngrx/store';
import {
AppStore,
isAdmin,
SnackbarAction,
SnackbarActionTypes,
SnackbarErrorAction,
SnackbarInfoAction,
UpdateLibraryAction,
isAdmin
UpdateLibraryAction
} from '@alfresco/aca-shared/store';
import { debounceTime, filter, mergeMap, takeUntil } from 'rxjs/operators';
import { debounceTime, filter, mergeMap } from 'rxjs/operators';
import { AlfrescoApiService } from '@alfresco/adf-content-services';
import { Observable, from, Subject } from 'rxjs';
import { from, Observable } from 'rxjs';
import { ErrorStateMatcher, MatOptionModule } from '@angular/material/core';
import { CommonModule } from '@angular/common';
import { MatCardModule } from '@angular/material/card';
@@ -58,6 +58,7 @@ import { MatInputModule } from '@angular/material/input';
import { A11yModule } from '@angular/cdk/a11y';
import { MatButtonModule } from '@angular/material/button';
import { Actions, ofType } from '@ngrx/effects';
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
export class InstantErrorStateMatcher implements ErrorStateMatcher {
isErrorState(control: UntypedFormControl | null, form: FormGroupDirective | NgForm | null): boolean {
@@ -86,7 +87,7 @@ export class InstantErrorStateMatcher implements ErrorStateMatcher {
styleUrls: ['./library-metadata-form.component.scss'],
encapsulation: ViewEncapsulation.None
})
export class LibraryMetadataFormComponent implements OnInit, OnChanges, OnDestroy {
export class LibraryMetadataFormComponent implements OnInit, OnChanges {
private _queriesApi: QueriesApi;
private _titleErrorTranslationKey: string;
@@ -121,7 +122,7 @@ export class LibraryMetadataFormComponent implements OnInit, OnChanges, OnDestro
canUpdateLibrary = false;
isAdmin = false;
onDestroy$: Subject<boolean> = new Subject<boolean>();
private readonly destroyRef = inject(DestroyRef);
constructor(private alfrescoApiService: AlfrescoApiService, protected store: Store<AppStore>, private actions$: Actions) {}
@@ -148,7 +149,7 @@ export class LibraryMetadataFormComponent implements OnInit, OnChanges, OnDestro
this.toggleEdit();
this.updateForm(this.node);
this.form.controls.title.statusChanges
.pipe(takeUntil(this.onDestroy$))
.pipe(takeUntilDestroyed(this.destroyRef))
.subscribe(
() =>
(this._titleErrorTranslationKey = this.form.controls.title.errors?.empty
@@ -159,7 +160,7 @@ export class LibraryMetadataFormComponent implements OnInit, OnChanges, OnDestro
.pipe(
debounceTime(300),
mergeMap((title) => this.findLibraryByTitle(title)),
takeUntil(this.onDestroy$)
takeUntilDestroyed(this.destroyRef)
)
.subscribe((result) => {
const { entries } = result.list;
@@ -176,7 +177,7 @@ export class LibraryMetadataFormComponent implements OnInit, OnChanges, OnDestro
});
this.store
.select(isAdmin)
.pipe(takeUntil(this.onDestroy$))
.pipe(takeUntilDestroyed(this.destroyRef))
.subscribe((value) => {
this.isAdmin = value;
});
@@ -187,11 +188,6 @@ export class LibraryMetadataFormComponent implements OnInit, OnChanges, OnDestro
this.handleUpdatingEvent<SnackbarErrorAction>(SnackbarActionTypes.Error, 'LIBRARY.ERRORS.LIBRARY_UPDATE_ERROR', () => this.form.markAsDirty());
}
ngOnDestroy() {
this.onDestroy$.next(true);
this.onDestroy$.complete();
}
ngOnChanges() {
this.updateForm(this.node);
this.canUpdateLibrary = this.node?.entry?.role === 'SiteManager' || this.isAdmin;
@@ -236,7 +232,7 @@ export class LibraryMetadataFormComponent implements OnInit, OnChanges, OnDestro
.pipe(
ofType<T>(actionType),
filter((action) => action.payload === payload),
takeUntil(this.onDestroy$)
takeUntilDestroyed(this.destroyRef)
)
.subscribe(handle);
}

View File

@@ -22,23 +22,24 @@
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
*/
import { Component, Input, ViewEncapsulation, OnInit, OnDestroy } from '@angular/core';
import { Component, DestroyRef, inject, Input, OnInit, ViewEncapsulation } from '@angular/core';
import { Node } from '@alfresco/js-api';
import { NodePermissionService, isLocked, AppExtensionService } from '@alfresco/aca-shared';
import { AppStore, EditOfflineAction, NodeActionTypes, infoDrawerMetadataAspect } from '@alfresco/aca-shared/store';
import { AppExtensionService, isLocked, NodePermissionService } from '@alfresco/aca-shared';
import { AppStore, EditOfflineAction, infoDrawerMetadataAspect, NodeActionTypes } from '@alfresco/aca-shared/store';
import { AppConfigService, NotificationService } from '@alfresco/adf-core';
import { Observable, Subject } from 'rxjs';
import { Observable } from 'rxjs';
import {
ContentMetadataService,
ContentMetadataCustomPanel,
TagService,
CategoryService,
ContentMetadataComponent
ContentMetadataComponent,
ContentMetadataCustomPanel,
ContentMetadataService,
TagService
} from '@alfresco/adf-content-services';
import { filter, map, takeUntil } from 'rxjs/operators';
import { filter, map } from 'rxjs/operators';
import { CommonModule } from '@angular/common';
import { Actions, ofType } from '@ngrx/effects';
import { Store } from '@ngrx/store';
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
@Component({
standalone: true,
@@ -58,8 +59,7 @@ import { Store } from '@ngrx/store';
encapsulation: ViewEncapsulation.None,
host: { class: 'app-metadata-tab' }
})
export class MetadataTabComponent implements OnInit, OnDestroy {
protected onDestroy$ = new Subject<boolean>();
export class MetadataTabComponent implements OnInit {
private _displayCategories = true;
private _displayTags = true;
@@ -77,6 +77,8 @@ export class MetadataTabComponent implements OnInit, OnDestroy {
return this._displayTags;
}
private readonly destroyRef = inject(DestroyRef);
constructor(
private permission: NodePermissionService,
protected extensions: AppExtensionService,
@@ -97,7 +99,7 @@ export class MetadataTabComponent implements OnInit, OnDestroy {
this._displayTags = this.tagService.areTagsEnabled();
this._displayCategories = this.categoryService.areCategoriesEnabled();
this.contentMetadataService.error.pipe(takeUntil(this.onDestroy$)).subscribe((err: { message: string }) => {
this.contentMetadataService.error.pipe(takeUntilDestroyed(this.destroyRef)).subscribe((err: { message: string }) => {
this.notificationService.showError(err.message);
});
this.checkIfNodeIsUpdatable(this.node);
@@ -105,7 +107,7 @@ export class MetadataTabComponent implements OnInit, OnDestroy {
.pipe(
ofType<EditOfflineAction>(NodeActionTypes.EditOffline),
filter((updatedNode) => this.node.id === updatedNode.payload.entry.id),
takeUntil(this.onDestroy$)
takeUntilDestroyed(this.destroyRef)
)
.subscribe((updatedNode) => {
this.checkIfNodeIsUpdatable(updatedNode?.payload.entry);
@@ -116,19 +118,14 @@ export class MetadataTabComponent implements OnInit, OnDestroy {
return { panelTitle: panel.title, component: panel.component };
});
}),
takeUntil(this.onDestroy$)
takeUntilDestroyed(this.destroyRef)
);
this.store
.select(infoDrawerMetadataAspect)
.pipe(takeUntil(this.onDestroy$))
.pipe(takeUntilDestroyed(this.destroyRef))
.subscribe((metadataAspect) => (this.metadataAspect = metadataAspect));
}
ngOnDestroy() {
this.onDestroy$.next(true);
this.onDestroy$.complete();
}
private checkIfNodeIsUpdatable(node: Node) {
this.readOnly = !(node && !isLocked({ entry: node }) ? this.permission.check(node, ['update']) : false);
}

View File

@@ -22,20 +22,21 @@
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
*/
import { ChangeDetectorRef, Component, Input, OnDestroy, OnInit, ViewEncapsulation } from '@angular/core';
import { ChangeDetectorRef, Component, DestroyRef, inject, Input, OnInit, ViewEncapsulation } from '@angular/core';
import { CommonModule } from '@angular/common';
import { SelectionState } from '@alfresco/adf-extensions';
import { Store } from '@ngrx/store';
import { AppStore, getAppSelection } from '@alfresco/aca-shared/store';
import { AvatarComponent, IconComponent, NotificationService } from '@alfresco/adf-core';
import { forkJoin, Subject, throwError } from 'rxjs';
import { catchError, take, takeUntil } from 'rxjs/operators';
import { forkJoin, throwError } from 'rxjs';
import { catchError, take } from 'rxjs/operators';
import { MatMenuModule } from '@angular/material/menu';
import { MatListModule, MatSelectionListChange } from '@angular/material/list';
import { TranslateModule, TranslateService } from '@ngx-translate/core';
import { Agent } from '@alfresco/js-api';
import { AgentService, SearchAiService } from '@alfresco/adf-content-services';
import { MatTooltipModule } from '@angular/material/tooltip';
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
@Component({
standalone: true,
@@ -46,13 +47,12 @@ import { MatTooltipModule } from '@angular/material/tooltip';
encapsulation: ViewEncapsulation.None,
host: { class: 'aca-agents-button' }
})
export class AgentsButtonComponent implements OnInit, OnDestroy {
export class AgentsButtonComponent implements OnInit {
@Input()
data: { trigger: string };
private selectedNodesState: SelectionState;
private _agents: Agent[] = [];
private onDestroy$ = new Subject<void>();
private _disabled = true;
private _initialsByAgentId: { [key: string]: string } = {};
private _hxInsightUrl: string;
@@ -73,6 +73,8 @@ export class AgentsButtonComponent implements OnInit, OnDestroy {
return this._hxInsightUrl;
}
private readonly destroyRef = inject(DestroyRef);
constructor(
private store: Store<AppStore>,
private notificationService: NotificationService,
@@ -85,7 +87,7 @@ export class AgentsButtonComponent implements OnInit, OnDestroy {
ngOnInit(): void {
this.store
.select(getAppSelection)
.pipe(takeUntil(this.onDestroy$))
.pipe(takeUntilDestroyed(this.destroyRef))
.subscribe((selection) => {
this.selectedNodesState = selection;
});
@@ -114,11 +116,6 @@ export class AgentsButtonComponent implements OnInit, OnDestroy {
);
}
ngOnDestroy(): void {
this.onDestroy$.next();
this.onDestroy$.complete();
}
onClick(): void {
if (!this.selectedNodesState.isEmpty) {
const message = this.searchAiService.checkSearchAvailability(this.selectedNodesState);

View File

@@ -22,7 +22,7 @@
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
*/
import { Component, Input, OnDestroy, OnInit, ViewEncapsulation } from '@angular/core';
import { Component, DestroyRef, inject, Input, OnInit, ViewEncapsulation } from '@angular/core';
import { CommonModule } from '@angular/common';
import { TranslateModule, TranslateService } from '@ngx-translate/core';
import { MatButtonModule } from '@angular/material/button';
@@ -32,10 +32,8 @@ import { MatInputModule } from '@angular/material/input';
import { A11yModule } from '@angular/cdk/a11y';
import { AvatarComponent, IconComponent, NotificationService, UserPreferencesService } from '@alfresco/adf-core';
import { FormControl, FormsModule, ReactiveFormsModule } from '@angular/forms';
import { Subject } from 'rxjs';
import { Store } from '@ngrx/store';
import { AiSearchByTermPayload, AppStore, getAppSelection, SearchByTermAiAction, ToggleAISearchInput } from '@alfresco/aca-shared/store';
import { takeUntil } from 'rxjs/operators';
import { SelectionState } from '@alfresco/adf-extensions';
import { MatSelectModule } from '@angular/material/select';
import { AgentService, SearchAiService } from '@alfresco/adf-content-services';
@@ -48,6 +46,7 @@ import {
} from '@angular/material/tooltip';
import { ModalAiService } from '../../../../services/modal-ai.service';
import { Agent } from '@alfresco/js-api';
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
const MatTooltipOptions: MatTooltipDefaultOptions = {
...MAT_TOOLTIP_DEFAULT_OPTIONS_FACTORY(),
@@ -78,7 +77,7 @@ const MatTooltipOptions: MatTooltipDefaultOptions = {
encapsulation: ViewEncapsulation.None,
providers: [{ provide: MAT_TOOLTIP_DEFAULT_OPTIONS, useValue: MatTooltipOptions }]
})
export class SearchAiInputComponent implements OnInit, OnDestroy {
export class SearchAiInputComponent implements OnInit {
@Input()
placeholder: string;
@@ -95,7 +94,6 @@ export class SearchAiInputComponent implements OnInit, OnDestroy {
private _agentControl = new FormControl<Agent>(null);
private _agents: Agent[] = [];
private onDestroy$ = new Subject<void>();
private selectedNodesState: SelectionState;
private _queryControl = new FormControl('');
private _initialsByAgentId: { [key: string]: string } = {};
@@ -116,6 +114,8 @@ export class SearchAiInputComponent implements OnInit, OnDestroy {
return this._initialsByAgentId;
}
private readonly destroyRef = inject(DestroyRef);
constructor(
private store: Store<AppStore>,
private searchAiService: SearchAiService,
@@ -133,7 +133,7 @@ export class SearchAiInputComponent implements OnInit, OnDestroy {
if (!this.usedInAiResultsPage) {
this.store
.select(getAppSelection)
.pipe(takeUntil(this.onDestroy$))
.pipe(takeUntilDestroyed(this.destroyRef))
.subscribe((selection) => {
this.selectedNodesState = selection;
});
@@ -143,7 +143,7 @@ export class SearchAiInputComponent implements OnInit, OnDestroy {
this.agentService
.getAgents()
.pipe(takeUntil(this.onDestroy$))
.pipe(takeUntilDestroyed(this.destroyRef))
.subscribe(
(agents) => {
this._agents = agents;
@@ -159,11 +159,6 @@ export class SearchAiInputComponent implements OnInit, OnDestroy {
);
}
ngOnDestroy(): void {
this.onDestroy$.next();
this.onDestroy$.complete();
}
onSearchSubmit() {
this.modalAiService.openUnsavedChangesModal(() => this.search());
}

View File

@@ -22,10 +22,10 @@
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
*/
import { Component, OnDestroy, OnInit, ViewEncapsulation } from '@angular/core';
import { Component, OnInit, ViewEncapsulation } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { PageComponent, PageLayoutComponent, ToolbarActionComponent, ToolbarComponent } from '@alfresco/aca-shared';
import { concatMap, delay, filter, finalize, retryWhen, skipWhile, switchMap, takeUntil } from 'rxjs/operators';
import { concatMap, delay, filter, finalize, retryWhen, skipWhile, switchMap } from 'rxjs/operators';
import { AvatarComponent, ClipboardService, EmptyContentComponent, ThumbnailService, ToolbarModule, UnsavedChangesGuard } from '@alfresco/adf-core';
import { AiAnswer, Node } from '@alfresco/js-api';
import { CommonModule } from '@angular/common';
@@ -42,6 +42,7 @@ import { MatTooltipModule } from '@angular/material/tooltip';
import { ModalAiService } from '../../../../services/modal-ai.service';
import { ViewNodeAction } from '@alfresco/aca-shared/store';
import { ViewerService } from '@alfresco/aca-content/viewer';
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
@Component({
standalone: true,
@@ -67,7 +68,7 @@ import { ViewerService } from '@alfresco/aca-content/viewer';
encapsulation: ViewEncapsulation.None,
host: { class: 'aca-search-ai-results' }
})
export class SearchAiResultsComponent extends PageComponent implements OnInit, OnDestroy {
export class SearchAiResultsComponent extends PageComponent implements OnInit {
private _agentId: string;
private _hasAnsweringError = false;
private _hasError = false;
@@ -133,7 +134,7 @@ export class SearchAiResultsComponent extends PageComponent implements OnInit, O
this.openedViewer = !!params.location;
return !this.openedViewer && (!openedViewerPreviously || !this.queryAnswer);
}),
takeUntil(this.onDestroy$)
takeUntilDestroyed(this.destroyRef)
)
.subscribe((params) => {
this._agentId = params.agentId;
@@ -156,11 +157,6 @@ export class SearchAiResultsComponent extends PageComponent implements OnInit, O
};
}
ngOnDestroy(): void {
this.onDestroy$.next();
this.onDestroy$.complete();
}
copyResponseToClipboard(): void {
this.clipboardService.copyContentToClipboard(
this.queryAnswer.answer,
@@ -192,7 +188,7 @@ export class SearchAiResultsComponent extends PageComponent implements OnInit, O
}),
retryWhen((errors: Observable<Error>) => this.aiSearchRetryWhen(errors)),
finalize(() => (this._loading = false)),
takeUntil(this.onDestroy$)
takeUntilDestroyed(this.destroyRef)
)
.subscribe(
(nodes) => {

View File

@@ -22,8 +22,7 @@
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
*/
import { Component, EventEmitter, Input, OnDestroy, Output, ViewEncapsulation, ViewChild, ElementRef } from '@angular/core';
import { Subject } from 'rxjs';
import { Component, ElementRef, EventEmitter, Input, Output, ViewChild, ViewEncapsulation } from '@angular/core';
import { CommonModule } from '@angular/common';
import { TranslateModule } from '@ngx-translate/core';
import { MatButtonModule } from '@angular/material/button';
@@ -41,9 +40,7 @@ import { FormsModule } from '@angular/forms';
encapsulation: ViewEncapsulation.None,
host: { class: 'app-search-control' }
})
export class SearchInputControlComponent implements OnDestroy {
onDestroy$: Subject<boolean> = new Subject<boolean>();
export class SearchInputControlComponent {
/** Type of the input field to render, e.g. "search" or "text" (default). */
@Input()
inputType = 'text';
@@ -68,11 +65,6 @@ export class SearchInputControlComponent implements OnDestroy {
searchTerm = '';
ngOnDestroy(): void {
this.onDestroy$.next(true);
this.onDestroy$.complete();
}
searchSubmit(event: any) {
this.submit.emit(event);
}

View File

@@ -26,12 +26,10 @@ import { AppHookService, AppService } from '@alfresco/aca-shared';
import { AppStore, SearchByTermAction, SearchOptionIds, SearchOptionModel } from '@alfresco/aca-shared/store';
import { SearchQueryBuilderService } from '@alfresco/adf-content-services';
import { AppConfigService, NotificationService } from '@alfresco/adf-core';
import { Component, inject, OnDestroy, OnInit, ViewChild, ViewEncapsulation } from '@angular/core';
import { Component, DestroyRef, inject, OnDestroy, OnInit, ViewChild, ViewEncapsulation } from '@angular/core';
import { MatMenuModule, MatMenuTrigger } from '@angular/material/menu';
import { ActivatedRoute, Params, PRIMARY_OUTLET, Router, UrlSegment, UrlSegmentGroup, UrlTree } from '@angular/router';
import { Store } from '@ngrx/store';
import { Subject } from 'rxjs';
import { takeUntil } from 'rxjs/operators';
import { SearchInputControlComponent } from '../search-input-control/search-input-control.component';
import { SearchNavigationService } from '../search-navigation.service';
import { SearchLibrariesQueryBuilderService } from '../search-libraries-results/search-libraries-query-builder.service';
@@ -45,6 +43,7 @@ import { A11yModule } from '@angular/cdk/a11y';
import { MatCheckboxModule } from '@angular/material/checkbox';
import { FormsModule } from '@angular/forms';
import { extractSearchedWordFromEncodedQuery } from '../../../utils/aca-search-utils';
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
@Component({
standalone: true,
@@ -70,7 +69,6 @@ import { extractSearchedWordFromEncodedQuery } from '../../../utils/aca-search-u
export class SearchInputComponent implements OnInit, OnDestroy {
private readonly notificationService = inject(NotificationService);
onDestroy$: Subject<boolean> = new Subject<boolean>();
has400LibraryError = false;
hasLibrariesConstraint = false;
searchOnChange: boolean;
@@ -103,6 +101,8 @@ export class SearchInputComponent implements OnInit, OnDestroy {
@ViewChild(MatMenuTrigger, { static: true })
trigger: MatMenuTrigger;
private readonly destroyRef = inject(DestroyRef);
constructor(
private readonly queryBuilder: SearchQueryBuilderService,
private readonly queryLibrariesBuilder: SearchLibrariesQueryBuilderService,
@@ -120,7 +120,7 @@ export class SearchInputComponent implements OnInit, OnDestroy {
ngOnInit() {
this.showInputValue();
this.route.queryParams.pipe(takeUntil(this.onDestroy$)).subscribe((params: Params) => {
this.route.queryParams.pipe(takeUntilDestroyed(this.destroyRef)).subscribe((params: Params) => {
const encodedQuery = params['q'];
if (encodedQuery && this.searchInputControl) {
this.searchedWord = extractSearchedWordFromEncodedQuery(encodedQuery);
@@ -128,7 +128,7 @@ export class SearchInputComponent implements OnInit, OnDestroy {
}
});
this.appHookService.library400Error.pipe(takeUntil(this.onDestroy$)).subscribe(() => {
this.appHookService.library400Error.pipe(takeUntilDestroyed(this.destroyRef)).subscribe(() => {
this.has400LibraryError = true;
this.hasLibrariesConstraint = this.evaluateLibrariesConstraint();
});
@@ -151,8 +151,6 @@ export class SearchInputComponent implements OnInit, OnDestroy {
ngOnDestroy(): void {
this.appService.setAppNavbarMode('expanded');
this.onDestroy$.next(true);
this.onDestroy$.complete();
this.removeContentFilters();
}

View File

@@ -46,7 +46,7 @@ import { MatProgressBarModule } from '@angular/material/progress-bar';
import { DocumentListDirective } from '../../../directives/document-list.directive';
import { DocumentListComponent } from '@alfresco/adf-content-services';
import { extractSearchedWordFromEncodedQuery } from '../../../utils/aca-search-utils';
import { takeUntil } from 'rxjs/operators';
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
@Component({
standalone: true,
@@ -130,7 +130,7 @@ export class SearchLibrariesResultsComponent extends PageComponent implements On
);
if (this.route) {
this.route.queryParams.pipe(takeUntil(this.onDestroy$)).subscribe((params: Params) => {
this.route.queryParams.pipe(takeUntilDestroyed(this.destroyRef)).subscribe((params: Params) => {
const encodedQuery = params[this.queryParamName] || null;
this.searchedWord = extractSearchedWordFromEncodedQuery(encodedQuery);
if (this.searchedWord?.length > 1) {

View File

@@ -22,19 +22,19 @@
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
*/
import { Component, Input, OnInit, ViewEncapsulation, ChangeDetectionStrategy, OnDestroy, inject } from '@angular/core';
import { ChangeDetectionStrategy, Component, DestroyRef, inject, Input, OnInit, ViewEncapsulation } from '@angular/core';
import { NodeEntry, SearchEntryHighlight } from '@alfresco/js-api';
import { NavigateToFolder, ViewNodeAction } from '@alfresco/aca-shared/store';
import { Store } from '@ngrx/store';
import { BehaviorSubject, Subject } from 'rxjs';
import { BehaviorSubject } from 'rxjs';
import { NodesApiService } from '@alfresco/adf-content-services';
import { takeUntil } from 'rxjs/operators';
import { Router } from '@angular/router';
import { AutoDownloadService, AppSettingsService } from '@alfresco/aca-shared';
import { AppSettingsService, AutoDownloadService } from '@alfresco/aca-shared';
import { CommonModule } from '@angular/common';
import { LocationLinkComponent } from '../../common/location-link/location-link.component';
import { MatDialogModule } from '@angular/material/dialog';
import { DatatableCellBadgesComponent } from '../../dl-custom-components/datatable-cell-badges/datatable-cell-badges.component';
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
@Component({
standalone: true,
@@ -46,14 +46,13 @@ import { DatatableCellBadgesComponent } from '../../dl-custom-components/datatab
changeDetection: ChangeDetectionStrategy.OnPush,
host: { class: 'aca-search-results-row' }
})
export class SearchResultsRowComponent implements OnInit, OnDestroy {
export class SearchResultsRowComponent implements OnInit {
private settings = inject(AppSettingsService);
private readonly highlightPrefix = "<span class='aca-highlight'>";
private readonly highlightPostfix = '</span>';
private node: NodeEntry;
private onDestroy$ = new Subject<boolean>();
@Input()
context: any;
@@ -68,6 +67,8 @@ export class SearchResultsRowComponent implements OnInit, OnDestroy {
contentStripped = '';
isFile = false;
private readonly destroyRef = inject(DestroyRef);
constructor(
private store: Store<any>,
private nodesApiService: NodesApiService,
@@ -78,7 +79,7 @@ export class SearchResultsRowComponent implements OnInit, OnDestroy {
ngOnInit() {
this.updateValues();
this.nodesApiService.nodeUpdated.pipe(takeUntil(this.onDestroy$)).subscribe((node) => {
this.nodesApiService.nodeUpdated.pipe(takeUntilDestroyed(this.destroyRef)).subscribe((node) => {
const row = this.context.row;
if (row) {
const { entry } = row.node;
@@ -136,11 +137,6 @@ export class SearchResultsRowComponent implements OnInit, OnDestroy {
}
}
ngOnDestroy() {
this.onDestroy$.next(true);
this.onDestroy$.complete();
}
showPreview(event: Event) {
event.stopPropagation();

View File

@@ -22,7 +22,7 @@
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
*/
import { ChangeDetectorRef, Component, DestroyRef, inject, OnInit, ViewEncapsulation } from '@angular/core';
import { ChangeDetectorRef, Component, inject, OnInit, ViewEncapsulation } from '@angular/core';
import { NodeEntry, Pagination, ResultSetPaging } from '@alfresco/js-api';
import { ActivatedRoute, Params } from '@angular/router';
import {
@@ -153,8 +153,6 @@ export class SearchResultsComponent extends PageComponent implements OnInit {
searchConfig: SearchConfiguration;
private readonly loadedFilters$ = new Subject<void>();
private readonly destroyRef = inject(DestroyRef);
constructor(
tagsService: TagService,
private readonly queryBuilder: SearchQueryBuilderService,

View File

@@ -22,15 +22,14 @@
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
*/
import { Component, inject, OnDestroy, OnInit, ViewEncapsulation } from '@angular/core';
import { Component, DestroyRef, inject, OnInit, ViewEncapsulation } from '@angular/core';
import { SavedSearch, SavedSearchesService } from '@alfresco/adf-content-services';
import { Subject } from 'rxjs';
import { takeUntil } from 'rxjs/operators';
import { CoreModule, TranslationService } from '@alfresco/adf-core';
import { DynamicExtensionComponent, NavBarLinkRef } from '@alfresco/adf-extensions';
import { ExpandMenuComponent } from '../../../sidenav/components/expand-menu.component';
import { SidenavHeaderComponent } from '../../../sidenav/components/sidenav-header.component';
import { AppService } from '@alfresco/aca-shared';
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
@Component({
selector: 'aca-save-search-sidenav',
@@ -39,30 +38,25 @@ import { AppService } from '@alfresco/aca-shared';
templateUrl: './save-search-sidenav.component.html',
encapsulation: ViewEncapsulation.None
})
export class SaveSearchSidenavComponent implements OnInit, OnDestroy {
export class SaveSearchSidenavComponent implements OnInit {
savedSearchesService = inject(SavedSearchesService);
appService = inject(AppService);
translationService = inject(TranslationService);
destroy$ = new Subject<void>();
item: NavBarLinkRef;
private readonly manageSearchesId = 'manage-saved-searches';
private readonly destroyRef = inject(DestroyRef);
ngOnInit() {
this.savedSearchesService.innit();
this.savedSearchesService.savedSearches$
.asObservable()
.pipe(takeUntil(this.destroy$))
.pipe(takeUntilDestroyed(this.destroyRef))
.subscribe((savedSearches) => {
this.item = this.createNavBarLinkRef(savedSearches);
});
}
ngOnDestroy(): void {
this.destroy$.next();
this.destroy$.complete();
}
onActionClick(el: NavBarLinkRef): void {
if (el.id !== this.manageSearchesId) {
this.appService.appNavNarMode$.next('collapsed');

View File

@@ -26,14 +26,15 @@ import { AppStore, SetSelectedNodesAction } from '@alfresco/aca-shared/store';
import { ViewerModule } from '@alfresco/adf-core';
import { ContentActionRef } from '@alfresco/adf-extensions';
import { SharedLinkEntry, SharedlinksApi } from '@alfresco/js-api';
import { Component, OnDestroy, OnInit, ViewEncapsulation } from '@angular/core';
import { Component, DestroyRef, inject, OnInit, ViewEncapsulation } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { Store } from '@ngrx/store';
import { forkJoin, from, of, Subject } from 'rxjs';
import { catchError, mergeMap, takeUntil } from 'rxjs/operators';
import { forkJoin, from, of } from 'rxjs';
import { catchError, mergeMap } from 'rxjs/operators';
import { AppExtensionService, AppService, ToolbarComponent } from '@alfresco/aca-shared';
import { CommonModule } from '@angular/common';
import { AlfrescoApiService, AlfrescoViewerModule } from '@alfresco/adf-content-services';
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
@Component({
standalone: true,
@@ -44,12 +45,14 @@ import { AlfrescoApiService, AlfrescoViewerModule } from '@alfresco/adf-content-
encapsulation: ViewEncapsulation.None,
host: { class: 'app-shared-link-view' }
})
export class SharedLinkViewComponent implements OnInit, OnDestroy {
private onDestroy$: Subject<boolean> = new Subject<boolean>();
private sharedLinksApi: SharedlinksApi;
export class SharedLinkViewComponent implements OnInit {
sharedLinkId: string = null;
viewerToolbarActions: Array<ContentActionRef> = [];
private sharedLinksApi: SharedlinksApi;
private readonly destroyRef = inject(DestroyRef);
constructor(
private route: ActivatedRoute,
private store: Store<AppStore>,
@@ -77,14 +80,9 @@ export class SharedLinkViewComponent implements OnInit, OnDestroy {
this.extensions
.getSharedLinkViewerToolbarActions()
.pipe(takeUntil(this.onDestroy$))
.pipe(takeUntilDestroyed(this.destroyRef))
.subscribe((actions) => {
this.viewerToolbarActions = actions;
});
}
ngOnDestroy() {
this.onDestroy$.next(true);
this.onDestroy$.complete();
}
}

View File

@@ -22,14 +22,13 @@
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
*/
import { Component, EventEmitter, inject, OnDestroy, OnInit, Output, ViewEncapsulation } from '@angular/core';
import { Subject } from 'rxjs';
import { Component, DestroyRef, EventEmitter, inject, OnInit, Output, ViewEncapsulation } from '@angular/core';
import { ContentActionRef } from '@alfresco/adf-extensions';
import { AppExtensionService, AppSettingsService, ToolbarComponent } from '@alfresco/aca-shared';
import { takeUntil } from 'rxjs/operators';
import { CommonModule } from '@angular/common';
import { TranslateModule } from '@ngx-translate/core';
import { RouterModule } from '@angular/router';
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
@Component({
standalone: true,
@@ -39,11 +38,12 @@ import { RouterModule } from '@angular/router';
encapsulation: ViewEncapsulation.None,
host: { class: 'app-sidenav-header' }
})
export class SidenavHeaderComponent implements OnInit, OnDestroy {
private onDestroy$ = new Subject<boolean>();
export class SidenavHeaderComponent implements OnInit {
private appSettings = inject(AppSettingsService);
private appExtensions = inject(AppExtensionService);
private readonly destroyRef = inject(DestroyRef);
appName = this.appSettings.appName;
logoUrl = this.appSettings.appLogoUrl;
landingPage = this.appSettings.landingPage;
@@ -55,14 +55,9 @@ export class SidenavHeaderComponent implements OnInit, OnDestroy {
ngOnInit() {
this.appExtensions
.getHeaderActions()
.pipe(takeUntil(this.onDestroy$))
.pipe(takeUntilDestroyed(this.destroyRef))
.subscribe((actions) => {
this.actions = actions;
});
}
ngOnDestroy() {
this.onDestroy$.next(true);
this.onDestroy$.complete();
}
}

View File

@@ -22,11 +22,23 @@
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
*/
import { AfterContentInit, ContentChildren, Directive, ElementRef, Input, OnInit, Optional, QueryList, Renderer2 } from '@angular/core';
import {
AfterContentInit,
ContentChildren,
DestroyRef,
Directive,
ElementRef,
inject,
Input,
OnInit,
Optional,
QueryList,
Renderer2
} from '@angular/core';
import { NavigationEnd, Router } from '@angular/router';
import { filter, takeUntil } from 'rxjs/operators';
import { Subject } from 'rxjs';
import { filter } from 'rxjs/operators';
import { ActionDirective } from './action.directive';
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
@Directive({
standalone: true,
@@ -39,7 +51,7 @@ export class ActiveLinkDirective implements OnInit, AfterContentInit {
links: QueryList<ActionDirective>;
isLinkActive = false;
private onDestroy$: Subject<boolean> = new Subject<boolean>();
private readonly destroyRef = inject(DestroyRef);
constructor(private router: Router, private element: ElementRef, private renderer: Renderer2, @Optional() private action?: ActionDirective) {}
@@ -47,7 +59,7 @@ export class ActiveLinkDirective implements OnInit, AfterContentInit {
this.router.events
.pipe(
filter((event) => event instanceof NavigationEnd),
takeUntil(this.onDestroy$)
takeUntilDestroyed(this.destroyRef)
)
.subscribe((event: NavigationEnd) => {
this.update(event.urlAfterRedirects);

View File

@@ -25,6 +25,7 @@
import { NavigationEnd } from '@angular/router';
import { ExpansionPanelDirective } from './expansion-panel.directive';
import { Subject } from 'rxjs';
import { TestBed } from '@angular/core/testing';
class RouterStub {
url;
@@ -64,7 +65,10 @@ describe('AcaExpansionPanel', () => {
const item = {
children: [{ url: 'dummy-route-1' }, { url: 'dummy-route-2' }]
};
const directive = new ExpansionPanelDirective(mockStore, router, mockMatExpansionPanel);
let directive: ExpansionPanelDirective;
TestBed.runInInjectionContext(() => {
directive = new ExpansionPanelDirective(mockStore, router, mockMatExpansionPanel);
});
directive.acaExpansionPanel = item;
@@ -75,7 +79,10 @@ describe('AcaExpansionPanel', () => {
const item = {
children: [{ url: 'dummy-route-1' }, { url: 'dummy-route-2' }]
};
const directive = new ExpansionPanelDirective(mockStore, router, mockMatExpansionPanel);
let directive: ExpansionPanelDirective;
TestBed.runInInjectionContext(() => {
directive = new ExpansionPanelDirective(mockStore, router, mockMatExpansionPanel);
});
directive.acaExpansionPanel = item;
@@ -93,7 +100,10 @@ describe('AcaExpansionPanel', () => {
mockMatExpansionPanel.expanded = true;
const directive = new ExpansionPanelDirective(mockStore, router, mockMatExpansionPanel);
let directive: ExpansionPanelDirective;
TestBed.runInInjectionContext(() => {
directive = new ExpansionPanelDirective(mockStore, router, mockMatExpansionPanel);
});
directive.acaExpansionPanel = item;
@@ -109,7 +119,10 @@ describe('AcaExpansionPanel', () => {
children: [{ url: 'dummy-route-1' }, { url: 'dummy-route-2' }]
};
const directive = new ExpansionPanelDirective(mockStore, router, mockMatExpansionPanel);
let directive: ExpansionPanelDirective;
TestBed.runInInjectionContext(() => {
directive = new ExpansionPanelDirective(mockStore, router, mockMatExpansionPanel);
});
directive.acaExpansionPanel = item;
mockMatExpansionPanel.expanded = true;
@@ -129,7 +142,10 @@ describe('AcaExpansionPanel', () => {
}
};
const directive = new ExpansionPanelDirective(mockStore, router, mockMatExpansionPanel);
let directive: ExpansionPanelDirective;
TestBed.runInInjectionContext(() => {
directive = new ExpansionPanelDirective(mockStore, router, mockMatExpansionPanel);
});
directive.acaExpansionPanel = item;
mockMatExpansionPanel.expanded = true;

View File

@@ -22,24 +22,22 @@
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
*/
import { Directive, Input, HostListener, OnInit, OnDestroy } from '@angular/core';
import { Router, NavigationEnd, PRIMARY_OUTLET } from '@angular/router';
import { filter, takeUntil } from 'rxjs/operators';
import { Subject } from 'rxjs';
import { DestroyRef, Directive, HostListener, inject, Input, OnInit } from '@angular/core';
import { NavigationEnd, PRIMARY_OUTLET, Router } from '@angular/router';
import { filter } from 'rxjs/operators';
import { MatExpansionPanel } from '@angular/material/expansion';
import { Store } from '@ngrx/store';
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
@Directive({
standalone: true,
selector: '[acaExpansionPanel]',
exportAs: 'acaExpansionPanel'
})
export class ExpansionPanelDirective implements OnInit, OnDestroy {
export class ExpansionPanelDirective implements OnInit {
@Input() acaExpansionPanel;
public hasActiveChildren = false;
private onDestroy$: Subject<boolean> = new Subject<boolean>();
@HostListener('click')
onClick() {
if (this.expansionPanel.expanded && !this.hasActiveLinks() && !this.acaExpansionPanel.data?.canBeInactive) {
@@ -55,6 +53,8 @@ export class ExpansionPanelDirective implements OnInit, OnDestroy {
}
}
private readonly destroyRef = inject(DestroyRef);
constructor(private store: Store<any>, private router: Router, private expansionPanel: MatExpansionPanel) {}
hasActiveLinks() {
@@ -70,18 +70,13 @@ export class ExpansionPanelDirective implements OnInit, OnDestroy {
this.router.events
.pipe(
filter((event) => event instanceof NavigationEnd),
takeUntil(this.onDestroy$)
takeUntilDestroyed(this.destroyRef)
)
.subscribe(() => {
this.hasActiveChildren = this.hasActiveLinks();
});
}
ngOnDestroy() {
this.onDestroy$.next(true);
this.onDestroy$.complete();
}
private getNavigationCommands(url: string): any[] {
const urlTree = this.router.parseUrl(url);
const urlSegmentGroup = urlTree.root.children[PRIMARY_OUTLET];

View File

@@ -25,6 +25,7 @@
import { NavigationEnd } from '@angular/router';
import { MenuPanelDirective } from './menu-panel.directive';
import { Subject } from 'rxjs';
import { TestBed } from '@angular/core/testing';
class RouterStub {
url;
@@ -64,7 +65,10 @@ describe('MenuPanelDirective', () => {
const item = {
children: [{ url: 'dummy-route-1' }, { url: 'dummy-route-2' }]
};
const directive = new MenuPanelDirective(mockStore, router);
let directive: MenuPanelDirective;
TestBed.runInInjectionContext(() => {
directive = new MenuPanelDirective(mockStore, router);
});
directive.acaMenuPanel = item;
@@ -75,7 +79,10 @@ describe('MenuPanelDirective', () => {
const item = {
children: [{ url: 'dummy-route-1' }, { url: 'dummy-route-2' }]
};
const directive = new MenuPanelDirective(mockStore, router);
let directive: MenuPanelDirective;
TestBed.runInInjectionContext(() => {
directive = new MenuPanelDirective(mockStore, router);
});
directive.acaMenuPanel = item;
@@ -93,7 +100,10 @@ describe('MenuPanelDirective', () => {
mockMatExpansionPanel.expanded = true;
const directive = new MenuPanelDirective(mockStore, router);
let directive: MenuPanelDirective;
TestBed.runInInjectionContext(() => {
directive = new MenuPanelDirective(mockStore, router);
});
directive.acaMenuPanel = item;
@@ -109,7 +119,10 @@ describe('MenuPanelDirective', () => {
children: [{ url: 'dummy-route-1' }, { url: 'dummy-route-2' }]
};
const directive = new MenuPanelDirective(mockStore, router);
let directive: MenuPanelDirective;
TestBed.runInInjectionContext(() => {
directive = new MenuPanelDirective(mockStore, router);
});
directive.acaMenuPanel = item;
mockMatExpansionPanel.expanded = true;

View File

@@ -22,23 +22,21 @@
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
*/
import { Directive, Input, OnInit, OnDestroy, HostListener } from '@angular/core';
import { Router, NavigationEnd, PRIMARY_OUTLET } from '@angular/router';
import { filter, takeUntil } from 'rxjs/operators';
import { Subject } from 'rxjs';
import { DestroyRef, Directive, HostListener, inject, Input, OnInit } from '@angular/core';
import { NavigationEnd, PRIMARY_OUTLET, Router } from '@angular/router';
import { filter } from 'rxjs/operators';
import { Store } from '@ngrx/store';
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
@Directive({
standalone: true,
selector: '[acaMenuPanel]',
exportAs: 'acaMenuPanel'
})
export class MenuPanelDirective implements OnInit, OnDestroy {
export class MenuPanelDirective implements OnInit {
@Input() acaMenuPanel;
hasActiveChildren = false;
private onDestroy$: Subject<boolean> = new Subject<boolean>();
@HostListener('menuOpened')
menuOpened() {
if (this.acaMenuPanel.children && !this.hasActiveLinks()) {
@@ -54,6 +52,8 @@ export class MenuPanelDirective implements OnInit, OnDestroy {
}
}
private readonly destroyRef = inject(DestroyRef);
constructor(private store: Store<any>, private router: Router) {}
hasActiveLinks() {
@@ -69,18 +69,13 @@ export class MenuPanelDirective implements OnInit, OnDestroy {
this.router.events
.pipe(
filter((event) => event instanceof NavigationEnd),
takeUntil(this.onDestroy$)
takeUntilDestroyed(this.destroyRef)
)
.subscribe(() => {
this.hasActiveChildren = this.hasActiveLinks();
});
}
ngOnDestroy() {
this.onDestroy$.next(true);
this.onDestroy$.complete();
}
private getNavigationCommands(url: string): any[] {
const urlTree = this.router.parseUrl(url);
const urlSegmentGroup = urlTree.root.children[PRIMARY_OUTLET];

View File

@@ -22,12 +22,11 @@
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
*/
import { Component, Input, OnInit, ViewEncapsulation, OnDestroy } from '@angular/core';
import { Component, DestroyRef, inject, Input, OnInit, ViewEncapsulation } from '@angular/core';
import { DynamicExtensionComponent, NavBarGroupRef, NavBarLinkRef } from '@alfresco/adf-extensions';
import { Store } from '@ngrx/store';
import { AppStore, getSideNavState } from '@alfresco/aca-shared/store';
import { Subject } from 'rxjs';
import { takeUntil, distinctUntilChanged, debounceTime } from 'rxjs/operators';
import { debounceTime, distinctUntilChanged } from 'rxjs/operators';
import { AppExtensionService, AppService, NavigationHistoryService } from '@alfresco/aca-shared';
import { SidenavLayoutComponent } from '@alfresco/adf-core';
import { CommonModule } from '@angular/common';
@@ -35,6 +34,7 @@ import { SidenavHeaderComponent } from './components/sidenav-header.component';
import { MatListModule } from '@angular/material/list';
import { ExpandMenuComponent } from './components/expand-menu.component';
import { NavigationEnd } from '@angular/router';
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
@Component({
standalone: true,
@@ -45,7 +45,7 @@ import { NavigationEnd } from '@angular/router';
encapsulation: ViewEncapsulation.None,
host: { class: 'app-sidenav' }
})
export class SidenavComponent implements OnInit, OnDestroy {
export class SidenavComponent implements OnInit {
@Input()
data: {
layout?: SidenavLayoutComponent;
@@ -53,7 +53,8 @@ export class SidenavComponent implements OnInit, OnDestroy {
} = {};
groups: Array<NavBarGroupRef> = [];
private onDestroy$ = new Subject<boolean>();
private readonly destroyRef = inject(DestroyRef);
constructor(
private store: Store<AppStore>,
@@ -65,17 +66,17 @@ export class SidenavComponent implements OnInit, OnDestroy {
ngOnInit() {
this.store
.select(getSideNavState)
.pipe(debounceTime(300), distinctUntilChanged(), takeUntil(this.onDestroy$))
.pipe(debounceTime(300), distinctUntilChanged(), takeUntilDestroyed(this.destroyRef))
.subscribe(() => {
this.groups = this.extensions.getApplicationNavigation(this.extensions.navbar);
});
this.appService.setAppNavbarMode(this.data.mode);
this.appService.toggleAppNavBar$.pipe(takeUntil(this.onDestroy$)).subscribe(() => this.toggleNavBar());
this.data.layout.expanded.pipe(takeUntil(this.onDestroy$)).subscribe(() => this.setNavBarMode());
this.appService.toggleAppNavBar$.pipe(takeUntilDestroyed(this.destroyRef)).subscribe(() => this.toggleNavBar());
this.data.layout.expanded.pipe(takeUntilDestroyed(this.destroyRef)).subscribe(() => this.setNavBarMode());
this.navigationHistoryService
.listenToRouteChanges()
.pipe(takeUntil(this.onDestroy$))
.pipe(takeUntilDestroyed(this.destroyRef))
.subscribe((event: NavigationEnd) => {
this.navigationHistoryService.setHistory(event, 3);
});
@@ -101,9 +102,4 @@ export class SidenavComponent implements OnInit, OnDestroy {
this.data.layout.toggleMenu();
this.setNavBarMode();
}
ngOnDestroy() {
this.onDestroy$.next(true);
this.onDestroy$.complete();
}
}

View File

@@ -22,19 +22,19 @@
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
*/
import { Component, ViewEncapsulation, OnInit, OnDestroy } from '@angular/core';
import { Component, DestroyRef, inject, OnInit, ViewEncapsulation } from '@angular/core';
import { Store } from '@ngrx/store';
import { AppHookService } from '@alfresco/aca-shared';
import { AppStore, getAppSelection } from '@alfresco/aca-shared/store';
import { SelectionState } from '@alfresco/adf-extensions';
import { distinctUntilChanged, takeUntil } from 'rxjs/operators';
import { distinctUntilChanged } from 'rxjs/operators';
import { Router } from '@angular/router';
import { Subject } from 'rxjs';
import { CommonModule } from '@angular/common';
import { TranslateModule } from '@ngx-translate/core';
import { LibraryFavoriteDirective } from '@alfresco/adf-content-services';
import { MatIconModule } from '@angular/material/icon';
import { MatMenuModule } from '@angular/material/menu';
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
@Component({
standalone: true,
@@ -55,9 +55,10 @@ import { MatMenuModule } from '@angular/material/menu';
encapsulation: ViewEncapsulation.None,
host: { class: 'app-toggle-favorite-library' }
})
export class ToggleFavoriteLibraryComponent implements OnInit, OnDestroy {
export class ToggleFavoriteLibraryComponent implements OnInit {
library;
private onDestroy$: Subject<void> = new Subject<void>();
private readonly destroyRef = inject(DestroyRef);
constructor(private store: Store<AppStore>, private appHookService: AppHookService, private router: Router) {}
@@ -66,7 +67,7 @@ export class ToggleFavoriteLibraryComponent implements OnInit, OnDestroy {
this.store
.select(getAppSelection)
.pipe(distinctUntilChanged(), takeUntil(this.onDestroy$))
.pipe(distinctUntilChanged(), takeUntilDestroyed(this.destroyRef))
.subscribe((selection: SelectionState) => {
this.library = { ...selection.library };
@@ -77,11 +78,6 @@ export class ToggleFavoriteLibraryComponent implements OnInit, OnDestroy {
});
}
ngOnDestroy() {
this.onDestroy$.next();
this.onDestroy$.complete();
}
onToggleEvent() {
this.appHookService.favoriteLibraryToggle.next();
}

View File

@@ -22,13 +22,14 @@
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
*/
import { Component, OnDestroy, ViewEncapsulation } from '@angular/core';
import { Observable, Subject } from 'rxjs';
import { delay, takeUntil } from 'rxjs/operators';
import { Component, ViewEncapsulation } from '@angular/core';
import { Observable } from 'rxjs';
import { delay } from 'rxjs/operators';
import { Store } from '@ngrx/store';
import { AppStore, getFileUploadingDialog } from '@alfresco/aca-shared/store';
import { CommonModule } from '@angular/common';
import { UploadModule } from '@alfresco/adf-content-services';
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
@Component({
standalone: true,
@@ -37,17 +38,10 @@ import { UploadModule } from '@alfresco/adf-content-services';
templateUrl: './upload-files-dialog.component.html',
encapsulation: ViewEncapsulation.None
})
export class UploadFilesDialogComponent implements OnDestroy {
export class UploadFilesDialogComponent {
showFileUploadingDialog$: Observable<boolean>;
private onDestroy$: Subject<boolean> = new Subject<boolean>();
constructor(private store: Store<AppStore>) {
this.showFileUploadingDialog$ = this.store.select(getFileUploadingDialog).pipe(delay(0), takeUntil(this.onDestroy$));
}
ngOnDestroy() {
this.onDestroy$.next(true);
this.onDestroy$.complete();
this.showFileUploadingDialog$ = this.store.select(getFileUploadingDialog).pipe(delay(0), takeUntilDestroyed());
}
}

View File

@@ -24,18 +24,18 @@
import { AlfrescoApiService } from '@alfresco/adf-content-services';
import { PeopleApi, Person } from '@alfresco/js-api';
import { Component, OnDestroy, OnInit, ViewEncapsulation } from '@angular/core';
import { Component, OnInit, ViewEncapsulation } from '@angular/core';
import { FormControl, FormGroup, ReactiveFormsModule, Validators } from '@angular/forms';
import { Router } from '@angular/router';
import { Observable, Subject, throwError } from 'rxjs';
import { Observable, throwError } from 'rxjs';
import { AppService } from '@alfresco/aca-shared';
import { takeUntil } from 'rxjs/operators';
import { CommonModule } from '@angular/common';
import { MatButtonModule } from '@angular/material/button';
import { MatIconModule } from '@angular/material/icon';
import { TranslateModule } from '@ngx-translate/core';
import { MatDividerModule } from '@angular/material/divider';
import { MatFormFieldModule } from '@angular/material/form-field';
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
@Component({
standalone: true,
@@ -45,7 +45,7 @@ import { MatFormFieldModule } from '@angular/material/form-field';
styleUrls: ['./view-profile.component.scss'],
encapsulation: ViewEncapsulation.None
})
export class ViewProfileComponent implements OnInit, OnDestroy {
export class ViewProfileComponent implements OnInit {
peopleApi: PeopleApi;
profileForm: FormGroup;
@@ -61,11 +61,10 @@ export class ViewProfileComponent implements OnInit, OnDestroy {
contactSectionDropdown = false;
contactSectionButtonsToggle = true;
appNavNarMode$: Observable<'collapsed' | 'expanded'>;
private onDestroy$ = new Subject<boolean>();
constructor(private router: Router, apiService: AlfrescoApiService, private appService: AppService) {
this.peopleApi = new PeopleApi(apiService.getInstance());
this.appNavNarMode$ = appService.appNavNarMode$.pipe(takeUntil(this.onDestroy$));
this.appNavNarMode$ = appService.appNavNarMode$.pipe(takeUntilDestroyed());
}
ngOnInit() {
@@ -205,9 +204,4 @@ export class ViewProfileComponent implements OnInit, OnDestroy {
isSaveButtonDisabled(): boolean {
return this.profileForm.invalid;
}
ngOnDestroy() {
this.onDestroy$.next(true);
this.onDestroy$.complete();
}
}

View File

@@ -25,6 +25,7 @@
import { DocumentListDirective } from './document-list.directive';
import { Subject } from 'rxjs';
import { SetSelectedNodesAction } from '@alfresco/aca-shared/store';
import { TestBed } from '@angular/core/testing';
describe('DocumentListDirective', () => {
let documentListDirective: DocumentListDirective;
@@ -74,14 +75,16 @@ describe('DocumentListDirective', () => {
};
beforeEach(() => {
documentListDirective = new DocumentListDirective(
storeMock,
documentListMock,
userPreferencesServiceMock,
mockRoute,
mockRouter,
documentListServiceMock as any
);
TestBed.runInInjectionContext(() => {
documentListDirective = new DocumentListDirective(
storeMock,
documentListMock,
userPreferencesServiceMock,
mockRoute,
mockRouter,
documentListServiceMock as any
);
});
});
afterEach(() => {

View File

@@ -22,30 +22,30 @@
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
*/
import { Directive, OnDestroy, OnInit, HostListener } from '@angular/core';
import { DestroyRef, Directive, HostListener, inject, OnInit } from '@angular/core';
import { DocumentListComponent, DocumentListService } from '@alfresco/adf-content-services';
import { ActivatedRoute, Router } from '@angular/router';
import { UserPreferencesService } from '@alfresco/adf-core';
import { Subject } from 'rxjs';
import { Store } from '@ngrx/store';
import { SetSelectedNodesAction } from '@alfresco/aca-shared/store';
import { takeUntil, filter } from 'rxjs/operators';
import { filter } from 'rxjs/operators';
import { NodeEntry } from '@alfresco/js-api';
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
@Directive({
standalone: true,
selector: '[acaDocumentList]'
})
export class DocumentListDirective implements OnInit, OnDestroy {
export class DocumentListDirective implements OnInit {
private isLibrary = false;
selectedNode: NodeEntry;
onDestroy$ = new Subject<boolean>();
get sortingPreferenceKey(): string {
return this.route.snapshot.data.sortingPreferenceKey;
}
private readonly destroyRef = inject(DestroyRef);
constructor(
private store: Store<any>,
private documentList: DocumentListComponent,
@@ -87,24 +87,19 @@ export class DocumentListDirective implements OnInit, OnDestroy {
this.documentList.ready
.pipe(
filter(() => !this.router.url.includes('viewer:view')),
takeUntil(this.onDestroy$)
takeUntilDestroyed(this.destroyRef)
)
.subscribe(() => this.onReady());
this.documentListService.reload$.pipe(takeUntil(this.onDestroy$)).subscribe(() => {
this.documentListService.reload$.pipe(takeUntilDestroyed(this.destroyRef)).subscribe(() => {
this.reload();
});
this.documentListService.resetSelection$.pipe(takeUntil(this.onDestroy$)).subscribe(() => {
this.documentListService.resetSelection$.pipe(takeUntilDestroyed(this.destroyRef)).subscribe(() => {
this.reset();
});
}
ngOnDestroy() {
this.onDestroy$.next(true);
this.onDestroy$.complete();
}
@HostListener('sorting-changed', ['$event'])
onSortingChanged(event: CustomEvent) {
if (this.sortingPreferenceKey) {