Mercurial > gemma
annotate client/src/store/bottlenecks.js @ 3044:c71373594719
client: map: prepared store to hold multiple map objects
This will be necessary to sync maps, toggle layers per map, etc. Therefore the methods to move the map
(moveToExtent, etc.) became actions instead of mutations.
author | Markus Kottlaender <markus@intevation.de> |
---|---|
date | Sat, 13 Apr 2019 16:02:06 +0200 |
parents | 44493664d40e |
children | 87e0422cffa7 |
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 | 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, |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
1363
diff
changeset
|
27 surveysLoading: false |
1296
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
28 }; |
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 export default { |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
32 init, |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
33 namespaced: true, |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
34 state: init(), |
1096
aa1f5daf6fc9
refac: centralized stores
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
35 mutations: { |
2438
bbc31150248c
client: import soundingresults: depthreferences from selected bottleneck
Markus Kottlaender <markus@intevation.de>
parents:
2436
diff
changeset
|
36 setBottlenecks: (state, bottlenecks) => { |
bbc31150248c
client: import soundingresults: depthreferences from selected bottleneck
Markus Kottlaender <markus@intevation.de>
parents:
2436
diff
changeset
|
37 state.bottlenecks = bottlenecks; |
bbc31150248c
client: import soundingresults: depthreferences from selected bottleneck
Markus Kottlaender <markus@intevation.de>
parents:
2436
diff
changeset
|
38 }, |
2436
64ff5984351e
client: renamed store property
Markus Kottlaender <markus@intevation.de>
parents:
2435
diff
changeset
|
39 setBottlenecksList: (state, bottlenecksList) => { |
64ff5984351e
client: renamed store property
Markus Kottlaender <markus@intevation.de>
parents:
2435
diff
changeset
|
40 state.bottlenecksList = bottlenecksList; |
1111
f106aee673e7
selected bottleneck and surveys now handled by bottleneck store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
41 }, |
f106aee673e7
selected bottleneck and surveys now handled by bottleneck store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
42 setSelectedBottleneck: (state, name) => { |
f106aee673e7
selected bottleneck and surveys now handled by bottleneck store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
43 state.selectedBottleneck = name; |
f106aee673e7
selected bottleneck and surveys now handled by bottleneck store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
44 }, |
f106aee673e7
selected bottleneck and surveys now handled by bottleneck store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
45 setSurveys(state, surveys) { |
f106aee673e7
selected bottleneck and surveys now handled by bottleneck store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
46 state.surveys = surveys; |
f106aee673e7
selected bottleneck and surveys now handled by bottleneck store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
47 }, |
1516
6b3756676bbe
refac: bottlenecks and surveydata are now retrieved via promises
Thomas Junk <thomas.junk@intevation.de>
parents:
1511
diff
changeset
|
48 setSelectedSurveyByDate(state, date) { |
6b3756676bbe
refac: bottlenecks and surveydata are now retrieved via promises
Thomas Junk <thomas.junk@intevation.de>
parents:
1511
diff
changeset
|
49 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
|
50 state.selectedSurvey = survey; |
6b3756676bbe
refac: bottlenecks and surveydata are now retrieved via promises
Thomas Junk <thomas.junk@intevation.de>
parents:
1511
diff
changeset
|
51 }, |
6b3756676bbe
refac: bottlenecks and surveydata are now retrieved via promises
Thomas Junk <thomas.junk@intevation.de>
parents:
1511
diff
changeset
|
52 setFirstSurveySelected(state) { |
6b3756676bbe
refac: bottlenecks and surveydata are now retrieved via promises
Thomas Junk <thomas.junk@intevation.de>
parents:
1511
diff
changeset
|
53 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
|
54 }, |
1394
b350b0b5cb6c
refactored fairwayprofile cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1386
diff
changeset
|
55 selectedSurvey(state, survey) { |
1111
f106aee673e7
selected bottleneck and surveys now handled by bottleneck store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
56 state.selectedSurvey = survey; |
1372
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
1363
diff
changeset
|
57 }, |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
1363
diff
changeset
|
58 surveysLoading: (state, loading) => { |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
1363
diff
changeset
|
59 state.surveysLoading = loading; |
1096
aa1f5daf6fc9
refac: centralized stores
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
60 } |
aa1f5daf6fc9
refac: centralized stores
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
61 }, |
aa1f5daf6fc9
refac: centralized stores
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
62 actions: { |
3044
c71373594719
client: map: prepared store to hold multiple map objects
Markus Kottlaender <markus@intevation.de>
parents:
3006
diff
changeset
|
63 setSelectedBottleneck({ state, commit, rootState, rootGetters }, name) { |
1516
6b3756676bbe
refac: bottlenecks and surveydata are now retrieved via promises
Thomas Junk <thomas.junk@intevation.de>
parents:
1511
diff
changeset
|
64 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
|
65 if (name !== state.selectedBottleneck) { |
6b3756676bbe
refac: bottlenecks and surveydata are now retrieved via promises
Thomas Junk <thomas.junk@intevation.de>
parents:
1511
diff
changeset
|
66 commit("selectedSurvey", null); |
2549
9bf6b767a56a
client: refactored and improved splitscreen for diagrams
Markus Kottlaender <markus@intevation.de>
parents:
2438
diff
changeset
|
67 commit("application/splitscreenLoading", true, { root: true }); |
1516
6b3756676bbe
refac: bottlenecks and surveydata are now retrieved via promises
Thomas Junk <thomas.junk@intevation.de>
parents:
1511
diff
changeset
|
68 commit("application/showSplitscreen", false, { root: true }); |
2566
83b938bf4da9
client: prepared store and minimized splitscreens for multiple simultaneous diagrams
Markus Kottlaender <markus@intevation.de>
parents:
2549
diff
changeset
|
69 commit("application/removeSplitscreen", "fairwayprofile", { |
83b938bf4da9
client: prepared store and minimized splitscreens for multiple simultaneous diagrams
Markus Kottlaender <markus@intevation.de>
parents:
2549
diff
changeset
|
70 root: true |
83b938bf4da9
client: prepared store and minimized splitscreens for multiple simultaneous diagrams
Markus Kottlaender <markus@intevation.de>
parents:
2549
diff
changeset
|
71 }); |
2549
9bf6b767a56a
client: refactored and improved splitscreen for diagrams
Markus Kottlaender <markus@intevation.de>
parents:
2438
diff
changeset
|
72 setTimeout(() => { |
9bf6b767a56a
client: refactored and improved splitscreen for diagrams
Markus Kottlaender <markus@intevation.de>
parents:
2438
diff
changeset
|
73 commit("fairwayprofile/clearCurrentProfile", null, { root: true }); |
2590
1686ec185155
client: added gauge waterlevel example diagram
Markus Kottlaender <markus@intevation.de>
parents:
2566
diff
changeset
|
74 commit("application/splitscreenLoading", false, { root: true }); |
2549
9bf6b767a56a
client: refactored and improved splitscreen for diagrams
Markus Kottlaender <markus@intevation.de>
parents:
2438
diff
changeset
|
75 }, 350); |
1516
6b3756676bbe
refac: bottlenecks and surveydata are now retrieved via promises
Thomas Junk <thomas.junk@intevation.de>
parents:
1511
diff
changeset
|
76 rootState.map.cutTool.setActive(false); |
3044
c71373594719
client: map: prepared store to hold multiple map objects
Markus Kottlaender <markus@intevation.de>
parents:
3006
diff
changeset
|
77 rootGetters["map/openLayersMap"] |
3006
44493664d40e
client: refactored layers config
Markus Kottlaender <markus@intevation.de>
parents:
2985
diff
changeset
|
78 .getLayer("CUTTOOL") |
44493664d40e
client: refactored layers config
Markus Kottlaender <markus@intevation.de>
parents:
2985
diff
changeset
|
79 .getSource() |
44493664d40e
client: refactored layers config
Markus Kottlaender <markus@intevation.de>
parents:
2985
diff
changeset
|
80 .clear(); |
1516
6b3756676bbe
refac: bottlenecks and surveydata are now retrieved via promises
Thomas Junk <thomas.junk@intevation.de>
parents:
1511
diff
changeset
|
81 } |
6b3756676bbe
refac: bottlenecks and surveydata are now retrieved via promises
Thomas Junk <thomas.junk@intevation.de>
parents:
1511
diff
changeset
|
82 if (name) { |
6b3756676bbe
refac: bottlenecks and surveydata are now retrieved via promises
Thomas Junk <thomas.junk@intevation.de>
parents:
1511
diff
changeset
|
83 commit("application/showProfiles", true, { root: true }); |
6b3756676bbe
refac: bottlenecks and surveydata are now retrieved via promises
Thomas Junk <thomas.junk@intevation.de>
parents:
1511
diff
changeset
|
84 } |
6b3756676bbe
refac: bottlenecks and surveydata are now retrieved via promises
Thomas Junk <thomas.junk@intevation.de>
parents:
1511
diff
changeset
|
85 commit("setSelectedBottleneck", name); |
6b3756676bbe
refac: bottlenecks and surveydata are now retrieved via promises
Thomas Junk <thomas.junk@intevation.de>
parents:
1511
diff
changeset
|
86 if (name) { |
6b3756676bbe
refac: bottlenecks and surveydata are now retrieved via promises
Thomas Junk <thomas.junk@intevation.de>
parents:
1511
diff
changeset
|
87 commit("surveysLoading", true); |
6b3756676bbe
refac: bottlenecks and surveydata are now retrieved via promises
Thomas Junk <thomas.junk@intevation.de>
parents:
1511
diff
changeset
|
88 HTTP.get("/surveys/" + name, { |
6b3756676bbe
refac: bottlenecks and surveydata are now retrieved via promises
Thomas Junk <thomas.junk@intevation.de>
parents:
1511
diff
changeset
|
89 headers: { |
6b3756676bbe
refac: bottlenecks and surveydata are now retrieved via promises
Thomas Junk <thomas.junk@intevation.de>
parents:
1511
diff
changeset
|
90 "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
|
91 "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
|
92 } |
6b3756676bbe
refac: bottlenecks and surveydata are now retrieved via promises
Thomas Junk <thomas.junk@intevation.de>
parents:
1511
diff
changeset
|
93 }) |
6b3756676bbe
refac: bottlenecks and surveydata are now retrieved via promises
Thomas Junk <thomas.junk@intevation.de>
parents:
1511
diff
changeset
|
94 .then(response => { |
1536
97bdcee1d4c0
Backed out changeset b4b3dfd24739
Bernhard Reiter <bernhard@intevation.de>
parents:
1535
diff
changeset
|
95 const surveys = response.data.surveys.sort((a, b) => |
97bdcee1d4c0
Backed out changeset b4b3dfd24739
Bernhard Reiter <bernhard@intevation.de>
parents:
1535
diff
changeset
|
96 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
|
97 ); |
6b3756676bbe
refac: bottlenecks and surveydata are now retrieved via promises
Thomas Junk <thomas.junk@intevation.de>
parents:
1511
diff
changeset
|
98 commit("setSurveys", surveys); |
6b3756676bbe
refac: bottlenecks and surveydata are now retrieved via promises
Thomas Junk <thomas.junk@intevation.de>
parents:
1511
diff
changeset
|
99 resolve(response); |
6b3756676bbe
refac: bottlenecks and surveydata are now retrieved via promises
Thomas Junk <thomas.junk@intevation.de>
parents:
1511
diff
changeset
|
100 }) |
6b3756676bbe
refac: bottlenecks and surveydata are now retrieved via promises
Thomas Junk <thomas.junk@intevation.de>
parents:
1511
diff
changeset
|
101 .catch(error => { |
6b3756676bbe
refac: bottlenecks and surveydata are now retrieved via promises
Thomas Junk <thomas.junk@intevation.de>
parents:
1511
diff
changeset
|
102 commit("setSurveys", []); |
6b3756676bbe
refac: bottlenecks and surveydata are now retrieved via promises
Thomas Junk <thomas.junk@intevation.de>
parents:
1511
diff
changeset
|
103 commit("selectedSurvey", null); |
6b3756676bbe
refac: bottlenecks and surveydata are now retrieved via promises
Thomas Junk <thomas.junk@intevation.de>
parents:
1511
diff
changeset
|
104 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
|
105 displayError({ |
6b3756676bbe
refac: bottlenecks and surveydata are now retrieved via promises
Thomas Junk <thomas.junk@intevation.de>
parents:
1511
diff
changeset
|
106 title: "Backend Error", |
6b3756676bbe
refac: bottlenecks and surveydata are now retrieved via promises
Thomas Junk <thomas.junk@intevation.de>
parents:
1511
diff
changeset
|
107 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
|
108 }); |
6b3756676bbe
refac: bottlenecks and surveydata are now retrieved via promises
Thomas Junk <thomas.junk@intevation.de>
parents:
1511
diff
changeset
|
109 reject(error); |
6b3756676bbe
refac: bottlenecks and surveydata are now retrieved via promises
Thomas Junk <thomas.junk@intevation.de>
parents:
1511
diff
changeset
|
110 }) |
6b3756676bbe
refac: bottlenecks and surveydata are now retrieved via promises
Thomas Junk <thomas.junk@intevation.de>
parents:
1511
diff
changeset
|
111 .finally(() => commit("surveysLoading", false)); |
6b3756676bbe
refac: bottlenecks and surveydata are now retrieved via promises
Thomas Junk <thomas.junk@intevation.de>
parents:
1511
diff
changeset
|
112 } else { |
6b3756676bbe
refac: bottlenecks and surveydata are now retrieved via promises
Thomas Junk <thomas.junk@intevation.de>
parents:
1511
diff
changeset
|
113 commit("setSurveys", []); |
6b3756676bbe
refac: bottlenecks and surveydata are now retrieved via promises
Thomas Junk <thomas.junk@intevation.de>
parents:
1511
diff
changeset
|
114 resolve(); |
6b3756676bbe
refac: bottlenecks and surveydata are now retrieved via promises
Thomas Junk <thomas.junk@intevation.de>
parents:
1511
diff
changeset
|
115 } |
6b3756676bbe
refac: bottlenecks and surveydata are now retrieved via promises
Thomas Junk <thomas.junk@intevation.de>
parents:
1511
diff
changeset
|
116 }); |
1111
f106aee673e7
selected bottleneck and surveys now handled by bottleneck store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
117 }, |
2435
3679d604645e
client: renamed store action
Markus Kottlaender <markus@intevation.de>
parents:
2365
diff
changeset
|
118 loadBottlenecksList({ commit }) { |
1516
6b3756676bbe
refac: bottlenecks and surveydata are now retrieved via promises
Thomas Junk <thomas.junk@intevation.de>
parents:
1511
diff
changeset
|
119 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
|
120 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
|
121 srsName: "EPSG:4326", |
6b3756676bbe
refac: bottlenecks and surveydata are now retrieved via promises
Thomas Junk <thomas.junk@intevation.de>
parents:
1511
diff
changeset
|
122 featureNS: "gemma", |
6b3756676bbe
refac: bottlenecks and surveydata are now retrieved via promises
Thomas Junk <thomas.junk@intevation.de>
parents:
1511
diff
changeset
|
123 featurePrefix: "gemma", |
6b3756676bbe
refac: bottlenecks and surveydata are now retrieved via promises
Thomas Junk <thomas.junk@intevation.de>
parents:
1511
diff
changeset
|
124 featureTypes: ["bottleneck_overview"], |
6b3756676bbe
refac: bottlenecks and surveydata are now retrieved via promises
Thomas Junk <thomas.junk@intevation.de>
parents:
1511
diff
changeset
|
125 outputFormat: "application/json" |
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 HTTP.post( |
6b3756676bbe
refac: bottlenecks and surveydata are now retrieved via promises
Thomas Junk <thomas.junk@intevation.de>
parents:
1511
diff
changeset
|
128 "/internal/wfs", |
6b3756676bbe
refac: bottlenecks and surveydata are now retrieved via promises
Thomas Junk <thomas.junk@intevation.de>
parents:
1511
diff
changeset
|
129 new XMLSerializer().serializeToString( |
6b3756676bbe
refac: bottlenecks and surveydata are now retrieved via promises
Thomas Junk <thomas.junk@intevation.de>
parents:
1511
diff
changeset
|
130 bottleneckFeatureCollectionRequest |
6b3756676bbe
refac: bottlenecks and surveydata are now retrieved via promises
Thomas Junk <thomas.junk@intevation.de>
parents:
1511
diff
changeset
|
131 ), |
6b3756676bbe
refac: bottlenecks and surveydata are now retrieved via promises
Thomas Junk <thomas.junk@intevation.de>
parents:
1511
diff
changeset
|
132 { |
6b3756676bbe
refac: bottlenecks and surveydata are now retrieved via promises
Thomas Junk <thomas.junk@intevation.de>
parents:
1511
diff
changeset
|
133 headers: { |
6b3756676bbe
refac: bottlenecks and surveydata are now retrieved via promises
Thomas Junk <thomas.junk@intevation.de>
parents:
1511
diff
changeset
|
134 "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
|
135 "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
|
136 } |
1096
aa1f5daf6fc9
refac: centralized stores
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
137 } |
1516
6b3756676bbe
refac: bottlenecks and surveydata are now retrieved via promises
Thomas Junk <thomas.junk@intevation.de>
parents:
1511
diff
changeset
|
138 ) |
1111
f106aee673e7
selected bottleneck and surveys now handled by bottleneck store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
139 .then(response => { |
2436
64ff5984351e
client: renamed store property
Markus Kottlaender <markus@intevation.de>
parents:
2435
diff
changeset
|
140 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
|
141 resolve(response); |
1111
f106aee673e7
selected bottleneck and surveys now handled by bottleneck store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
142 }) |
f106aee673e7
selected bottleneck and surveys now handled by bottleneck store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
143 .catch(error => { |
1516
6b3756676bbe
refac: bottlenecks and surveydata are now retrieved via promises
Thomas Junk <thomas.junk@intevation.de>
parents:
1511
diff
changeset
|
144 reject(error); |
6b3756676bbe
refac: bottlenecks and surveydata are now retrieved via promises
Thomas Junk <thomas.junk@intevation.de>
parents:
1511
diff
changeset
|
145 }); |
6b3756676bbe
refac: bottlenecks and surveydata are now retrieved via promises
Thomas Junk <thomas.junk@intevation.de>
parents:
1511
diff
changeset
|
146 }); |
2438
bbc31150248c
client: import soundingresults: depthreferences from selected bottleneck
Markus Kottlaender <markus@intevation.de>
parents:
2436
diff
changeset
|
147 }, |
bbc31150248c
client: import soundingresults: depthreferences from selected bottleneck
Markus Kottlaender <markus@intevation.de>
parents:
2436
diff
changeset
|
148 loadBottlenecks({ commit }) { |
bbc31150248c
client: import soundingresults: depthreferences from selected bottleneck
Markus Kottlaender <markus@intevation.de>
parents:
2436
diff
changeset
|
149 return new Promise((resolve, reject) => { |
bbc31150248c
client: import soundingresults: depthreferences from selected bottleneck
Markus Kottlaender <markus@intevation.de>
parents:
2436
diff
changeset
|
150 var bottleneckFeatureCollectionRequest = new WFS().writeGetFeature({ |
bbc31150248c
client: import soundingresults: depthreferences from selected bottleneck
Markus Kottlaender <markus@intevation.de>
parents:
2436
diff
changeset
|
151 srsName: "EPSG:4326", |
bbc31150248c
client: import soundingresults: depthreferences from selected bottleneck
Markus Kottlaender <markus@intevation.de>
parents:
2436
diff
changeset
|
152 featureNS: "gemma", |
bbc31150248c
client: import soundingresults: depthreferences from selected bottleneck
Markus Kottlaender <markus@intevation.de>
parents:
2436
diff
changeset
|
153 featurePrefix: "gemma", |
bbc31150248c
client: import soundingresults: depthreferences from selected bottleneck
Markus Kottlaender <markus@intevation.de>
parents:
2436
diff
changeset
|
154 featureTypes: ["bottlenecks_geoserver"], |
bbc31150248c
client: import soundingresults: depthreferences from selected bottleneck
Markus Kottlaender <markus@intevation.de>
parents:
2436
diff
changeset
|
155 outputFormat: "application/json" |
bbc31150248c
client: import soundingresults: depthreferences from selected bottleneck
Markus Kottlaender <markus@intevation.de>
parents:
2436
diff
changeset
|
156 }); |
bbc31150248c
client: import soundingresults: depthreferences from selected bottleneck
Markus Kottlaender <markus@intevation.de>
parents:
2436
diff
changeset
|
157 HTTP.post( |
bbc31150248c
client: import soundingresults: depthreferences from selected bottleneck
Markus Kottlaender <markus@intevation.de>
parents:
2436
diff
changeset
|
158 "/internal/wfs", |
bbc31150248c
client: import soundingresults: depthreferences from selected bottleneck
Markus Kottlaender <markus@intevation.de>
parents:
2436
diff
changeset
|
159 new XMLSerializer().serializeToString( |
bbc31150248c
client: import soundingresults: depthreferences from selected bottleneck
Markus Kottlaender <markus@intevation.de>
parents:
2436
diff
changeset
|
160 bottleneckFeatureCollectionRequest |
bbc31150248c
client: import soundingresults: depthreferences from selected bottleneck
Markus Kottlaender <markus@intevation.de>
parents:
2436
diff
changeset
|
161 ), |
bbc31150248c
client: import soundingresults: depthreferences from selected bottleneck
Markus Kottlaender <markus@intevation.de>
parents:
2436
diff
changeset
|
162 { |
bbc31150248c
client: import soundingresults: depthreferences from selected bottleneck
Markus Kottlaender <markus@intevation.de>
parents:
2436
diff
changeset
|
163 headers: { |
bbc31150248c
client: import soundingresults: depthreferences from selected bottleneck
Markus Kottlaender <markus@intevation.de>
parents:
2436
diff
changeset
|
164 "X-Gemma-Auth": localStorage.getItem("token"), |
bbc31150248c
client: import soundingresults: depthreferences from selected bottleneck
Markus Kottlaender <markus@intevation.de>
parents:
2436
diff
changeset
|
165 "Content-type": "text/xml; charset=UTF-8" |
bbc31150248c
client: import soundingresults: depthreferences from selected bottleneck
Markus Kottlaender <markus@intevation.de>
parents:
2436
diff
changeset
|
166 } |
bbc31150248c
client: import soundingresults: depthreferences from selected bottleneck
Markus Kottlaender <markus@intevation.de>
parents:
2436
diff
changeset
|
167 } |
bbc31150248c
client: import soundingresults: depthreferences from selected bottleneck
Markus Kottlaender <markus@intevation.de>
parents:
2436
diff
changeset
|
168 ) |
bbc31150248c
client: import soundingresults: depthreferences from selected bottleneck
Markus Kottlaender <markus@intevation.de>
parents:
2436
diff
changeset
|
169 .then(response => { |
bbc31150248c
client: import soundingresults: depthreferences from selected bottleneck
Markus Kottlaender <markus@intevation.de>
parents:
2436
diff
changeset
|
170 commit("setBottlenecks", response.data.features); |
bbc31150248c
client: import soundingresults: depthreferences from selected bottleneck
Markus Kottlaender <markus@intevation.de>
parents:
2436
diff
changeset
|
171 resolve(response); |
bbc31150248c
client: import soundingresults: depthreferences from selected bottleneck
Markus Kottlaender <markus@intevation.de>
parents:
2436
diff
changeset
|
172 }) |
bbc31150248c
client: import soundingresults: depthreferences from selected bottleneck
Markus Kottlaender <markus@intevation.de>
parents:
2436
diff
changeset
|
173 .catch(error => { |
bbc31150248c
client: import soundingresults: depthreferences from selected bottleneck
Markus Kottlaender <markus@intevation.de>
parents:
2436
diff
changeset
|
174 reject(error); |
bbc31150248c
client: import soundingresults: depthreferences from selected bottleneck
Markus Kottlaender <markus@intevation.de>
parents:
2436
diff
changeset
|
175 }); |
bbc31150248c
client: import soundingresults: depthreferences from selected bottleneck
Markus Kottlaender <markus@intevation.de>
parents:
2436
diff
changeset
|
176 }); |
1096
aa1f5daf6fc9
refac: centralized stores
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
177 } |
aa1f5daf6fc9
refac: centralized stores
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
178 } |
aa1f5daf6fc9
refac: centralized stores
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
179 }; |