Skip to content

Commit

Permalink
feat: add "description" column in Correspondances > Champs array
Browse files Browse the repository at this point in the history
  • Loading branch information
edelclaux committed May 16, 2024
1 parent 04c16d5 commit 0d2caf0
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -146,12 +146,14 @@ <h6>Champs ({{ (importData?.fieldmapping || {} | keyvalue).length }})</h6>
<tr>
<th>Champ source</th>
<th>Champ cible</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let field of entity?.themes | keyvalue">
<td>{{ field.value }}</td>
<td>{{ field.key }}</td>
<tr *ngFor="let field of entity?.themes">
<td>{{ field.source }}</td>
<td>{{ field.destination }}</td>
<td>{{ field.description }}</td>
</tr>
</tbody>
</table>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,21 @@ img {
}
}

table {
display: block;
overflow-x: auto;
}

table caption {
caption-side: top;
border-collapse: collapse;
}

mat-panel-title {
justify-content: space-between;
align-items: center !important;
column-gap: 0.5rem;
h6 {
margin: 0 !important;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ import { FieldMappingValues } from '../../models/mapping.model';
import { HttpClient } from '@angular/common/http';
import { finalize } from 'rxjs/operators';

interface CorrespondancesField {
source: string;
description: string;
destination: string | string[];
}

@Component({
selector: 'pnx-import-report',
templateUrl: 'import_report.component.html',
Expand Down Expand Up @@ -256,17 +262,18 @@ export class ImportReportComponent implements OnInit {
return tableFieldsCorresp;
}

mapThemes(themes: ThemesFields[], fieldMapping: FieldMappingValues) {
mapThemes(themes: ThemesFields[], fieldMapping: FieldMappingValues): Array<CorrespondancesField> {
const mappedThemes = themes.map((theme) => this.mapField(theme.fields, fieldMapping));
return Object.assign({}, ...mappedThemes);
return mappedThemes.flat();
}

mapField(listField: Field[], fieldMapping: FieldMappingValues) {
const mappedFields = {};
listField.forEach((field) => {
if (Object.keys(fieldMapping).includes(field.name_field)) {
mappedFields[field.name_field] = fieldMapping[field.name_field];
}
mapField(listField: Field[], fieldMapping: FieldMappingValues): Array<CorrespondancesField> {
const mappedFields: Array<CorrespondancesField> = listField.map((field) => {
return {
source: field.name_field,
description: field.comment,
destination: fieldMapping[field.name_field],
};
});
return mappedFields;
}
Expand Down

0 comments on commit 0d2caf0

Please sign in to comment.