comparison client/src/morphtool/Morphtool.vue @ 975:3da707172772

refac: removed technical debt Cleaned up mapstore to adhere more to Single Repsonsibility Principle (SRP)
author Thomas Junk <thomas.junk@intevation.de>
date Thu, 18 Oct 2018 16:47:17 +0200
parents d7f34791b18d
children d9cc1e906469
comparison
equal deleted inserted replaced
974:7a89313f0ead 975:3da707172772
91 surveyList: null 91 surveyList: null
92 }; 92 };
93 }, 93 },
94 computed: { 94 computed: {
95 ...mapGetters("application", ["drawMode"]), 95 ...mapGetters("application", ["drawMode"]),
96 ...mapState("mapstore", ["identifiedFeatures", "selectedMorph"]), 96 ...mapState("identifystore", ["identifiedFeatures"]),
97 ...mapState("morphstore", ["selectedMorph"]),
97 selectedBottleneck: function() { 98 selectedBottleneck: function() {
98 if (this.identifiedFeatures && !this.drawMode) { 99 if (this.identifiedFeatures && !this.drawMode) {
99 for (let feature of this.identifiedFeatures) { 100 for (let feature of this.identifiedFeatures) {
100 let id = feature.getId(); 101 let id = feature.getId();
101 // RegExp.prototype.test() works with number, str and undefined 102 // RegExp.prototype.test() works with number, str and undefined
102 if (/^bottlenecks\./.test(id)) { 103 if (/^bottlenecks\./.test(id)) {
103 this.$store.commit("mapstore/setSelectedMorph", null); 104 this.$store.commit("morphstore/setSelectedMorph", null);
104 return feature; 105 return feature;
105 } 106 }
106 } 107 }
107 } 108 }
108 return null; 109 return null;
138 message: `${status}: ${data.message || data}` 139 message: `${status}: ${data.message || data}`
139 }); 140 });
140 }); 141 });
141 }, 142 },
142 selectSurvey(survey) { 143 selectSurvey(survey) {
143 this.$store.commit("mapstore/setSelectedMorph", survey); 144 this.$store.commit("morphstore/setSelectedMorph", survey);
144 this.surveyList = null; 145 this.surveyList = null;
145 }, 146 },
146 clearSelection() { 147 clearSelection() {
147 this.$store.commit("mapstore/setIdentifiedFeatures", []); 148 this.$store.commit("identifystore/setIdentifiedFeatures", []);
148 this.$store.commit("mapstore/setSelectedMorph", null); 149 this.$store.commit("morphstore/setSelectedMorph", null);
149 this.surveyList = null; 150 this.surveyList = null;
150 if (this.drawMode) { 151 if (this.drawMode) {
151 this.$store.commit("application/toggleDrawModeLine"); 152 this.$store.commit("application/toggleDrawModeLine");
152 } 153 }
153 } 154 }