comparison client/src/components/Bottlenecks.vue @ 5572:3b842e951317 surveysperbottleneckid

change use from name of bottleneck to its id.
author Thomas Junk <thomas.junk@intevation.de>
date Tue, 20 Jul 2021 17:07:51 +0200
parents 2ad3a29e0e14
children 271888ef85bc
comparison
equal deleted inserted replaced
5472:9321d9fb719f 5572:3b842e951317
136 }, 136 },
137 selectSurvey(survey, bottleneck) { 137 selectSurvey(survey, bottleneck) {
138 this.$store 138 this.$store
139 .dispatch( 139 .dispatch(
140 "bottlenecks/setSelectedBottleneck", 140 "bottlenecks/setSelectedBottleneck",
141 bottleneck.properties.name 141 bottleneck.properties.bottleneck_id
142 ) 142 )
143 .then(() => { 143 .then(() => {
144 this.$store.commit("bottlenecks/selectedSurvey", survey); 144 this.$store.commit("bottlenecks/selectedSurvey", survey);
145 }) 145 })
146 .then(() => { 146 .then(() => {
153 }, 153 },
154 selectBottleneck(bottleneck) { 154 selectBottleneck(bottleneck) {
155 this.$store 155 this.$store
156 .dispatch( 156 .dispatch(
157 "bottlenecks/setSelectedBottleneck", 157 "bottlenecks/setSelectedBottleneck",
158 bottleneck.properties.name 158 bottleneck.properties.bottleneck_id
159 ) 159 )
160 .then(() => { 160 .then(() => {
161 this.$store.dispatch("map/moveToFeauture", { 161 this.$store.dispatch("map/moveToFeauture", {
162 feature: bottleneck, 162 feature: bottleneck,
163 zoom: 16, 163 zoom: 16,
173 if (bottleneck === this.openBottleneck) { 173 if (bottleneck === this.openBottleneck) {
174 this.openBottleneck = null; 174 this.openBottleneck = null;
175 this.openBottleneckSurveys = null; 175 this.openBottleneckSurveys = null;
176 } else { 176 } else {
177 this.loading = bottleneck; 177 this.loading = bottleneck;
178 HTTP.get("/surveys/" + encodeURIComponent(bottleneck.properties.name), { 178 HTTP.get(
179 headers: { 179 "/surveys/" + encodeURIComponent(bottleneck.properties.bottleneck_id),
180 "X-Gemma-Auth": localStorage.getItem("token"), 180 {
181 "Content-type": "text/xml; charset=UTF-8" 181 headers: {
182 "X-Gemma-Auth": localStorage.getItem("token"),
183 "Content-type": "text/xml; charset=UTF-8"
184 }
182 } 185 }
183 }) 186 )
184 .then(response => { 187 .then(response => {
185 this.openBottleneckSurveys = response.data.surveys.sort((a, b) => { 188 this.openBottleneckSurveys = response.data.surveys.sort((a, b) => {
186 return a.date_info < b.date_info ? 1 : -1; 189 return a.date_info < b.date_info ? 1 : -1;
187 }); 190 });
188 this.openBottleneck = bottleneck; 191 this.openBottleneck = bottleneck;