RED-9201 - UI for Component Mapping Tables

This commit is contained in:
Valentin Mihai 2024-07-26 15:36:24 +03:00
parent 9010677c6d
commit c5fd581a62
4 changed files with 8 additions and 6 deletions

View File

@ -1,5 +1,5 @@
import { Component, OnInit } from '@angular/core';
import { CircleButtonComponent, IconButtonComponent, IconButtonTypes, IqserDialogComponent, UploadFileComponent } from '@iqser/common-ui';
import { CircleButtonComponent, IconButtonComponent, IqserDialogComponent, UploadFileComponent } from '@iqser/common-ui';
import { FileAttributeEncodingTypes, IComponentMapping } from '@red/domain';
import { FormBuilder, ReactiveFormsModule, UntypedFormGroup, Validators } from '@angular/forms';
import { TranslateModule } from '@ngx-translate/core';
@ -22,6 +22,7 @@ interface DialogResult {
file: Blob;
encoding: string;
delimiter: string;
fileName?: string;
}
@Component({
@ -77,7 +78,8 @@ export class AddEditComponentMappingDialogComponent
}
save() {
this.dialogRef.close({ ...this.data.mapping, ...this.form.getRawValue() });
const fileName = document.getElementById('file-name-label')?.textContent;
this.dialogRef.close({ ...this.data.mapping, ...this.form.getRawValue(), fileName });
}
#getForm(): UntypedFormGroup {

View File

@ -99,8 +99,8 @@ export default class ComponentMappingsScreenComponent extends ListingComponent<C
const result = await dialog.result();
if (result) {
this._loadingService.start();
const { id, name, encoding, delimiter } = result;
const newMapping = { id, name, encoding, delimiter };
const { id, name, encoding, delimiter, fileName } = result;
const newMapping = { id, name, encoding, delimiter, fileName };
await firstValueFrom(
this._componentMappingService.createUpdateComponentMapping(this.#dossierTemplateId, newMapping, result.file),
);

View File

@ -22,7 +22,7 @@ export class ComponentMappingsService extends EntitiesService<IComponentMapping,
file: Blob,
): Observable<IComponentMapping> {
const formParams = new FormData();
formParams.append('file', file, `${componentMapping.name}.csv`);
formParams.append('file', file, componentMapping.fileName);
const queryParams: List<QueryParam> = [
{ key: 'name', value: componentMapping.name },

@ -1 +1 @@
Subproject commit 98ac49fbc81bb9989c14a8ca06c11d98ed042c86
Subproject commit 9df87dc218ea8090159059a7bad184aaaeba8854