Removed check for changes from dossier table item
This commit is contained in:
parent
81103034c7
commit
7d941f6f01
@ -7,7 +7,8 @@ import { NotificationsService } from '@services/notifications.service';
|
||||
import { Notification } from '@red/domain';
|
||||
import { distinctUntilChanged, map, switchMap, tap } from 'rxjs/operators';
|
||||
import { BehaviorSubject, Observable, timer } from 'rxjs';
|
||||
import { AutoUnsubscribe, CHANGED_CHECK_INTERVAL, List, shareLast } from '@iqser/common-ui';
|
||||
import { AutoUnsubscribe, List, shareLast } from '@iqser/common-ui';
|
||||
import { CHANGED_CHECK_INTERVAL } from '@utils/constants';
|
||||
|
||||
const INCLUDE_SEEN = false;
|
||||
|
||||
|
||||
@ -20,7 +20,6 @@ import { Observable, timer } from 'rxjs';
|
||||
import { filter, switchMap, tap } from 'rxjs/operators';
|
||||
import { convertFiles, Files, handleFileDrop } from '@utils/index';
|
||||
import {
|
||||
CHANGED_CHECK_INTERVAL,
|
||||
CircleButtonTypes,
|
||||
DefaultListingServices,
|
||||
ListingComponent,
|
||||
@ -46,6 +45,7 @@ import { LongPressEvent } from '@shared/directives/long-press.directive';
|
||||
import { UserPreferenceService } from '@services/user-preference.service';
|
||||
import { FilesMapService } from '@services/entity-services/files-map.service';
|
||||
import { FilesService } from '@services/entity-services/files.service';
|
||||
import { CHANGED_CHECK_INTERVAL } from '@utils/constants';
|
||||
|
||||
@Component({
|
||||
templateUrl: './dossier-overview-screen.component.html',
|
||||
|
||||
@ -1,10 +1,8 @@
|
||||
import { ChangeDetectionStrategy, Component, Input, OnChanges } from '@angular/core';
|
||||
import { Dossier, DossierStats } from '@red/domain';
|
||||
import { DossierStatsService } from '@services/entity-services/dossier-stats.service';
|
||||
import { BehaviorSubject, merge, Observable, timer } from 'rxjs';
|
||||
import { filter, switchMap } from 'rxjs/operators';
|
||||
import { CHANGED_CHECK_INTERVAL } from '@iqser/common-ui';
|
||||
import { FilesService } from '@services/entity-services/files.service';
|
||||
import { BehaviorSubject, Observable } from 'rxjs';
|
||||
import { switchMap } from 'rxjs/operators';
|
||||
|
||||
@Component({
|
||||
selector: 'redaction-table-item [dossier]',
|
||||
@ -18,24 +16,13 @@ export class TableItemComponent implements OnChanges {
|
||||
readonly stats$: Observable<DossierStats>;
|
||||
private readonly _ngOnChanges$ = new BehaviorSubject<string>(undefined);
|
||||
|
||||
constructor(readonly dossierStatsService: DossierStatsService, readonly filesService: FilesService) {
|
||||
const hasChanges$ = this._hasChanges$;
|
||||
this.stats$ = merge(this._ngOnChanges$, hasChanges$).pipe(
|
||||
filter(() => !!this.dossier),
|
||||
switchMap(() => this.dossierStatsService.watch$(this.dossier.dossierId)),
|
||||
);
|
||||
}
|
||||
|
||||
private get _hasChanges$() {
|
||||
return timer(CHANGED_CHECK_INTERVAL, CHANGED_CHECK_INTERVAL).pipe(
|
||||
filter(() => !!this.dossier),
|
||||
switchMap(() => this.filesService.hasChanges$(this.dossier.dossierId)),
|
||||
filter(changed => changed),
|
||||
switchMap(() => this.dossierStatsService.getFor([this.dossier.dossierId])),
|
||||
);
|
||||
constructor(readonly dossierStatsService: DossierStatsService) {
|
||||
this.stats$ = this._ngOnChanges$.pipe(switchMap(dossierId => this.dossierStatsService.watch$(dossierId)));
|
||||
}
|
||||
|
||||
ngOnChanges() {
|
||||
this._ngOnChanges$.next(this.dossier.dossierId);
|
||||
if (this.dossier) {
|
||||
this._ngOnChanges$.next(this.dossier.dossierId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -6,21 +6,14 @@ import { TranslateChartService } from '@services/translate-chart.service';
|
||||
import { timer } from 'rxjs';
|
||||
import { Router } from '@angular/router';
|
||||
import { DossiersDialogService } from '../../../services/dossiers-dialog.service';
|
||||
import {
|
||||
CHANGED_CHECK_INTERVAL,
|
||||
DefaultListingServicesTmp,
|
||||
EntitiesService,
|
||||
ListingComponent,
|
||||
OnAttach,
|
||||
OnDetach,
|
||||
TableComponent,
|
||||
} from '@iqser/common-ui';
|
||||
import { DefaultListingServicesTmp, EntitiesService, ListingComponent, OnAttach, OnDetach, TableComponent } from '@iqser/common-ui';
|
||||
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
|
||||
import { ConfigService } from '../config.service';
|
||||
import { DossiersService } from '@services/entity-services/dossiers.service';
|
||||
import { FilesService } from '@services/entity-services/files.service';
|
||||
import { DossierTemplatesService } from '@services/entity-services/dossier-templates.service';
|
||||
import { switchMap, tap } from 'rxjs/operators';
|
||||
import { CHANGED_CHECK_INTERVAL } from '@utils/constants';
|
||||
|
||||
@Component({
|
||||
templateUrl: './dossiers-listing-screen.component.html',
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import { Component, Input, OnChanges, OnInit } from '@angular/core';
|
||||
import { Color } from '@utils/types';
|
||||
import { Color } from '@red/domain';
|
||||
import { FilterService, INestedFilter } from '@iqser/common-ui';
|
||||
import { Observable, of } from 'rxjs';
|
||||
import { map } from 'rxjs/operators';
|
||||
|
||||
1
apps/red-ui/src/app/utils/constants.ts
Normal file
1
apps/red-ui/src/app/utils/constants.ts
Normal file
@ -0,0 +1 @@
|
||||
export const CHANGED_CHECK_INTERVAL = 3000;
|
||||
3
apps/red-ui/src/app/utils/types.d.ts
vendored
3
apps/red-ui/src/app/utils/types.d.ts
vendored
@ -1,3 +0,0 @@
|
||||
import { DossierStatus, FileStatus } from '@red/domain';
|
||||
|
||||
export type Color = FileStatus | DossierStatus | string;
|
||||
@ -1 +1 @@
|
||||
Subproject commit 8f440491e8006cad8d64ee62b1b84b97be747413
|
||||
Subproject commit fb53b06cfc8fa2c846e7d1a173ad6f0e19f90d02
|
||||
4
libs/red-domain/src/lib/shared/colors.ts
Normal file
4
libs/red-domain/src/lib/shared/colors.ts
Normal file
@ -0,0 +1,4 @@
|
||||
import { DossierStatus } from '../dossiers';
|
||||
import { WorkflowFileStatus } from '../files';
|
||||
|
||||
export type Color = WorkflowFileStatus | DossierStatus | string;
|
||||
@ -3,4 +3,5 @@ export * from './types';
|
||||
export * from './rules';
|
||||
export * from './watermark';
|
||||
export * from './default-color-type';
|
||||
export * from './colors';
|
||||
export * from './view-mode';
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user