-
Notifications
You must be signed in to change notification settings - Fork 102
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(wip): get context import by query params url
- Format params to FieldsMapping interface - Send on upload route frontend - Set fieldsmapping for t_import on upload route backend Reviewed-by: andriacap
- Loading branch information
Showing
4 changed files
with
55 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
frontend/src/app/modules/imports/utils/format-row-count.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,25 @@ | ||
import { Import } from '../models/import.model'; | ||
import { FieldMappingValues } from '../models/mapping.model'; | ||
|
||
export function formatRowCount(imprt: Import): string { | ||
return imprt && imprt.source_count | ||
? `${imprt.statistics['nb_line_valid'] ?? 0} / ${imprt['source_count']}` | ||
: ''; | ||
} | ||
|
||
export function formatQueryParams(queryParams: { [key: string]: string }): FieldMappingValues { | ||
const formattedParams: FieldMappingValues = {}; | ||
|
||
Object.keys(queryParams).forEach((key) => { | ||
const value = queryParams[key]; | ||
|
||
const parsedValue = !isNaN(Number(value)) ? Number(value) : value; | ||
|
||
formattedParams[key] = { | ||
column_src: key, | ||
default_value: parsedValue, | ||
}; | ||
}); | ||
|
||
return formattedParams; | ||
} |