comparison client/src/components/staging/Staging.vue @ 1618:9f5090fe130f

fix:reimported STATES in staging view
author Thomas Junk <thomas.junk@intevation.de>
date Tue, 18 Dec 2018 12:57:43 +0100
parents 95641748383f
children 2e4ec4251c57
comparison
equal deleted inserted replaced
1617:f4b31cf5b656 1618:9f5090fe130f
60 * Thomas Junk <thomas.junk@intevation.de> 60 * Thomas Junk <thomas.junk@intevation.de>
61 * Markus Kottländer <markus@intevation.de> 61 * Markus Kottländer <markus@intevation.de>
62 */ 62 */
63 import { mapState } from "vuex"; 63 import { mapState } from "vuex";
64 import { HTTP } from "@/lib/http.js"; 64 import { HTTP } from "@/lib/http.js";
65 import { displayError, displayInfo } from "@/lib/errors.js";
66 import StagingDetail from "./StagingDetail";
65 import { STATES } from "@/store/imports.js"; 67 import { STATES } from "@/store/imports.js";
66 import { displayError, displayInfo } from "@/lib/errors.js";
67 import { formatSurveyDate } from "@/lib/date.js";
68 import StagingDetail from "./StagingDetail";
69 68
70 export default { 69 export default {
71 data() { 70 data() {
72 return {}; 71 return {};
73 }, 72 },
87 ); 86 );
88 return result; 87 return result;
89 }); 88 });
90 } 89 }
91 }, 90 },
92 STATES: STATES,
93 methods: { 91 methods: {
94 formatSurveyDate(date) {
95 return formatSurveyDate(date);
96 },
97 loadData() { 92 loadData() {
98 this.$store.dispatch("imports/getStaging").catch(error => { 93 this.$store.dispatch("imports/getStaging").catch(error => {
99 const { status, data } = error.response; 94 const { status, data } = error.response;
100 displayError({ 95 displayError({
101 title: "Backend Error", 96 title: "Backend Error",
141 displayError({ 136 displayError({
142 title: "Backend Error", 137 title: "Backend Error",
143 message: `${status}: ${data.message || data}` 138 message: `${status}: ${data.message || data}`
144 }); 139 });
145 }); 140 });
146 },
147 needsApproval(item) {
148 return item.status === STATES.NEEDSAPPROVAL;
149 },
150 isRejected(item) {
151 return item.status === STATES.REJECTED;
152 },
153 isApproved(item) {
154 return item.status === STATES.APPROVED;
155 },
156 zoomTo(id) {
157 if (!id) return;
158 const soundingResult = this.filteredData.filter(x => x.id == id)[0];
159 const { lat, lon, bottleneck, date } = soundingResult.summary;
160 const coordinates = [lat, lon];
161
162 this.$store.commit("map/moveMap", {
163 coordinates: coordinates,
164 zoom: 17,
165 preventZoomOut: true
166 });
167 this.$store
168 .dispatch("bottlenecks/setSelectedBottleneck", bottleneck)
169 .then(() => {
170 this.$store.commit("bottlenecks/setSelectedSurveyByDate", date);
171 });
172 },
173 toggleApproval(id, newStatus) {
174 this.$store.commit("imports/toggleApproval", {
175 id: id,
176 newStatus: newStatus
177 });
178 } 141 }
179 } 142 },
143 STATES: STATES
180 }; 144 };
181 </script> 145 </script>
182 146
183 <style lang="scss" scoped> 147 <style lang="scss" scoped>
184 .refresh { 148 .refresh {