Mercurial > gemma
annotate client/src/store/bottlenecks.js @ 5624:29d729607ac1
Added tag v5.7 for changeset ff0af91a7f62
author | Sascha Wilde <wilde@sha-bang.de> |
---|---|
date | Thu, 22 Dec 2022 18:42:14 +0100 |
parents | 826e67e959c9 |
children |
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"; |
5572
3b842e951317
change use from name of bottleneck to its id.
Thomas Junk <thomas.junk@intevation.de>
parents:
5310
diff
changeset
|
17 import { compareAsc } from "date-fns"; |
2985
1b8bb4f89227
client: removed .js and .vue extention from imports
Markus Kottlaender <markus@intevation.de>
parents:
2957
diff
changeset
|
18 import { displayError } from "@/lib/errors"; |
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, |
5310
660147046ddd
Client: Implement handling zpg-exception info in pdf
Fadi Abbud <fadi.abbud@intevation.de>
parents:
5291
diff
changeset
|
28 bottleneckForPrint: null, |
660147046ddd
Client: Implement handling zpg-exception info in pdf
Fadi Abbud <fadi.abbud@intevation.de>
parents:
5291
diff
changeset
|
29 soundingInfo: null |
1296
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 |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
33 export default { |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
34 init, |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
35 namespaced: true, |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
36 state: init(), |
3236
5914d615f703
available_fairway_depth: use the store luke
Thomas Junk <thomas.junk@intevation.de>
parents:
3204
diff
changeset
|
37 getters: { |
3407
7ea54c3b3fd6
afd: breaks for bottlenecks
Thomas Junk <thomas.junk@intevation.de>
parents:
3236
diff
changeset
|
38 limitingFactorsPerBottleneck: state => { |
7ea54c3b3fd6
afd: breaks for bottlenecks
Thomas Junk <thomas.junk@intevation.de>
parents:
3236
diff
changeset
|
39 if (state.bottlenecks.length === 0) return {}; |
7ea54c3b3fd6
afd: breaks for bottlenecks
Thomas Junk <thomas.junk@intevation.de>
parents:
3236
diff
changeset
|
40 return state.bottlenecks.reduce((o, n) => { |
5578
1d847bc21bb7
Available Fairway Depth: Change evaluation of Limiting Factors from objnam to bottleneck_id
Thomas Junk <thomas.junk@intevation.de>
parents:
5577
diff
changeset
|
41 o[n.properties.bottleneck_id] = n.properties.limiting; |
3407
7ea54c3b3fd6
afd: breaks for bottlenecks
Thomas Junk <thomas.junk@intevation.de>
parents:
3236
diff
changeset
|
42 return o; |
7ea54c3b3fd6
afd: breaks for bottlenecks
Thomas Junk <thomas.junk@intevation.de>
parents:
3236
diff
changeset
|
43 }, {}); |
7ea54c3b3fd6
afd: breaks for bottlenecks
Thomas Junk <thomas.junk@intevation.de>
parents:
3236
diff
changeset
|
44 }, |
5590
826e67e959c9
For BN Overview display id for all doubles
Thomas Junk <thomas.junk@intevation.de>
parents:
5588
diff
changeset
|
45 bottlenecksForDisplay: state => { |
826e67e959c9
For BN Overview display id for all doubles
Thomas Junk <thomas.junk@intevation.de>
parents:
5588
diff
changeset
|
46 const names = {}; |
826e67e959c9
For BN Overview display id for all doubles
Thomas Junk <thomas.junk@intevation.de>
parents:
5588
diff
changeset
|
47 const doubleNames = {}; |
826e67e959c9
For BN Overview display id for all doubles
Thomas Junk <thomas.junk@intevation.de>
parents:
5588
diff
changeset
|
48 const bottlenecks = state.bottlenecksList.map(bn => { |
826e67e959c9
For BN Overview display id for all doubles
Thomas Junk <thomas.junk@intevation.de>
parents:
5588
diff
changeset
|
49 const name = bn.properties.name || bn.properties.objnam; |
826e67e959c9
For BN Overview display id for all doubles
Thomas Junk <thomas.junk@intevation.de>
parents:
5588
diff
changeset
|
50 if (!names[name]) { |
826e67e959c9
For BN Overview display id for all doubles
Thomas Junk <thomas.junk@intevation.de>
parents:
5588
diff
changeset
|
51 names[name] = name; |
826e67e959c9
For BN Overview display id for all doubles
Thomas Junk <thomas.junk@intevation.de>
parents:
5588
diff
changeset
|
52 } else { |
826e67e959c9
For BN Overview display id for all doubles
Thomas Junk <thomas.junk@intevation.de>
parents:
5588
diff
changeset
|
53 doubleNames[name] = name; |
826e67e959c9
For BN Overview display id for all doubles
Thomas Junk <thomas.junk@intevation.de>
parents:
5588
diff
changeset
|
54 } |
826e67e959c9
For BN Overview display id for all doubles
Thomas Junk <thomas.junk@intevation.de>
parents:
5588
diff
changeset
|
55 return bn; |
826e67e959c9
For BN Overview display id for all doubles
Thomas Junk <thomas.junk@intevation.de>
parents:
5588
diff
changeset
|
56 }); |
826e67e959c9
For BN Overview display id for all doubles
Thomas Junk <thomas.junk@intevation.de>
parents:
5588
diff
changeset
|
57 return bottlenecks.map(bn => { |
826e67e959c9
For BN Overview display id for all doubles
Thomas Junk <thomas.junk@intevation.de>
parents:
5588
diff
changeset
|
58 const name = bn.properties.name || bn.properties.objnam; |
826e67e959c9
For BN Overview display id for all doubles
Thomas Junk <thomas.junk@intevation.de>
parents:
5588
diff
changeset
|
59 if (doubleNames[name]) { |
826e67e959c9
For BN Overview display id for all doubles
Thomas Junk <thomas.junk@intevation.de>
parents:
5588
diff
changeset
|
60 bn.properties.displayName = `${name} [${bn.properties.bottleneck_id}]`; |
826e67e959c9
For BN Overview display id for all doubles
Thomas Junk <thomas.junk@intevation.de>
parents:
5588
diff
changeset
|
61 } else { |
826e67e959c9
For BN Overview display id for all doubles
Thomas Junk <thomas.junk@intevation.de>
parents:
5588
diff
changeset
|
62 bn.properties.displayName = name; |
826e67e959c9
For BN Overview display id for all doubles
Thomas Junk <thomas.junk@intevation.de>
parents:
5588
diff
changeset
|
63 } |
826e67e959c9
For BN Overview display id for all doubles
Thomas Junk <thomas.junk@intevation.de>
parents:
5588
diff
changeset
|
64 return bn; |
826e67e959c9
For BN Overview display id for all doubles
Thomas Junk <thomas.junk@intevation.de>
parents:
5588
diff
changeset
|
65 }); |
5588
94ef43fac0eb
Make BN for overview distinguishable
Thomas Junk <thomas.junk@intevation.de>
parents:
5587
diff
changeset
|
66 }, |
3236
5914d615f703
available_fairway_depth: use the store luke
Thomas Junk <thomas.junk@intevation.de>
parents:
3204
diff
changeset
|
67 orderedBottlenecks: state => { |
5586
215e6ba9651b
Added property "displayName" to bottlenecks.
Thomas Junk <thomas.junk@intevation.de>
parents:
5578
diff
changeset
|
68 const groupedBottlenecks = {}; |
215e6ba9651b
Added property "displayName" to bottlenecks.
Thomas Junk <thomas.junk@intevation.de>
parents:
5578
diff
changeset
|
69 const orderedGroups = {}; |
3236
5914d615f703
available_fairway_depth: use the store luke
Thomas Junk <thomas.junk@intevation.de>
parents:
3204
diff
changeset
|
70 // group bottlenecks by cc |
5914d615f703
available_fairway_depth: use the store luke
Thomas Junk <thomas.junk@intevation.de>
parents:
3204
diff
changeset
|
71 state.bottlenecksList.forEach(bn => { |
5914d615f703
available_fairway_depth: use the store luke
Thomas Junk <thomas.junk@intevation.de>
parents:
3204
diff
changeset
|
72 let cc = bn.properties.responsible_country; |
5914d615f703
available_fairway_depth: use the store luke
Thomas Junk <thomas.junk@intevation.de>
parents:
3204
diff
changeset
|
73 if (groupedBottlenecks.hasOwnProperty(cc)) { |
5914d615f703
available_fairway_depth: use the store luke
Thomas Junk <thomas.junk@intevation.de>
parents:
3204
diff
changeset
|
74 groupedBottlenecks[cc].push(bn); |
5914d615f703
available_fairway_depth: use the store luke
Thomas Junk <thomas.junk@intevation.de>
parents:
3204
diff
changeset
|
75 } else { |
5914d615f703
available_fairway_depth: use the store luke
Thomas Junk <thomas.junk@intevation.de>
parents:
3204
diff
changeset
|
76 groupedBottlenecks[cc] = [bn]; |
5914d615f703
available_fairway_depth: use the store luke
Thomas Junk <thomas.junk@intevation.de>
parents:
3204
diff
changeset
|
77 } |
5914d615f703
available_fairway_depth: use the store luke
Thomas Junk <thomas.junk@intevation.de>
parents:
3204
diff
changeset
|
78 }); |
5914d615f703
available_fairway_depth: use the store luke
Thomas Junk <thomas.junk@intevation.de>
parents:
3204
diff
changeset
|
79 |
5914d615f703
available_fairway_depth: use the store luke
Thomas Junk <thomas.junk@intevation.de>
parents:
3204
diff
changeset
|
80 // order groups by cc |
5914d615f703
available_fairway_depth: use the store luke
Thomas Junk <thomas.junk@intevation.de>
parents:
3204
diff
changeset
|
81 Object.keys(groupedBottlenecks) |
5914d615f703
available_fairway_depth: use the store luke
Thomas Junk <thomas.junk@intevation.de>
parents:
3204
diff
changeset
|
82 .sort() |
5586
215e6ba9651b
Added property "displayName" to bottlenecks.
Thomas Junk <thomas.junk@intevation.de>
parents:
5578
diff
changeset
|
83 .forEach(cc => { |
215e6ba9651b
Added property "displayName" to bottlenecks.
Thomas Junk <thomas.junk@intevation.de>
parents:
5578
diff
changeset
|
84 const names = {}; |
215e6ba9651b
Added property "displayName" to bottlenecks.
Thomas Junk <thomas.junk@intevation.de>
parents:
5578
diff
changeset
|
85 const doubleNames = {}; |
215e6ba9651b
Added property "displayName" to bottlenecks.
Thomas Junk <thomas.junk@intevation.de>
parents:
5578
diff
changeset
|
86 groupedBottlenecks[cc].forEach(bn => { |
215e6ba9651b
Added property "displayName" to bottlenecks.
Thomas Junk <thomas.junk@intevation.de>
parents:
5578
diff
changeset
|
87 const name = bn.properties.name || bn.properties.objnam; |
215e6ba9651b
Added property "displayName" to bottlenecks.
Thomas Junk <thomas.junk@intevation.de>
parents:
5578
diff
changeset
|
88 if (!names[name]) { |
215e6ba9651b
Added property "displayName" to bottlenecks.
Thomas Junk <thomas.junk@intevation.de>
parents:
5578
diff
changeset
|
89 names[name] = name; |
215e6ba9651b
Added property "displayName" to bottlenecks.
Thomas Junk <thomas.junk@intevation.de>
parents:
5578
diff
changeset
|
90 } else { |
215e6ba9651b
Added property "displayName" to bottlenecks.
Thomas Junk <thomas.junk@intevation.de>
parents:
5578
diff
changeset
|
91 doubleNames[name] = name; |
215e6ba9651b
Added property "displayName" to bottlenecks.
Thomas Junk <thomas.junk@intevation.de>
parents:
5578
diff
changeset
|
92 } |
215e6ba9651b
Added property "displayName" to bottlenecks.
Thomas Junk <thomas.junk@intevation.de>
parents:
5578
diff
changeset
|
93 }); |
215e6ba9651b
Added property "displayName" to bottlenecks.
Thomas Junk <thomas.junk@intevation.de>
parents:
5578
diff
changeset
|
94 groupedBottlenecks[cc].forEach(bn => { |
215e6ba9651b
Added property "displayName" to bottlenecks.
Thomas Junk <thomas.junk@intevation.de>
parents:
5578
diff
changeset
|
95 const name = bn.properties.name || bn.properties.objnam; |
215e6ba9651b
Added property "displayName" to bottlenecks.
Thomas Junk <thomas.junk@intevation.de>
parents:
5578
diff
changeset
|
96 if (doubleNames[name]) { |
5587
2576a399c2cf
Using squarebrackets in displayName
Thomas Junk <thomas.junk@intevation.de>
parents:
5586
diff
changeset
|
97 bn.properties.displayName = `${name} [${bn.properties.bottleneck_id}]`; |
5586
215e6ba9651b
Added property "displayName" to bottlenecks.
Thomas Junk <thomas.junk@intevation.de>
parents:
5578
diff
changeset
|
98 } else { |
215e6ba9651b
Added property "displayName" to bottlenecks.
Thomas Junk <thomas.junk@intevation.de>
parents:
5578
diff
changeset
|
99 bn.properties.displayName = name; |
215e6ba9651b
Added property "displayName" to bottlenecks.
Thomas Junk <thomas.junk@intevation.de>
parents:
5578
diff
changeset
|
100 } |
215e6ba9651b
Added property "displayName" to bottlenecks.
Thomas Junk <thomas.junk@intevation.de>
parents:
5578
diff
changeset
|
101 }); |
215e6ba9651b
Added property "displayName" to bottlenecks.
Thomas Junk <thomas.junk@intevation.de>
parents:
5578
diff
changeset
|
102 orderedGroups[cc] = groupedBottlenecks[cc]; |
215e6ba9651b
Added property "displayName" to bottlenecks.
Thomas Junk <thomas.junk@intevation.de>
parents:
5578
diff
changeset
|
103 }); |
3236
5914d615f703
available_fairway_depth: use the store luke
Thomas Junk <thomas.junk@intevation.de>
parents:
3204
diff
changeset
|
104 |
5914d615f703
available_fairway_depth: use the store luke
Thomas Junk <thomas.junk@intevation.de>
parents:
3204
diff
changeset
|
105 return orderedGroups; |
5914d615f703
available_fairway_depth: use the store luke
Thomas Junk <thomas.junk@intevation.de>
parents:
3204
diff
changeset
|
106 } |
5914d615f703
available_fairway_depth: use the store luke
Thomas Junk <thomas.junk@intevation.de>
parents:
3204
diff
changeset
|
107 }, |
1096
aa1f5daf6fc9
refac: centralized stores
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
108 mutations: { |
5310
660147046ddd
Client: Implement handling zpg-exception info in pdf
Fadi Abbud <fadi.abbud@intevation.de>
parents:
5291
diff
changeset
|
109 setSoundingInfo: (state, data) => { |
660147046ddd
Client: Implement handling zpg-exception info in pdf
Fadi Abbud <fadi.abbud@intevation.de>
parents:
5291
diff
changeset
|
110 state.soundingInfo = data; |
660147046ddd
Client: Implement handling zpg-exception info in pdf
Fadi Abbud <fadi.abbud@intevation.de>
parents:
5291
diff
changeset
|
111 }, |
4488
bff6c5c1db4f
client: pdf-gen: improve adding bottleneck info to pdf
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3692
diff
changeset
|
112 setBottleneckForPrint: (state, bottleneck) => { |
bff6c5c1db4f
client: pdf-gen: improve adding bottleneck info to pdf
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3692
diff
changeset
|
113 state.bottleneckForPrint = bottleneck; |
bff6c5c1db4f
client: pdf-gen: improve adding bottleneck info to pdf
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3692
diff
changeset
|
114 }, |
2438
bbc31150248c
client: import soundingresults: depthreferences from selected bottleneck
Markus Kottlaender <markus@intevation.de>
parents:
2436
diff
changeset
|
115 setBottlenecks: (state, bottlenecks) => { |
bbc31150248c
client: import soundingresults: depthreferences from selected bottleneck
Markus Kottlaender <markus@intevation.de>
parents:
2436
diff
changeset
|
116 state.bottlenecks = bottlenecks; |
bbc31150248c
client: import soundingresults: depthreferences from selected bottleneck
Markus Kottlaender <markus@intevation.de>
parents:
2436
diff
changeset
|
117 }, |
2436
64ff5984351e
client: renamed store property
Markus Kottlaender <markus@intevation.de>
parents:
2435
diff
changeset
|
118 setBottlenecksList: (state, bottlenecksList) => { |
64ff5984351e
client: renamed store property
Markus Kottlaender <markus@intevation.de>
parents:
2435
diff
changeset
|
119 state.bottlenecksList = bottlenecksList; |
1111
f106aee673e7
selected bottleneck and surveys now handled by bottleneck store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
120 }, |
5572
3b842e951317
change use from name of bottleneck to its id.
Thomas Junk <thomas.junk@intevation.de>
parents:
5310
diff
changeset
|
121 setSelectedBottleneck: (state, value) => { |
3b842e951317
change use from name of bottleneck to its id.
Thomas Junk <thomas.junk@intevation.de>
parents:
5310
diff
changeset
|
122 state.selectedBottleneck = value; |
1111
f106aee673e7
selected bottleneck and surveys now handled by bottleneck store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
123 }, |
f106aee673e7
selected bottleneck and surveys now handled by bottleneck store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
124 setSurveys(state, surveys) { |
f106aee673e7
selected bottleneck and surveys now handled by bottleneck store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
125 state.surveys = surveys; |
f106aee673e7
selected bottleneck and surveys now handled by bottleneck store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
126 }, |
1516
6b3756676bbe
refac: bottlenecks and surveydata are now retrieved via promises
Thomas Junk <thomas.junk@intevation.de>
parents:
1511
diff
changeset
|
127 setSelectedSurveyByDate(state, date) { |
6b3756676bbe
refac: bottlenecks and surveydata are now retrieved via promises
Thomas Junk <thomas.junk@intevation.de>
parents:
1511
diff
changeset
|
128 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
|
129 state.selectedSurvey = survey; |
6b3756676bbe
refac: bottlenecks and surveydata are now retrieved via promises
Thomas Junk <thomas.junk@intevation.de>
parents:
1511
diff
changeset
|
130 }, |
6b3756676bbe
refac: bottlenecks and surveydata are now retrieved via promises
Thomas Junk <thomas.junk@intevation.de>
parents:
1511
diff
changeset
|
131 setFirstSurveySelected(state) { |
6b3756676bbe
refac: bottlenecks and surveydata are now retrieved via promises
Thomas Junk <thomas.junk@intevation.de>
parents:
1511
diff
changeset
|
132 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
|
133 }, |
1394
b350b0b5cb6c
refactored fairwayprofile cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1386
diff
changeset
|
134 selectedSurvey(state, survey) { |
1111
f106aee673e7
selected bottleneck and surveys now handled by bottleneck store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
135 state.selectedSurvey = survey; |
1372
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
1363
diff
changeset
|
136 }, |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
1363
diff
changeset
|
137 surveysLoading: (state, loading) => { |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
1363
diff
changeset
|
138 state.surveysLoading = loading; |
1096
aa1f5daf6fc9
refac: centralized stores
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
139 } |
aa1f5daf6fc9
refac: centralized stores
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
140 }, |
aa1f5daf6fc9
refac: centralized stores
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
141 actions: { |
5572
3b842e951317
change use from name of bottleneck to its id.
Thomas Junk <thomas.junk@intevation.de>
parents:
5310
diff
changeset
|
142 setSelectedBottleneck({ state, commit, rootState }, id) { |
1516
6b3756676bbe
refac: bottlenecks and surveydata are now retrieved via promises
Thomas Junk <thomas.junk@intevation.de>
parents:
1511
diff
changeset
|
143 return new Promise((resolve, reject) => { |
5572
3b842e951317
change use from name of bottleneck to its id.
Thomas Junk <thomas.junk@intevation.de>
parents:
5310
diff
changeset
|
144 if (id !== state.selectedBottleneck) { |
1516
6b3756676bbe
refac: bottlenecks and surveydata are now retrieved via promises
Thomas Junk <thomas.junk@intevation.de>
parents:
1511
diff
changeset
|
145 commit("selectedSurvey", null); |
3149
a90091aaef67
client: fairwayprofile: close profile diagram when switching bottlenecks
Markus Kottlaender <markus@intevation.de>
parents:
3062
diff
changeset
|
146 commit("fairwayprofile/additionalSurvey", null, { root: true }); |
a90091aaef67
client: fairwayprofile: close profile diagram when switching bottlenecks
Markus Kottlaender <markus@intevation.de>
parents:
3062
diff
changeset
|
147 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
|
148 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
|
149 rootState.map.openLayersMaps.forEach(m => { |
87e0422cffa7
client: draw/cut tools work now with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3044
diff
changeset
|
150 m.getLayer("CUTTOOL") |
87e0422cffa7
client: draw/cut tools work now with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3044
diff
changeset
|
151 .getSource() |
87e0422cffa7
client: draw/cut tools work now with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3044
diff
changeset
|
152 .clear(); |
87e0422cffa7
client: draw/cut tools work now with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3044
diff
changeset
|
153 }); |
1516
6b3756676bbe
refac: bottlenecks and surveydata are now retrieved via promises
Thomas Junk <thomas.junk@intevation.de>
parents:
1511
diff
changeset
|
154 } |
5572
3b842e951317
change use from name of bottleneck to its id.
Thomas Junk <thomas.junk@intevation.de>
parents:
5310
diff
changeset
|
155 commit("setSelectedBottleneck", id); |
3b842e951317
change use from name of bottleneck to its id.
Thomas Junk <thomas.junk@intevation.de>
parents:
5310
diff
changeset
|
156 if (id) { |
1516
6b3756676bbe
refac: bottlenecks and surveydata are now retrieved via promises
Thomas Junk <thomas.junk@intevation.de>
parents:
1511
diff
changeset
|
157 commit("surveysLoading", true); |
5574
271888ef85bc
Finalize use of bottleneck id instead of name.
Thomas Junk <thomas.junk@intevation.de>
parents:
5572
diff
changeset
|
158 HTTP.get("/surveys?id=" + encodeURIComponent(id), { |
1516
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 } |
6b3756676bbe
refac: bottlenecks and surveydata are now retrieved via promises
Thomas Junk <thomas.junk@intevation.de>
parents:
1511
diff
changeset
|
163 }) |
6b3756676bbe
refac: bottlenecks and surveydata are now retrieved via promises
Thomas Junk <thomas.junk@intevation.de>
parents:
1511
diff
changeset
|
164 .then(response => { |
1536
97bdcee1d4c0
Backed out changeset b4b3dfd24739
Bernhard Reiter <bernhard@intevation.de>
parents:
1535
diff
changeset
|
165 const surveys = response.data.surveys.sort((a, b) => |
97bdcee1d4c0
Backed out changeset b4b3dfd24739
Bernhard Reiter <bernhard@intevation.de>
parents:
1535
diff
changeset
|
166 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
|
167 ); |
6b3756676bbe
refac: bottlenecks and surveydata are now retrieved via promises
Thomas Junk <thomas.junk@intevation.de>
parents:
1511
diff
changeset
|
168 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
|
169 commit("setFirstSurveySelected"); |
1516
6b3756676bbe
refac: bottlenecks and surveydata are now retrieved via promises
Thomas Junk <thomas.junk@intevation.de>
parents:
1511
diff
changeset
|
170 resolve(response); |
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 .catch(error => { |
6b3756676bbe
refac: bottlenecks and surveydata are now retrieved via promises
Thomas Junk <thomas.junk@intevation.de>
parents:
1511
diff
changeset
|
173 commit("setSurveys", []); |
6b3756676bbe
refac: bottlenecks and surveydata are now retrieved via promises
Thomas Junk <thomas.junk@intevation.de>
parents:
1511
diff
changeset
|
174 commit("selectedSurvey", null); |
6b3756676bbe
refac: bottlenecks and surveydata are now retrieved via promises
Thomas Junk <thomas.junk@intevation.de>
parents:
1511
diff
changeset
|
175 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
|
176 displayError({ |
6b3756676bbe
refac: bottlenecks and surveydata are now retrieved via promises
Thomas Junk <thomas.junk@intevation.de>
parents:
1511
diff
changeset
|
177 title: "Backend Error", |
6b3756676bbe
refac: bottlenecks and surveydata are now retrieved via promises
Thomas Junk <thomas.junk@intevation.de>
parents:
1511
diff
changeset
|
178 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
|
179 }); |
6b3756676bbe
refac: bottlenecks and surveydata are now retrieved via promises
Thomas Junk <thomas.junk@intevation.de>
parents:
1511
diff
changeset
|
180 reject(error); |
6b3756676bbe
refac: bottlenecks and surveydata are now retrieved via promises
Thomas Junk <thomas.junk@intevation.de>
parents:
1511
diff
changeset
|
181 }) |
6b3756676bbe
refac: bottlenecks and surveydata are now retrieved via promises
Thomas Junk <thomas.junk@intevation.de>
parents:
1511
diff
changeset
|
182 .finally(() => commit("surveysLoading", false)); |
6b3756676bbe
refac: bottlenecks and surveydata are now retrieved via promises
Thomas Junk <thomas.junk@intevation.de>
parents:
1511
diff
changeset
|
183 } else { |
6b3756676bbe
refac: bottlenecks and surveydata are now retrieved via promises
Thomas Junk <thomas.junk@intevation.de>
parents:
1511
diff
changeset
|
184 commit("setSurveys", []); |
6b3756676bbe
refac: bottlenecks and surveydata are now retrieved via promises
Thomas Junk <thomas.junk@intevation.de>
parents:
1511
diff
changeset
|
185 resolve(); |
6b3756676bbe
refac: bottlenecks and surveydata are now retrieved via promises
Thomas Junk <thomas.junk@intevation.de>
parents:
1511
diff
changeset
|
186 } |
6b3756676bbe
refac: bottlenecks and surveydata are now retrieved via promises
Thomas Junk <thomas.junk@intevation.de>
parents:
1511
diff
changeset
|
187 }); |
1111
f106aee673e7
selected bottleneck and surveys now handled by bottleneck store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
188 }, |
2435
3679d604645e
client: renamed store action
Markus Kottlaender <markus@intevation.de>
parents:
2365
diff
changeset
|
189 loadBottlenecksList({ commit }) { |
1516
6b3756676bbe
refac: bottlenecks and surveydata are now retrieved via promises
Thomas Junk <thomas.junk@intevation.de>
parents:
1511
diff
changeset
|
190 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
|
191 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
|
192 srsName: "EPSG:4326", |
6b3756676bbe
refac: bottlenecks and surveydata are now retrieved via promises
Thomas Junk <thomas.junk@intevation.de>
parents:
1511
diff
changeset
|
193 featureNS: "gemma", |
6b3756676bbe
refac: bottlenecks and surveydata are now retrieved via promises
Thomas Junk <thomas.junk@intevation.de>
parents:
1511
diff
changeset
|
194 featurePrefix: "gemma", |
6b3756676bbe
refac: bottlenecks and surveydata are now retrieved via promises
Thomas Junk <thomas.junk@intevation.de>
parents:
1511
diff
changeset
|
195 featureTypes: ["bottleneck_overview"], |
6b3756676bbe
refac: bottlenecks and surveydata are now retrieved via promises
Thomas Junk <thomas.junk@intevation.de>
parents:
1511
diff
changeset
|
196 outputFormat: "application/json" |
6b3756676bbe
refac: bottlenecks and surveydata are now retrieved via promises
Thomas Junk <thomas.junk@intevation.de>
parents:
1511
diff
changeset
|
197 }); |
6b3756676bbe
refac: bottlenecks and surveydata are now retrieved via promises
Thomas Junk <thomas.junk@intevation.de>
parents:
1511
diff
changeset
|
198 HTTP.post( |
6b3756676bbe
refac: bottlenecks and surveydata are now retrieved via promises
Thomas Junk <thomas.junk@intevation.de>
parents:
1511
diff
changeset
|
199 "/internal/wfs", |
6b3756676bbe
refac: bottlenecks and surveydata are now retrieved via promises
Thomas Junk <thomas.junk@intevation.de>
parents:
1511
diff
changeset
|
200 new XMLSerializer().serializeToString( |
6b3756676bbe
refac: bottlenecks and surveydata are now retrieved via promises
Thomas Junk <thomas.junk@intevation.de>
parents:
1511
diff
changeset
|
201 bottleneckFeatureCollectionRequest |
6b3756676bbe
refac: bottlenecks and surveydata are now retrieved via promises
Thomas Junk <thomas.junk@intevation.de>
parents:
1511
diff
changeset
|
202 ), |
6b3756676bbe
refac: bottlenecks and surveydata are now retrieved via promises
Thomas Junk <thomas.junk@intevation.de>
parents:
1511
diff
changeset
|
203 { |
6b3756676bbe
refac: bottlenecks and surveydata are now retrieved via promises
Thomas Junk <thomas.junk@intevation.de>
parents:
1511
diff
changeset
|
204 headers: { |
6b3756676bbe
refac: bottlenecks and surveydata are now retrieved via promises
Thomas Junk <thomas.junk@intevation.de>
parents:
1511
diff
changeset
|
205 "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
|
206 "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
|
207 } |
1096
aa1f5daf6fc9
refac: centralized stores
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
208 } |
1516
6b3756676bbe
refac: bottlenecks and surveydata are now retrieved via promises
Thomas Junk <thomas.junk@intevation.de>
parents:
1511
diff
changeset
|
209 ) |
1111
f106aee673e7
selected bottleneck and surveys now handled by bottleneck store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
210 .then(response => { |
2436
64ff5984351e
client: renamed store property
Markus Kottlaender <markus@intevation.de>
parents:
2435
diff
changeset
|
211 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
|
212 resolve(response); |
1111
f106aee673e7
selected bottleneck and surveys now handled by bottleneck store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
213 }) |
f106aee673e7
selected bottleneck and surveys now handled by bottleneck store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
214 .catch(error => { |
1516
6b3756676bbe
refac: bottlenecks and surveydata are now retrieved via promises
Thomas Junk <thomas.junk@intevation.de>
parents:
1511
diff
changeset
|
215 reject(error); |
6b3756676bbe
refac: bottlenecks and surveydata are now retrieved via promises
Thomas Junk <thomas.junk@intevation.de>
parents:
1511
diff
changeset
|
216 }); |
6b3756676bbe
refac: bottlenecks and surveydata are now retrieved via promises
Thomas Junk <thomas.junk@intevation.de>
parents:
1511
diff
changeset
|
217 }); |
2438
bbc31150248c
client: import soundingresults: depthreferences from selected bottleneck
Markus Kottlaender <markus@intevation.de>
parents:
2436
diff
changeset
|
218 }, |
bbc31150248c
client: import soundingresults: depthreferences from selected bottleneck
Markus Kottlaender <markus@intevation.de>
parents:
2436
diff
changeset
|
219 loadBottlenecks({ commit }) { |
bbc31150248c
client: import soundingresults: depthreferences from selected bottleneck
Markus Kottlaender <markus@intevation.de>
parents:
2436
diff
changeset
|
220 return new Promise((resolve, reject) => { |
bbc31150248c
client: import soundingresults: depthreferences from selected bottleneck
Markus Kottlaender <markus@intevation.de>
parents:
2436
diff
changeset
|
221 var bottleneckFeatureCollectionRequest = new WFS().writeGetFeature({ |
bbc31150248c
client: import soundingresults: depthreferences from selected bottleneck
Markus Kottlaender <markus@intevation.de>
parents:
2436
diff
changeset
|
222 srsName: "EPSG:4326", |
bbc31150248c
client: import soundingresults: depthreferences from selected bottleneck
Markus Kottlaender <markus@intevation.de>
parents:
2436
diff
changeset
|
223 featureNS: "gemma", |
bbc31150248c
client: import soundingresults: depthreferences from selected bottleneck
Markus Kottlaender <markus@intevation.de>
parents:
2436
diff
changeset
|
224 featurePrefix: "gemma", |
bbc31150248c
client: import soundingresults: depthreferences from selected bottleneck
Markus Kottlaender <markus@intevation.de>
parents:
2436
diff
changeset
|
225 featureTypes: ["bottlenecks_geoserver"], |
3407
7ea54c3b3fd6
afd: breaks for bottlenecks
Thomas Junk <thomas.junk@intevation.de>
parents:
3236
diff
changeset
|
226 outputFormat: "application/json", |
3692
3138836bf840
import_soundingresults: bottlenecks grouped by countrycode
Thomas Junk <thomas.junk@intevation.de>
parents:
3407
diff
changeset
|
227 propertyNames: [ |
5577
973c71c07bb2
Added bottleneck_id to queried properties for bottlenecks in store.
Thomas Junk <thomas.junk@intevation.de>
parents:
5574
diff
changeset
|
228 "bottleneck_id", |
3692
3138836bf840
import_soundingresults: bottlenecks grouped by countrycode
Thomas Junk <thomas.junk@intevation.de>
parents:
3407
diff
changeset
|
229 "objnam", |
3138836bf840
import_soundingresults: bottlenecks grouped by countrycode
Thomas Junk <thomas.junk@intevation.de>
parents:
3407
diff
changeset
|
230 "responsible_country", |
3138836bf840
import_soundingresults: bottlenecks grouped by countrycode
Thomas Junk <thomas.junk@intevation.de>
parents:
3407
diff
changeset
|
231 "limiting", |
3138836bf840
import_soundingresults: bottlenecks grouped by countrycode
Thomas Junk <thomas.junk@intevation.de>
parents:
3407
diff
changeset
|
232 "reference_water_levels" |
5291
d62587503a39
Client: add bottlenecks filter for the soundingresults import
Fadi Abbud <fadi.abbud@intevation.de>
parents:
5289
diff
changeset
|
233 ] |
2438
bbc31150248c
client: import soundingresults: depthreferences from selected bottleneck
Markus Kottlaender <markus@intevation.de>
parents:
2436
diff
changeset
|
234 }); |
bbc31150248c
client: import soundingresults: depthreferences from selected bottleneck
Markus Kottlaender <markus@intevation.de>
parents:
2436
diff
changeset
|
235 HTTP.post( |
bbc31150248c
client: import soundingresults: depthreferences from selected bottleneck
Markus Kottlaender <markus@intevation.de>
parents:
2436
diff
changeset
|
236 "/internal/wfs", |
bbc31150248c
client: import soundingresults: depthreferences from selected bottleneck
Markus Kottlaender <markus@intevation.de>
parents:
2436
diff
changeset
|
237 new XMLSerializer().serializeToString( |
bbc31150248c
client: import soundingresults: depthreferences from selected bottleneck
Markus Kottlaender <markus@intevation.de>
parents:
2436
diff
changeset
|
238 bottleneckFeatureCollectionRequest |
bbc31150248c
client: import soundingresults: depthreferences from selected bottleneck
Markus Kottlaender <markus@intevation.de>
parents:
2436
diff
changeset
|
239 ), |
bbc31150248c
client: import soundingresults: depthreferences from selected bottleneck
Markus Kottlaender <markus@intevation.de>
parents:
2436
diff
changeset
|
240 { |
bbc31150248c
client: import soundingresults: depthreferences from selected bottleneck
Markus Kottlaender <markus@intevation.de>
parents:
2436
diff
changeset
|
241 headers: { |
bbc31150248c
client: import soundingresults: depthreferences from selected bottleneck
Markus Kottlaender <markus@intevation.de>
parents:
2436
diff
changeset
|
242 "X-Gemma-Auth": localStorage.getItem("token"), |
bbc31150248c
client: import soundingresults: depthreferences from selected bottleneck
Markus Kottlaender <markus@intevation.de>
parents:
2436
diff
changeset
|
243 "Content-type": "text/xml; charset=UTF-8" |
bbc31150248c
client: import soundingresults: depthreferences from selected bottleneck
Markus Kottlaender <markus@intevation.de>
parents:
2436
diff
changeset
|
244 } |
bbc31150248c
client: import soundingresults: depthreferences from selected bottleneck
Markus Kottlaender <markus@intevation.de>
parents:
2436
diff
changeset
|
245 } |
bbc31150248c
client: import soundingresults: depthreferences from selected bottleneck
Markus Kottlaender <markus@intevation.de>
parents:
2436
diff
changeset
|
246 ) |
bbc31150248c
client: import soundingresults: depthreferences from selected bottleneck
Markus Kottlaender <markus@intevation.de>
parents:
2436
diff
changeset
|
247 .then(response => { |
5291
d62587503a39
Client: add bottlenecks filter for the soundingresults import
Fadi Abbud <fadi.abbud@intevation.de>
parents:
5289
diff
changeset
|
248 // Filter bottlenecks to get them unique with the latest time for each one. |
d62587503a39
Client: add bottlenecks filter for the soundingresults import
Fadi Abbud <fadi.abbud@intevation.de>
parents:
5289
diff
changeset
|
249 const bottlenecks = response.data.features; |
d62587503a39
Client: add bottlenecks filter for the soundingresults import
Fadi Abbud <fadi.abbud@intevation.de>
parents:
5289
diff
changeset
|
250 let btnIds = [], |
d62587503a39
Client: add bottlenecks filter for the soundingresults import
Fadi Abbud <fadi.abbud@intevation.de>
parents:
5289
diff
changeset
|
251 filteredBottlenceks = []; |
d62587503a39
Client: add bottlenecks filter for the soundingresults import
Fadi Abbud <fadi.abbud@intevation.de>
parents:
5289
diff
changeset
|
252 bottlenecks.forEach(btn => { |
d62587503a39
Client: add bottlenecks filter for the soundingresults import
Fadi Abbud <fadi.abbud@intevation.de>
parents:
5289
diff
changeset
|
253 const btnName = btn.properties.bottleneck_id; |
d62587503a39
Client: add bottlenecks filter for the soundingresults import
Fadi Abbud <fadi.abbud@intevation.de>
parents:
5289
diff
changeset
|
254 if (btnIds.indexOf(btnName) === -1) { |
d62587503a39
Client: add bottlenecks filter for the soundingresults import
Fadi Abbud <fadi.abbud@intevation.de>
parents:
5289
diff
changeset
|
255 btnIds.push(btnName); |
d62587503a39
Client: add bottlenecks filter for the soundingresults import
Fadi Abbud <fadi.abbud@intevation.de>
parents:
5289
diff
changeset
|
256 filteredBottlenceks.push(btn); |
d62587503a39
Client: add bottlenecks filter for the soundingresults import
Fadi Abbud <fadi.abbud@intevation.de>
parents:
5289
diff
changeset
|
257 } else { |
d62587503a39
Client: add bottlenecks filter for the soundingresults import
Fadi Abbud <fadi.abbud@intevation.de>
parents:
5289
diff
changeset
|
258 let btnToCompare = filteredBottlenceks.find( |
d62587503a39
Client: add bottlenecks filter for the soundingresults import
Fadi Abbud <fadi.abbud@intevation.de>
parents:
5289
diff
changeset
|
259 b => b.properties.bottleneck_id === btnName |
d62587503a39
Client: add bottlenecks filter for the soundingresults import
Fadi Abbud <fadi.abbud@intevation.de>
parents:
5289
diff
changeset
|
260 ); |
d62587503a39
Client: add bottlenecks filter for the soundingresults import
Fadi Abbud <fadi.abbud@intevation.de>
parents:
5289
diff
changeset
|
261 if ( |
d62587503a39
Client: add bottlenecks filter for the soundingresults import
Fadi Abbud <fadi.abbud@intevation.de>
parents:
5289
diff
changeset
|
262 compareAsc( |
d62587503a39
Client: add bottlenecks filter for the soundingresults import
Fadi Abbud <fadi.abbud@intevation.de>
parents:
5289
diff
changeset
|
263 btn.properties.date_info, |
d62587503a39
Client: add bottlenecks filter for the soundingresults import
Fadi Abbud <fadi.abbud@intevation.de>
parents:
5289
diff
changeset
|
264 btnToCompare.properties.date_info |
d62587503a39
Client: add bottlenecks filter for the soundingresults import
Fadi Abbud <fadi.abbud@intevation.de>
parents:
5289
diff
changeset
|
265 ) === 1 |
d62587503a39
Client: add bottlenecks filter for the soundingresults import
Fadi Abbud <fadi.abbud@intevation.de>
parents:
5289
diff
changeset
|
266 ) { |
d62587503a39
Client: add bottlenecks filter for the soundingresults import
Fadi Abbud <fadi.abbud@intevation.de>
parents:
5289
diff
changeset
|
267 const index = filteredBottlenceks.findIndex( |
d62587503a39
Client: add bottlenecks filter for the soundingresults import
Fadi Abbud <fadi.abbud@intevation.de>
parents:
5289
diff
changeset
|
268 x => x.properties.bottleneck_id === btnName |
d62587503a39
Client: add bottlenecks filter for the soundingresults import
Fadi Abbud <fadi.abbud@intevation.de>
parents:
5289
diff
changeset
|
269 ); |
d62587503a39
Client: add bottlenecks filter for the soundingresults import
Fadi Abbud <fadi.abbud@intevation.de>
parents:
5289
diff
changeset
|
270 filteredBottlenceks[index] = btn; |
d62587503a39
Client: add bottlenecks filter for the soundingresults import
Fadi Abbud <fadi.abbud@intevation.de>
parents:
5289
diff
changeset
|
271 } |
d62587503a39
Client: add bottlenecks filter for the soundingresults import
Fadi Abbud <fadi.abbud@intevation.de>
parents:
5289
diff
changeset
|
272 } |
d62587503a39
Client: add bottlenecks filter for the soundingresults import
Fadi Abbud <fadi.abbud@intevation.de>
parents:
5289
diff
changeset
|
273 }); |
d62587503a39
Client: add bottlenecks filter for the soundingresults import
Fadi Abbud <fadi.abbud@intevation.de>
parents:
5289
diff
changeset
|
274 commit("setBottlenecks", filteredBottlenceks); |
2438
bbc31150248c
client: import soundingresults: depthreferences from selected bottleneck
Markus Kottlaender <markus@intevation.de>
parents:
2436
diff
changeset
|
275 resolve(response); |
bbc31150248c
client: import soundingresults: depthreferences from selected bottleneck
Markus Kottlaender <markus@intevation.de>
parents:
2436
diff
changeset
|
276 }) |
bbc31150248c
client: import soundingresults: depthreferences from selected bottleneck
Markus Kottlaender <markus@intevation.de>
parents:
2436
diff
changeset
|
277 .catch(error => { |
bbc31150248c
client: import soundingresults: depthreferences from selected bottleneck
Markus Kottlaender <markus@intevation.de>
parents:
2436
diff
changeset
|
278 reject(error); |
bbc31150248c
client: import soundingresults: depthreferences from selected bottleneck
Markus Kottlaender <markus@intevation.de>
parents:
2436
diff
changeset
|
279 }); |
bbc31150248c
client: import soundingresults: depthreferences from selected bottleneck
Markus Kottlaender <markus@intevation.de>
parents:
2436
diff
changeset
|
280 }); |
1096
aa1f5daf6fc9
refac: centralized stores
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
281 } |
aa1f5daf6fc9
refac: centralized stores
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
282 } |
aa1f5daf6fc9
refac: centralized stores
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
283 }; |