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