try fix files list change detection
This commit is contained in:
parent
c404f876a8
commit
eb101e7f9f
@ -1,6 +1,4 @@
|
|||||||
<ng-container *ngIf="files$ | async | log"></ng-container>
|
<ng-container *ngIf="(files$ | async) && dossier$ | async as dossier">
|
||||||
|
|
||||||
<ng-container *ngIf="dossier$ | async as dossier">
|
|
||||||
<section>
|
<section>
|
||||||
<redaction-dossier-overview-screen-header
|
<redaction-dossier-overview-screen-header
|
||||||
(upload)="fileInput.click()"
|
(upload)="fileInput.click()"
|
||||||
@ -73,6 +71,10 @@
|
|||||||
[file]="file"
|
[file]="file"
|
||||||
></redaction-table-item>
|
></redaction-table-item>
|
||||||
</ng-template>
|
</ng-template>
|
||||||
|
|
||||||
|
<ng-template #workflowItemTemplate let-entity="entity">
|
||||||
|
<redaction-workflow-item [displayedAttributes]="displayedAttributes" [dossier]="dossier" [file]="entity"></redaction-workflow-item>
|
||||||
|
</ng-template>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
|
|
||||||
<ng-template #needsWorkFilterTemplate let-filter="filter">
|
<ng-template #needsWorkFilterTemplate let-filter="filter">
|
||||||
@ -80,11 +82,3 @@
|
|||||||
</ng-template>
|
</ng-template>
|
||||||
|
|
||||||
<input #fileInput (change)="uploadFiles($event.target['files'])" class="file-upload-input" multiple="true" type="file" />
|
<input #fileInput (change)="uploadFiles($event.target['files'])" class="file-upload-input" multiple="true" type="file" />
|
||||||
|
|
||||||
<ng-template #workflowItemTemplate let-entity="entity">
|
|
||||||
<redaction-workflow-item
|
|
||||||
[displayedAttributes]="displayedAttributes"
|
|
||||||
[dossier]="dossier$ | async"
|
|
||||||
[file]="entity"
|
|
||||||
></redaction-workflow-item>
|
|
||||||
</ng-template>
|
|
||||||
|
|||||||
@ -1,15 +1,4 @@
|
|||||||
import {
|
import { Component, ElementRef, forwardRef, HostListener, Injector, OnDestroy, OnInit, TemplateRef, ViewChild } from '@angular/core';
|
||||||
ChangeDetectionStrategy,
|
|
||||||
Component,
|
|
||||||
ElementRef,
|
|
||||||
forwardRef,
|
|
||||||
HostListener,
|
|
||||||
Injector,
|
|
||||||
OnDestroy,
|
|
||||||
OnInit,
|
|
||||||
TemplateRef,
|
|
||||||
ViewChild,
|
|
||||||
} from '@angular/core';
|
|
||||||
import { Dossier, DossierAttributeWithValue, File, IFileAttributeConfig, WorkflowFileStatus } from '@red/domain';
|
import { Dossier, DossierAttributeWithValue, File, IFileAttributeConfig, WorkflowFileStatus } from '@red/domain';
|
||||||
import { FileDropOverlayService } from '@upload-download/services/file-drop-overlay.service';
|
import { FileDropOverlayService } from '@upload-download/services/file-drop-overlay.service';
|
||||||
import { FileUploadModel } from '@upload-download/model/file-upload.model';
|
import { FileUploadModel } from '@upload-download/model/file-upload.model';
|
||||||
@ -47,6 +36,7 @@ import { DOSSIER_ID } from '@utils/constants';
|
|||||||
import { BulkActionsService } from '../services/bulk-actions.service';
|
import { BulkActionsService } from '../services/bulk-actions.service';
|
||||||
import { DossiersService } from '@services/dossiers/dossiers.service';
|
import { DossiersService } from '@services/dossiers/dossiers.service';
|
||||||
import { dossiersServiceProvider } from '@services/entity-services/dossiers.service.provider';
|
import { dossiersServiceProvider } from '@services/entity-services/dossiers.service.provider';
|
||||||
|
import { NGXLogger } from 'ngx-logger';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
templateUrl: './dossier-overview-screen.component.html',
|
templateUrl: './dossier-overview-screen.component.html',
|
||||||
@ -58,7 +48,6 @@ import { dossiersServiceProvider } from '@services/entity-services/dossiers.serv
|
|||||||
{ provide: ListingComponent, useExisting: forwardRef(() => DossierOverviewScreenComponent) },
|
{ provide: ListingComponent, useExisting: forwardRef(() => DossierOverviewScreenComponent) },
|
||||||
dossiersServiceProvider,
|
dossiersServiceProvider,
|
||||||
],
|
],
|
||||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
||||||
})
|
})
|
||||||
export class DossierOverviewScreenComponent extends ListingComponent<File> implements OnInit, OnDestroy, OnAttach {
|
export class DossierOverviewScreenComponent extends ListingComponent<File> implements OnInit, OnDestroy, OnAttach {
|
||||||
readonly listingModes = ListingModes;
|
readonly listingModes = ListingModes;
|
||||||
@ -102,13 +91,14 @@ export class DossierOverviewScreenComponent extends ListingComponent<File> imple
|
|||||||
private readonly _fileMapService: FilesMapService,
|
private readonly _fileMapService: FilesMapService,
|
||||||
private readonly _errorService: ErrorService,
|
private readonly _errorService: ErrorService,
|
||||||
private readonly _route: ActivatedRoute,
|
private readonly _route: ActivatedRoute,
|
||||||
|
private readonly _logger: NGXLogger,
|
||||||
readonly permissionsService: PermissionsService,
|
readonly permissionsService: PermissionsService,
|
||||||
readonly configService: ConfigService,
|
readonly configService: ConfigService,
|
||||||
) {
|
) {
|
||||||
super(_injector);
|
super(_injector);
|
||||||
this.dossierId = _route.snapshot.paramMap.get(DOSSIER_ID);
|
this.dossierId = _route.snapshot.paramMap.get(DOSSIER_ID);
|
||||||
this.dossier$ = this._dossiersService.getEntityChanged$(this.dossierId).pipe(tap(dossier => (this.#currentDossier = dossier)));
|
this.dossier$ = _dossiersService.getEntityChanged$(this.dossierId).pipe(tap(dossier => (this.#currentDossier = dossier)));
|
||||||
this.#currentDossier = this._dossiersService.find(this.dossierId);
|
this.#currentDossier = _dossiersService.find(this.dossierId);
|
||||||
this.workflowConfig = configService.workflowConfig(this.#currentDossier);
|
this.workflowConfig = configService.workflowConfig(this.#currentDossier);
|
||||||
this.dossierTemplateId = this.#currentDossier.dossierTemplateId;
|
this.dossierTemplateId = this.#currentDossier.dossierTemplateId;
|
||||||
this.files$ = merge(this.#files$, this.#dossierFilesChange$).pipe(shareLast());
|
this.files$ = merge(this.#files$, this.#dossierFilesChange$).pipe(shareLast());
|
||||||
@ -163,7 +153,7 @@ export class DossierOverviewScreenComponent extends ListingComponent<File> imple
|
|||||||
try {
|
try {
|
||||||
this.dossierAttributes = await this._dossierAttributesService.getWithValues(this.#currentDossier);
|
this.dossierAttributes = await this._dossierAttributesService.getWithValues(this.#currentDossier);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log('Error from dossier overview screen: ', e);
|
this._logger.error('[DOSSIER ATTRIBUTES] Error: ', e);
|
||||||
}
|
}
|
||||||
|
|
||||||
this._loadingService.stop();
|
this._loadingService.stop();
|
||||||
|
|||||||
@ -1 +1 @@
|
|||||||
Subproject commit aab7e8c0b1b4822f31777ffc8a38febdfc2ea041
|
Subproject commit 320c3d3f4a68cef5a7387ed93af7fcc28e6a9dde
|
||||||
Loading…
x
Reference in New Issue
Block a user