changeset 3622:30a9fdac70f0

client: configuration: prepared fetching morphology classbreaks and ecdis url from backend
author Markus Kottlaender <markus@intevation.de>
date Wed, 05 Jun 2019 16:38:26 +0200
parents 7e7a2b501595
children 3012d0b3badc
files client/src/components/systemconfiguration/MapLayers.vue client/src/components/systemconfiguration/MorphologyClassbreaks.vue client/src/store/application.js
diffstat 3 files changed, 97 insertions(+), 82 deletions(-) [+]
line wrap: on
line diff
--- a/client/src/components/systemconfiguration/MapLayers.vue	Wed Jun 05 16:33:57 2019 +0200
+++ b/client/src/components/systemconfiguration/MapLayers.vue	Wed Jun 05 16:38:26 2019 +0200
@@ -9,8 +9,8 @@
             <input
               type="url"
               class="form-control"
-              id="ecdis-url"
               placeholder="https://..."
+              v-model="config.ecdis_url"
             />
           </div>
         </div>
@@ -38,10 +38,16 @@
  * Author(s):
  * Markus Kottländer <markus@intevation.de>
  */
+import { mapState } from "vuex";
 
 export default {
+  computed: {
+    ...mapState("application", ["config"])
+  },
   methods: {
-    submit() {}
+    submit() {
+      this.$store.commit("application/config", this.config);
+    }
   }
 };
 </script>
--- a/client/src/components/systemconfiguration/MorphologyClassbreaks.vue	Wed Jun 05 16:33:57 2019 +0200
+++ b/client/src/components/systemconfiguration/MorphologyClassbreaks.vue	Wed Jun 05 16:38:26 2019 +0200
@@ -8,11 +8,11 @@
       <div class="d-flex flex-wrap">
         <div
           class="input-group mb-3 mr-2 classbreak"
-          v-for="(value, i) in classbreaks"
+          v-for="(value, i) in config.morphology_classbreaks"
           :key="i"
         >
           <input
-            v-model="classbreaks[i]"
+            v-model="config.morphology_classbreaks[i]"
             type="number"
             min="0"
             step="0.1"
@@ -22,7 +22,7 @@
             <button
               class="btn btn-sm btn-outline-secondary"
               type="button"
-              @click="classbreaks.splice(i, 1)"
+              @click="config.morphology_classbreaks.splice(i, 1)"
             >
               <font-awesome-icon icon="times" />
             </button>
@@ -31,8 +31,12 @@
         <button
           class="btn btn-sm btn-success mb-3"
           @click="
