mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[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:
committed by
Eugenio Romano
parent
e2311ab045
commit
1abb9bfc89
@@ -15,9 +15,11 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { Component, ViewEncapsulation, OnInit } from '@angular/core';
|
||||
import { Component, ViewEncapsulation, OnInit, OnDestroy } from '@angular/core';
|
||||
import { UserPreferencesService, AppConfigService, AlfrescoApiService, UserPreferenceValues } from '@alfresco/adf-core';
|
||||
import { HeaderDataService } from '../header-data/header-data.service';
|
||||
import { Subject } from 'rxjs';
|
||||
import { takeUntil } from 'rxjs/operators';
|
||||
|
||||
@Component({
|
||||
templateUrl: 'app-layout.component.html',
|
||||
@@ -27,8 +29,8 @@ import { HeaderDataService } from '../header-data/header-data.service';
|
||||
},
|
||||
encapsulation: ViewEncapsulation.None
|
||||
})
|
||||
|
||||
export class AppLayoutComponent implements OnInit {
|
||||
export class AppLayoutComponent implements OnInit, OnDestroy {
|
||||
private onDestroy$ = new Subject<boolean>();
|
||||
|
||||
links: Array<any> = [
|
||||
{ href: '/home', icon: 'home', title: 'APP_LAYOUT.HOME' },
|
||||
@@ -108,14 +110,42 @@ export class AppLayoutComponent implements OnInit {
|
||||
this.expandedSidenav = expand;
|
||||
}
|
||||
|
||||
this.headerService.hideMenu.subscribe((show) => this.showMenu = show);
|
||||
this.headerService.color.subscribe((color) => this.color = color);
|
||||
this.headerService.title.subscribe((title) => this.title = title);
|
||||
this.headerService.logo.subscribe((path) => this.logo = path);
|
||||
this.headerService.redirectUrl.subscribe((redirectUrl) => this.redirectUrl = redirectUrl);
|
||||
this.headerService.tooltip.subscribe((tooltip) => this.tooltip = tooltip);
|
||||
this.headerService.position.subscribe((position) => this.position = position);
|
||||
this.headerService.hideSidenav.subscribe((hideSidenav) => this.hideSidenav = hideSidenav);
|
||||
this.headerService.hideMenu
|
||||
.pipe(takeUntil(this.onDestroy$))
|
||||
.subscribe(show => this.showMenu = show);
|
||||
|
||||
this.headerService.color
|
||||
.pipe(takeUntil(this.onDestroy$))
|
||||
.subscribe(color => this.color = color);
|
||||
|
||||
this.headerService.title
|
||||
.pipe(takeUntil(this.onDestroy$))
|
||||
.subscribe(title => this.title = title);
|
||||
|
||||
this.headerService.logo
|
||||
.pipe(takeUntil(this.onDestroy$))
|
||||
.subscribe(path => this.logo = path);
|
||||
|
||||
this.headerService.redirectUrl
|
||||
.pipe(takeUntil(this.onDestroy$))
|
||||
.subscribe(redirectUrl => this.redirectUrl = redirectUrl);
|
||||
|
||||
this.headerService.tooltip
|
||||
.pipe(takeUntil(this.onDestroy$))
|
||||
.subscribe(tooltip => this.tooltip = tooltip);
|
||||
|
||||
this.headerService.position
|
||||
.pipe(takeUntil(this.onDestroy$))
|
||||
.subscribe(position => this.position = position);
|
||||
|
||||
this.headerService.hideSidenav
|
||||
.pipe(takeUntil(this.onDestroy$))
|
||||
.subscribe(hideSidenav => this.hideSidenav = hideSidenav);
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
this.onDestroy$.next(true);
|
||||
this.onDestroy$.complete();
|
||||
}
|
||||
|
||||
constructor(
|
||||
|
@@ -15,7 +15,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { Component, OnInit, ElementRef, ViewChild } from '@angular/core';
|
||||
import { Component, OnInit, ElementRef, ViewChild, OnDestroy } from '@angular/core';
|
||||
import {
|
||||
CardViewTextItemModel,
|
||||
CardViewDateItemModel,
|
||||
@@ -29,13 +29,14 @@ import {
|
||||
CardViewMapItemModel,
|
||||
UpdateNotification
|
||||
} from '@alfresco/adf-core';
|
||||
import { of } from 'rxjs';
|
||||
import { of, Subject } from 'rxjs';
|
||||
import { takeUntil } from 'rxjs/operators';
|
||||
|
||||
@Component({
|
||||
templateUrl: './card-view.component.html',
|
||||
styleUrls: ['./card-view.component.scss']
|
||||
})
|
||||
export class CardViewComponent implements OnInit {
|
||||
export class CardViewComponent implements OnInit, OnDestroy {
|
||||
|
||||
@ViewChild('console') console: ElementRef;
|
||||
|
||||
@@ -43,6 +44,8 @@ export class CardViewComponent implements OnInit {
|
||||
properties: any;
|
||||
logs: string[];
|
||||
|
||||
private onDestroy$ = new Subject<boolean>();
|
||||
|
||||
constructor(private cardViewUpdateService: CardViewUpdateService) {
|
||||
this.logs = [];
|
||||
this.createCard();
|
||||
@@ -53,7 +56,14 @@ export class CardViewComponent implements OnInit {
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.cardViewUpdateService.itemUpdated$.subscribe(this.onItemChange.bind(this));
|
||||
this.cardViewUpdateService.itemUpdated$
|
||||
.pipe(takeUntil(this.onDestroy$))
|
||||
.subscribe(this.onItemChange.bind(this));
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
this.onDestroy$.next(true);
|
||||
this.onDestroy$.complete();
|
||||
}
|
||||
|
||||
createCard() {
|
||||
|
@@ -19,26 +19,24 @@ import { Component, OnInit } from '@angular/core';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
|
||||
@Component({
|
||||
selector: 'app-cloud-breadcrumbs',
|
||||
templateUrl: './cloud-breadcrumb-component.html',
|
||||
styleUrls: ['cloud-breadcrumb-component.scss']
|
||||
selector: 'app-cloud-breadcrumbs',
|
||||
templateUrl: './cloud-breadcrumb-component.html',
|
||||
styleUrls: ['cloud-breadcrumb-component.scss']
|
||||
})
|
||||
export class CloudBreadcrumbsComponent implements OnInit {
|
||||
appName: string;
|
||||
filterName: string;
|
||||
|
||||
appName: string;
|
||||
filterName: string;
|
||||
constructor(private route: ActivatedRoute) {}
|
||||
|
||||
constructor(private route: ActivatedRoute) { }
|
||||
|
||||
ngOnInit() {
|
||||
this.route.parent.params.subscribe((
|
||||
params) => {
|
||||
this.appName = params.appName;
|
||||
});
|
||||
this.route.queryParams.subscribe((params) => {
|
||||
if (params.filterName) {
|
||||
this.filterName = params.filterName;
|
||||
}
|
||||
});
|
||||
}
|
||||
ngOnInit() {
|
||||
this.route.parent.params.subscribe(params => {
|
||||
this.appName = params.appName;
|
||||
});
|
||||
this.route.queryParams.subscribe(params => {
|
||||
if (params.filterName) {
|
||||
this.filterName = params.filterName;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@@ -46,8 +46,9 @@ export class CloudFiltersDemoComponent implements OnInit {
|
||||
) {}
|
||||
|
||||
ngOnInit() {
|
||||
this.currentTaskFilter$ = this.cloudLayoutService.getCurrentTaskFilterParam();
|
||||
this.currentProcessFilter$ = this.cloudLayoutService.getCurrentProcessFilterParam();
|
||||
this.currentTaskFilter$ = this.cloudLayoutService.taskFilter$;
|
||||
this.currentProcessFilter$ = this.cloudLayoutService.processFilter$;
|
||||
|
||||
let root = '';
|
||||
if (this.route.snapshot && this.route.snapshot.firstChild) {
|
||||
root = this.route.snapshot.firstChild.url[0].path;
|
||||
|
@@ -15,15 +15,18 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { Component, OnInit, OnDestroy } from '@angular/core';
|
||||
import { CloudLayoutService } from './services/cloud-layout.service';
|
||||
import { Subject } from 'rxjs';
|
||||
import { takeUntil } from 'rxjs/operators';
|
||||
|
||||
@Component({
|
||||
selector: 'app-cloud-settings',
|
||||
templateUrl: './cloud-settings.component.html',
|
||||
styleUrls: ['./cloud-settings.component.scss']
|
||||
})
|
||||
export class CloudSettingsComponent implements OnInit {
|
||||
export class CloudSettingsComponent implements OnInit, OnDestroy {
|
||||
private onDestroy$ = new Subject<boolean>();
|
||||
|
||||
multiselect: boolean;
|
||||
selectionMode: string;
|
||||
@@ -40,8 +43,15 @@ export class CloudSettingsComponent implements OnInit {
|
||||
constructor(private cloudLayoutService: CloudLayoutService) { }
|
||||
|
||||
ngOnInit() {
|
||||
this.cloudLayoutService.getCurrentSettings()
|
||||
.subscribe((settings) => this.setCurrentSettings(settings));
|
||||
this.cloudLayoutService
|
||||
.settings$
|
||||
.pipe(takeUntil(this.onDestroy$))
|
||||
.subscribe(settings => this.setCurrentSettings(settings));
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
this.onDestroy$.next(true);
|
||||
this.onDestroy$.complete();
|
||||
}
|
||||
|
||||
setCurrentSettings(settings) {
|
||||
|
@@ -15,32 +15,24 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { Component, OnDestroy, OnInit } from '@angular/core';
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
import { Subscription } from 'rxjs';
|
||||
import { Params } from '@angular/router/src/shared';
|
||||
|
||||
@Component({
|
||||
selector: 'app-cloud-viewer',
|
||||
templateUrl: './cloud-viewer.component.html'
|
||||
})
|
||||
export class CloudViewerComponent implements OnInit, OnDestroy {
|
||||
export class CloudViewerComponent implements OnInit {
|
||||
|
||||
nodeId: string;
|
||||
|
||||
private sub: Subscription;
|
||||
|
||||
constructor(private route: ActivatedRoute) {
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.sub = this.route.params.subscribe((params: Params) => {
|
||||
this.route.params.subscribe((params: Params) => {
|
||||
this.nodeId = params['nodeId'];
|
||||
});
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
this.sub.unsubscribe();
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -45,8 +45,9 @@ export class CommunityCloudFiltersDemoComponent implements OnInit {
|
||||
) {}
|
||||
|
||||
ngOnInit() {
|
||||
this.currentTaskFilter$ = this.cloudLayoutService.getCurrentTaskFilterParam();
|
||||
this.currentProcessFilter$ = this.cloudLayoutService.getCurrentProcessFilterParam();
|
||||
this.currentTaskFilter$ = this.cloudLayoutService.taskFilter$;
|
||||
this.currentProcessFilter$ = this.cloudLayoutService.processFilter$;
|
||||
|
||||
let root = '';
|
||||
if (this.route.snapshot && this.route.snapshot.firstChild) {
|
||||
root = this.route.snapshot.firstChild.url[0].path;
|
||||
|
@@ -15,7 +15,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { Component, ViewChild, OnInit } from '@angular/core';
|
||||
import { Component, ViewChild, OnInit, OnDestroy } from '@angular/core';
|
||||
import {
|
||||
ProcessListCloudComponent,
|
||||
ProcessFilterCloudModel,
|
||||
@@ -27,12 +27,14 @@ import {
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import { UserPreferencesService, AppConfigService } from '@alfresco/adf-core';
|
||||
import { CloudLayoutService } from '../services/cloud-layout.service';
|
||||
import { Subject } from 'rxjs';
|
||||
import { takeUntil } from 'rxjs/operators';
|
||||
import { Pagination } from '@alfresco/js-api';
|
||||
|
||||
@Component({
|
||||
templateUrl: './community-processes-cloud.component.html'
|
||||
})
|
||||
export class CommunityProcessesCloudDemoComponent implements OnInit {
|
||||
|
||||
export class CommunityProcessesCloudDemoComponent implements OnInit, OnDestroy {
|
||||
public static ACTION_SAVE_AS = 'saveAs';
|
||||
static PROCESS_FILTER_PROPERTY_KEYS = 'adf-edit-process-filter';
|
||||
|
||||
@@ -56,6 +58,8 @@ export class CommunityProcessesCloudDemoComponent implements OnInit {
|
||||
|
||||
editedFilter: ProcessFilterCloudModel;
|
||||
|
||||
private onDestroy$ = new Subject<boolean>();
|
||||
|
||||
constructor(
|
||||
private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
@@ -63,7 +67,10 @@ export class CommunityProcessesCloudDemoComponent implements OnInit {
|
||||
private userPreference: UserPreferencesService,
|
||||
private processFilterCloudService: ProcessFilterCloudService,
|
||||
private appConfig: AppConfigService) {
|
||||
const properties = this.appConfig.get<Array<any>>(CommunityProcessesCloudDemoComponent.PROCESS_FILTER_PROPERTY_KEYS);
|
||||
const properties = this.appConfig.get<Array<any>>(
|
||||
CommunityProcessesCloudDemoComponent.PROCESS_FILTER_PROPERTY_KEYS
|
||||
);
|
||||
|
||||
if (properties) {
|
||||
this.processFilterProperties = properties;
|
||||
}
|
||||
@@ -71,6 +78,7 @@ export class CommunityProcessesCloudDemoComponent implements OnInit {
|
||||
|
||||
ngOnInit() {
|
||||
this.isFilterLoaded = false;
|
||||
|
||||
this.route.parent.params.subscribe((params) => {
|
||||
this.appName = params.appName;
|
||||
});
|
||||
@@ -85,14 +93,23 @@ export class CommunityProcessesCloudDemoComponent implements OnInit {
|
||||
}
|
||||
});
|
||||
|
||||
this.cloudLayoutService.getCurrentSettings()
|
||||
.subscribe((settings) => this.setCurrentSettings(settings));
|
||||
this.cloudLayoutService
|
||||
.settings$
|
||||
.pipe(takeUntil(this.onDestroy$))
|
||||
.subscribe(settings => this.setCurrentSettings(settings));
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
this.onDestroy$.next(true);
|
||||
this.onDestroy$.complete();
|
||||
}
|
||||
|
||||
loadDefaultFilters() {
|
||||
this.processFilterCloudService.getProcessFilters('community').subscribe( (filters: ProcessFilterCloudModel[]) => {
|
||||
this.onFilterChange(filters[0]);
|
||||
});
|
||||
this.processFilterCloudService
|
||||
.getProcessFilters('community')
|
||||
.subscribe((filters: ProcessFilterCloudModel[]) => {
|
||||
this.onFilterChange(filters[0]);
|
||||
});
|
||||
}
|
||||
|
||||
setCurrentSettings(settings) {
|
||||
@@ -103,7 +120,7 @@ export class CommunityProcessesCloudDemoComponent implements OnInit {
|
||||
}
|
||||
}
|
||||
|
||||
onChangePageSize(event) {
|
||||
onChangePageSize(event: Pagination) {
|
||||
this.userPreference.paginationSize = event.maxItems;
|
||||
}
|
||||
|
||||
@@ -111,13 +128,18 @@ export class CommunityProcessesCloudDemoComponent implements OnInit {
|
||||
this.selectedRows = [];
|
||||
}
|
||||
|
||||
onRowClick(processInstanceId) {
|
||||
onRowClick(processInstanceId: string) {
|
||||
this.router.navigate([`/cloud/community/process-details/${processInstanceId}`]);
|
||||
}
|
||||
|
||||
onFilterChange(query: any) {
|
||||
this.editedFilter = Object.assign({}, query);
|
||||
this.sortArray = [new ProcessListCloudSortingModel({ orderBy: this.editedFilter.sort, direction: this.editedFilter.order })];
|
||||
this.sortArray = [
|
||||
new ProcessListCloudSortingModel({
|
||||
orderBy: this.editedFilter.sort,
|
||||
direction: this.editedFilter.order
|
||||
})
|
||||
];
|
||||
}
|
||||
|
||||
onProcessFilterAction(filterAction: any) {
|
||||
|
@@ -15,11 +15,14 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { Component, ViewChild, OnInit } from '@angular/core';
|
||||
import { Component, ViewChild, OnInit, OnDestroy } from '@angular/core';
|
||||
import { TaskListCloudComponent, TaskListCloudSortingModel, TaskFilterCloudModel, TaskFilterCloudService } from '@alfresco/adf-process-services-cloud';
|
||||
import { UserPreferencesService, AppConfigService } from '@alfresco/adf-core';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import { CloudLayoutService } from '../services/cloud-layout.service';
|
||||
import { Subject } from 'rxjs';
|
||||
import { takeUntil } from 'rxjs/operators';
|
||||
import { Pagination } from '@alfresco/js-api';
|
||||
|
||||
@Component({
|
||||
templateUrl: './community-task-cloud.component.html',
|
||||
@@ -28,8 +31,7 @@ import { CloudLayoutService } from '../services/cloud-layout.service';
|
||||
}
|
||||
`]
|
||||
})
|
||||
export class CommunityTasksCloudDemoComponent implements OnInit {
|
||||
|
||||
export class CommunityTasksCloudDemoComponent implements OnInit, OnDestroy {
|
||||
public static ACTION_SAVE_AS = 'saveAs';
|
||||
static TASK_FILTER_PROPERTY_KEYS = 'adf-edit-task-filter';
|
||||
|
||||
@@ -51,6 +53,8 @@ export class CommunityTasksCloudDemoComponent implements OnInit {
|
||||
selectionMode: string;
|
||||
taskDetailsRedirection: boolean;
|
||||
|
||||
private onDestroy$ = new Subject<boolean>();
|
||||
|
||||
constructor(
|
||||
private cloudLayoutService: CloudLayoutService,
|
||||
private route: ActivatedRoute,
|
||||
@@ -79,14 +83,23 @@ export class CommunityTasksCloudDemoComponent implements OnInit {
|
||||
}
|
||||
});
|
||||
|
||||
this.cloudLayoutService.getCurrentSettings()
|
||||
.subscribe((settings) => this.setCurrentSettings(settings));
|
||||
this.cloudLayoutService
|
||||
.settings$
|
||||
.pipe(takeUntil(this.onDestroy$))
|
||||
.subscribe(settings => this.setCurrentSettings(settings));
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
this.onDestroy$.next(true);
|
||||
this.onDestroy$.complete();
|
||||
}
|
||||
|
||||
loadDefaultFilters() {
|
||||
this.taskFilterCloudService.getTaskListFilters('community').subscribe( (filters: TaskFilterCloudModel[]) => {
|
||||
this.onFilterChange(filters[0]);
|
||||
});
|
||||
this.taskFilterCloudService
|
||||
.getTaskListFilters('community')
|
||||
.subscribe((filters: TaskFilterCloudModel[]) => {
|
||||
this.onFilterChange(filters[0]);
|
||||
});
|
||||
}
|
||||
|
||||
setCurrentSettings(settings) {
|
||||
@@ -98,7 +111,7 @@ export class CommunityTasksCloudDemoComponent implements OnInit {
|
||||
}
|
||||
}
|
||||
|
||||
onChangePageSize(event) {
|
||||
onChangePageSize(event: Pagination) {
|
||||
this.userPreference.paginationSize = event.maxItems;
|
||||
}
|
||||
|
||||
@@ -106,7 +119,7 @@ export class CommunityTasksCloudDemoComponent implements OnInit {
|
||||
this.selectedRows = [];
|
||||
}
|
||||
|
||||
onRowClick(taskId) {
|
||||
onRowClick(taskId: string) {
|
||||
if (!this.multiselect && this.selectionMode !== 'multiple' && this.taskDetailsRedirection) {
|
||||
this.router.navigate([`/cloud/community/task-details/${taskId}`]);
|
||||
}
|
||||
|
@@ -15,7 +15,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { Component, ViewChild, OnInit } from '@angular/core';
|
||||
import { Component, ViewChild, OnInit, OnDestroy } from '@angular/core';
|
||||
import {
|
||||
ProcessListCloudComponent,
|
||||
ProcessFilterCloudModel,
|
||||
@@ -25,13 +25,16 @@ import {
|
||||
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import { UserPreferencesService, AppConfigService } from '@alfresco/adf-core';
|
||||
import { CloudLayoutService } from './services/cloud-layout.service';
|
||||
import { CloudLayoutService, CloudServiceSettings } from './services/cloud-layout.service';
|
||||
import { Subject } from 'rxjs';
|
||||
import { takeUntil } from 'rxjs/operators';
|
||||
import { Pagination } from '@alfresco/js-api';
|
||||
|
||||
@Component({
|
||||
templateUrl: './processes-cloud-demo.component.html',
|
||||
styleUrls: ['./processes-cloud-demo.component.scss']
|
||||
})
|
||||
export class ProcessesCloudDemoComponent implements OnInit {
|
||||
export class ProcessesCloudDemoComponent implements OnInit, OnDestroy {
|
||||
|
||||
public static ACTION_SAVE_AS = 'saveAs';
|
||||
static PROCESS_FILTER_PROPERTY_KEYS = 'adf-edit-process-filter';
|
||||
@@ -57,6 +60,8 @@ export class ProcessesCloudDemoComponent implements OnInit {
|
||||
|
||||
editedFilter: ProcessFilterCloudModel;
|
||||
|
||||
private onDestroy$ = new Subject<boolean>();
|
||||
|
||||
constructor(
|
||||
private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
@@ -81,11 +86,17 @@ export class ProcessesCloudDemoComponent implements OnInit {
|
||||
this.filterId = params.id;
|
||||
});
|
||||
|
||||
this.cloudLayoutService.getCurrentSettings()
|
||||
.subscribe((settings) => this.setCurrentSettings(settings));
|
||||
this.cloudLayoutService.settings$
|
||||
.pipe(takeUntil(this.onDestroy$))
|
||||
.subscribe(settings => this.setCurrentSettings(settings));
|
||||
}
|
||||
|
||||
setCurrentSettings(settings) {
|
||||
ngOnDestroy() {
|
||||
this.onDestroy$.next(true);
|
||||
this.onDestroy$.complete();
|
||||
}
|
||||
|
||||
setCurrentSettings(settings: CloudServiceSettings) {
|
||||
if (settings) {
|
||||
this.multiselect = settings.multiselect;
|
||||
this.testingMode = settings.testingMode;
|
||||
@@ -94,7 +105,7 @@ export class ProcessesCloudDemoComponent implements OnInit {
|
||||
}
|
||||
}
|
||||
|
||||
onChangePageSize(event) {
|
||||
onChangePageSize(event: Pagination) {
|
||||
this.userPreference.paginationSize = event.maxItems;
|
||||
}
|
||||
|
||||
@@ -102,7 +113,7 @@ export class ProcessesCloudDemoComponent implements OnInit {
|
||||
this.selectedRows = [];
|
||||
}
|
||||
|
||||
onRowClick(processInstanceId) {
|
||||
onRowClick(processInstanceId: string) {
|
||||
if (!this.multiselect && this.selectionMode !== 'multiple' && this.processDetailsRedirection) {
|
||||
this.router.navigate([`/cloud/${this.appName}/process-details/${processInstanceId}`]);
|
||||
}
|
||||
@@ -110,7 +121,12 @@ export class ProcessesCloudDemoComponent implements OnInit {
|
||||
|
||||
onFilterChange(query: any) {
|
||||
this.editedFilter = Object.assign({}, query);
|
||||
this.sortArray = [new ProcessListCloudSortingModel({ orderBy: this.editedFilter.sort, direction: this.editedFilter.order })];
|
||||
this.sortArray = [
|
||||
new ProcessListCloudSortingModel({
|
||||
orderBy: this.editedFilter.sort,
|
||||
direction: this.editedFilter.order
|
||||
})
|
||||
];
|
||||
}
|
||||
|
||||
onProcessFilterAction(filterAction: any) {
|
||||
|
@@ -16,14 +16,28 @@
|
||||
*/
|
||||
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Observable, BehaviorSubject } from 'rxjs';
|
||||
import { BehaviorSubject } from 'rxjs';
|
||||
|
||||
export interface CloudServiceSettings {
|
||||
multiselect: boolean;
|
||||
testingMode: boolean;
|
||||
taskDetailsRedirection: boolean;
|
||||
processDetailsRedirection: boolean;
|
||||
selectionMode: string;
|
||||
}
|
||||
|
||||
export interface FilterSettings {
|
||||
id?: string;
|
||||
index?: number;
|
||||
key?: string;
|
||||
}
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class CloudLayoutService {
|
||||
|
||||
private settings = {
|
||||
private settings: CloudServiceSettings = {
|
||||
multiselect: false,
|
||||
testingMode: false,
|
||||
taskDetailsRedirection: true,
|
||||
@@ -31,40 +45,19 @@ export class CloudLayoutService {
|
||||
selectionMode: 'single'
|
||||
};
|
||||
|
||||
private filterTaskSubject: BehaviorSubject<any> = new BehaviorSubject({index: 0});
|
||||
private filterTask$: Observable<any>;
|
||||
private filterProcessSubject: BehaviorSubject<any> = new BehaviorSubject({index: 0});
|
||||
private filterProcess$: Observable<any>;
|
||||
private settingsSubject: BehaviorSubject<any> = new BehaviorSubject(this.settings);
|
||||
private settings$: Observable<any>;
|
||||
taskFilter$ = new BehaviorSubject<FilterSettings>({index: 0});
|
||||
processFilter$ = new BehaviorSubject<FilterSettings>({index: 0});
|
||||
settings$ = new BehaviorSubject<CloudServiceSettings>(this.settings);
|
||||
|
||||
constructor() {
|
||||
this.filterTask$ = this.filterTaskSubject.asObservable();
|
||||
this.filterProcess$ = this.filterProcessSubject.asObservable();
|
||||
this.settings$ = this.settingsSubject.asObservable();
|
||||
setCurrentTaskFilterParam(param: FilterSettings) {
|
||||
this.taskFilter$.next(param);
|
||||
}
|
||||
|
||||
getCurrentTaskFilterParam() {
|
||||
return this.filterTask$;
|
||||
setCurrentProcessFilterParam(param: FilterSettings) {
|
||||
this.processFilter$.next(param);
|
||||
}
|
||||
|
||||
setCurrentTaskFilterParam(param) {
|
||||
this.filterTaskSubject.next(param);
|
||||
}
|
||||
|
||||
getCurrentProcessFilterParam() {
|
||||
return this.filterProcess$;
|
||||
}
|
||||
|
||||
setCurrentProcessFilterParam(param) {
|
||||
this.filterProcessSubject.next(param);
|
||||
}
|
||||
|
||||
getCurrentSettings() {
|
||||
return this.settings$;
|
||||
}
|
||||
|
||||
setCurrentSettings(param) {
|
||||
this.settingsSubject.next(param);
|
||||
setCurrentSettings(param: CloudServiceSettings) {
|
||||
this.settings$.next(param);
|
||||
}
|
||||
}
|
||||
|
@@ -15,17 +15,19 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { Component, ViewChild, OnInit } from '@angular/core';
|
||||
import { Component, ViewChild, OnInit, OnDestroy } from '@angular/core';
|
||||
import { TaskListCloudComponent, TaskListCloudSortingModel, TaskFilterCloudModel } from '@alfresco/adf-process-services-cloud';
|
||||
import { UserPreferencesService, AppConfigService } from '@alfresco/adf-core';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import { CloudLayoutService } from './services/cloud-layout.service';
|
||||
import { Subject } from 'rxjs';
|
||||
import { takeUntil } from 'rxjs/operators';
|
||||
|
||||
@Component({
|
||||
templateUrl: 'tasks-cloud-demo.component.html',
|
||||
styleUrls: ['tasks-cloud-demo.component.scss']
|
||||
})
|
||||
export class TasksCloudDemoComponent implements OnInit {
|
||||
export class TasksCloudDemoComponent implements OnInit, OnDestroy {
|
||||
|
||||
public static ACTION_SAVE_AS = 'saveAs';
|
||||
static TASK_FILTER_PROPERTY_KEYS = 'adf-edit-task-filter';
|
||||
@@ -50,6 +52,8 @@ export class TasksCloudDemoComponent implements OnInit {
|
||||
selectionMode: string;
|
||||
taskDetailsRedirection: boolean;
|
||||
|
||||
private onDestroy$ = new Subject<boolean>();
|
||||
|
||||
constructor(
|
||||
private cloudLayoutService: CloudLayoutService,
|
||||
private route: ActivatedRoute,
|
||||
@@ -75,8 +79,14 @@ export class TasksCloudDemoComponent implements OnInit {
|
||||
this.filterId = params.id;
|
||||
});
|
||||
|
||||
this.cloudLayoutService.getCurrentSettings()
|
||||
.subscribe((settings) => this.setCurrentSettings(settings));
|
||||
this.cloudLayoutService.settings$
|
||||
.pipe(takeUntil(this.onDestroy$))
|
||||
.subscribe(settings => this.setCurrentSettings(settings));
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
this.onDestroy$.next(true);
|
||||
this.onDestroy$.complete();
|
||||
}
|
||||
|
||||
setCurrentSettings(settings) {
|
||||
|
@@ -15,20 +15,24 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { Component } from '@angular/core';
|
||||
import { Component, OnDestroy } from '@angular/core';
|
||||
import {
|
||||
AppConfigService,
|
||||
NotificationService,
|
||||
UserPreferencesService,
|
||||
UserPreferenceValues
|
||||
} from '@alfresco/adf-core';
|
||||
import { Subject } from 'rxjs';
|
||||
import { takeUntil } from 'rxjs/operators';
|
||||
|
||||
@Component({
|
||||
selector: 'app-config-editor',
|
||||
templateUrl: 'config-editor.component.html',
|
||||
styleUrls: ['./config-editor.component.scss']
|
||||
})
|
||||
export class ConfigEditorComponent {
|
||||
export class ConfigEditorComponent implements OnDestroy {
|
||||
|
||||
private onDestroy$ = new Subject<boolean>();
|
||||
|
||||
editor: any;
|
||||
code: any;
|
||||
@@ -83,15 +87,23 @@ export class ConfigEditorComponent {
|
||||
this.indentCode();
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
this.onDestroy$.next(true);
|
||||
this.onDestroy$.complete();
|
||||
}
|
||||
|
||||
textOrientationClick() {
|
||||
this.isUserPreference = true;
|
||||
this.userPreferenceProperty = 'textOrientation';
|
||||
|
||||
this.userPreferencesService.select(this.userPreferenceProperty).subscribe((textOrientation: number) => {
|
||||
this.code = JSON.stringify(textOrientation);
|
||||
this.field = 'textOrientation';
|
||||
this.indentCode();
|
||||
});
|
||||
this.userPreferencesService
|
||||
.select(this.userPreferenceProperty)
|
||||
.pipe(takeUntil(this.onDestroy$))
|
||||
.subscribe((textOrientation: number) => {
|
||||
this.code = JSON.stringify(textOrientation);
|
||||
this.field = 'textOrientation';
|
||||
this.indentCode();
|
||||
});
|
||||
|
||||
this.indentCode();
|
||||
}
|
||||
@@ -99,21 +111,27 @@ export class ConfigEditorComponent {
|
||||
infinitePaginationConfClick() {
|
||||
this.isUserPreference = true;
|
||||
this.userPreferenceProperty = UserPreferenceValues.PaginationSize;
|
||||
this.userPreferencesService.select(this.userPreferenceProperty).subscribe((pageSize: number) => {
|
||||
this.code = JSON.stringify(pageSize);
|
||||
this.field = 'adf-infinite-pagination';
|
||||
this.indentCode();
|
||||
});
|
||||
this.userPreferencesService
|
||||
.select(this.userPreferenceProperty)
|
||||
.pipe(takeUntil(this.onDestroy$))
|
||||
.subscribe((pageSize: number) => {
|
||||
this.code = JSON.stringify(pageSize);
|
||||
this.field = 'adf-infinite-pagination';
|
||||
this.indentCode();
|
||||
});
|
||||
}
|
||||
|
||||
supportedPageSizesClick() {
|
||||
this.isUserPreference = true;
|
||||
this.userPreferenceProperty = UserPreferenceValues.SupportedPageSizes;
|
||||
this.userPreferencesService.select(this.userPreferenceProperty).subscribe((supportedPageSizes: number) => {
|
||||
this.code = JSON.stringify(supportedPageSizes);
|
||||
this.field = 'adf-supported-page-size';
|
||||
this.indentCode();
|
||||
});
|
||||
this.userPreferencesService
|
||||
.select(this.userPreferenceProperty)
|
||||
.pipe(takeUntil(this.onDestroy$))
|
||||
.subscribe((supportedPageSizes: number) => {
|
||||
this.code = JSON.stringify(supportedPageSizes);
|
||||
this.field = 'adf-supported-page-size';
|
||||
this.indentCode();
|
||||
});
|
||||
}
|
||||
|
||||
indentCode() {
|
||||
|
@@ -25,9 +25,10 @@ import {
|
||||
OnDestroy
|
||||
} from '@angular/core';
|
||||
import { NodeEntry } from '@alfresco/js-api';
|
||||
import { BehaviorSubject, Subscription } from 'rxjs';
|
||||
import { BehaviorSubject, Subject } from 'rxjs';
|
||||
import { AlfrescoApiService } from '@alfresco/adf-core';
|
||||
import { Node } from '@alfresco/js-api';
|
||||
import { takeUntil } from 'rxjs/operators';
|
||||
|
||||
@Component({
|
||||
selector: 'app-name-column',
|
||||
@@ -47,24 +48,26 @@ export class NameColumnComponent implements OnInit, OnDestroy {
|
||||
displayText$ = new BehaviorSubject<string>('');
|
||||
node: NodeEntry;
|
||||
|
||||
private sub: Subscription;
|
||||
private onDestroy$ = new Subject<boolean>();
|
||||
|
||||
constructor(private element: ElementRef, private alfrescoApiService: AlfrescoApiService) {}
|
||||
|
||||
ngOnInit() {
|
||||
this.updateValue();
|
||||
|
||||
this.sub = this.alfrescoApiService.nodeUpdated.subscribe((node: Node) => {
|
||||
const row = this.context.row;
|
||||
if (row) {
|
||||
const { entry } = row.node;
|
||||
this.alfrescoApiService.nodeUpdated
|
||||
.pipe(takeUntil(this.onDestroy$))
|
||||
.subscribe((node: Node) => {
|
||||
const row = this.context.row;
|
||||
if (row) {
|
||||
const { entry } = row.node;
|
||||
|
||||
if (entry === node) {
|
||||
row.node = { entry };
|
||||
this.updateValue();
|
||||
if (entry === node) {
|
||||
row.node = { entry };
|
||||
this.updateValue();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
protected updateValue() {
|
||||
@@ -87,9 +90,7 @@ export class NameColumnComponent implements OnInit, OnDestroy {
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
if (this.sub) {
|
||||
this.sub.unsubscribe();
|
||||
this.sub = null;
|
||||
}
|
||||
this.onDestroy$.next(true);
|
||||
this.onDestroy$.complete();
|
||||
}
|
||||
}
|
||||
|
@@ -45,7 +45,7 @@ import { SelectAppsDialogComponent } from '@alfresco/adf-process-services';
|
||||
|
||||
import { VersionManagerDialogAdapterComponent } from './version-manager-dialog-adapter.component';
|
||||
import { MetadataDialogAdapterComponent } from './metadata-dialog-adapter.component';
|
||||
import { Subscription, Subject } from 'rxjs';
|
||||
import { Subject } from 'rxjs';
|
||||
import { PreviewService } from '../../services/preview.service';
|
||||
import { debounceTime, takeUntil } from 'rxjs/operators';
|
||||
import { SearchEntry } from '@alfresco/js-api';
|
||||
@@ -201,9 +201,6 @@ export class FilesComponent implements OnInit, OnChanges, OnDestroy {
|
||||
displayEmptyMetadata = false;
|
||||
hyperlinkNavigation = false;
|
||||
|
||||
private onCreateFolder: Subscription;
|
||||
private onEditFolder: Subscription;
|
||||
|
||||
constructor(private notificationService: NotificationService,
|
||||
private uploadService: UploadService,
|
||||
private contentService: ContentService,
|
||||
@@ -264,13 +261,28 @@ export class FilesComponent implements OnInit, OnChanges, OnDestroy {
|
||||
});
|
||||
}
|
||||
|
||||
this.uploadService.fileUploadComplete.asObservable()
|
||||
.pipe(debounceTime(300))
|
||||
.subscribe((value) => this.onFileUploadEvent(value));
|
||||
this.uploadService.fileUploadDeleted.subscribe((value) => this.onFileUploadEvent(value));
|
||||
this.contentService.folderCreated.subscribe((value) => this.onFolderCreated(value));
|
||||
this.onCreateFolder = this.contentService.folderCreate.subscribe((value) => this.onFolderAction(value));
|
||||
this.onEditFolder = this.contentService.folderEdit.subscribe((value) => this.onFolderAction(value));
|
||||
this.uploadService.fileUploadComplete
|
||||
.pipe(
|
||||
debounceTime(300),
|
||||
takeUntil(this.onDestroy$)
|
||||
)
|
||||
.subscribe(value => this.onFileUploadEvent(value));
|
||||
|
||||
this.uploadService.fileUploadDeleted
|
||||
.pipe(takeUntil(this.onDestroy$))
|
||||
.subscribe(value => this.onFileUploadEvent(value));
|
||||
|
||||
this.contentService.folderCreated
|
||||
.pipe(takeUntil(this.onDestroy$))
|
||||
.subscribe(value => this.onFolderCreated(value));
|
||||
|
||||
this.contentService.folderCreate
|
||||
.pipe(takeUntil(this.onDestroy$))
|
||||
.subscribe(value => this.onFolderAction(value));
|
||||
|
||||
this.contentService.folderEdit
|
||||
.pipe(takeUntil(this.onDestroy$))
|
||||
.subscribe(value => this.onFolderAction(value));
|
||||
|
||||
this.contentMetadataService.error
|
||||
.pipe(takeUntil(this.onDestroy$))
|
||||
@@ -286,9 +298,6 @@ export class FilesComponent implements OnInit, OnChanges, OnDestroy {
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
this.onCreateFolder.unsubscribe();
|
||||
this.onEditFolder.unsubscribe();
|
||||
|
||||
this.onDestroy$.next(true);
|
||||
this.onDestroy$.complete();
|
||||
}
|
||||
@@ -592,7 +601,7 @@ export class FilesComponent implements OnInit, OnChanges, OnDestroy {
|
||||
width: '400px'
|
||||
});
|
||||
|
||||
dialogInstance.componentInstance.error.subscribe((message) => {
|
||||
dialogInstance.componentInstance.error.subscribe((message: string) => {
|
||||
this.notificationService.openSnackMessage(message);
|
||||
});
|
||||
}
|
||||
|
@@ -15,16 +15,18 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { Component, ViewChild } from '@angular/core';
|
||||
import { Component, ViewChild, OnDestroy, OnInit } from '@angular/core';
|
||||
import { FormModel, FormService, LogService, FormOutcomeEvent } from '@alfresco/adf-core';
|
||||
import { FormComponent } from '@alfresco/adf-process-services';
|
||||
import { Subject } from 'rxjs';
|
||||
import { takeUntil } from 'rxjs/operators';
|
||||
|
||||
@Component({
|
||||
selector: 'app-form-list',
|
||||
templateUrl: 'form-list.component.html',
|
||||
styleUrls: ['form-list.component.scss']
|
||||
})
|
||||
export class FormListComponent {
|
||||
export class FormListComponent implements OnInit, OnDestroy {
|
||||
|
||||
@ViewChild('adfForm')
|
||||
activitiForm: FormComponent;
|
||||
@@ -38,13 +40,24 @@ export class FormListComponent {
|
||||
restoredData: any = {};
|
||||
|
||||
showValidationIcon = false;
|
||||
private onDestroy$ = new Subject<boolean>();
|
||||
|
||||
constructor(private formService: FormService, private logService: LogService) {
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
// Prevent default outcome actions
|
||||
formService.executeOutcome.subscribe((formOutcomeEvent: FormOutcomeEvent) => {
|
||||
formOutcomeEvent.preventDefault();
|
||||
this.logService.log(formOutcomeEvent.outcome);
|
||||
});
|
||||
this.formService.executeOutcome
|
||||
.pipe(takeUntil(this.onDestroy$))
|
||||
.subscribe((formOutcomeEvent: FormOutcomeEvent) => {
|
||||
formOutcomeEvent.preventDefault();
|
||||
this.logService.log(formOutcomeEvent.outcome);
|
||||
});
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
this.onDestroy$.next(true);
|
||||
this.onDestroy$.complete();
|
||||
}
|
||||
|
||||
onRowDblClick(event: CustomEvent) {
|
||||
|
@@ -15,46 +15,60 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { Component, Inject, OnInit } from '@angular/core';
|
||||
import { FormModel, FormService, FormOutcomeEvent, CoreAutomationService } from '@alfresco/adf-core';
|
||||
import { Component, Inject, OnInit, OnDestroy } from '@angular/core';
|
||||
import {
|
||||
FormModel,
|
||||
FormService,
|
||||
FormOutcomeEvent,
|
||||
CoreAutomationService
|
||||
} from '@alfresco/adf-core';
|
||||
import { InMemoryFormService } from '../../services/in-memory-form.service';
|
||||
import { FakeFormService } from './fake-form.service';
|
||||
import { Subject } from 'rxjs';
|
||||
import { takeUntil } from 'rxjs/operators';
|
||||
|
||||
@Component({
|
||||
selector: 'app-form-loading',
|
||||
templateUrl: 'form-loading.component.html',
|
||||
styleUrls: ['form-loading.component.scss'],
|
||||
providers: [
|
||||
{ provide: FormService, useClass: FakeFormService }
|
||||
]
|
||||
providers: [{ provide: FormService, useClass: FakeFormService }]
|
||||
})
|
||||
export class FormLoadingComponent implements OnInit {
|
||||
|
||||
export class FormLoadingComponent implements OnInit, OnDestroy {
|
||||
form: FormModel;
|
||||
typeaheadFieldValue = '';
|
||||
selectFieldValue = '';
|
||||
radioButtonFieldValue = '';
|
||||
formattedData = {};
|
||||
|
||||
constructor(@Inject(FormService) private formService: InMemoryFormService,
|
||||
private automationService: CoreAutomationService) {
|
||||
formService.executeOutcome.subscribe((formOutcomeEvent: FormOutcomeEvent) => {
|
||||
formOutcomeEvent.preventDefault();
|
||||
});
|
||||
}
|
||||
private onDestroy$ = new Subject<boolean>();
|
||||
|
||||
constructor(
|
||||
@Inject(FormService) private formService: InMemoryFormService,
|
||||
private automationService: CoreAutomationService
|
||||
) {}
|
||||
|
||||
ngOnInit() {
|
||||
this.formService.executeOutcome
|
||||
.pipe(takeUntil(this.onDestroy$))
|
||||
.subscribe((formOutcomeEvent: FormOutcomeEvent) => {
|
||||
formOutcomeEvent.preventDefault();
|
||||
});
|
||||
|
||||
this.formattedData = {};
|
||||
const formDefinitionJSON: any = this.automationService.forms.getSimpleFormDefinition();
|
||||
this.form = this.formService.parseForm(formDefinitionJSON);
|
||||
}
|
||||
|
||||
onLoadButtonClicked() {
|
||||
this.formattedData = {
|
||||
'typeaheadField': this.typeaheadFieldValue,
|
||||
'selectBox': this.selectFieldValue,
|
||||
'radioButton': this.radioButtonFieldValue
|
||||
};
|
||||
ngOnDestroy() {
|
||||
this.onDestroy$.next(true);
|
||||
this.onDestroy$.complete();
|
||||
}
|
||||
|
||||
onLoadButtonClicked() {
|
||||
this.formattedData = {
|
||||
typeaheadField: this.typeaheadFieldValue,
|
||||
selectBox: this.selectFieldValue,
|
||||
radioButton: this.radioButtonFieldValue
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@@ -18,7 +18,8 @@
|
||||
import { Component, Inject, OnDestroy, OnInit, ViewEncapsulation } from '@angular/core';
|
||||
import { FormModel, FormFieldModel, FormService, FormOutcomeEvent, NotificationService, CoreAutomationService } from '@alfresco/adf-core';
|
||||
import { InMemoryFormService } from '../../services/in-memory-form.service';
|
||||
import { Subscription } from 'rxjs';
|
||||
import { Subject } from 'rxjs';
|
||||
import { takeUntil } from 'rxjs/operators';
|
||||
|
||||
@Component({
|
||||
selector: 'app-form',
|
||||
@@ -35,7 +36,6 @@ export class FormComponent implements OnInit, OnDestroy {
|
||||
errorFields: FormFieldModel[] = [];
|
||||
formConfig: string;
|
||||
editor: any;
|
||||
private subscriptions: Subscription[] = [];
|
||||
|
||||
editorOptions = {
|
||||
theme: 'vs-dark',
|
||||
@@ -46,15 +46,11 @@ export class FormComponent implements OnInit, OnDestroy {
|
||||
automaticLayout: true
|
||||
};
|
||||
|
||||
private onDestroy$ = new Subject<boolean>();
|
||||
|
||||
constructor(@Inject(FormService) private formService: InMemoryFormService,
|
||||
private notificationService: NotificationService,
|
||||
private automationService: CoreAutomationService) {
|
||||
|
||||
this.subscriptions.push(
|
||||
formService.executeOutcome.subscribe((formOutcomeEvent: FormOutcomeEvent) => {
|
||||
formOutcomeEvent.preventDefault();
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
logErrors(errorFields: FormFieldModel[]) {
|
||||
@@ -62,13 +58,21 @@ export class FormComponent implements OnInit, OnDestroy {
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.formConfig = JSON.stringify(this.automationService.forms.getFormDefinition());
|
||||
this.formService.executeOutcome
|
||||
.pipe(takeUntil(this.onDestroy$))
|
||||
.subscribe((formOutcomeEvent: FormOutcomeEvent) => {
|
||||
formOutcomeEvent.preventDefault();
|
||||
});
|
||||
|
||||
this.formConfig = JSON.stringify(
|
||||
this.automationService.forms.getFormDefinition()
|
||||
);
|
||||
this.parseForm();
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
this.subscriptions.forEach((subscription) => subscription.unsubscribe());
|
||||
this.subscriptions = [];
|
||||
this.onDestroy$.next(true);
|
||||
this.onDestroy$.complete();
|
||||
}
|
||||
|
||||
onInitFormEditor(editor) {
|
||||
|
@@ -24,14 +24,14 @@ export class HeaderDataService {
|
||||
|
||||
show = true;
|
||||
|
||||
@Output() hideMenu: EventEmitter<boolean> = new EventEmitter();
|
||||
@Output() color: EventEmitter<string> = new EventEmitter();
|
||||
@Output() title: EventEmitter<string> = new EventEmitter();
|
||||
@Output() logo: EventEmitter<string> = new EventEmitter();
|
||||
@Output() redirectUrl: EventEmitter<string | any[]> = new EventEmitter();
|
||||
@Output() tooltip: EventEmitter<string> = new EventEmitter();
|
||||
@Output() position: EventEmitter<string> = new EventEmitter();
|
||||
@Output() hideSidenav: EventEmitter<string> = new EventEmitter();
|
||||
@Output() hideMenu = new EventEmitter<boolean>();
|
||||
@Output() color = new EventEmitter<string>();
|
||||
@Output() title = new EventEmitter<string>();
|
||||
@Output() logo = new EventEmitter<string>();
|
||||
@Output() redirectUrl = new EventEmitter<string | any[]>();
|
||||
@Output() tooltip = new EventEmitter<string>();
|
||||
@Output() position = new EventEmitter<string>();
|
||||
@Output() hideSidenav = new EventEmitter<boolean>();
|
||||
|
||||
hideMenuButton() {
|
||||
this.show = !this.show;
|
||||
@@ -59,11 +59,11 @@ export class HeaderDataService {
|
||||
this.tooltip.emit(tooltip);
|
||||
}
|
||||
|
||||
changePosition(position) {
|
||||
changePosition(position: string) {
|
||||
this.position.emit(position);
|
||||
}
|
||||
|
||||
changeSidenavVisibility(hideSidenav) {
|
||||
changeSidenavVisibility(hideSidenav: boolean) {
|
||||
this.hideSidenav.emit(hideSidenav);
|
||||
}
|
||||
}
|
||||
|
@@ -15,36 +15,57 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { Component, HostListener } from '@angular/core';
|
||||
import { Component, HostListener, OnDestroy, OnInit } from '@angular/core';
|
||||
import { LogService, ObjectDataTableAdapter } from '@alfresco/adf-core';
|
||||
import { Subject } from 'rxjs';
|
||||
import { takeUntil } from 'rxjs/operators';
|
||||
|
||||
@Component({
|
||||
selector: 'app-log',
|
||||
templateUrl: './log.component.html',
|
||||
styleUrls: ['./log.component.css']
|
||||
})
|
||||
export class LogComponent {
|
||||
export class LogComponent implements OnInit, OnDestroy {
|
||||
logs: any[] = [];
|
||||
show = false;
|
||||
ctrlLKey = 12;
|
||||
logsData: ObjectDataTableAdapter;
|
||||
|
||||
constructor(public logService: LogService) {
|
||||
private onDestroy$ = new Subject<boolean>();
|
||||
|
||||
logService.onMessage.subscribe((message) => {
|
||||
let contentMessage = '';
|
||||
try {
|
||||
contentMessage = JSON.stringify(message.text);
|
||||
} catch (error) {
|
||||
return;
|
||||
}
|
||||
this.logs.push({ type: message.type, text: contentMessage});
|
||||
this.logsData = new ObjectDataTableAdapter(this.logs, [
|
||||
{ type: 'text', key: 'type', title: 'Log level', sortable: true },
|
||||
{ type: 'text', key: 'text', title: 'Message', sortable: false }
|
||||
]);
|
||||
constructor(public logService: LogService) {}
|
||||
|
||||
});
|
||||
ngOnInit() {
|
||||
this.logService.onMessage
|
||||
.pipe(takeUntil(this.onDestroy$))
|
||||
.subscribe(message => {
|
||||
let contentMessage = '';
|
||||
try {
|
||||
contentMessage = JSON.stringify(message.text);
|
||||
} catch (error) {
|
||||
return;
|
||||
}
|
||||
this.logs.push({ type: message.type, text: contentMessage });
|
||||
this.logsData = new ObjectDataTableAdapter(this.logs, [
|
||||
{
|
||||
type: 'text',
|
||||
key: 'type',
|
||||
title: 'Log level',
|
||||
sortable: true
|
||||
},
|
||||
{
|
||||
type: 'text',
|
||||
key: 'text',
|
||||
title: 'Message',
|
||||
sortable: false
|
||||
}
|
||||
]);
|
||||
});
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
this.onDestroy$.next(true);
|
||||
this.onDestroy$.complete();
|
||||
}
|
||||
|
||||
@HostListener('document:keypress', ['$event'])
|
||||
@@ -54,6 +75,5 @@ export class LogComponent {
|
||||
if (key === this.ctrlLKey) {
|
||||
this.show = !this.show;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@@ -15,16 +15,18 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { Component, OnInit, OnDestroy } from '@angular/core';
|
||||
import { NotificationService } from '@alfresco/adf-core';
|
||||
import { MatSnackBarConfig } from '@angular/material';
|
||||
import { FormBuilder, FormGroup, FormControl } from '@angular/forms';
|
||||
import { Subject } from 'rxjs';
|
||||
import { takeUntil } from 'rxjs/operators';
|
||||
|
||||
@Component({
|
||||
templateUrl: './notifications.component.html',
|
||||
styleUrls: ['./notifications.component.scss']
|
||||
})
|
||||
export class NotificationsComponent implements OnInit {
|
||||
export class NotificationsComponent implements OnInit, OnDestroy {
|
||||
|
||||
message = 'I ♥️ ADF';
|
||||
withAction = false;
|
||||
@@ -55,6 +57,8 @@ export class NotificationsComponent implements OnInit {
|
||||
|
||||
defaultDuration = 20000;
|
||||
|
||||
private onDestroy$ = new Subject<boolean>();
|
||||
|
||||
constructor(private notificationService: NotificationService,
|
||||
private formBuilder: FormBuilder) {
|
||||
this.snackBarConfig.duration = this.defaultDuration;
|
||||
@@ -69,10 +73,15 @@ export class NotificationsComponent implements OnInit {
|
||||
});
|
||||
|
||||
this.configForm.valueChanges
|
||||
.subscribe((configFormValues) =>
|
||||
.pipe(takeUntil(this.onDestroy$))
|
||||
.subscribe(configFormValues =>
|
||||
this.setSnackBarConfig(configFormValues)
|
||||
);
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
this.onDestroy$.next(true);
|
||||
this.onDestroy$.complete();
|
||||
}
|
||||
|
||||
setSnackBarConfig(configFormValues: any) {
|
||||
|
@@ -48,9 +48,11 @@ export class DemoPermissionComponent implements OnInit {
|
||||
}
|
||||
});
|
||||
}
|
||||
this.nodeService.getNode(this.nodeId, {include: ['permissions'] }).subscribe( (currentNode: MinimalNodeEntryEntity) => {
|
||||
this.toggleStatus = currentNode.permissions.isInheritanceEnabled;
|
||||
});
|
||||
this.nodeService
|
||||
.getNode(this.nodeId, {include: ['permissions'] })
|
||||
.subscribe( (currentNode: MinimalNodeEntryEntity) => {
|
||||
this.toggleStatus = currentNode.permissions.isInheritanceEnabled;
|
||||
});
|
||||
}
|
||||
|
||||
onUpdatedPermissions(node: MinimalNodeEntryEntity) {
|
||||
@@ -63,9 +65,12 @@ export class DemoPermissionComponent implements OnInit {
|
||||
}
|
||||
|
||||
openAddPermissionDialog(event: Event) {
|
||||
this.nodePermissionDialogService.updateNodePermissionByDialog(this.nodeId).subscribe(
|
||||
() => this.displayPermissionComponent.reload(),
|
||||
(error) => this.showErrorMessage(error));
|
||||
this.nodePermissionDialogService
|
||||
.updateNodePermissionByDialog(this.nodeId)
|
||||
.subscribe(
|
||||
() => this.displayPermissionComponent.reload(),
|
||||
(error) => this.showErrorMessage(error)
|
||||
);
|
||||
}
|
||||
|
||||
showErrorMessage(error) {
|
||||
|
@@ -15,17 +15,18 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { Component, OnInit, OnDestroy } from '@angular/core';
|
||||
import { FormGroup, FormBuilder, Validators, FormControl, AbstractControl } from '@angular/forms';
|
||||
import { ActivatedRoute, Params } from '@angular/router';
|
||||
import { debounceTime } from 'rxjs/operators';
|
||||
import { debounceTime, takeUntil } from 'rxjs/operators';
|
||||
import { Subject } from 'rxjs';
|
||||
|
||||
@Component({
|
||||
templateUrl: './process-list-demo.component.html',
|
||||
styleUrls: [`./process-list-demo.component.scss`]
|
||||
})
|
||||
|
||||
export class ProcessListDemoComponent implements OnInit {
|
||||
export class ProcessListDemoComponent implements OnInit, OnDestroy {
|
||||
|
||||
DEFAULT_SIZE = 20;
|
||||
|
||||
@@ -54,6 +55,8 @@ export class ProcessListDemoComponent implements OnInit {
|
||||
{value: 'created-desc', title: 'Created (desc)'}
|
||||
];
|
||||
|
||||
private onDestroy$ = new Subject<boolean>();
|
||||
|
||||
constructor(private route: ActivatedRoute,
|
||||
private formBuilder: FormBuilder) {
|
||||
}
|
||||
@@ -72,6 +75,11 @@ export class ProcessListDemoComponent implements OnInit {
|
||||
this.buildForm();
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
this.onDestroy$.next(true);
|
||||
this.onDestroy$.complete();
|
||||
}
|
||||
|
||||
buildForm() {
|
||||
this.processListForm = this.formBuilder.group({
|
||||
processAppId: new FormControl(this.appId, [Validators.pattern('^[0-9]*$'), Validators.min(this.minValue)]),
|
||||
@@ -84,10 +92,9 @@ export class ProcessListDemoComponent implements OnInit {
|
||||
});
|
||||
|
||||
this.processListForm.valueChanges
|
||||
.pipe(
|
||||
debounceTime(500)
|
||||
)
|
||||
.subscribe((processFilter) => {
|
||||
.pipe(takeUntil(this.onDestroy$))
|
||||
.pipe(debounceTime(500))
|
||||
.subscribe(processFilter => {
|
||||
if (this.isFormValid()) {
|
||||
this.filterProcesses(processFilter);
|
||||
}
|
||||
|
@@ -15,32 +15,25 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { Component, OnDestroy, OnInit } from '@angular/core';
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
import { Subscription } from 'rxjs';
|
||||
|
||||
@Component({
|
||||
selector: 'app-form-node-viewer',
|
||||
templateUrl: './form-node-viewer.component.html',
|
||||
styleUrls: ['./form-node-viewer.component.css']
|
||||
})
|
||||
export class FormNodeViewerComponent implements OnInit, OnDestroy {
|
||||
export class FormNodeViewerComponent implements OnInit {
|
||||
|
||||
nodeId: string;
|
||||
|
||||
private sub: Subscription;
|
||||
|
||||
constructor(private route: ActivatedRoute) {
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.sub = this.route.params.subscribe((params) => {
|
||||
this.route.params.subscribe((params) => {
|
||||
this.nodeId = params['id'];
|
||||
});
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
this.sub.unsubscribe();
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -15,9 +15,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { Component, OnDestroy, OnInit } from '@angular/core';
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
import { Subscription } from 'rxjs';
|
||||
import { Params } from '@angular/router/src/shared';
|
||||
|
||||
@Component({
|
||||
@@ -25,23 +24,16 @@ import { Params } from '@angular/router/src/shared';
|
||||
templateUrl: './form-viewer.component.html',
|
||||
styleUrls: ['./form-viewer.component.css']
|
||||
})
|
||||
export class FormViewerComponent implements OnInit, OnDestroy {
|
||||
export class FormViewerComponent implements OnInit {
|
||||
|
||||
taskId: string;
|
||||
|
||||
private sub: Subscription;
|
||||
|
||||
constructor(private route: ActivatedRoute) {
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.sub = this.route.params.subscribe((params: Params) => {
|
||||
this.route.params.subscribe((params: Params) => {
|
||||
this.taskId = params['id'];
|
||||
});
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
this.sub.unsubscribe();
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -22,7 +22,8 @@ import { UploadService } from '@alfresco/adf-core';
|
||||
import { AlfrescoApiService } from '@alfresco/adf-core';
|
||||
import { AppConfigService } from '@alfresco/adf-core';
|
||||
import { PreviewService } from '../../services/preview.service';
|
||||
import { Subscription } from 'rxjs';
|
||||
import { Subject } from 'rxjs';
|
||||
import { takeUntil } from 'rxjs/operators';
|
||||
|
||||
export function processUploadServiceFactory(api: AlfrescoApiService, config: AppConfigService) {
|
||||
return new ProcessUploadService(api, config);
|
||||
@@ -51,7 +52,7 @@ export class ProcessAttachmentsComponent implements OnInit, OnChanges, OnDestroy
|
||||
|
||||
processInstance: ProcessInstance;
|
||||
|
||||
private subscriptions: Subscription[] = [];
|
||||
private onDestroy$ = new Subject<boolean>();
|
||||
|
||||
constructor(
|
||||
private uploadService: UploadService,
|
||||
@@ -60,11 +61,9 @@ export class ProcessAttachmentsComponent implements OnInit, OnChanges, OnDestroy
|
||||
) {}
|
||||
|
||||
ngOnInit() {
|
||||
this.subscriptions.push(
|
||||
this.uploadService.fileUploadComplete.subscribe(
|
||||
(value) => this.onFileUploadComplete(value.data)
|
||||
)
|
||||
);
|
||||
this.uploadService.fileUploadComplete
|
||||
.pipe(takeUntil(this.onDestroy$))
|
||||
.subscribe(value => this.onFileUploadComplete(value.data));
|
||||
}
|
||||
|
||||
ngOnChanges() {
|
||||
@@ -77,8 +76,8 @@ export class ProcessAttachmentsComponent implements OnInit, OnChanges, OnDestroy
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
this.subscriptions.forEach((subscription) => subscription.unsubscribe());
|
||||
this.subscriptions = [];
|
||||
this.onDestroy$.next(true);
|
||||
this.onDestroy$.complete();
|
||||
}
|
||||
|
||||
onFileUploadComplete(content: any) {
|
||||
|
@@ -35,7 +35,7 @@ import {
|
||||
UserProcessInstanceFilterRepresentation
|
||||
} from '@alfresco/js-api';
|
||||
import {
|
||||
FORM_FIELD_VALIDATORS, FormEvent, FormFieldEvent, FormRenderingService, FormService,
|
||||
FORM_FIELD_VALIDATORS, FormRenderingService, FormService,
|
||||
DynamicTableRow, ValidateDynamicTableRowEvent, AppConfigService, PaginationComponent, UserPreferenceValues
|
||||
} from '@alfresco/adf-core';
|
||||
|
||||
@@ -57,12 +57,13 @@ import {
|
||||
TaskListComponent
|
||||
} from '@alfresco/adf-process-services';
|
||||
import { LogService } from '@alfresco/adf-core';
|
||||
import { AlfrescoApiService, UserPreferencesService, ValidateFormEvent } from '@alfresco/adf-core';
|
||||
import { Subscription } from 'rxjs';
|
||||
import { AlfrescoApiService, UserPreferencesService } from '@alfresco/adf-core';
|
||||
import { Subject } from 'rxjs';
|
||||
import { /*CustomEditorComponent*/ CustomStencil01 } from './custom-editor/custom-editor.component';
|
||||
import { DemoFieldValidator } from './demo-field-validator';
|
||||
import { PreviewService } from '../../services/preview.service';
|
||||
import { Location } from '@angular/common';
|
||||
import { takeUntil } from 'rxjs/operators';
|
||||
|
||||
const currentProcessIdNew = '__NEW__';
|
||||
const currentTaskIdNew = '__NEW__';
|
||||
@@ -160,7 +161,7 @@ export class ProcessServiceComponent implements AfterViewInit, OnDestroy, OnInit
|
||||
new DemoFieldValidator()
|
||||
];
|
||||
|
||||
private subscriptions: Subscription[] = [];
|
||||
private onDestroy$ = new Subject<boolean>();
|
||||
|
||||
constructor(private elementRef: ElementRef,
|
||||
private route: ActivatedRoute,
|
||||
@@ -184,17 +185,28 @@ export class ProcessServiceComponent implements AfterViewInit, OnDestroy, OnInit
|
||||
// Uncomment this line to map 'custom_stencil_01' to local editor component
|
||||
formRenderingService.setComponentTypeResolver('custom_stencil_01', () => CustomStencil01, true);
|
||||
|
||||
this.subscriptions.push(
|
||||
formService.formLoaded.subscribe((formEvent: FormEvent) => {
|
||||
formService.formLoaded
|
||||
.pipe(takeUntil(this.onDestroy$))
|
||||
.subscribe(formEvent => {
|
||||
this.logService.log(`Form loaded: ${formEvent.form.id}`);
|
||||
}),
|
||||
formService.formFieldValueChanged.subscribe((formFieldEvent: FormFieldEvent) => {
|
||||
});
|
||||
|
||||
formService.formFieldValueChanged
|
||||
.pipe(takeUntil(this.onDestroy$))
|
||||
.subscribe(formFieldEvent => {
|
||||
this.logService.log(`Field value changed. Form: ${formFieldEvent.form.id}, Field: ${formFieldEvent.field.id}, Value: ${formFieldEvent.field.value}`);
|
||||
}),
|
||||
this.preferenceService.select(UserPreferenceValues.PaginationSize).subscribe((pageSize) => {
|
||||
});
|
||||
|
||||
this.preferenceService
|
||||
.select(UserPreferenceValues.PaginationSize)
|
||||
.pipe(takeUntil(this.onDestroy$))
|
||||
.subscribe((pageSize) => {
|
||||
this.paginationPageSize = pageSize;
|
||||
}),
|
||||
formService.validateDynamicTableRow.subscribe(
|
||||
});
|
||||
|
||||
formService.validateDynamicTableRow
|
||||
.pipe(takeUntil(this.onDestroy$))
|
||||
.subscribe(
|
||||
(validateDynamicTableRowEvent: ValidateDynamicTableRowEvent) => {
|
||||
const row: DynamicTableRow = validateDynamicTableRowEvent.row;
|
||||
if (row && row.value && row.value.name === 'admin') {
|
||||
@@ -203,23 +215,28 @@ export class ProcessServiceComponent implements AfterViewInit, OnDestroy, OnInit
|
||||
validateDynamicTableRowEvent.preventDefault();
|
||||
}
|
||||
}
|
||||
),
|
||||
);
|
||||
|
||||
formService.formContentClicked.subscribe((content) => {
|
||||
formService.formContentClicked
|
||||
.pipe(takeUntil(this.onDestroy$))
|
||||
.subscribe((content) => {
|
||||
this.showContentPreview(content);
|
||||
}),
|
||||
});
|
||||
|
||||
formService.validateForm.subscribe((validateFormEvent: ValidateFormEvent) => {
|
||||
formService.validateForm
|
||||
.pipe(takeUntil(this.onDestroy$))
|
||||
.subscribe(validateFormEvent => {
|
||||
this.logService.log('Error form:' + validateFormEvent.errorsField);
|
||||
})
|
||||
);
|
||||
});
|
||||
|
||||
// Uncomment this block to see form event handling in action
|
||||
/*
|
||||
formService.formEvents.subscribe((event: Event) => {
|
||||
this.logService.log('Event fired:' + event.type);
|
||||
this.logService.log('Event Target:' + event.target);
|
||||
});
|
||||
formService.formEvents
|
||||
.pipe(takeUntil(this.onDestroy$))
|
||||
.subscribe((event: Event) => {
|
||||
this.logService.log('Event fired:' + event.type);
|
||||
this.logService.log('Event Target:' + event.target);
|
||||
});
|
||||
*/
|
||||
}
|
||||
|
||||
@@ -247,8 +264,8 @@ export class ProcessServiceComponent implements AfterViewInit, OnDestroy, OnInit
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
this.subscriptions.forEach((subscription) => subscription.unsubscribe());
|
||||
this.subscriptions = [];
|
||||
this.onDestroy$.next(true);
|
||||
this.onDestroy$.complete();
|
||||
}
|
||||
|
||||
onTaskFilterClick(filter: FilterRepresentationModel): void {
|
||||
|
@@ -19,12 +19,13 @@ import { Component, Input, OnChanges, OnInit, ViewChild, OnDestroy } from '@angu
|
||||
import {
|
||||
TaskListService,
|
||||
TaskAttachmentListComponent,
|
||||
TaskDetailsModel,
|
||||
TaskUploadService
|
||||
TaskUploadService,
|
||||
TaskDetailsModel
|
||||
} from '@alfresco/adf-process-services';
|
||||
import { UploadService, AlfrescoApiService, AppConfigService, FileUploadCompleteEvent } from '@alfresco/adf-core';
|
||||
import { UploadService, AlfrescoApiService, AppConfigService } from '@alfresco/adf-core';
|
||||
import { PreviewService } from '../../services/preview.service';
|
||||
import { Subscription } from 'rxjs';
|
||||
import { Subject } from 'rxjs';
|
||||
import { takeUntil } from 'rxjs/operators';
|
||||
|
||||
export function taskUploadServiceFactory(api: AlfrescoApiService, config: AppConfigService) {
|
||||
return new TaskUploadService(api, config);
|
||||
@@ -51,9 +52,9 @@ export class TaskAttachmentsComponent implements OnInit, OnChanges, OnDestroy {
|
||||
@Input()
|
||||
taskId: string;
|
||||
|
||||
taskDetails: any;
|
||||
taskDetails: TaskDetailsModel;
|
||||
|
||||
private subscriptions: Subscription[] = [];
|
||||
private onDestroy$ = new Subject<boolean>();
|
||||
|
||||
constructor(
|
||||
private uploadService: UploadService,
|
||||
@@ -62,25 +63,22 @@ export class TaskAttachmentsComponent implements OnInit, OnChanges, OnDestroy {
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.subscriptions.push(
|
||||
this.uploadService.fileUploadComplete.subscribe(
|
||||
(fileUploadCompleteEvent: FileUploadCompleteEvent) => this.onFileUploadComplete(fileUploadCompleteEvent.data)
|
||||
)
|
||||
);
|
||||
this.uploadService.fileUploadComplete
|
||||
.pipe(takeUntil(this.onDestroy$))
|
||||
.subscribe(event => this.onFileUploadComplete(event.data));
|
||||
}
|
||||
|
||||
ngOnChanges() {
|
||||
if (this.taskId) {
|
||||
this.activitiTaskList.getTaskDetails(this.taskId)
|
||||
.subscribe((taskDetails: TaskDetailsModel) => {
|
||||
this.taskDetails = taskDetails;
|
||||
});
|
||||
this.activitiTaskList
|
||||
.getTaskDetails(this.taskId)
|
||||
.subscribe(taskDetails => this.taskDetails = taskDetails);
|
||||
}
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
this.subscriptions.forEach((subscription) => subscription.unsubscribe());
|
||||
this.subscriptions = [];
|
||||
this.onDestroy$.next(true);
|
||||
this.onDestroy$.complete();
|
||||
}
|
||||
|
||||
onFileUploadComplete(content: any) {
|
||||
|
@@ -20,7 +20,8 @@ import { Router, ActivatedRoute, Params } from '@angular/router';
|
||||
import { NodePaging, Pagination, ResultSetPaging } from '@alfresco/js-api';
|
||||
import { SearchQueryBuilderService } from '@alfresco/adf-content-services';
|
||||
import { UserPreferencesService, SearchService, AppConfigService } from '@alfresco/adf-core';
|
||||
import { Subscription } from 'rxjs';
|
||||
import { Subject } from 'rxjs';
|
||||
import { takeUntil } from 'rxjs/operators';
|
||||
|
||||
@Component({
|
||||
selector: 'app-search-result-component',
|
||||
@@ -38,7 +39,7 @@ export class SearchResultComponent implements OnInit, OnDestroy {
|
||||
|
||||
sorting = ['name', 'asc'];
|
||||
|
||||
private subscriptions: Subscription[] = [];
|
||||
private onDestroy$ = new Subject<boolean>();
|
||||
|
||||
constructor(public router: Router,
|
||||
private config: AppConfigService,
|
||||
@@ -55,19 +56,21 @@ export class SearchResultComponent implements OnInit, OnDestroy {
|
||||
|
||||
this.sorting = this.getSorting();
|
||||
|
||||
this.subscriptions.push(
|
||||
this.queryBuilder.updated.subscribe(() => {
|
||||
this.queryBuilder.updated
|
||||
.pipe(takeUntil(this.onDestroy$))
|
||||
.subscribe(() => {
|
||||
this.sorting = this.getSorting();
|
||||
this.isLoading = true;
|
||||
}),
|
||||
});
|
||||
|
||||
this.queryBuilder.executed.subscribe((resultSetPaging: ResultSetPaging) => {
|
||||
this.queryBuilder.executed
|
||||
.pipe(takeUntil(this.onDestroy$))
|
||||
.subscribe((resultSetPaging: ResultSetPaging) => {
|
||||
this.queryBuilder.paging.skipCount = 0;
|
||||
|
||||
this.onSearchResultLoaded(resultSetPaging);
|
||||
this.isLoading = false;
|
||||
})
|
||||
);
|
||||
});
|
||||
|
||||
if (this.route) {
|
||||
this.route.params.forEach((params: Params) => {
|
||||
@@ -102,8 +105,8 @@ export class SearchResultComponent implements OnInit, OnDestroy {
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
this.subscriptions.forEach((subscription) => subscription.unsubscribe());
|
||||
this.subscriptions = [];
|
||||
this.onDestroy$.next(true);
|
||||
this.onDestroy$.complete();
|
||||
}
|
||||
|
||||
onSearchResultLoaded(resultSetPaging: ResultSetPaging) {
|
||||
|
@@ -15,11 +15,12 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { Component, OnInit, OnDestroy } from '@angular/core';
|
||||
import { FormGroup, FormBuilder, Validators, FormControl, AbstractControl } from '@angular/forms';
|
||||
import { ActivatedRoute, Params } from '@angular/router';
|
||||
import { debounceTime } from 'rxjs/operators';
|
||||
import { debounceTime, takeUntil } from 'rxjs/operators';
|
||||
import moment from 'moment-es6';
|
||||
import { Subject } from 'rxjs';
|
||||
|
||||
@Component({
|
||||
selector: 'app-task-list-demo',
|
||||
@@ -27,7 +28,7 @@ import moment from 'moment-es6';
|
||||
styleUrls: [`./task-list-demo.component.scss`]
|
||||
})
|
||||
|
||||
export class TaskListDemoComponent implements OnInit {
|
||||
export class TaskListDemoComponent implements OnInit, OnDestroy {
|
||||
DEFAULT_SIZE = 20;
|
||||
|
||||
taskListForm: FormGroup;
|
||||
@@ -75,6 +76,8 @@ export class TaskListDemoComponent implements OnInit {
|
||||
{value: 'due-desc', title: 'Due (desc)'}
|
||||
];
|
||||
|
||||
private onDestroy$ = new Subject<boolean>();
|
||||
|
||||
constructor(private route: ActivatedRoute,
|
||||
private formBuilder: FormBuilder) {
|
||||
}
|
||||
@@ -94,6 +97,11 @@ export class TaskListDemoComponent implements OnInit {
|
||||
this.buildForm();
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
this.onDestroy$.next(true);
|
||||
this.onDestroy$.complete();
|
||||
}
|
||||
|
||||
buildForm() {
|
||||
this.taskListForm = this.formBuilder.group({
|
||||
taskAppId: new FormControl(this.defaultAppId, [Validators.pattern('^[0-9]*$')]),
|
||||
@@ -114,9 +122,10 @@ export class TaskListDemoComponent implements OnInit {
|
||||
|
||||
this.taskListForm.valueChanges
|
||||
.pipe(
|
||||
debounceTime(500)
|
||||
debounceTime(500),
|
||||
takeUntil(this.onDestroy$)
|
||||
)
|
||||
.subscribe((taskFilter) => {
|
||||
.subscribe(taskFilter => {
|
||||
if (this.isFormValid()) {
|
||||
this.filterTasks(taskFilter);
|
||||
}
|
||||
|
@@ -15,32 +15,42 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { Component, ViewChild } from '@angular/core';
|
||||
import { Component, ViewChild, OnInit, OnDestroy } from '@angular/core';
|
||||
import { DocumentListComponent } from '@alfresco/adf-content-services';
|
||||
import { UserPreferencesService, UserPreferenceValues, RestoreMessageModel, NotificationService } from '@alfresco/adf-core';
|
||||
import { Router } from '@angular/router';
|
||||
import { PathInfoEntity } from '@alfresco/js-api';
|
||||
import { Subject } from 'rxjs';
|
||||
import { takeUntil } from 'rxjs/operators';
|
||||
|
||||
@Component({
|
||||
templateUrl: './trashcan.component.html',
|
||||
styleUrls: ['trashcan.component.scss']
|
||||
})
|
||||
export class TrashcanComponent {
|
||||
export class TrashcanComponent implements OnInit, OnDestroy {
|
||||
@ViewChild('documentList')
|
||||
documentList: DocumentListComponent;
|
||||
|
||||
currentLocale;
|
||||
|
||||
private onDestroy$ = new Subject<boolean>();
|
||||
|
||||
constructor(
|
||||
private preference: UserPreferencesService,
|
||||
private router: Router,
|
||||
private notificationService: NotificationService
|
||||
) {
|
||||
private notificationService: NotificationService) {
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.preference
|
||||
.select(UserPreferenceValues.Locale)
|
||||
.subscribe((locale) => {
|
||||
this.currentLocale = locale;
|
||||
});
|
||||
.pipe(takeUntil(this.onDestroy$))
|
||||
.subscribe(locale => this.currentLocale = locale);
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
this.onDestroy$.next(true);
|
||||
this.onDestroy$.complete();
|
||||
}
|
||||
|
||||
onRestore(restoreMessage: RestoreMessageModel) {
|
||||
|
Reference in New Issue
Block a user