[ADF-4745] memory leak fixes (#4931)

* fix app-layout component

* fix card-view component

* fix cloud-layout service

* code fixes

* code fixes

* even more fixes

* even more fixes

* lint fixes

* test fixes

* fix code

* remove useless pipes

* fix code owners

* enable spellcheck for cloud components

* update test

* update test
This commit is contained in:
Denys Vuika
2019-07-16 15:56:00 +01:00
committed by Eugenio Romano
parent e2311ab045
commit 1abb9bfc89
98 changed files with 1581 additions and 1066 deletions

View File

@@ -16,18 +16,18 @@
*/
import { AppsProcessService, TranslationService, CustomEmptyContentTemplateDirective } from '@alfresco/adf-core';
import { AfterContentInit, Component, EventEmitter, Input, OnInit, Output, ContentChild } from '@angular/core';
import { Observable, Observer, of } from 'rxjs';
import { AfterContentInit, Component, EventEmitter, Input, OnInit, Output, ContentChild, OnDestroy } from '@angular/core';
import { Observable, Observer, of, Subject } from 'rxjs';
import { AppDefinitionRepresentationModel } from '../task-list';
import { IconModel } from './icon.model';
import { share } from 'rxjs/operators';
import { share, takeUntil } from 'rxjs/operators';
@Component({
selector: 'adf-apps',
templateUrl: 'apps-list.component.html',
styleUrls: ['./apps-list.component.scss']
})
export class AppsListComponent implements OnInit, AfterContentInit {
export class AppsListComponent implements OnInit, AfterContentInit, OnDestroy {
public static LAYOUT_LIST: string = 'LIST';
public static LAYOUT_GRID: string = 'GRID';
@@ -60,17 +60,16 @@ export class AppsListComponent implements OnInit, AfterContentInit {
private appsObserver: Observer<AppDefinitionRepresentationModel>;
apps$: Observable<AppDefinitionRepresentationModel>;
currentApp: AppDefinitionRepresentationModel;
appList: AppDefinitionRepresentationModel [] = [];
private iconsMDL: IconModel;
loading: boolean = false;
hasEmptyCustomContentTemplate: boolean = false;
private onDestroy$ = new Subject<boolean>();
constructor(
private appsProcessService: AppsProcessService,
private translationService: TranslationService) {
@@ -83,13 +82,19 @@ export class AppsListComponent implements OnInit, AfterContentInit {
this.setDefaultLayoutType();
}
this.apps$.subscribe((app: any) => {
this.appList.push(app);
});
this.apps$
.pipe(takeUntil(this.onDestroy$))
.subscribe((app: any) => this.appList.push(app));
this.iconsMDL = new IconModel();
this.load();
}
ngOnDestroy() {
this.onDestroy$.next(true);
this.onDestroy$.complete();
}
ngAfterContentInit() {
if (this.emptyCustomContent) {
this.hasEmptyCustomContentTemplate = true;