annotate client/src/store/bottlenecks.js @ 4488:bff6c5c1db4f

client: pdf-gen: improve adding bottleneck info to pdf * Check if the bottleneck is in the current view to add its info to the exported pdf and the pdf filename, this avoid wrong filename and wrong info in pdf in case view has been changed to another location. * Set the bottleneck to print after moving to it in map.
author Fadi Abbud <fadi.abbud@intevation.de>
date Fri, 27 Sep 2019 11:15:02 +0200
parents 3138836bf840
children 2e47b32a389d
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1362
ca33ad696594 remove the first empyty lines
Fadi Abbud <fadi.abbud@intevation.de>
parents: 1296
diff changeset
1 /* This is Free Software under GNU Affero General Public License v >= 3.0
1096
aa1f5daf6fc9 refac: centralized stores
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
2 * without warranty, see README.md and license for details.
aa1f5daf6fc9 refac: centralized stores
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
3 *
aa1f5daf6fc9 refac: centralized stores
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
4 * SPDX-License-Identifier: AGPL-3.0-or-later
aa1f5daf6fc9 refac: centralized stores
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
5 * License-Filename: LICENSES/AGPL-3.0.txt
aa1f5daf6fc9 refac: centralized stores
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
6 *
aa1f5daf6fc9 refac: centralized stores
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
7 * Copyright (C) 2018 by via donau
aa1f5daf6fc9 refac: centralized stores
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
8 * – Österreichische Wasserstraßen-Gesellschaft mbH
aa1f5daf6fc9 refac: centralized stores
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
9 * Software engineering by Intevation GmbH
aa1f5daf6fc9 refac: centralized stores
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
10 *
aa1f5daf6fc9 refac: centralized stores
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
11 * Author(s):
aa1f5daf6fc9 refac: centralized stores
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
12 * Markus Kottländer <markuks.kottlaender@intevation.de>
1363
d0c4d17ee7ab add missing authors
Fadi Abbud <fadi.abbud@intevation.de>
parents: 1362
diff changeset
13 * Thomas Junk <thomas.junk@intevation.de>
1096
aa1f5daf6fc9 refac: centralized stores
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
14 */
1625
de4e4dcb8f87 staging area: implemented details and zoom to bbox
Thomas Junk <thomas.junk@intevation.de>
parents: 1536
diff changeset
15 import { HTTP } from "@/lib/http";
2985
1b8bb4f89227 client: removed .js and .vue extention from imports
Markus Kottlaender <markus@intevation.de>
parents: 2957
diff changeset
16 import { WFS } from "ol/format";
1b8bb4f89227 client: removed .js and .vue extention from imports
Markus Kottlaender <markus@intevation.de>
parents: 2957
diff changeset
17 import { displayError } from "@/lib/errors";
1096
aa1f5daf6fc9 refac: centralized stores
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
18
1296
99c039e86624 replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
19 // initial state
99c039e86624 replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
20 const init = () => {
99c039e86624 replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
21 return {
2438
bbc31150248c client: import soundingresults: depthreferences from selected bottleneck
Markus Kottlaender <markus@intevation.de>
parents: 2436
diff changeset
22 bottlenecks: [],
2436
64ff5984351e client: renamed store property
Markus Kottlaender <markus@intevation.de>
parents: 2435
diff changeset
23 bottlenecksList: [],
1111
f106aee673e7 selected bottleneck and surveys now handled by bottleneck store
Markus Kottlaender <markus@intevation.de>
parents: 1096
diff changeset
24 selectedBottleneck: null,
f106aee673e7 selected bottleneck and surveys now handled by bottleneck store
Markus Kottlaender <markus@intevation.de>
parents: 1096
diff changeset
25 surveys: [],
1372
553aadd97087 new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents: 1363
diff changeset
26 selectedSurvey: null,
4488
bff6c5c1db4f client: pdf-gen: improve adding bottleneck info to pdf
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3692
diff changeset
27 surveysLoading: false,
bff6c5c1db4f client: pdf-gen: improve adding bottleneck info to pdf
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3692
diff changeset
28 bottleneckForPrint: null
1296
99c039e86624 replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
29 };
99c039e86624 replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
30 };
99c039e86624 replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
31
99c039e86624 replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
32 export default {
99c039e86624 replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
33 init,
99c039e86624 replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
34 namespaced: true,
99c039e86624 replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
35 state: init(),
3236
5914d615f703 available_fairway_depth: use the store luke
Thomas Junk <thomas.junk@intevation.de>
parents: 3204
diff changeset
36 getters: {
3407
7ea54c3b3fd6 afd: breaks for bottlenecks
Thomas Junk <thomas.junk@intevation.de>
parents: 3236
diff changeset
37 limitingFactorsPerBottleneck: state => {
7ea54c3b3fd6 afd: breaks for bottlenecks
Thomas Junk <thomas.junk@intevation.de>
parents: 3236
diff changeset
38 if (state.bottlenecks.length === 0) return {};
7ea54c3b3fd6 afd: breaks for bottlenecks
Thomas Junk <thomas.junk@intevation.de>
parents: 3236
diff changeset
39 return state.bottlenecks.reduce((o, n) => {
7ea54c3b3fd6 afd: breaks for bottlenecks
Thomas Junk <thomas.junk@intevation.de>
parents: 3236
diff changeset
40 o[n.properties.objnam] = n.properties.limiting;
7ea54c3b3fd6 afd: breaks for bottlenecks
Thomas Junk <thomas.junk@intevation.de>
parents: 3236
diff changeset
41 return o;
7ea54c3b3fd6 afd: breaks for bottlenecks
Thomas Junk <thomas.junk@intevation.de>
parents: 3236
diff changeset
42 }, {});
7ea54c3b3fd6 afd: breaks for bottlenecks
Thomas Junk <thomas.junk@intevation.de>
parents: 3236
diff changeset
43 },
3236
5914d615f703 available_fairway_depth: use the store luke
Thomas Junk <thomas.junk@intevation.de>
parents: 3204
diff changeset
44 orderedBottlenecks: state => {
5914d615f703 available_fairway_depth: use the store luke
Thomas Junk <thomas.junk@intevation.de>
parents: 3204
diff changeset
45 let groupedBottlenecks = {},
5914d615f703 available_fairway_depth: use the store luke
Thomas Junk <thomas.junk@intevation.de>
parents: 3204
diff changeset
46 orderedGroups = {};
5914d615f703 available_fairway_depth: use the store luke
Thomas Junk <thomas.junk@intevation.de>
parents: 3204
diff changeset
47
5914d615f703 available_fairway_depth: use the store luke
Thomas Junk <thomas.junk@intevation.de>
parents: 3204
diff changeset
48 // group bottlenecks by cc
5914d615f703 available_fairway_depth: use the store luke
Thomas Junk <thomas.junk@intevation.de>
parents: 3204
diff changeset
49 state.bottlenecksList.forEach(bn => {
5914d615f703 available_fairway_depth: use the store luke
Thomas Junk <thomas.junk@intevation.de>
parents: 3204
diff changeset
50 let cc = bn.properties.responsible_country;
5914d615f703 available_fairway_depth: use the store luke
Thomas Junk <thomas.junk@intevation.de>
parents: 3204
diff changeset
51 if (groupedBottlenecks.hasOwnProperty(cc)) {
5914d615f703 available_fairway_depth: use the store luke
Thomas Junk <thomas.junk@intevation.de>
parents: 3204
diff changeset
52 groupedBottlenecks[cc].push(bn);
5914d615f703 available_fairway_depth: use the store luke
Thomas Junk <thomas.junk@intevation.de>
parents: 3204
diff changeset
53 } else {
5914d615f703 available_fairway_depth: use the store luke
Thomas Junk <thomas.junk@intevation.de>
parents: 3204
diff changeset
54 groupedBottlenecks[cc] = [bn];
5914d615f703 available_fairway_depth: use the store luke
Thomas Junk <thomas.junk@intevation.de>
parents: 3204
diff changeset
55 }
5914d615f703 available_fairway_depth: use the store luke
Thomas Junk <thomas.junk@intevation.de>
parents: 3204
diff changeset
56 });
5914d615f703 available_fairway_depth: use the store luke
Thomas Junk <thomas.junk@intevation.de>
parents: 3204
diff changeset
57
5914d615f703 available_fairway_depth: use the store luke
Thomas Junk <thomas.junk@intevation.de>
parents: 3204
diff changeset
58 // order groups by cc
5914d615f703 available_fairway_depth: use the store luke
Thomas Junk <thomas.junk@intevation.de>
parents: 3204
diff changeset
59 Object.keys(groupedBottlenecks)
5914d615f703 available_fairway_depth: use the store luke
Thomas Junk <thomas.junk@intevation.de>
parents: 3204
diff changeset
60 .sort()
5914d615f703 available_fairway_depth: use the store luke
Thomas Junk <thomas.junk@intevation.de>
parents: 3204
diff changeset
61 .forEach(cc => (orderedGroups[cc] = groupedBottlenecks[cc]));
5914d615f703 available_fairway_depth: use the store luke
Thomas Junk <thomas.junk@intevation.de>
parents: 3204
diff changeset
62
5914d615f703 available_fairway_depth: use the store luke
Thomas Junk <thomas.junk@intevation.de>
parents: 3204
diff changeset
63 return orderedGroups;
5914d615f703 available_fairway_depth: use the store luke
Thomas Junk <thomas.junk@intevation.de>
parents: 3204
diff changeset
64 }
5914d615f703 available_fairway_depth: use the store luke
Thomas Junk <thomas.junk@intevation.de>
parents: 3204
diff changeset
65 },
1096
aa1f5daf6fc9 refac: centralized stores
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
66 mutations: {
4488
bff6c5c1db4f client: pdf-gen: improve adding bottleneck info to pdf
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3692
diff changeset
67 setBottleneckForPrint: (state, bottleneck) => {
bff6c5c1db4f client: pdf-gen: improve adding bottleneck info to pdf
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3692
diff changeset
68 state.bottleneckForPrint = bottleneck;
bff6c5c1db4f client: pdf-gen: improve adding bottleneck info to pdf
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3692
diff changeset
69 },
2438
bbc31150248c client: import soundingresults: depthreferences from selected bottleneck
Markus Kottlaender <markus@intevation.de>
parents: 2436
diff changeset
70 setBottlenecks: (state, bottlenecks) => {
bbc31150248c client: import soundingresults: depthreferences from selected bottleneck
Markus Kottlaender <markus@intevation.de>
parents: 2436
diff changeset
71 state.bottlenecks = bottlenecks;
bbc31150248c client: import soundingresults: depthreferences from selected bottleneck
Markus Kottlaender <markus@intevation.de>
parents: 2436
diff changeset
72 },
2436
64ff5984351e client: renamed store property
Markus Kottlaender <markus@intevation.de>
parents: 2435
diff changeset
73 setBottlenecksList: (state, bottlenecksList) => {
64ff5984351e client: renamed store property
Markus Kottlaender <markus@intevation.de>
parents: 2435
diff changeset
74 state.bottlenecksList = bottlenecksList;
1111
f106aee673e7 selected bottleneck and surveys now handled by bottleneck store
Markus Kottlaender <markus@intevation.de>
parents: 1096
diff changeset
75 },
f106aee673e7 selected bottleneck and surveys now handled by bottleneck store
Markus Kottlaender <markus@intevation.de>
parents: 1096
diff changeset
76 setSelectedBottleneck: (state, name) => {
f106aee673e7 selected bottleneck and surveys now handled by bottleneck store
Markus Kottlaender <markus@intevation.de>
parents: 1096
diff changeset
77 state.selectedBottleneck = name;
f106aee673e7 selected bottleneck and surveys now handled by bottleneck store
Markus Kottlaender <markus@intevation.de>
parents: 1096
diff changeset
78 },
f106aee673e7 selected bottleneck and surveys now handled by bottleneck store
Markus Kottlaender <markus@intevation.de>
parents: 1096
diff changeset
79 setSurveys(state, surveys) {
f106aee673e7 selected bottleneck and surveys now handled by bottleneck store
Markus Kottlaender <markus@intevation.de>
parents: 1096
diff changeset
80 state.surveys = surveys;
f106aee673e7 selected bottleneck and surveys now handled by bottleneck store
Markus Kottlaender <markus@intevation.de>
parents: 1096
diff changeset
81 },
1516
6b3756676bbe refac: bottlenecks and surveydata are now retrieved via promises
Thomas Junk <thomas.junk@intevation.de>
parents: 1511
diff changeset
82 setSelectedSurveyByDate(state, date) {
6b3756676bbe refac: bottlenecks and surveydata are now retrieved via promises
Thomas Junk <thomas.junk@intevation.de>
parents: 1511
diff changeset
83 const survey = state.surveys.filter(x => x.date_info === date)[0];
6b3756676bbe refac: bottlenecks and surveydata are now retrieved via promises
Thomas Junk <thomas.junk@intevation.de>
parents: 1511
diff changeset
84 state.selectedSurvey = survey;
6b3756676bbe refac: bottlenecks and surveydata are now retrieved via promises
Thomas Junk <thomas.junk@intevation.de>
parents: 1511
diff changeset
85 },
6b3756676bbe refac: bottlenecks and surveydata are now retrieved via promises
Thomas Junk <thomas.junk@intevation.de>
parents: 1511
diff changeset
86 setFirstSurveySelected(state) {
6b3756676bbe refac: bottlenecks and surveydata are now retrieved via promises
Thomas Junk <thomas.junk@intevation.de>
parents: 1511
diff changeset
87 state.selectedSurvey = state.surveys[0];
6b3756676bbe refac: bottlenecks and surveydata are now retrieved via promises
Thomas Junk <thomas.junk@intevation.de>
parents: 1511
diff changeset
88 },
1394
b350b0b5cb6c refactored fairwayprofile cross cuts
Markus Kottlaender <markus@intevation.de>
parents: 1386
diff changeset
89 selectedSurvey(state, survey) {
1111
f106aee673e7 selected bottleneck and surveys now handled by bottleneck store
Markus Kottlaender <markus@intevation.de>
parents: 1096
diff changeset
90 state.selectedSurvey = survey;
1372
553aadd97087 new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents: 1363
diff changeset
91 },
553aadd97087 new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents: 1363
diff changeset
92 surveysLoading: (state, loading) => {
553aadd97087 new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents: 1363
diff changeset
93 state.surveysLoading = loading;
1096
aa1f5daf6fc9 refac: centralized stores
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
94 }
aa1f5daf6fc9 refac: centralized stores
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
95 },
aa1f5daf6fc9 refac: centralized stores
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
96 actions: {
3062
87e0422cffa7 client: draw/cut tools work now with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3044
diff changeset
97 setSelectedBottleneck({ state, commit, rootState }, name) {
1516
6b3756676bbe refac: bottlenecks and surveydata are now retrieved via promises
Thomas Junk <thomas.junk@intevation.de>
parents: 1511
diff changeset
98 return new Promise((resolve, reject) => {
6b3756676bbe refac: bottlenecks and surveydata are now retrieved via promises
Thomas Junk <thomas.junk@intevation.de>
parents: 1511
diff changeset
99 if (name !== state.selectedBottleneck) {
6b3756676bbe refac: bottlenecks and surveydata are now retrieved via promises
Thomas Junk <thomas.junk@intevation.de>
parents: 1511
diff changeset
100 commit("selectedSurvey", null);
3149
a90091aaef67 client: fairwayprofile: close profile diagram when switching bottlenecks
Markus Kottlaender <markus@intevation.de>
parents: 3062
diff changeset
101 commit("fairwayprofile/additionalSurvey", null, { root: true });
a90091aaef67 client: fairwayprofile: close profile diagram when switching bottlenecks
Markus Kottlaender <markus@intevation.de>
parents: 3062
diff changeset
102 commit("fairwayprofile/clearCurrentProfile", null, { root: true });
3062
87e0422cffa7 client: draw/cut tools work now with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3044
diff changeset
103 commit("map/cutToolEnabled", false, { root: true });
87e0422cffa7 client: draw/cut tools work now with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3044
diff changeset
104 rootState.map.openLayersMaps.forEach(m => {
87e0422cffa7 client: draw/cut tools work now with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3044
diff changeset
105 m.getLayer("CUTTOOL")
87e0422cffa7 client: draw/cut tools work now with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3044
diff changeset
106 .getSource()
87e0422cffa7 client: draw/cut tools work now with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3044
diff changeset
107 .clear();
87e0422cffa7 client: draw/cut tools work now with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3044
diff changeset
108 });
1516
6b3756676bbe refac: bottlenecks and surveydata are now retrieved via promises
Thomas Junk <thomas.junk@intevation.de>
parents: 1511
diff changeset
109 }
6b3756676bbe refac: bottlenecks and surveydata are now retrieved via promises
Thomas Junk <thomas.junk@intevation.de>
parents: 1511
diff changeset
110 commit("setSelectedBottleneck", name);
6b3756676bbe refac: bottlenecks and surveydata are now retrieved via promises
Thomas Junk <thomas.junk@intevation.de>
parents: 1511
diff changeset
111 if (name) {
6b3756676bbe refac: bottlenecks and surveydata are now retrieved via promises
Thomas Junk <thomas.junk@intevation.de>
parents: 1511
diff changeset
112 commit("surveysLoading", true);
6b3756676bbe refac: bottlenecks and surveydata are now retrieved via promises
Thomas Junk <thomas.junk@intevation.de>
parents: 1511
diff changeset
113 HTTP.get("/surveys/" + name, {
6b3756676bbe refac: bottlenecks and surveydata are now retrieved via promises
Thomas Junk <thomas.junk@intevation.de>
parents: 1511
diff changeset
114 headers: {
6b3756676bbe refac: bottlenecks and surveydata are now retrieved via promises
Thomas Junk <thomas.junk@intevation.de>
parents: 1511
diff changeset
115 "X-Gemma-Auth": localStorage.getItem("token"),
6b3756676bbe refac: bottlenecks and surveydata are now retrieved via promises
Thomas Junk <thomas.junk@intevation.de>
parents: 1511
diff changeset
116 "Content-type": "text/xml; charset=UTF-8"
6b3756676bbe refac: bottlenecks and surveydata are now retrieved via promises
Thomas Junk <thomas.junk@intevation.de>
parents: 1511
diff changeset
117 }
6b3756676bbe refac: bottlenecks and surveydata are now retrieved via promises
Thomas Junk <thomas.junk@intevation.de>
parents: 1511
diff changeset
118 })
6b3756676bbe refac: bottlenecks and surveydata are now retrieved via promises
Thomas Junk <thomas.junk@intevation.de>
parents: 1511
diff changeset
119 .then(response => {
1536
97bdcee1d4c0 Backed out changeset b4b3dfd24739
Bernhard Reiter <bernhard@intevation.de>
parents: 1535
diff changeset
120 const surveys = response.data.surveys.sort((a, b) =>
97bdcee1d4c0 Backed out changeset b4b3dfd24739
Bernhard Reiter <bernhard@intevation.de>
parents: 1535
diff changeset
121 a.date_info < b.date_info ? 1 : -1
1516
6b3756676bbe refac: bottlenecks and surveydata are now retrieved via promises
Thomas Junk <thomas.junk@intevation.de>
parents: 1511
diff changeset
122 );
6b3756676bbe refac: bottlenecks and surveydata are now retrieved via promises
Thomas Junk <thomas.junk@intevation.de>
parents: 1511
diff changeset
123 commit("setSurveys", surveys);
3204
1253fe15e3e3 client: identify: implemented popup when clicking the map and the intention is not clear...
Markus Kottlaender <markus@intevation.de>
parents: 3149
diff changeset
124 commit("setFirstSurveySelected");
1516
6b3756676bbe refac: bottlenecks and surveydata are now retrieved via promises
Thomas Junk <thomas.junk@intevation.de>
parents: 1511
diff changeset
125 resolve(response);
6b3756676bbe refac: bottlenecks and surveydata are now retrieved via promises
Thomas Junk <thomas.junk@intevation.de>
parents: 1511
diff changeset
126 })
6b3756676bbe refac: bottlenecks and surveydata are now retrieved via promises
Thomas Junk <thomas.junk@intevation.de>
parents: 1511
diff changeset
127 .catch(error => {
6b3756676bbe refac: bottlenecks and surveydata are now retrieved via promises
Thomas Junk <thomas.junk@intevation.de>
parents: 1511
diff changeset
128 commit("setSurveys", []);
6b3756676bbe refac: bottlenecks and surveydata are now retrieved via promises
Thomas Junk <thomas.junk@intevation.de>
parents: 1511
diff changeset
129 commit("selectedSurvey", null);
6b3756676bbe refac: bottlenecks and surveydata are now retrieved via promises
Thomas Junk <thomas.junk@intevation.de>
parents: 1511
diff changeset
130 const { status, data } = error.response;
6b3756676bbe refac: bottlenecks and surveydata are now retrieved via promises
Thomas Junk <thomas.junk@intevation.de>
parents: 1511
diff changeset
131 displayError({
6b3756676bbe refac: bottlenecks and surveydata are now retrieved via promises
Thomas Junk <thomas.junk@intevation.de>
parents: 1511
diff changeset
132 title: "Backend Error",
6b3756676bbe refac: bottlenecks and surveydata are now retrieved via promises
Thomas Junk <thomas.junk@intevation.de>
parents: 1511
diff changeset
133 message: `${status}: ${data.message || data}`
6b3756676bbe refac: bottlenecks and surveydata are now retrieved via promises
Thomas Junk <thomas.junk@intevation.de>
parents: 1511
diff changeset
134 });
6b3756676bbe refac: bottlenecks and surveydata are now retrieved via promises
Thomas Junk <thomas.junk@intevation.de>
parents: 1511
diff changeset
135 reject(error);
6b3756676bbe refac: bottlenecks and surveydata are now retrieved via promises
Thomas Junk <thomas.junk@intevation.de>
parents: 1511
diff changeset
136 })
6b3756676bbe refac: bottlenecks and surveydata are now retrieved via promises
Thomas Junk <thomas.junk@intevation.de>
parents: 1511
diff changeset
137 .finally(() => commit("surveysLoading", false));
6b3756676bbe refac: bottlenecks and surveydata are now retrieved via promises
Thomas Junk <thomas.junk@intevation.de>
parents: 1511
diff changeset
138 } else {
6b3756676bbe refac: bottlenecks and surveydata are now retrieved via promises
Thomas Junk <thomas.junk@intevation.de>
parents: 1511
diff changeset
139 commit("setSurveys", []);
6b3756676bbe refac: bottlenecks and surveydata are now retrieved via promises
Thomas Junk <thomas.junk@intevation.de>
parents: 1511
diff changeset
140 resolve();
6b3756676bbe refac: bottlenecks and surveydata are now retrieved via promises
Thomas Junk <thomas.junk@intevation.de>
parents: 1511
diff changeset
141 }
6b3756676bbe refac: bottlenecks and surveydata are now retrieved via promises
Thomas Junk <thomas.junk@intevation.de>
parents: 1511
diff changeset
142 });
1111
f106aee673e7 selected bottleneck and surveys now handled by bottleneck store
Markus Kottlaender <markus@intevation.de>
parents: 1096
diff changeset
143 },
2435
3679d604645e client: renamed store action
Markus Kottlaender <markus@intevation.de>
parents: 2365
diff changeset
144 loadBottlenecksList({ commit }) {
1516
6b3756676bbe refac: bottlenecks and surveydata are now retrieved via promises
Thomas Junk <thomas.junk@intevation.de>
parents: 1511
diff changeset
145 return new Promise((resolve, reject) => {
6b3756676bbe refac: bottlenecks and surveydata are now retrieved via promises
Thomas Junk <thomas.junk@intevation.de>
parents: 1511
diff changeset
146 var bottleneckFeatureCollectionRequest = new WFS().writeGetFeature({
6b3756676bbe refac: bottlenecks and surveydata are now retrieved via promises
Thomas Junk <thomas.junk@intevation.de>
parents: 1511
diff changeset
147 srsName: "EPSG:4326",
6b3756676bbe refac: bottlenecks and surveydata are now retrieved via promises
Thomas Junk <thomas.junk@intevation.de>
parents: 1511
diff changeset
148 featureNS: "gemma",
6b3756676bbe refac: bottlenecks and surveydata are now retrieved via promises
Thomas Junk <thomas.junk@intevation.de>
parents: 1511
diff changeset
149 featurePrefix: "gemma",
6b3756676bbe refac: bottlenecks and surveydata are now retrieved via promises
Thomas Junk <thomas.junk@intevation.de>
parents: 1511
diff changeset
150 featureTypes: ["bottleneck_overview"],
6b3756676bbe refac: bottlenecks and surveydata are now retrieved via promises
Thomas Junk <thomas.junk@intevation.de>
parents: 1511
diff changeset
151 outputFormat: "application/json"
6b3756676bbe refac: bottlenecks and surveydata are now retrieved via promises
Thomas Junk <thomas.junk@intevation.de>
parents: 1511
diff changeset
152 });
6b3756676bbe refac: bottlenecks and surveydata are now retrieved via promises
Thomas Junk <thomas.junk@intevation.de>
parents: 1511
diff changeset
153 HTTP.post(
6b3756676bbe refac: bottlenecks and surveydata are now retrieved via promises
Thomas Junk <thomas.junk@intevation.de>
parents: 1511
diff changeset
154 "/internal/wfs",
6b3756676bbe refac: bottlenecks and surveydata are now retrieved via promises
Thomas Junk <thomas.junk@intevation.de>
parents: 1511
diff changeset
155 new XMLSerializer().serializeToString(
6b3756676bbe refac: bottlenecks and surveydata are now retrieved via promises
Thomas Junk <thomas.junk@intevation.de>
parents: 1511
diff changeset
156 bottleneckFeatureCollectionRequest
6b3756676bbe refac: bottlenecks and surveydata are now retrieved via promises
Thomas Junk <thomas.junk@intevation.de>
parents: 1511
diff changeset
157 ),
6b3756676bbe refac: bottlenecks and surveydata are now retrieved via promises
Thomas Junk <thomas.junk@intevation.de>
parents: 1511
diff changeset
158 {
6b3756676bbe refac: bottlenecks and surveydata are now retrieved via promises
Thomas Junk <thomas.junk@intevation.de>
parents: 1511
diff changeset
159 headers: {
6b3756676bbe refac: bottlenecks and surveydata are now retrieved via promises
Thomas Junk <thomas.junk@intevation.de>
parents: 1511
diff changeset
160 "X-Gemma-Auth": localStorage.getItem("token"),
6b3756676bbe refac: bottlenecks and surveydata are now retrieved via promises
Thomas Junk <thomas.junk@intevation.de>
parents: 1511
diff changeset
161 "Content-type": "text/xml; charset=UTF-8"
6b3756676bbe refac: bottlenecks and surveydata are now retrieved via promises
Thomas Junk <thomas.junk@intevation.de>
parents: 1511
diff changeset
162 }
1096
aa1f5daf6fc9 refac: centralized stores
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
163 }
1516
6b3756676bbe refac: bottlenecks and surveydata are now retrieved via promises
Thomas Junk <thomas.junk@intevation.de>
parents: 1511
diff changeset
164 )
1111
f106aee673e7 selected bottleneck and surveys now handled by bottleneck store
Markus Kottlaender <markus@intevation.de>
parents: 1096
diff changeset
165 .then(response => {
2436
64ff5984351e client: renamed store property
Markus Kottlaender <markus@intevation.de>
parents: 2435
diff changeset
166 commit("setBottlenecksList", response.data.features);
1516
6b3756676bbe refac: bottlenecks and surveydata are now retrieved via promises
Thomas Junk <thomas.junk@intevation.de>
parents: 1511
diff changeset
167 resolve(response);
1111
f106aee673e7 selected bottleneck and surveys now handled by bottleneck store
Markus Kottlaender <markus@intevation.de>
parents: 1096
diff changeset
168 })
f106aee673e7 selected bottleneck and surveys now handled by bottleneck store
Markus Kottlaender <markus@intevation.de>
parents: 1096
diff changeset
169 .catch(error => {
1516
6b3756676bbe refac: bottlenecks and surveydata are now retrieved via promises
Thomas Junk <thomas.junk@intevation.de>
parents: 1511
diff changeset
170 reject(error);
6b3756676bbe refac: bottlenecks and surveydata are now retrieved via promises
Thomas Junk <thomas.junk@intevation.de>
parents: 1511
diff changeset
171 });
6b3756676bbe refac: bottlenecks and surveydata are now retrieved via promises
Thomas Junk <thomas.junk@intevation.de>
parents: 1511
diff changeset
172 });
2438
bbc31150248c client: import soundingresults: depthreferences from selected bottleneck
Markus Kottlaender <markus@intevation.de>
parents: 2436
diff changeset
173 },
bbc31150248c client: import soundingresults: depthreferences from selected bottleneck
Markus Kottlaender <markus@intevation.de>
parents: 2436
diff changeset
174 loadBottlenecks({ commit }) {
bbc31150248c client: import soundingresults: depthreferences from selected bottleneck
Markus Kottlaender <markus@intevation.de>
parents: 2436
diff changeset
175 return new Promise((resolve, reject) => {
bbc31150248c client: import soundingresults: depthreferences from selected bottleneck
Markus Kottlaender <markus@intevation.de>
parents: 2436
diff changeset
176 var bottleneckFeatureCollectionRequest = new WFS().writeGetFeature({
bbc31150248c client: import soundingresults: depthreferences from selected bottleneck
Markus Kottlaender <markus@intevation.de>
parents: 2436
diff changeset
177 srsName: "EPSG:4326",
bbc31150248c client: import soundingresults: depthreferences from selected bottleneck
Markus Kottlaender <markus@intevation.de>
parents: 2436
diff changeset
178 featureNS: "gemma",
bbc31150248c client: import soundingresults: depthreferences from selected bottleneck
Markus Kottlaender <markus@intevation.de>
parents: 2436
diff changeset
179 featurePrefix: "gemma",
bbc31150248c client: import soundingresults: depthreferences from selected bottleneck
Markus Kottlaender <markus@intevation.de>
parents: 2436
diff changeset
180 featureTypes: ["bottlenecks_geoserver"],
3407
7ea54c3b3fd6 afd: breaks for bottlenecks
Thomas Junk <thomas.junk@intevation.de>
parents: 3236
diff changeset
181 outputFormat: "application/json",
3692
3138836bf840 import_soundingresults: bottlenecks grouped by countrycode
Thomas Junk <thomas.junk@intevation.de>
parents: 3407
diff changeset
182 propertyNames: [
3138836bf840 import_soundingresults: bottlenecks grouped by countrycode
Thomas Junk <thomas.junk@intevation.de>
parents: 3407
diff changeset
183 "objnam",
3138836bf840 import_soundingresults: bottlenecks grouped by countrycode
Thomas Junk <thomas.junk@intevation.de>
parents: 3407
diff changeset
184 "responsible_country",
3138836bf840 import_soundingresults: bottlenecks grouped by countrycode
Thomas Junk <thomas.junk@intevation.de>
parents: 3407
diff changeset
185 "limiting",
3138836bf840 import_soundingresults: bottlenecks grouped by countrycode
Thomas Junk <thomas.junk@intevation.de>
parents: 3407
diff changeset
186 "reference_water_levels"
3138836bf840 import_soundingresults: bottlenecks grouped by countrycode
Thomas Junk <thomas.junk@intevation.de>
parents: 3407
diff changeset
187 ]
2438
bbc31150248c client: import soundingresults: depthreferences from selected bottleneck
Markus Kottlaender <markus@intevation.de>
parents: 2436
diff changeset
188 });
bbc31150248c client: import soundingresults: depthreferences from selected bottleneck
Markus Kottlaender <markus@intevation.de>
parents: 2436
diff changeset
189 HTTP.post(
bbc31150248c client: import soundingresults: depthreferences from selected bottleneck
Markus Kottlaender <markus@intevation.de>
parents: 2436
diff changeset
190 "/internal/wfs",
bbc31150248c client: import soundingresults: depthreferences from selected bottleneck
Markus Kottlaender <markus@intevation.de>
parents: 2436
diff changeset
191 new XMLSerializer().serializeToString(
bbc31150248c client: import soundingresults: depthreferences from selected bottleneck
Markus Kottlaender <markus@intevation.de>
parents: 2436
diff changeset
192 bottleneckFeatureCollectionRequest
bbc31150248c client: import soundingresults: depthreferences from selected bottleneck
Markus Kottlaender <markus@intevation.de>
parents: 2436
diff changeset
193 ),
bbc31150248c client: import soundingresults: depthreferences from selected bottleneck
Markus Kottlaender <markus@intevation.de>
parents: 2436
diff changeset
194 {
bbc31150248c client: import soundingresults: depthreferences from selected bottleneck
Markus Kottlaender <markus@intevation.de>
parents: 2436
diff changeset
195 headers: {
bbc31150248c client: import soundingresults: depthreferences from selected bottleneck
Markus Kottlaender <markus@intevation.de>
parents: 2436
diff changeset
196 "X-Gemma-Auth": localStorage.getItem("token"),
bbc31150248c client: import soundingresults: depthreferences from selected bottleneck
Markus Kottlaender <markus@intevation.de>
parents: 2436
diff changeset
197 "Content-type": "text/xml; charset=UTF-8"
bbc31150248c client: import soundingresults: depthreferences from selected bottleneck
Markus Kottlaender <markus@intevation.de>
parents: 2436
diff changeset
198 }
bbc31150248c client: import soundingresults: depthreferences from selected bottleneck
Markus Kottlaender <markus@intevation.de>
parents: 2436
diff changeset
199 }
bbc31150248c client: import soundingresults: depthreferences from selected bottleneck
Markus Kottlaender <markus@intevation.de>
parents: 2436
diff changeset
200 )
bbc31150248c client: import soundingresults: depthreferences from selected bottleneck
Markus Kottlaender <markus@intevation.de>
parents: 2436
diff changeset
201 .then(response => {
bbc31150248c client: import soundingresults: depthreferences from selected bottleneck
Markus Kottlaender <markus@intevation.de>
parents: 2436
diff changeset
202 commit("setBottlenecks", response.data.features);
bbc31150248c client: import soundingresults: depthreferences from selected bottleneck
Markus Kottlaender <markus@intevation.de>
parents: 2436
diff changeset
203 resolve(response);
bbc31150248c client: import soundingresults: depthreferences from selected bottleneck
Markus Kottlaender <markus@intevation.de>
parents: 2436
diff changeset
204 })
bbc31150248c client: import soundingresults: depthreferences from selected bottleneck
Markus Kottlaender <markus@intevation.de>
parents: 2436
diff changeset
205 .catch(error => {
bbc31150248c client: import soundingresults: depthreferences from selected bottleneck
Markus Kottlaender <markus@intevation.de>
parents: 2436
diff changeset
206 reject(error);
bbc31150248c client: import soundingresults: depthreferences from selected bottleneck
Markus Kottlaender <markus@intevation.de>
parents: 2436
diff changeset
207 });
bbc31150248c client: import soundingresults: depthreferences from selected bottleneck
Markus Kottlaender <markus@intevation.de>
parents: 2436
diff changeset
208 });
1096
aa1f5daf6fc9 refac: centralized stores
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
209 }
aa1f5daf6fc9 refac: centralized stores
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
210 }
aa1f5daf6fc9 refac: centralized stores
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
211 };