RED-5514 - csv single row fix
This commit is contained in:
parent
b9a355673a
commit
81eccdfeb1
@ -63,8 +63,10 @@ export class FileAttributesCsvImportDialogComponent extends ListingComponent<IFi
|
|||||||
const reader = new FileReader();
|
const reader = new FileReader();
|
||||||
reader.addEventListener('load', event => {
|
reader.addEventListener('load', event => {
|
||||||
const parsedCsv = <any>event.target.result;
|
const parsedCsv = <any>event.target.result;
|
||||||
|
|
||||||
|
const hasMoreThanOneLine = parsedCsv.indexOf('\n') > 0 && parsedCsv.substring(parsedCsv.indexOf('\n')).length > 1;
|
||||||
this.parseResult = Papa.parse(parsedCsv, {
|
this.parseResult = Papa.parse(parsedCsv, {
|
||||||
header: true,
|
header: hasMoreThanOneLine,
|
||||||
delimiter: this.form.get('delimiter').value,
|
delimiter: this.form.get('delimiter').value,
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -72,6 +74,11 @@ export class FileAttributesCsvImportDialogComponent extends ListingComponent<IFi
|
|||||||
this.form.patchValue({ delimiter: this.parseResult.meta.delimiter });
|
this.form.patchValue({ delimiter: this.parseResult.meta.delimiter });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!hasMoreThanOneLine) {
|
||||||
|
this.parseResult.meta.fields = this.parseResult.data[0];
|
||||||
|
this.parseResult.data = [];
|
||||||
|
}
|
||||||
|
|
||||||
// Filter duplicate columns
|
// Filter duplicate columns
|
||||||
if (this.parseResult?.data?.length) {
|
if (this.parseResult?.data?.length) {
|
||||||
this.parseResult.meta.fields = Object.keys(this.parseResult.data[0]);
|
this.parseResult.meta.fields = Object.keys(this.parseResult.data[0]);
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"ADMIN_CONTACT_NAME": null,
|
"ADMIN_CONTACT_NAME": null,
|
||||||
"ADMIN_CONTACT_URL": null,
|
"ADMIN_CONTACT_URL": null,
|
||||||
"API_URL": "https://dev-08.iqser.cloud/redaction-gateway-v1",
|
"API_URL": "https://dev-04.iqser.cloud/redaction-gateway-v1",
|
||||||
"APP_NAME": "RedactManager",
|
"APP_NAME": "RedactManager",
|
||||||
"AUTO_READ_TIME": 3,
|
"AUTO_READ_TIME": 3,
|
||||||
"BACKEND_APP_VERSION": "4.4.40",
|
"BACKEND_APP_VERSION": "4.4.40",
|
||||||
@ -11,7 +11,7 @@
|
|||||||
"MAX_RETRIES_ON_SERVER_ERROR": 3,
|
"MAX_RETRIES_ON_SERVER_ERROR": 3,
|
||||||
"OAUTH_CLIENT_ID": "redaction",
|
"OAUTH_CLIENT_ID": "redaction",
|
||||||
"OAUTH_IDP_HINT": null,
|
"OAUTH_IDP_HINT": null,
|
||||||
"OAUTH_URL": "https://dev-08.iqser.cloud/auth/realms/redaction",
|
"OAUTH_URL": "https://dev-04.iqser.cloud/auth/realms/redaction",
|
||||||
"RECENT_PERIOD_IN_HOURS": 24,
|
"RECENT_PERIOD_IN_HOURS": 24,
|
||||||
"SELECTION_MODE": "structural",
|
"SELECTION_MODE": "structural",
|
||||||
"MANUAL_BASE_URL": "https://docs.redactmanager.com/preview",
|
"MANUAL_BASE_URL": "https://docs.redactmanager.com/preview",
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user