Skip to content
Snippets Groups Projects
Verified Commit 335e6a3f authored by Martin Weise's avatar Martin Weise
Browse files

Display warning in UI when providing wrong separator

parent d8f68f59
No related branches found
No related tags found
3 merge requests!231CI: Remove build for log-service,!228Better error message handling in the frontend,!223Release of version 1.4.0
......@@ -133,7 +133,7 @@ export default {
},
tableImport: {
location: null,
quote: null,
quote: '"',
false_element: null,
true_element: null,
null_element: null,
......
......@@ -132,6 +132,19 @@
</v-stepper-step>
<v-stepper-content step="3">
<v-form ref="form" v-model="validStep3" @submit.prevent="submit">
<v-row dense>
<v-col cols="8">
<v-alert
v-if="warnAnalyseSeparator"
border="left"
color="warning">
We analysed your .csv/.tsv file and found that the separator you provided
<code>{{ tableImport.separator }}</code> is not correct, the separator
<code>{{ suggestedAnalyseSeparator }}</code> is more likely to be correct. If you really want to import
the .csv/.tsv file still, click "continue".
</v-alert>
</v-col>
</v-row>
<v-row dense>
<v-col cols="8">
<v-file-input
......@@ -240,7 +253,7 @@ export default {
},
tableImport: {
location: null,
quote: null,
quote: '"',
false_element: null,
true_element: null,
null_element: null,
......@@ -251,6 +264,8 @@ export default {
loadingUpload: false,
loadingAnalyse: false,
loadingImage: false,
warnAnalyseSeparator: false,
suggestedAnalyseSeparator: null,
url: null,
columns: [],
newTableId: 42 // FIXME ???
......@@ -331,7 +346,7 @@ export default {
this.loadingAnalyse = true
AnalyseService.determineDataTypes(path)
.then((analysis) => {
const { columns } = analysis
const { columns, separator } = analysis
const dataTypes = QueryMapper.mySql8DataTypes()
this.tableCreate.columns = Object.entries(columns)
.map(([key, val]) => {
......@@ -347,7 +362,12 @@ export default {
}
})
this.tableImport.location = path
if (separator !== this.tableImport.separator) {
this.warnAnalyseSeparator = true
this.suggestedAnalyseSeparator = separator
} else {
this.step = 4
}
})
.finally(() => {
this.loadingAnalyse = false
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment