Skip to content
Snippets Groups Projects
Unverified 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 { ...@@ -133,7 +133,7 @@ export default {
}, },
tableImport: { tableImport: {
location: null, location: null,
quote: null, quote: '"',
false_element: null, false_element: null,
true_element: null, true_element: null,
null_element: null, null_element: null,
......
...@@ -132,6 +132,19 @@ ...@@ -132,6 +132,19 @@
</v-stepper-step> </v-stepper-step>
<v-stepper-content step="3"> <v-stepper-content step="3">
<v-form ref="form" v-model="validStep3" @submit.prevent="submit"> <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-row dense>
<v-col cols="8"> <v-col cols="8">
<v-file-input <v-file-input
...@@ -240,7 +253,7 @@ export default { ...@@ -240,7 +253,7 @@ export default {
}, },
tableImport: { tableImport: {
location: null, location: null,
quote: null, quote: '"',
false_element: null, false_element: null,
true_element: null, true_element: null,
null_element: null, null_element: null,
...@@ -251,6 +264,8 @@ export default { ...@@ -251,6 +264,8 @@ export default {
loadingUpload: false, loadingUpload: false,
loadingAnalyse: false, loadingAnalyse: false,
loadingImage: false, loadingImage: false,
warnAnalyseSeparator: false,
suggestedAnalyseSeparator: null,
url: null, url: null,
columns: [], columns: [],
newTableId: 42 // FIXME ??? newTableId: 42 // FIXME ???
...@@ -331,7 +346,7 @@ export default { ...@@ -331,7 +346,7 @@ export default {
this.loadingAnalyse = true this.loadingAnalyse = true
AnalyseService.determineDataTypes(path) AnalyseService.determineDataTypes(path)
.then((analysis) => { .then((analysis) => {
const { columns } = analysis const { columns, separator } = analysis
const dataTypes = QueryMapper.mySql8DataTypes() const dataTypes = QueryMapper.mySql8DataTypes()
this.tableCreate.columns = Object.entries(columns) this.tableCreate.columns = Object.entries(columns)
.map(([key, val]) => { .map(([key, val]) => {
...@@ -347,7 +362,12 @@ export default { ...@@ -347,7 +362,12 @@ export default {
} }
}) })
this.tableImport.location = path this.tableImport.location = path
if (separator !== this.tableImport.separator) {
this.warnAnalyseSeparator = true
this.suggestedAnalyseSeparator = separator
} else {
this.step = 4 this.step = 4
}
}) })
.finally(() => { .finally(() => {
this.loadingAnalyse = false this.loadingAnalyse = false
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment