changeset 2262:dedd7bbee846

testclient: ufa, vgm implemented
author Thomas Junk <thomas.junk@intevation.de>
date Thu, 14 Feb 2019 11:30:27 +0100
parents c5bbe2409a52
children 7efa29d16e77
files client/src/components/importschedule/Importscheduledetail.vue
diffstat 1 files changed, 28 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/client/src/components/importschedule/Importscheduledetail.vue	Thu Feb 14 11:21:33 2019 +0100
+++ b/client/src/components/importschedule/Importscheduledetail.vue	Thu Feb 14 11:30:27 2019 +0100
@@ -93,7 +93,10 @@
             </div>
           </div>
           <Availablefairwaydepth
-            v-if="import_ == $options.IMPORTTYPES.FAIRWAYAVAILABILITY"
+            v-if="
+              import_ == $options.IMPORTTYPES.FAIRWAYAVAILABILITY &&
+                !directImport
+            "
             @urlChanged="setUrl"
             :url="url"
           ></Availablefairwaydepth>
@@ -140,7 +143,9 @@
             :depth="depth"
           ></Faiwaydimensions>
           <Gaugemeasurement
-            v-if="import_ == $options.IMPORTTYPES.GAUGEMEASUREMENT"
+            v-if="
+              import_ == $options.IMPORTTYPES.GAUGEMEASUREMENT && !directImport
+            "
             @urlChanged="setUrl"
             :url="url"
           ></Gaugemeasurement>
@@ -516,6 +521,8 @@
     directImportAvailable() {
       switch (this.import_) {
         case this.$options.IMPORTTYPES.BOTTLENECK:
+        case this.$options.IMPORTTYPES.FAIRWAYAVAILABILITY:
+        case this.$options.IMPORTTYPES.GAUGEMEASUREMENT:
           return true;
         default:
           return false;
@@ -663,11 +670,26 @@
       this.day = null;
       this.dayOfMonth = null;
     },
-    triggerBottleneckFileUpload() {
+    triggerFileUpload() {
       if (!this.uploadFile) return;
       let formData = new FormData();
-      formData.append("ubn", this.uploadFile);
-      HTTP.post("/imports/ubn", formData, {
+      let routeParam = "";
+      switch (this.import_) {
+        case this.$options.IMPORTTYPES.BOTTLENECK:
+          routeParam = "ubn";
+          break;
+        case this.$options.IMPORTTYPES.FAIRWAYAVAILABILITY:
+          routeParam = "ufa";
+          break;
+        case this.$options.IMPORTTYPES.GAUGEMEASUREMENT:
+          routeParam = "ugm";
+          break;
+        default:
+          throw new Error("invalid importroute");
+      }
+
+      formData.append(routeParam, this.uploadFile);
+      HTTP.post("/imports/" + routeParam, formData, {
         headers: {
           "X-Gemma-Auth": localStorage.getItem("token"),
           "Content-Type": "multipart/form-data"
@@ -701,7 +723,7 @@
       if (!this.import_) return;
       if (this.directImport) {
         if (!this.uploadFile) return;
-        this.triggerBottleneckFileUpload();
+        this.triggerFileUpload();
         return;
       }
       let data = {};