mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2026-09-09 18:03:21 +00:00
AAE-49653 Code improvement
This commit is contained in:
+2
-2
@@ -16,7 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { Component, DestroyRef, EventEmitter, inject, Input, OnChanges, OnInit, Output, SimpleChanges } from '@angular/core';
|
import { Component, DestroyRef, EventEmitter, inject, Input, OnChanges, OnInit, Output, SimpleChanges } from '@angular/core';
|
||||||
import { combineLatest, defer, EMPTY, Observable, Subscription } from 'rxjs';
|
import { combineLatest, defer, EMPTY, Observable, of, Subscription } from 'rxjs';
|
||||||
import { ProcessFilterCloudService } from '../../services/process-filter-cloud.service';
|
import { ProcessFilterCloudService } from '../../services/process-filter-cloud.service';
|
||||||
import { ProcessFilterCloudModel } from '../../models/process-filter-cloud.model';
|
import { ProcessFilterCloudModel } from '../../models/process-filter-cloud.model';
|
||||||
import { AppConfigService, IconModule, TranslationService } from '@alfresco/adf-core';
|
import { AppConfigService, IconModule, TranslationService } from '@alfresco/adf-core';
|
||||||
@@ -131,7 +131,7 @@ export class ProcessFiltersCloudComponent implements OnInit, OnChanges {
|
|||||||
getFilters(appName: string): void {
|
getFilters(appName: string): void {
|
||||||
this.filtersLoadedFor = appName;
|
this.filtersLoadedFor = appName;
|
||||||
const filters$ = this.filterCountersCloudService.getProcessFilters(appName);
|
const filters$ = this.filterCountersCloudService.getProcessFilters(appName);
|
||||||
this.filters$ = filters$.pipe(catchError(() => EMPTY));
|
this.filters$ = filters$.pipe(catchError(() => of([])));
|
||||||
|
|
||||||
filters$.pipe(takeUntilDestroyed(this.destroyRef)).subscribe({
|
filters$.pipe(takeUntilDestroyed(this.destroyRef)).subscribe({
|
||||||
next: (res) => {
|
next: (res) => {
|
||||||
|
|||||||
+10
-14
@@ -176,22 +176,18 @@ export class TaskFiltersCloudComponent extends BaseTaskFiltersCloudComponent imp
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
initFilterCounterNotifications() {
|
initFilterCounterNotifications(): void {
|
||||||
if (!this.appName) {
|
if (this.appName && this.enableNotifications) {
|
||||||
return;
|
this.filterCountersCloudService
|
||||||
}
|
.getEngineEvents(this.appName, FilterCounterEntityType.TASK)
|
||||||
if (!this.enableNotifications) {
|
.pipe(takeUntilDestroyed(this.destroyRef))
|
||||||
|
.subscribe((events) => {
|
||||||
|
events.forEach((taskEvent) => this.checkFilterCounter(taskEvent.entity));
|
||||||
|
this.filterCounterUpdated.emit(events);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
this.counters = {};
|
this.counters = {};
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this.filterCountersCloudService
|
|
||||||
.getEngineEvents(this.appName, FilterCounterEntityType.TASK)
|
|
||||||
.pipe(takeUntilDestroyed(this.destroyRef))
|
|
||||||
.subscribe((events) => {
|
|
||||||
events.forEach((taskEvent) => this.checkFilterCounter(taskEvent.entity));
|
|
||||||
this.filterCounterUpdated.emit(events);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
checkFilterCounter(filterNotification: TaskDetailsCloudModel) {
|
checkFilterCounter(filterNotification: TaskDetailsCloudModel) {
|
||||||
|
|||||||
Reference in New Issue
Block a user