Remove invalid columns from display column selection and fix schema failure handling
This commit is contained in:
parent
5d0918a6cb
commit
08920f8015
|
@ -4,16 +4,6 @@
|
|||
import { API } from "api"
|
||||
import { parseFile } from "./utils"
|
||||
|
||||
let fileInput
|
||||
let error = null
|
||||
let fileName = null
|
||||
let fileType = null
|
||||
|
||||
let loading = false
|
||||
let validation = {}
|
||||
let validateHash = ""
|
||||
let errors = {}
|
||||
|
||||
export let rows = []
|
||||
export let schema = {}
|
||||
export let allValid = true
|
||||
|
@ -51,6 +41,19 @@
|
|||
},
|
||||
]
|
||||
|
||||
let fileInput
|
||||
let error = null
|
||||
let fileName = null
|
||||
let fileType = null
|
||||
let loading = false
|
||||
let validation = {}
|
||||
let validateHash = ""
|
||||
let errors = {}
|
||||
|
||||
$: displayColumnOptions = Object.keys(schema || {}).filter(column => {
|
||||
return validation[column]
|
||||
})
|
||||
|
||||
async function handleFile(e) {
|
||||
loading = true
|
||||
error = null
|
||||
|
@ -178,7 +181,7 @@
|
|||
<Select
|
||||
label="Display Column"
|
||||
bind:value={displayColumn}
|
||||
options={Object.keys(schema)}
|
||||
options={displayColumnOptions}
|
||||
sort
|
||||
/>
|
||||
</div>
|
||||
|
|
|
@ -84,7 +84,7 @@ export function validate(rows: Rows, schema: Schema): ValidationResults {
|
|||
results.invalidColumns.push(columnName)
|
||||
} else if (!columnName.match(ValidColumnNameRegex)) {
|
||||
// Check for special characters in column names
|
||||
results.invalidColumns.push(columnName)
|
||||
results.schemaValidation[columnName] = false
|
||||
results.errors[columnName] =
|
||||
"Column names can't contain special characters"
|
||||
} else if (
|
||||
|
|
Loading…
Reference in New Issue