Fixed dossier / files changes
This commit is contained in:
parent
7b05faec83
commit
a2a96ad2df
@ -16,8 +16,8 @@ import { FileUploadModel } from '@upload-download/model/file-upload.model';
|
||||
import { FileUploadService } from '@upload-download/services/file-upload.service';
|
||||
import { StatusOverlayService } from '@upload-download/services/status-overlay.service';
|
||||
import * as moment from 'moment';
|
||||
import { Observable, timer } from 'rxjs';
|
||||
import { filter, skip, switchMap, tap } from 'rxjs/operators';
|
||||
import { combineLatest, Observable } from 'rxjs';
|
||||
import { skip, switchMap, tap } from 'rxjs/operators';
|
||||
import { convertFiles, Files, handleFileDrop } from '@utils/index';
|
||||
import {
|
||||
CircleButtonTypes,
|
||||
@ -45,7 +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';
|
||||
import { DossierStatsService } from '@services/entity-services/dossier-stats.service';
|
||||
|
||||
@Component({
|
||||
templateUrl: './dossier-overview-screen.component.html',
|
||||
@ -81,6 +81,7 @@ export class DossierOverviewScreenComponent extends ListingComponent<File> imple
|
||||
readonly permissionsService: PermissionsService,
|
||||
private readonly _loadingService: LoadingService,
|
||||
private readonly _dossiersService: DossiersService,
|
||||
private readonly _dossierStatsService: DossierStatsService,
|
||||
private readonly _dossierTemplatesService: DossierTemplatesService,
|
||||
private readonly _appConfigService: AppConfigService,
|
||||
private readonly _fileUploadService: FileUploadService,
|
||||
@ -128,12 +129,11 @@ export class DossierOverviewScreenComponent extends ListingComponent<File> imple
|
||||
|
||||
this._fileDropOverlayService.initFileDropHandling(this.dossierId);
|
||||
|
||||
this.addSubscription = timer(CHANGED_CHECK_INTERVAL, CHANGED_CHECK_INTERVAL)
|
||||
.pipe(
|
||||
switchMap(() => this._filesService.hasChanges$(this.dossierId)),
|
||||
filter(changed => changed),
|
||||
switchMap(() => this._reloadFiles()),
|
||||
)
|
||||
this.addSubscription = combineLatest([
|
||||
this._dossiersService.getEntityChanged$(this.dossierId),
|
||||
this._dossierStatsService.watch$(this.dossierId),
|
||||
])
|
||||
.pipe(switchMap(() => this._reloadFiles()))
|
||||
.subscribe();
|
||||
|
||||
this.addSubscription = this.configService.listingMode$.subscribe(() => {
|
||||
|
||||
@ -3,7 +3,6 @@ import { Dossier } from '@red/domain';
|
||||
import { UserService } from '@services/user.service';
|
||||
import { PermissionsService } from '@services/permissions.service';
|
||||
import { TranslateChartService } from '@services/translate-chart.service';
|
||||
import { timer } from 'rxjs';
|
||||
import { Router } from '@angular/router';
|
||||
import { DossiersDialogService } from '../../../services/dossiers-dialog.service';
|
||||
import { DefaultListingServicesTmp, EntitiesService, ListingComponent, OnAttach, OnDetach, TableComponent } from '@iqser/common-ui';
|
||||
@ -12,8 +11,7 @@ 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';
|
||||
import { tap } from 'rxjs/operators';
|
||||
|
||||
@Component({
|
||||
templateUrl: './dossiers-listing-screen.component.html',
|
||||
@ -57,10 +55,6 @@ export class DossiersListingScreenComponent extends ListingComponent<Dossier> im
|
||||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
this.addSubscription = timer(CHANGED_CHECK_INTERVAL, CHANGED_CHECK_INTERVAL)
|
||||
.pipe(switchMap(() => this._dossiersService.loadAllIfChanged()))
|
||||
.subscribe();
|
||||
|
||||
this.addSubscription = this._dossiersService.all$.pipe(tap(() => this._computeAllFilters())).subscribe();
|
||||
}
|
||||
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
import {
|
||||
ChangeDetectionStrategy,
|
||||
ChangeDetectorRef,
|
||||
Component,
|
||||
EventEmitter,
|
||||
HostBinding,
|
||||
@ -96,6 +97,7 @@ export class FileActionsComponent extends AutoUnsubscribe implements OnDestroy,
|
||||
private readonly _userPreferenceService: UserPreferenceService,
|
||||
private readonly _reanalysisService: ReanalysisService,
|
||||
private readonly _router: Router,
|
||||
private readonly _changeRef: ChangeDetectorRef,
|
||||
) {
|
||||
super();
|
||||
}
|
||||
@ -224,7 +226,10 @@ export class FileActionsComponent extends AutoUnsubscribe implements OnDestroy,
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this._dossiersService.getEntityChanged$(this.file.dossierId).pipe(tap(() => this._setup()));
|
||||
this.addSubscription = this._dossiersService
|
||||
.getEntityChanged$(this.file.dossierId)
|
||||
.pipe(tap(() => this._setup()))
|
||||
.subscribe();
|
||||
}
|
||||
|
||||
ngOnChanges() {
|
||||
@ -353,6 +358,8 @@ export class FileActionsComponent extends AutoUnsubscribe implements OnDestroy,
|
||||
this.showReanalyseDossierOverview = this.canReanalyse && this.isDossierOverview && this.analysisForced;
|
||||
|
||||
this.buttons = this._buttons;
|
||||
|
||||
this._changeRef.markForCheck();
|
||||
}
|
||||
|
||||
private async _setFileApproved() {
|
||||
|
||||
@ -1,11 +1,12 @@
|
||||
import { Injectable, Injector } from '@angular/core';
|
||||
import { EntitiesService, List, mapEach, QueryParam, RequiredParam, shareLast, Toaster, Validate } from '@iqser/common-ui';
|
||||
import { EntitiesService, List, log, mapEach, QueryParam, RequiredParam, shareLast, Toaster, Validate } from '@iqser/common-ui';
|
||||
import { Dossier, IDossier, IDossierRequest } from '@red/domain';
|
||||
import { catchError, filter, map, mapTo, switchMap, tap } from 'rxjs/operators';
|
||||
import { combineLatest, iif, Observable, of, throwError } from 'rxjs';
|
||||
import { combineLatest, iif, Observable, of, throwError, timer } from 'rxjs';
|
||||
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
|
||||
import { HttpErrorResponse, HttpStatusCode } from '@angular/common/http';
|
||||
import { DossierStatsService } from '@services/entity-services/dossier-stats.service';
|
||||
import { CHANGED_CHECK_INTERVAL } from '@utils/constants';
|
||||
|
||||
export interface IDossiersStats {
|
||||
totalPeople: number;
|
||||
@ -27,6 +28,13 @@ export class DossiersService extends EntitiesService<Dossier, IDossier> {
|
||||
private readonly _dossierStatsService: DossierStatsService,
|
||||
) {
|
||||
super(_injector, Dossier, 'dossier');
|
||||
|
||||
timer(CHANGED_CHECK_INTERVAL, CHANGED_CHECK_INTERVAL)
|
||||
.pipe(
|
||||
switchMap(() => this.loadAllIfChanged()),
|
||||
log(),
|
||||
)
|
||||
.subscribe();
|
||||
}
|
||||
|
||||
loadAll(): Observable<Dossier[]> {
|
||||
|
||||
@ -1 +1 @@
|
||||
Subproject commit 51f3d7502b5545663afa2fa0a62abc3578f92905
|
||||
Subproject commit a1c1be7edc783bdea42b86c0f8b1f74437065b76
|
||||
Loading…
x
Reference in New Issue
Block a user