changeset 1027:04a9e78dcc5f

refac: remove morphstore. not necessary
author Thomas Junk <thomas.junk@intevation.de>
date Wed, 24 Oct 2018 14:17:51 +0200
parents 3de54d7b7d30
children dd67e46366ef
files client/src/application/Main.vue client/src/fairway/store.js client/src/linetool/Linetool.vue client/src/map/Maplayer.vue client/src/morphtool/Morphtool.vue client/src/morphtool/store.js client/src/store.js
diffstat 7 files changed, 28 insertions(+), 47 deletions(-) [+]
line wrap: on
line diff
--- a/client/src/application/Main.vue	Wed Oct 24 13:35:15 2018 +0200
+++ b/client/src/application/Main.vue	Wed Oct 24 14:17:51 2018 +0200
@@ -86,7 +86,7 @@
       "selectedWaterLevel",
       "availableSurveys"
     ]),
-    ...mapState("morphstore", ["selectedMorph"]),
+    ...mapState("fairwayprofile", ["selectedMorph"]),
     coordinates() {
       const currentSurveyDate = this.selectedMorph.date_info;
       return this.currentProfile[currentSurveyDate];
--- a/client/src/fairway/store.js	Wed Oct 24 13:35:15 2018 +0200
+++ b/client/src/fairway/store.js	Wed Oct 24 14:17:51 2018 +0200
@@ -29,7 +29,8 @@
     selectedWaterLevel: DEMOLEVEL,
     fairwayCoordinates: [],
     startPoint: null,
-    endPoint: null
+    endPoint: null,
+    selectedMorph: null
   },
   getters: {
     length: state => {
@@ -37,6 +38,9 @@
     }
   },
   mutations: {
+    setSelectedMorph: (state, selectedMorph) => {
+      state.selectedMorph = selectedMorph;
+    },
     setAvailableSurveys: (state, surveys) => {
       state.availableSurveys = surveys;
     },
--- a/client/src/linetool/Linetool.vue	Wed Oct 24 13:35:15 2018 +0200
+++ b/client/src/linetool/Linetool.vue	Wed Oct 24 14:17:51 2018 +0200
@@ -51,8 +51,8 @@
   },
   computed: {
     ...mapGetters("application", ["drawMode"]),
-    ...mapState("identifystore", ["identifiedFeatures", "selectedMorph"]),
-    ...mapState("morphstore", ["selectedMorph"]),
+    ...mapState("identifystore", ["identifiedFeatures"]),
+    ...mapState("fairwayprofile", ["selectedMorph"]),
     icon() {
       return {
         fa: true,
--- a/client/src/map/Maplayer.vue	Wed Oct 24 13:35:15 2018 +0200
+++ b/client/src/map/Maplayer.vue	Wed Oct 24 14:17:51 2018 +0200
@@ -78,7 +78,7 @@
   computed: {
     ...mapGetters("mapstore", ["layers", "getLayerByName"]),
     ...mapState("mapstore", ["openLayersMap"]),
-    ...mapState("morphstore", ["selectedMorph"]),
+    ...mapState("fairwayprofile", ["selectedMorph"]),
     mapStyle() {
       return {
         mapfull: !this.split,
--- a/client/src/morphtool/Morphtool.vue	Wed Oct 24 13:35:15 2018 +0200
+++ b/client/src/morphtool/Morphtool.vue	Wed Oct 24 14:17:51 2018 +0200
@@ -5,13 +5,21 @@
                 <div class="headline">
                     <h4>{{bottleneckName}}</h4>
                     <hr>
-                    <div @click="clearSelection" class="float-left ui-element d-flex morphtoolminus">
+                    <div
+                        @click="clearSelection"
+                        class="float-left ui-element d-flex morphtoolminus"
+                    >
                         <i class="fa fa-close morphtoolsminus"></i>
                     </div>
                 </div>
                 <ul class="list-group surveylist">
-                    <li v-for="survey of surveyList.surveys" :key="survey.data_info" class="list-group-item" @click.prevent="selectSurvey(survey)">
-                        <a href="#" @click.prevent="">{{survey.date_info}}</a>
+                    <li
+                        v-for="survey of surveyList.surveys"
+                        :key="survey.data_info"
+                        class="list-group-item"
+                        @click.prevent="selectSurvey(survey)"
+                    >
+                        <a href="#" @click.prevent>{{survey.date_info}}</a>
                     </li>
                 </ul>
             </div>
@@ -20,7 +28,10 @@
             <div class="d-flex flex-row justify-content-between">
                 <i class="fa fa-close text-danger"></i>
                 <small>Bottleneck:&nbsp;</small>
-                <h6>{{bottleneckName}} <small>( {{selectedMorph.date_info}} )</small></h6>
+                <h6>
+                    {{bottleneckName}}
+                    <small>( {{selectedMorph.date_info}} )</small>
+                </h6>
             </div>
         </div>
     </div>
@@ -111,14 +122,14 @@
   computed: {
     ...mapGetters("application", ["drawMode"]),
     ...mapState("identifystore", ["identifiedFeatures"]),
-    ...mapState("morphstore", ["selectedMorph"]),
+    ...mapState("fairwayprofile", ["selectedMorph"]),
     selectedBottleneck: function() {
       if (this.identifiedFeatures && !this.drawMode) {
         for (let feature of this.identifiedFeatures) {
           let id = feature.getId();
           // RegExp.prototype.test() works with number, str and undefined
           if (/^bottlenecks\./.test(id)) {
-            this.$store.commit("morphstore/setSelectedMorph", null);
+            this.$store.commit("fairwayprofile/setSelectedMorph", null);
             return feature;
           }
         }
@@ -163,12 +174,12 @@
         });
     },
     selectSurvey(survey) {
-      this.$store.commit("morphstore/setSelectedMorph", survey);
+      this.$store.commit("fairwayprofile/setSelectedMorph", survey);
       this.surveyList = null;
     },
     clearSelection() {
       this.$store.commit("identifystore/setIdentifiedFeatures", []);
-      this.$store.commit("morphstore/setSelectedMorph", null);
+      this.$store.commit("fairwayprofile/setSelectedMorph", null);
       this.surveyList = null;
       if (this.drawMode) {
         this.$store.commit("application/toggleDrawModeLine");
--- a/client/src/morphtool/store.js	Wed Oct 24 13:35:15 2018 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,32 +0,0 @@
-/*
- * This is Free Software under GNU Affero General Public License v >= 3.0
- * without warranty, see README.md and license for details.
- * 
- * SPDX-License-Identifier: AGPL-3.0-or-later
- * License-Filename: LICENSES/AGPL-3.0.txt
- * 
- * Copyright (C) 2018 by via donau 
- *   – Österreichische Wasserstraßen-Gesellschaft mbH
- * Software engineering by Intevation GmbH
- * 
- * Author(s):
- * Thomas Junk <thomas.junk@intevation.de>
- */
-const MorphStore = {
-  namespaced: true,
-  state: {
-    selectedMorph: null
-  },
-  getters: {
-    selectedMorph: state => {
-      return state.selectedMorph;
-    }
-  },
-  mutations: {
-    setSelectedMorph: (state, selectedMorph) => {
-      state.selectedMorph = selectedMorph;
-    }
-  }
-};
-
-export default MorphStore;
--- a/client/src/store.js	Wed Oct 24 13:35:15 2018 +0200
+++ b/client/src/store.js	Wed Oct 24 14:17:51 2018 +0200
@@ -21,7 +21,6 @@
 import mapstore from "./map/store";
 import FairwayProfile from "./fairway/store";
 import IdentifyStore from "./identify/store";
-import MorphStore from "./morphtool/store";
 
 Vue.use(Vuex);
 
@@ -31,7 +30,6 @@
     fairwayprofile: FairwayProfile,
     identifystore: IdentifyStore,
     mapstore: mapstore,
-    morphstore: MorphStore,
     user: user,
     usermanagement: usermanagement
   }