diff client/src/components/importschedule/Importscheduledetail.vue @ 2563:dc4fae4bdb8f

Expose axis snapping tolerance to users
author Tom Gottfried <tom@intevation.de>
date Fri, 08 Mar 2019 19:15:47 +0100
parents f185503ef35a
children fcb139bfa56b
line wrap: on
line diff
--- a/client/src/components/importschedule/Importscheduledetail.vue	Fri Mar 08 18:57:58 2019 +0100
+++ b/client/src/components/importschedule/Importscheduledetail.vue	Fri Mar 08 19:15:47 2019 +0100
@@ -96,7 +96,9 @@
           <Bottleneck
             v-if="import_ == $options.IMPORTTYPES.BOTTLENECK && !directImport"
             @urlChanged="setUrl"
+            @toleranceChanged="setTolerance"
             :url="url"
+            :tolerance="tolerance"
           ></Bottleneck>
           <Distancemarksvirtual
             v-if="import_ == $options.IMPORTTYPES.DISTANCEMARKSVIRTUAL"
@@ -422,12 +424,13 @@
  * SPDX-License-Identifier: AGPL-3.0-or-later
  * License-Filename: LICENSES/AGPL-3.0.txt
  *
- * Copyright (C) 2018 by via donau
+ * Copyright (C) 2018, 2019 by via donau
  *   – Österreichische Wasserstraßen-Gesellschaft mbH
  * Software engineering by Intevation GmbH
  *
  * Author(s):
  * Thomas Junk <thomas.junk@intevation.de>
+ * Tom Gottfried <tom.gottfried@intevation.de>
  */
 import {
   IMPORTTYPES,
@@ -570,6 +573,14 @@
           return false;
       }
     },
+    isToleranceRequired() {
+      switch (this.import_) {
+        case this.$options.IMPORTTYPES.BOTTLENECK:
+          return true;
+        default:
+          return false;
+      }
+    },
     isValid() {
       if (!this.import_) return false;
       if (this.directImport && !this.uploadFile) return false;
@@ -577,6 +588,7 @@
         if (this.isURLRequired && !this.url) return false;
         if (this.isSortbyRequired && !this.sortBy) return false;
         if (this.isFeatureTypeRequired && !this.featureType) return false;
+        if (this.isToleranceRequired && !this.tolerance) return false;
         if (this.isCredentialsRequired && (!this.username || !this.password))
           return false;
         if (this.import_ == this.$options.IMPORTTYPES.FAIRWAYDIMENSION) {
@@ -609,6 +621,9 @@
     setSortBy(value) {
       this.sortBy = value;
     },
+    setTolerance(value) {
+      this.tolerance = value;
+    },
     setUsername(value) {
       this.username = value;
     },
@@ -673,6 +688,7 @@
       this.cronString = this.currentSchedule.cronString;
       this.featureType = this.currentSchedule.featureType;
       this.sortBy = this.currentSchedule.sortBy;
+      this.tolerance = this.currentSchedule.tolerance;
       this.username = this.currentSchedule.username;
       this.password = this.currentSchedule.password;
       this.LOS = this.currentSchedule.LOS;
@@ -765,6 +781,10 @@
         if (!this.sortBy) return;
         data["sort-by"] = this.sortBy;
       }
+      if (this.isToleranceRequired) {
+        if (!this.tolerance) return;
+        data["tolerance"] = parseFloat(this.tolerance);
+      }
       if (this.isCredentialsRequired) {
         if (!this.username || !this.password) return;
         data["user"] = this.username;
@@ -836,6 +856,10 @@
         if (!this.featureType) return;
         config["feature-type"] = this.featureType;
       }
+      if (this.isToleranceRequired) {
+        if (!this.tolerance) return;
+        config["tolerance"] = parseFloat(this.tolerance);
+      }
       if (this.isCredentialsRequired) {
         if (!this.username || !this.password) return;
         config = {