RED-7214: Fixed filter bugs.

This commit is contained in:
Nicoleta Panaghiu 2023-08-18 10:54:28 +03:00
parent 500a97c286
commit fe5f63b5c4
3 changed files with 20 additions and 18 deletions

View File

@ -79,12 +79,12 @@
[file]="file"
></redaction-table-item>
</ng-template>
<ng-template #needsWorkFilterTemplate let-filter="filter">
<redaction-type-filter [dossierTemplateId]="dossier.dossierTemplateId" [filter]="filter"></redaction-type-filter>
</ng-template>
</ng-container>
<ng-template #needsWorkFilterTemplate let-filter="filter">
<redaction-type-filter [dossierTemplateId]="dossierTemplateId" [filter]="filter"></redaction-type-filter>
</ng-template>
<input
#fileInput
(change)="uploadFiles($event.target['files'])"

View File

@ -66,12 +66,13 @@ export class DossierOverviewScreenComponent extends ListingComponent<File> imple
displayedAttributes: IFileAttributeConfig[] = [];
displayedWorkflowAttributes: IFileAttributeConfig[] = [];
readonly listingMode$ = this.configService.listingMode$.pipe(
tap(() => this._computeAllFilters()),
tap(() => this.#computeAllFilters()),
shareLast(),
);
readonly dossier$: Observable<Dossier>;
readonly files$: Observable<File[]>;
readonly dossierId = getParam(DOSSIER_ID);
readonly dossierTemplateId: string;
readonly workflowConfig: WorkflowConfig<File, WorkflowFileStatus>;
readonly dossierAttributes$: Observable<DossierAttributeConfig[]>;
@ -96,6 +97,7 @@ export class DossierOverviewScreenComponent extends ListingComponent<File> imple
this.dossier$ = _dossiersService.getEntityChanged$(this.dossierId).pipe(tap(dossier => (this.#dossier = dossier)));
this.dossierAttributes$ = this._dossierAttributesService.all$.pipe(tap(() => this.#updateDossierAttributes()));
this.#dossier = _dossiersService.find(this.dossierId);
this.dossierTemplateId = this.#dossier.dossierTemplateId;
const hasRss = iqserPermissionsService.has(Roles.getRss);
this.workflowConfig = hasRss ? configService.workflowConfigRss() : configService.workflowConfig();
this.files$ = merge(this.#files$, this.#dossierFilesChange$).pipe(shareLast());
@ -113,7 +115,7 @@ export class DossierOverviewScreenComponent extends ListingComponent<File> imple
get #files$() {
return this._fileMapService.get$(this.dossierId).pipe(
tap(files => this.entitiesService.setEntities(files)),
tap(() => this._computeAllFilters()),
tap(() => this.#computeAllFilters()),
);
}
@ -129,8 +131,8 @@ export class DossierOverviewScreenComponent extends ListingComponent<File> imple
lastOpenedFn = (file: File) => this._userPreferenceService.getLastOpenedFileForDossier(file.dossierId) === file.id;
async ngOnInit(): Promise<void> {
this._computeAllFilters();
this._setRemovableSubscriptions();
this.#computeAllFilters();
this.#setRemovableSubscriptions();
this.#initFileDropHandling();
this._loadingService.stop();
@ -138,7 +140,7 @@ export class DossierOverviewScreenComponent extends ListingComponent<File> imple
ngOnAttach() {
this.#initFileDropHandling();
this._setRemovableSubscriptions();
this.#setRemovableSubscriptions();
this.#updateFileAttributes();
this._tableComponent?.scrollToLastIndex();
}
@ -156,7 +158,7 @@ export class DossierOverviewScreenComponent extends ListingComponent<File> imple
@HostListener('drop', ['$event'])
onDrop(event: DragEvent): void {
if (this.permissionsService.canUploadFiles(this.#dossier)) {
handleFileDrop(event, this.#dossier, this._uploadFiles.bind(this));
handleFileDrop(event, this.#dossier, this.#uploadFiles.bind(this));
}
}
@ -167,7 +169,7 @@ export class DossierOverviewScreenComponent extends ListingComponent<File> imple
}
async uploadFiles(files: Files): Promise<void> {
await this._uploadFiles(convertFiles(files, this.#dossier));
await this.#uploadFiles(convertFiles(files, this.#dossier));
(this._fileInput as any).nativeElement.value = null;
}
@ -191,10 +193,10 @@ export class DossierOverviewScreenComponent extends ListingComponent<File> imple
}
}
private _setRemovableSubscriptions(): void {
#setRemovableSubscriptions(): void {
this.addActiveScreenSubscription = this._dossiersService
.getEntityDeleted$(this.dossierId)
.pipe(tap(() => this._handleDeletedDossier()))
.pipe(tap(() => this.#handleDeletedDossier()))
.subscribe();
this.addActiveScreenSubscription = this._dossierTemplatesService
@ -206,7 +208,7 @@ export class DossierOverviewScreenComponent extends ListingComponent<File> imple
.subscribe();
}
private _handleDeletedDossier(): void {
#handleDeletedDossier(): void {
this._errorService.set(
new CustomError(_('error.deleted-entity.dossier.label'), _('error.deleted-entity.dossier.action'), 'iqser:expand'),
);
@ -219,7 +221,7 @@ export class DossierOverviewScreenComponent extends ListingComponent<File> imple
this.displayedAttributes = this.displayedInFileListAttributes.filter(c => c.displayedInFileList);
this.displayedWorkflowAttributes = this.#getDisplayedWorkflowAttributes(this.displayedAttributes);
this.tableColumnConfigs = this.configService.tableConfig(this.displayedAttributes);
this._computeAllFilters();
this.#computeAllFilters();
}
#getDisplayedWorkflowAttributes(displayedAttributes: IFileAttributeConfig[]): IFileAttributeConfig[] {
@ -231,14 +233,14 @@ export class DossierOverviewScreenComponent extends ListingComponent<File> imple
return displayedAttributes.sort((c1, c2) => (c1.primaryAttribute ? -1 : c2.primaryAttribute ? 1 : 0));
}
private async _uploadFiles(files: FileUploadModel[]) {
async #uploadFiles(files: FileUploadModel[]) {
const fileCount = await this._fileUploadService.uploadFiles(files, this.dossierId);
if (fileCount) {
this._statusOverlayService.openUploadStatusOverlay();
}
}
private _computeAllFilters() {
#computeAllFilters() {
const filterGroups = this.configService.filterGroups(
this.entitiesService.all,
this._fileAttributeConfigs,

@ -1 +1 @@
Subproject commit fed7c6a180745043c5bfdbaf8b7eecaed03eca5e
Subproject commit db37aa6257764e20a3c2ba602fc5cf875200d987