mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-09-17 14:21:14 +00:00
cleanup subscriptions
This commit is contained in:
@@ -32,7 +32,6 @@ import { SetCurrentFolderAction, isAdmin, UploadFileVersionAction, showLoaderSel
|
||||
import { debounceTime, takeUntil } from 'rxjs/operators';
|
||||
import { FilterSearch, ShareDataRow, UploadService, FileUploadEvent } from '@alfresco/adf-content-services';
|
||||
import { DocumentListPresetRef } from '@alfresco/adf-extensions';
|
||||
import { Observable } from 'rxjs';
|
||||
|
||||
@Component({
|
||||
templateUrl: './files.component.html'
|
||||
@@ -43,7 +42,7 @@ export class FilesComponent extends PageComponent implements OnInit, OnDestroy {
|
||||
selectedNode: MinimalNodeEntity;
|
||||
queryParams = null;
|
||||
|
||||
showLoader$: Observable<boolean>;
|
||||
showLoader$ = this.store.select(showLoaderSelector);
|
||||
private nodePath: PathElement[];
|
||||
|
||||
columns: DocumentListPresetRef[] = [];
|
||||
@@ -61,17 +60,15 @@ export class FilesComponent extends PageComponent implements OnInit, OnDestroy {
|
||||
ngOnInit() {
|
||||
super.ngOnInit();
|
||||
|
||||
const { route, nodeActionsService, uploadService } = this;
|
||||
const { data } = route.snapshot;
|
||||
const { data } = this.route.snapshot;
|
||||
|
||||
this.title = data.title;
|
||||
|
||||
this.showLoader$ = this.store.select(showLoaderSelector);
|
||||
route.queryParamMap.subscribe((queryMap: Params) => {
|
||||
this.route.queryParamMap.subscribe((queryMap: Params) => {
|
||||
this.queryParams = queryMap.params;
|
||||
});
|
||||
|
||||
route.params.subscribe(({ folderId }: Params) => {
|
||||
this.route.params.subscribe(({ folderId }: Params) => {
|
||||
const nodeId = folderId || data.defaultNodeId;
|
||||
|
||||
this.contentApi.getNode(nodeId).subscribe(
|
||||
@@ -91,9 +88,9 @@ export class FilesComponent extends PageComponent implements OnInit, OnDestroy {
|
||||
});
|
||||
|
||||
this.subscriptions = this.subscriptions.concat([
|
||||
nodeActionsService.contentCopied.subscribe((nodes) => this.onContentCopied(nodes)),
|
||||
uploadService.fileUploadComplete.pipe(debounceTime(300)).subscribe((file) => this.onFileUploadedEvent(file)),
|
||||
uploadService.fileUploadDeleted.pipe(debounceTime(300)).subscribe((file) => this.onFileUploadedEvent(file))
|
||||
this.nodeActionsService.contentCopied.subscribe((nodes) => this.onContentCopied(nodes)),
|
||||
this.uploadService.fileUploadComplete.pipe(debounceTime(300)).subscribe((file) => this.onFileUploadedEvent(file)),
|
||||
this.uploadService.fileUploadDeleted.pipe(debounceTime(300)).subscribe((file) => this.onFileUploadedEvent(file))
|
||||
]);
|
||||
|
||||
this.store
|
||||
|
@@ -44,8 +44,8 @@ export class RecentFilesComponent extends PageComponent implements OnInit {
|
||||
super.ngOnInit();
|
||||
|
||||
this.subscriptions = this.subscriptions.concat([
|
||||
this.uploadService.fileUploadComplete.pipe(debounceTime(300)).subscribe(() => this.onFileUploadedEvent()),
|
||||
this.uploadService.fileUploadDeleted.pipe(debounceTime(300)).subscribe(() => this.onFileUploadedEvent())
|
||||
this.uploadService.fileUploadComplete.pipe(debounceTime(300)).subscribe(() => this.reload()),
|
||||
this.uploadService.fileUploadDeleted.pipe(debounceTime(300)).subscribe(() => this.reload())
|
||||
]);
|
||||
|
||||
this.columns = this.extensions.documentListPresets.recent || [];
|
||||
@@ -60,8 +60,4 @@ export class RecentFilesComponent extends PageComponent implements OnInit {
|
||||
handleNodeClick(event: Event) {
|
||||
this.onNodeDoubleClick((event as CustomEvent).detail?.node);
|
||||
}
|
||||
|
||||
private onFileUploadedEvent() {
|
||||
this.reload();
|
||||
}
|
||||
}
|
||||
|
@@ -36,7 +36,7 @@ import {
|
||||
SnackbarErrorAction
|
||||
} from '@alfresco/aca-shared/store';
|
||||
import { TranslationService } from '@alfresco/adf-core';
|
||||
import { combineLatest, Observable } from 'rxjs';
|
||||
import { combineLatest } from 'rxjs';
|
||||
import { PageComponent } from '@alfresco/aca-shared';
|
||||
import { SearchSortingDefinition } from '@alfresco/adf-content-services/lib/search/models/search-sorting-definition.interface';
|
||||
import { takeUntil } from 'rxjs/operators';
|
||||
@@ -48,8 +48,8 @@ import { takeUntil } from 'rxjs/operators';
|
||||
styleUrls: ['./search-results.component.scss']
|
||||
})
|
||||
export class SearchResultsComponent extends PageComponent implements OnInit {
|
||||
showFacetFilter$: Observable<boolean>;
|
||||
infoDrawerPreview$: Observable<boolean>;
|
||||
showFacetFilter$ = this.store.select(showFacetFilter);
|
||||
infoDrawerPreview$ = this.store.select(infoDrawerPreview);
|
||||
|
||||
searchedWord: string;
|
||||
queryParamName = 'q';
|
||||
@@ -70,8 +70,6 @@ export class SearchResultsComponent extends PageComponent implements OnInit {
|
||||
maxItems: 25
|
||||
};
|
||||
|
||||
this.showFacetFilter$ = this.store.select(showFacetFilter);
|
||||
this.infoDrawerPreview$ = this.store.select(infoDrawerPreview);
|
||||
combineLatest([this.route.params, this.queryBuilder.configUpdated])
|
||||
.pipe(takeUntil(this.onDestroy$))
|
||||
.subscribe(([params, searchConfig]) => {
|
||||
|
Reference in New Issue
Block a user