This commit is contained in:
@@ -75,6 +75,7 @@ export default {
|
||||
importable() {
|
||||
return (
|
||||
(this.doImport || this.doUpdate) &&
|
||||
this.uploadFile &&
|
||||
this.uploadFile.name &&
|
||||
this.ayaType != 0
|
||||
);
|
||||
@@ -128,10 +129,10 @@ export default {
|
||||
//strip out any unsupported fields before transmission
|
||||
cleanData(dat, this.ayaType);
|
||||
|
||||
// console.log(
|
||||
// "The processed data AFTER cleaning is ",
|
||||
// JSON.stringify(dat)
|
||||
// );
|
||||
console.log(
|
||||
"The processed data AFTER cleaning is ",
|
||||
JSON.stringify(dat)
|
||||
);
|
||||
|
||||
// console.log(
|
||||
// "if it was csv it should look like this:",
|
||||
@@ -139,7 +140,7 @@ export default {
|
||||
// );
|
||||
|
||||
//upload the data
|
||||
await this.upload(dat);
|
||||
//await this.upload(dat);
|
||||
} catch (error) {
|
||||
window.$gz.errorHandler.handleFormError(error);
|
||||
}
|
||||
@@ -250,6 +251,7 @@ async function parseCSVFile(file) {
|
||||
return new Promise(function(complete, error) {
|
||||
Papa.parse(file, {
|
||||
header: true,
|
||||
skipEmptyLines: true,
|
||||
dynamicTyping: true,
|
||||
worker: true,
|
||||
complete,
|
||||
@@ -334,6 +336,14 @@ function cleanData(dat, atype) {
|
||||
for (const prop in z) {
|
||||
if (allowedProps.includes(prop) == false) {
|
||||
delete z[prop];
|
||||
} else {
|
||||
if (prop == "Tags") {
|
||||
//if it's coming from csv then Tags will be a string with comma separated items like this: blue,white,red
|
||||
//if it's json it will already be an array
|
||||
if (z.Tags && typeof z.Tags === "string") {
|
||||
z.Tags = z.Tags.split(",");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user