-            classbreaks.push(
-              classbreaks.length ? classbreaks[classbreaks.length - 1] : 1
+            config.morphology_classbreaks.push(
+              config.morphology_classbreaks.length
+                ? config.morphology_classbreaks[
+                    config.morphology_classbreaks.length - 1
+                  ]
+                : 1
             )
           "
         >
@@ -47,11 +51,11 @@
       <div class="d-flex flex-wrap">
         <div
           class="input-group mb-3 mr-2 classbreak"
-          v-for="(value, i) in compareClassbreaks"
+          v-for="(value, i) in config.morphology_classbreaks_compare"
           :key="i"
         >
           <input
-            v-model="compareClassbreaks[i]"
+            v-model="config.morphology_classbreaks_compare[i]"
             type="number"
             step="0.1"
             class="form-control form-control-sm"
@@ -60,7 +64,7 @@
             <button
               class="btn btn-sm btn-outline-secondary"
               type="button"
-              @click="classbreaks.splice(i, 1)"
+              @click="config.morphology_classbreaks_compare.splice(i, 1)"
             >
               <font-awesome-icon icon="times" />
             </button>
@@ -69,9 +73,11 @@
         <button
           class="btn btn-sm btn-success mb-3"
           @click="
-            compareClassbreaks.push(
-              compareClassbreaks.length
-                ? compareClassbreaks[compareClassbreaks.length - 1]
+            config.morphology_classbreaks_compare.push(
+              config.morphology_classbreaks_compare.length
+                ? config.morphology_classbreaks_compare[
+                    config.morphology_classbreaks_compare.length - 1
+                  ]
                 : 1
             )
           "
@@ -113,78 +119,16 @@
  * Author(s):
  * Markus Kottländer <markus@intevation.de>
  */
+import { mapState } from "vuex";
 
 export default {
-  data() {
-    return {
-      classbreaks: [
-        1,
-        1.5,
-        1.7,
-        1.9,
-        2.1,
-        2.3,
-        2.5,
-        2.7,
-        2.9,
-        3.1,
-        3.3,
-        3.5,
-        4.0,
-        4.5,
-        5,
-        5.5,
-        6,
-        6.5,
-        7
-      ],
-      compareClassbreaks: [
-        -2,
-        -1.9,
-        -1.8,
-        -1.7,
-        -1.6,
-        -1.5,
-        -1.4,
-        -1.3,
-        -1.2,
-        -1.1,
-        -1,
-        -0.9,
-        -0.8,
-        -0.7,
-        -0.6,
-        -0.5,
-        -0.4,
-        -0.3,
-        -0.2,
-        -0.1,
-        0,
-        0.1,
-        0.2,
-        0.3,
-        0.4,
-        0.5,
-        0.6,
-        0.7,
-        0.8,
-        0.9,
-        1,
-        1.1,
-        1.2,
-        1.3,
-        1.4,
-        1.5,
-        1.6,
-        1.7,
-        1.8,
-        1.9,
-        2
-      ]
-    };
+  computed: {
+    ...mapState("application", ["config"])
   },
   methods: {
-    submit() {}
+    submit() {
+      this.$store.commit("application/config", this.config);
+    }
   }
 };
 </script>
--- a/client/src/store/application.js	Wed Jun 05 16:33:57 2019 +0200
+++ b/client/src/store/application.js	Wed Jun 05 16:38:26 2019 +0200
@@ -144,13 +144,78 @@
       if (!Object.keys(state.config).length) {
         setTimeout(() => {
           commit("config", {
+            ecdis_url: "https://service.d4d-portal.info/wms/",
             bn_revtime_multiplier: 1.5,
             gm_min_values_14d: 1124,
             gm_latest_hours: 24,
             gm_forecast_offset_24h: 15,
             gm_forecast_offset_72h: 15,
             gm_forecast_vs_reality_nsc_24h: -12.5,
-            gm_forecast_vs_reality_nsc_72h: -12.5
+            gm_forecast_vs_reality_nsc_72h: -12.5,
+            morphology_classbreaks: [
+              1,
+              1.5,
+              1.7,
+              1.9,
+              2.1,
+              2.3,
+              2.5,
+              2.7,
+              2.9,
+              3.1,
+              3.3,
+              3.5,
+              4.0,
+              4.5,
+              5,
+              5.5,
+              6,
+              6.5,
+              7
+            ],
+            morphology_classbreaks_compare: [
+              -2,
+              -1.9,
+              -1.8,
+              -1.7,
+              -1.6,
+              -1.5,
+              -1.4,
+              -1.3,
+              -1.2,
+              -1.1,
+              -1,
+              -0.9,
+              -0.8,
+              -0.7,
+              -0.6,
+              -0.5,
+              -0.4,
+              -0.3,
+              -0.2,
+              -0.1,
+              0,
+              0.1,
+              0.2,
+              0.3,
+              0.4,
+              0.5,
+              0.6,
+              0.7,
+              0.8,
+              0.9,
+              1,
+              1.1,
+              1.2,
+              1.3,
+              1.4,
+              1.5,
+              1.6,
+              1.7,
+              1.8,
+              1.9,
+              2
+            ]
           });
         }, 1000);
       }