changeset 1242:da99d4560fd4

feat: import sounding results Sends now bottleneck, importdate, depthreference over the wire. Changed success message to "starting import for ...". In case of an error, display errormessages.
author Thomas Junk <thomas.junk@intevation.de>
date Wed, 21 Nov 2018 09:38:51 +0100
parents a45fa8943254
children 24797f66f268
files client/src/imports/Imports.vue
diffstat 1 files changed, 8 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/client/src/imports/Imports.vue	Tue Nov 20 18:05:19 2018 +0100
+++ b/client/src/imports/Imports.vue	Wed Nov 21 09:38:51 2018 +0100
@@ -23,7 +23,7 @@
                 </div>
                 <input
                     id="importdate"
-                    type="text"
+                    type="date"
                     class="form-control"
                     placeholder="Date of import"
                     aria-label="bottleneck"
@@ -157,20 +157,24 @@
           this.importState = IMPORTSTATE.EDIT;
           this.bottleneck = bottleneck;
           this.depthReference = depthReference;
-          this.importDate = date;
+          this.importDate = new Date(date).toISOString().split("T")[0];
           this.token = response.data.token;
         })
         .catch(error => {
           const { status, data } = error.response;
+          const messages = data.messages ? data.messages.join(", ") : "";
           displayError({
             title: "Backend Error",
-            message: `${status}: ${data.message || data}`
+            message: `${status}: ${messages}`
           });
         });
     },
     confirm() {
       let formData = new FormData();
       formData.append("token", this.token);
+      ["bottleneck", "importDate", "depthReference"].forEach(x => {
+        if (this[x]) formData.append(x, this[x]);
+      });
       HTTP.post("/imports/soundingresult", formData, {
         headers: {
           "X-Gemma-Auth": localStorage.getItem("token"),
@@ -180,7 +184,7 @@
         .then(() => {
           displayInfo({
             title: "Import",
-            message: "Successfully imported " + this.bottleneck
+            message: "Starting import for " + this.bottleneck
           });
           this.initialState();
         })