Skip to content
Snippets Groups Projects
Commit c711e69e authored by Timothee P's avatar Timothee P :sunflower:
Browse files

add error message at wrong file import

parent 8b85f8ee
No related branches found
No related tags found
No related merge requests found
...@@ -73,6 +73,11 @@ ...@@ -73,6 +73,11 @@
id="json_file" id="json_file"
/> />
</div> </div>
<ul v-if="importError" class="errorlist">
<li>
{{ importError }}
</li>
</ul>
<button <button
:disabled="fileToImport.size === 0" :disabled="fileToImport.size === 0"
@click="importGeoJson" @click="importGeoJson"
...@@ -197,6 +202,7 @@ export default { ...@@ -197,6 +202,7 @@ export default {
data() { data() {
return { return {
importError: "",
fileToImport: { fileToImport: {
name: "Sélectionner un fichier GeoJSON ...", name: "Sélectionner un fichier GeoJSON ...",
size: 0, size: 0,
...@@ -271,6 +277,7 @@ export default { ...@@ -271,6 +277,7 @@ export default {
}, },
checkJsonValidity(json) { checkJsonValidity(json) {
this.importError = "";
const fields = this.structure.customfield_set.map((el) => { const fields = this.structure.customfield_set.map((el) => {
return { return {
name: el.name, name: el.name,
...@@ -302,6 +309,7 @@ export default { ...@@ -302,6 +309,7 @@ export default {
} else if (customType !== field_type) { } else if (customType !== field_type) {
//* check if custom field value match //* check if custom field value match
console.log("NOT matched"); console.log("NOT matched");
this.importError = `Le fichier est invalide: Un champ de type ${field_type} ne peut pas avoir la valeur [ ${fieldInFeature} ]`;
return false; return false;
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment