Mercurial > gemma
annotate client/src/components/gauge/Gauges.vue @ 3678:8f58851927c0
client: make layer factory only return new layer config for individual maps
instead of each time it is invoked. The purpose of the factory was to support multiple maps with individual layers.
But returning a new config each time it is invoked leads to bugs that rely on the layer's state. Now this factory
reuses the same objects it created before, per map.
author | Markus Kottlaender <markus@intevation.de> |
---|---|
date | Mon, 17 Jun 2019 17:31:35 +0200 |
parents | f7d7fdc58cad |
children | 4a5ed371011f |
rev | line source |
---|---|
2598
5fa1ad39e1bc
client: added missing files for Gauges dialog
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
1 <template> |
5fa1ad39e1bc
client: added missing files for Gauges dialog
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
2 <div |
5fa1ad39e1bc
client: added missing files for Gauges dialog
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
3 :class="[ |
5fa1ad39e1bc
client: added missing files for Gauges dialog
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
4 'box ui-element rounded bg-white text-nowrap', |
5fa1ad39e1bc
client: added missing files for Gauges dialog
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
5 { expanded: showGauges } |
5fa1ad39e1bc
client: added missing files for Gauges dialog
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
6 ]" |
5fa1ad39e1bc
client: added missing files for Gauges dialog
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
7 > |
5fa1ad39e1bc
client: added missing files for Gauges dialog
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
8 <div style="width: 18rem"> |
5fa1ad39e1bc
client: added missing files for Gauges dialog
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
9 <UIBoxHeader |
5fa1ad39e1bc
client: added missing files for Gauges dialog
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
10 icon="ruler-vertical" |
2754
d0f6c222f4f9
client:correct a set of strings marking
Fadi Abbud <fadi.abbud@intevation.de>
parents:
2751
diff
changeset
|
11 :title="gaugesLabel" |
2598
5fa1ad39e1bc
client: added missing files for Gauges dialog
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
12 :closeCallback="close" |
5fa1ad39e1bc
client: added missing files for Gauges dialog
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
13 /> |
5fa1ad39e1bc
client: added missing files for Gauges dialog
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
14 <div class="box-body"> |
2894
95e40c87a943
client: applied component name change where it is used
Markus Kottlaender <markus@intevation.de>
parents:
2840
diff
changeset
|
15 <UISpinnerOverlay v-if="loading" /> |
2598
5fa1ad39e1bc
client: added missing files for Gauges dialog
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
16 <select |
2643
27933e66e848
client: gauges: use isrs_code as unique id for gauges
Markus Kottlaender <markus@intevation.de>
parents:
2642
diff
changeset
|
17 v-model="selectedGaugeISRS" |
2598
5fa1ad39e1bc
client: added missing files for Gauges dialog
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
18 class="form-control font-weight-bold" |
5fa1ad39e1bc
client: added missing files for Gauges dialog
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
19 > |
5fa1ad39e1bc
client: added missing files for Gauges dialog
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
20 <option :value="null"> |
5fa1ad39e1bc
client: added missing files for Gauges dialog
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
21 <translate>Select Gauge</translate> |
5fa1ad39e1bc
client: added missing files for Gauges dialog
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
22 </option> |
2712
0ac077897ce5
client: Gauges dialog: ordered gauge list by country code
Markus Kottlaender <markus@intevation.de>
parents:
2710
diff
changeset
|
23 <optgroup |
0ac077897ce5
client: Gauges dialog: ordered gauge list by country code
Markus Kottlaender <markus@intevation.de>
parents:
2710
diff
changeset
|
24 v-for="(gaugesForCountry, cc) in orderedGauges" |
0ac077897ce5
client: Gauges dialog: ordered gauge list by country code
Markus Kottlaender <markus@intevation.de>
parents:
2710
diff
changeset
|
25 :key="cc" |
0ac077897ce5
client: Gauges dialog: ordered gauge list by country code
Markus Kottlaender <markus@intevation.de>
parents:
2710
diff
changeset
|
26 :label="cc" |
2598
5fa1ad39e1bc
client: added missing files for Gauges dialog
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
27 > |
2712
0ac077897ce5
client: Gauges dialog: ordered gauge list by country code
Markus Kottlaender <markus@intevation.de>
parents:
2710
diff
changeset
|
28 <option |
0ac077897ce5
client: Gauges dialog: ordered gauge list by country code
Markus Kottlaender <markus@intevation.de>
parents:
2710
diff
changeset
|
29 v-for="g in gaugesForCountry" |
0ac077897ce5
client: Gauges dialog: ordered gauge list by country code
Markus Kottlaender <markus@intevation.de>
parents:
2710
diff
changeset
|
30 :key="g.properties.isrs_code" |
0ac077897ce5
client: Gauges dialog: ordered gauge list by country code
Markus Kottlaender <markus@intevation.de>
parents:
2710
diff
changeset
|
31 :value="g.properties.isrs_code" |
0ac077897ce5
client: Gauges dialog: ordered gauge list by country code
Markus Kottlaender <markus@intevation.de>
parents:
2710
diff
changeset
|
32 > |
0ac077897ce5
client: Gauges dialog: ordered gauge list by country code
Markus Kottlaender <markus@intevation.de>
parents:
2710
diff
changeset
|
33 {{ gaugeLabel(g) }} |
0ac077897ce5
client: Gauges dialog: ordered gauge list by country code
Markus Kottlaender <markus@intevation.de>
parents:
2710
diff
changeset
|
34 </option> |
0ac077897ce5
client: Gauges dialog: ordered gauge list by country code
Markus Kottlaender <markus@intevation.de>
parents:
2710
diff
changeset
|
35 </optgroup> |
2598
5fa1ad39e1bc
client: added missing files for Gauges dialog
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
36 </select> |
2643
27933e66e848
client: gauges: use isrs_code as unique id for gauges
Markus Kottlaender <markus@intevation.de>
parents:
2642
diff
changeset
|
37 <div v-if="selectedGaugeISRS" class="mt-2"> |
2598
5fa1ad39e1bc
client: added missing files for Gauges dialog
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
38 <hr class="mb-1" /> |
2701
e622689d73bd
client: waterlevel diagram: use endpoint
Markus Kottlaender <markus@intevation.de>
parents:
2696
diff
changeset
|
39 <div class="row no-gutters mb-2"> |
e622689d73bd
client: waterlevel diagram: use endpoint
Markus Kottlaender <markus@intevation.de>
parents:
2696
diff
changeset
|
40 <div class="col-6 pr-1"> |
e622689d73bd
client: waterlevel diagram: use endpoint
Markus Kottlaender <markus@intevation.de>
parents:
2696
diff
changeset
|
41 <small class="text-muted"><translate>From</translate>:</small> |
e622689d73bd
client: waterlevel diagram: use endpoint
Markus Kottlaender <markus@intevation.de>
parents:
2696
diff
changeset
|
42 <input |
e622689d73bd
client: waterlevel diagram: use endpoint
Markus Kottlaender <markus@intevation.de>
parents:
2696
diff
changeset
|
43 type="date" |
e622689d73bd
client: waterlevel diagram: use endpoint
Markus Kottlaender <markus@intevation.de>
parents:
2696
diff
changeset
|
44 class="form-control form-control-sm small" |
e622689d73bd
client: waterlevel diagram: use endpoint
Markus Kottlaender <markus@intevation.de>
parents:
2696
diff
changeset
|
45 :value="dateFrom && dateFrom.toISOString().split('T')[0]" |
e622689d73bd
client: waterlevel diagram: use endpoint
Markus Kottlaender <markus@intevation.de>
parents:
2696
diff
changeset
|
46 @input="dateFrom = $event.target.valueAsDate" |
e622689d73bd
client: waterlevel diagram: use endpoint
Markus Kottlaender <markus@intevation.de>
parents:
2696
diff
changeset
|
47 /> |
e622689d73bd
client: waterlevel diagram: use endpoint
Markus Kottlaender <markus@intevation.de>
parents:
2696
diff
changeset
|
48 </div> |
e622689d73bd
client: waterlevel diagram: use endpoint
Markus Kottlaender <markus@intevation.de>
parents:
2696
diff
changeset
|
49 <div class="col-6 pl-1"> |
e622689d73bd
client: waterlevel diagram: use endpoint
Markus Kottlaender <markus@intevation.de>
parents:
2696
diff
changeset
|
50 <small class="text-muted"><translate>To</translate>:</small> |
e622689d73bd
client: waterlevel diagram: use endpoint
Markus Kottlaender <markus@intevation.de>
parents:
2696
diff
changeset
|
51 <input |
e622689d73bd
client: waterlevel diagram: use endpoint
Markus Kottlaender <markus@intevation.de>
parents:
2696
diff
changeset
|
52 type="date" |
e622689d73bd
client: waterlevel diagram: use endpoint
Markus Kottlaender <markus@intevation.de>
parents:
2696
diff
changeset
|
53 class="form-control form-control-sm small" |
e622689d73bd
client: waterlevel diagram: use endpoint
Markus Kottlaender <markus@intevation.de>
parents:
2696
diff
changeset
|
54 :value="dateTo && dateTo.toISOString().split('T')[0]" |
e622689d73bd
client: waterlevel diagram: use endpoint
Markus Kottlaender <markus@intevation.de>
parents:
2696
diff
changeset
|
55 @input="dateTo = $event.target.valueAsDate" |
e622689d73bd
client: waterlevel diagram: use endpoint
Markus Kottlaender <markus@intevation.de>
parents:
2696
diff
changeset
|
56 /> |
e622689d73bd
client: waterlevel diagram: use endpoint
Markus Kottlaender <markus@intevation.de>
parents:
2696
diff
changeset
|
57 </div> |
e622689d73bd
client: waterlevel diagram: use endpoint
Markus Kottlaender <markus@intevation.de>
parents:
2696
diff
changeset
|
58 </div> |
2598
5fa1ad39e1bc
client: added missing files for Gauges dialog
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
59 <button |
5fa1ad39e1bc
client: added missing files for Gauges dialog
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
60 @click="showWaterlevelDiagram()" |
5fa1ad39e1bc
client: added missing files for Gauges dialog
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
61 class="btn btn-sm btn-info d-block w-100" |
5fa1ad39e1bc
client: added missing files for Gauges dialog
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
62 > |
5fa1ad39e1bc
client: added missing files for Gauges dialog
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
63 <translate>Show Waterlevels</translate> |
5fa1ad39e1bc
client: added missing files for Gauges dialog
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
64 </button> |
2829
4a1211727d5f
client: spuc8: implemented year controls
Markus Kottlaender <markus@intevation.de>
parents:
2813
diff
changeset
|
65 <hr class="mb-1" /> |
4a1211727d5f
client: spuc8: implemented year controls
Markus Kottlaender <markus@intevation.de>
parents:
2813
diff
changeset
|
66 <div class="row no-gutters mb-2"> |
4a1211727d5f
client: spuc8: implemented year controls
Markus Kottlaender <markus@intevation.de>
parents:
2813
diff
changeset
|
67 <small class="text-muted"> |
4a1211727d5f
client: spuc8: implemented year controls
Markus Kottlaender <markus@intevation.de>
parents:
2813
diff
changeset
|
68 <translate>Compare to</translate>: |
4a1211727d5f
client: spuc8: implemented year controls
Markus Kottlaender <markus@intevation.de>
parents:
2813
diff
changeset
|
69 </small> |
4a1211727d5f
client: spuc8: implemented year controls
Markus Kottlaender <markus@intevation.de>
parents:
2813
diff
changeset
|
70 <input |
4a1211727d5f
client: spuc8: implemented year controls
Markus Kottlaender <markus@intevation.de>
parents:
2813
diff
changeset
|
71 type="number" |
4a1211727d5f
client: spuc8: implemented year controls
Markus Kottlaender <markus@intevation.de>
parents:
2813
diff
changeset
|
72 step="1" |
4a1211727d5f
client: spuc8: implemented year controls
Markus Kottlaender <markus@intevation.de>
parents:
2813
diff
changeset
|
73 min="1900" |
4a1211727d5f
client: spuc8: implemented year controls
Markus Kottlaender <markus@intevation.de>
parents:
2813
diff
changeset
|
74 :max="new Date().getFullYear()" |
4a1211727d5f
client: spuc8: implemented year controls
Markus Kottlaender <markus@intevation.de>
parents:
2813
diff
changeset
|
75 class="form-control form-control-sm small" |
4a1211727d5f
client: spuc8: implemented year controls
Markus Kottlaender <markus@intevation.de>
parents:
2813
diff
changeset
|
76 v-model="yearCompare" |
4a1211727d5f
client: spuc8: implemented year controls
Markus Kottlaender <markus@intevation.de>
parents:
2813
diff
changeset
|
77 /> |
4a1211727d5f
client: spuc8: implemented year controls
Markus Kottlaender <markus@intevation.de>
parents:
2813
diff
changeset
|
78 </div> |
2761
71e7237110ba
client: spuc8: prepared diagram
Markus Kottlaender <markus@intevation.de>
parents:
2754
diff
changeset
|
79 <button |
71e7237110ba
client: spuc8: prepared diagram
Markus Kottlaender <markus@intevation.de>
parents:
2754
diff
changeset
|
80 @click="showHydrologicalConditionsDiagram()" |
71e7237110ba
client: spuc8: prepared diagram
Markus Kottlaender <markus@intevation.de>
parents:
2754
diff
changeset
|
81 class="btn btn-sm btn-info d-block w-100 mt-2" |
71e7237110ba
client: spuc8: prepared diagram
Markus Kottlaender <markus@intevation.de>
parents:
2754
diff
changeset
|
82 > |
2598
5fa1ad39e1bc
client: added missing files for Gauges dialog
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
83 <translate>Show Hydrological Conditions</translate> |
5fa1ad39e1bc
client: added missing files for Gauges dialog
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
84 </button> |
5fa1ad39e1bc
client: added missing files for Gauges dialog
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
85 </div> |
5fa1ad39e1bc
client: added missing files for Gauges dialog
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
86 </div> |
5fa1ad39e1bc
client: added missing files for Gauges dialog
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
87 </div> |
5fa1ad39e1bc
client: added missing files for Gauges dialog
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
88 </div> |
5fa1ad39e1bc
client: added missing files for Gauges dialog
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
89 </template> |
5fa1ad39e1bc
client: added missing files for Gauges dialog
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
90 |
3200 | 91 <style lang="scss" scoped> |
92 input, | |
93 select { | |
94 font-size: 0.8em; | |
95 } | |
96 </style> | |
97 | |
2598
5fa1ad39e1bc
client: added missing files for Gauges dialog
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
98 <script> |
5fa1ad39e1bc
client: added missing files for Gauges dialog
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
99 /* This is Free Software under GNU Affero General Public License v >= 3.0 |
5fa1ad39e1bc
client: added missing files for Gauges dialog
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
100 * without warranty, see README.md and license for details. |
5fa1ad39e1bc
client: added missing files for Gauges dialog
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
101 * |
5fa1ad39e1bc
client: added missing files for Gauges dialog
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
102 * SPDX-License-Identifier: AGPL-3.0-or-later |
5fa1ad39e1bc
client: added missing files for Gauges dialog
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
103 * License-Filename: LICENSES/AGPL-3.0.txt |
5fa1ad39e1bc
client: added missing files for Gauges dialog
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
104 * |
5fa1ad39e1bc
client: added missing files for Gauges dialog
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
105 * Copyright (C) 2018 by via donau |
5fa1ad39e1bc
client: added missing files for Gauges dialog
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
106 * – Österreichische Wasserstraßen-Gesellschaft mbH |
5fa1ad39e1bc
client: added missing files for Gauges dialog
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
107 * Software engineering by Intevation GmbH |
5fa1ad39e1bc
client: added missing files for Gauges dialog
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
108 * |
5fa1ad39e1bc
client: added missing files for Gauges dialog
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
109 * Author(s): |
5fa1ad39e1bc
client: added missing files for Gauges dialog
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
110 * Markus Kottländer <markus.kottlaender@intevation.de> |
5fa1ad39e1bc
client: added missing files for Gauges dialog
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
111 */ |
2604
85f9bf4a6eba
client: gauge waterlevel diagram: draw reference waterlevels
Markus Kottlaender <markus@intevation.de>
parents:
2598
diff
changeset
|
112 import { mapState, mapGetters } from "vuex"; |
2985
1b8bb4f89227
client: removed .js and .vue extention from imports
Markus Kottlaender <markus@intevation.de>
parents:
2894
diff
changeset
|
113 import { displayError } from "@/lib/errors"; |
2598
5fa1ad39e1bc
client: added missing files for Gauges dialog
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
114 |
5fa1ad39e1bc
client: added missing files for Gauges dialog
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
115 export default { |
5fa1ad39e1bc
client: added missing files for Gauges dialog
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
116 data() { |
5fa1ad39e1bc
client: added missing files for Gauges dialog
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
117 return { |
2710
f393fabfdd35
client: waterlevel diagram: chart extent based on selected dates instead of data
Markus Kottlaender <markus@intevation.de>
parents:
2701
diff
changeset
|
118 loading: false |
2598
5fa1ad39e1bc
client: added missing files for Gauges dialog
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
119 }; |
5fa1ad39e1bc
client: added missing files for Gauges dialog
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
120 }, |
5fa1ad39e1bc
client: added missing files for Gauges dialog
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
121 computed: { |
3146
b6cc4838d2c0
client: implemented pane mechanic for diagrams
Markus Kottlaender <markus@intevation.de>
parents:
3054
diff
changeset
|
122 ...mapState("application", ["showGauges", "paneSetup"]), |
2830
0632d543a427
client: spuc7/8: show time periods in diagram titles
Markus Kottlaender <markus@intevation.de>
parents:
2829
diff
changeset
|
123 ...mapState("gauges", ["gauges", "longtermInterval"]), |
2604
85f9bf4a6eba
client: gauge waterlevel diagram: draw reference waterlevels
Markus Kottlaender <markus@intevation.de>
parents:
2598
diff
changeset
|
124 ...mapGetters("gauges", ["selectedGauge"]), |
2754
d0f6c222f4f9
client:correct a set of strings marking
Fadi Abbud <fadi.abbud@intevation.de>
parents:
2751
diff
changeset
|
125 gaugesLabel() { |
d0f6c222f4f9
client:correct a set of strings marking
Fadi Abbud <fadi.abbud@intevation.de>
parents:
2751
diff
changeset
|
126 return this.$gettext("Gauges"); |
d0f6c222f4f9
client:correct a set of strings marking
Fadi Abbud <fadi.abbud@intevation.de>
parents:
2751
diff
changeset
|
127 }, |
2712
0ac077897ce5
client: Gauges dialog: ordered gauge list by country code
Markus Kottlaender <markus@intevation.de>
parents:
2710
diff
changeset
|
128 orderedGauges() { |
0ac077897ce5
client: Gauges dialog: ordered gauge list by country code
Markus Kottlaender <markus@intevation.de>
parents:
2710
diff
changeset
|
129 let orderedGauges = {}; |
0ac077897ce5
client: Gauges dialog: ordered gauge list by country code
Markus Kottlaender <markus@intevation.de>
parents:
2710
diff
changeset
|
130 this.gauges.forEach(g => { |
0ac077897ce5
client: Gauges dialog: ordered gauge list by country code
Markus Kottlaender <markus@intevation.de>
parents:
2710
diff
changeset
|
131 let isrsInfo = this.isrsInfo(g); |
0ac077897ce5
client: Gauges dialog: ordered gauge list by country code
Markus Kottlaender <markus@intevation.de>
parents:
2710
diff
changeset
|
132 if (orderedGauges.hasOwnProperty(isrsInfo.countryCode)) { |
0ac077897ce5
client: Gauges dialog: ordered gauge list by country code
Markus Kottlaender <markus@intevation.de>
parents:
2710
diff
changeset
|
133 orderedGauges[isrsInfo.countryCode].push(g); |
0ac077897ce5
client: Gauges dialog: ordered gauge list by country code
Markus Kottlaender <markus@intevation.de>
parents:
2710
diff
changeset
|
134 } else { |
0ac077897ce5
client: Gauges dialog: ordered gauge list by country code
Markus Kottlaender <markus@intevation.de>
parents:
2710
diff
changeset
|
135 orderedGauges[isrsInfo.countryCode] = [g]; |
0ac077897ce5
client: Gauges dialog: ordered gauge list by country code
Markus Kottlaender <markus@intevation.de>
parents:
2710
diff
changeset
|
136 } |
0ac077897ce5
client: Gauges dialog: ordered gauge list by country code
Markus Kottlaender <markus@intevation.de>
parents:
2710
diff
changeset
|
137 }); |
0ac077897ce5
client: Gauges dialog: ordered gauge list by country code
Markus Kottlaender <markus@intevation.de>
parents:
2710
diff
changeset
|
138 return orderedGauges; |
0ac077897ce5
client: Gauges dialog: ordered gauge list by country code
Markus Kottlaender <markus@intevation.de>
parents:
2710
diff
changeset
|
139 }, |
2643
27933e66e848
client: gauges: use isrs_code as unique id for gauges
Markus Kottlaender <markus@intevation.de>
parents:
2642
diff
changeset
|
140 selectedGaugeISRS: { |
2598
5fa1ad39e1bc
client: added missing files for Gauges dialog
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
141 get() { |
2643
27933e66e848
client: gauges: use isrs_code as unique id for gauges
Markus Kottlaender <markus@intevation.de>
parents:
2642
diff
changeset
|
142 return this.$store.state.gauges.selectedGaugeISRS; |
2598
5fa1ad39e1bc
client: added missing files for Gauges dialog
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
143 }, |
2643
27933e66e848
client: gauges: use isrs_code as unique id for gauges
Markus Kottlaender <markus@intevation.de>
parents:
2642
diff
changeset
|
144 set(isrs) { |
27933e66e848
client: gauges: use isrs_code as unique id for gauges
Markus Kottlaender <markus@intevation.de>
parents:
2642
diff
changeset
|
145 this.$store.dispatch("gauges/selectedGaugeISRS", isrs); |
2598
5fa1ad39e1bc
client: added missing files for Gauges dialog
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
146 } |
2710
f393fabfdd35
client: waterlevel diagram: chart extent based on selected dates instead of data
Markus Kottlaender <markus@intevation.de>
parents:
2701
diff
changeset
|
147 }, |
f393fabfdd35
client: waterlevel diagram: chart extent based on selected dates instead of data
Markus Kottlaender <markus@intevation.de>
parents:
2701
diff
changeset
|
148 dateFrom: { |
f393fabfdd35
client: waterlevel diagram: chart extent based on selected dates instead of data
Markus Kottlaender <markus@intevation.de>
parents:
2701
diff
changeset
|
149 get() { |
f393fabfdd35
client: waterlevel diagram: chart extent based on selected dates instead of data
Markus Kottlaender <markus@intevation.de>
parents:
2701
diff
changeset
|
150 return this.$store.state.gauges.dateFrom; |
f393fabfdd35
client: waterlevel diagram: chart extent based on selected dates instead of data
Markus Kottlaender <markus@intevation.de>
parents:
2701
diff
changeset
|
151 }, |
f393fabfdd35
client: waterlevel diagram: chart extent based on selected dates instead of data
Markus Kottlaender <markus@intevation.de>
parents:
2701
diff
changeset
|
152 set(date) { |
f393fabfdd35
client: waterlevel diagram: chart extent based on selected dates instead of data
Markus Kottlaender <markus@intevation.de>
parents:
2701
diff
changeset
|
153 this.$store.commit("gauges/dateFrom", date); |
f393fabfdd35
client: waterlevel diagram: chart extent based on selected dates instead of data
Markus Kottlaender <markus@intevation.de>
parents:
2701
diff
changeset
|
154 } |
f393fabfdd35
client: waterlevel diagram: chart extent based on selected dates instead of data
Markus Kottlaender <markus@intevation.de>
parents:
2701
diff
changeset
|
155 }, |
f393fabfdd35
client: waterlevel diagram: chart extent based on selected dates instead of data
Markus Kottlaender <markus@intevation.de>
parents:
2701
diff
changeset
|
156 dateTo: { |
f393fabfdd35
client: waterlevel diagram: chart extent based on selected dates instead of data
Markus Kottlaender <markus@intevation.de>
parents:
2701
diff
changeset
|
157 get() { |
f393fabfdd35
client: waterlevel diagram: chart extent based on selected dates instead of data
Markus Kottlaender <markus@intevation.de>
parents:
2701
diff
changeset
|
158 return this.$store.state.gauges.dateTo; |
f393fabfdd35
client: waterlevel diagram: chart extent based on selected dates instead of data
Markus Kottlaender <markus@intevation.de>
parents:
2701
diff
changeset
|
159 }, |
f393fabfdd35
client: waterlevel diagram: chart extent based on selected dates instead of data
Markus Kottlaender <markus@intevation.de>
parents:
2701
diff
changeset
|
160 set(date) { |
f393fabfdd35
client: waterlevel diagram: chart extent based on selected dates instead of data
Markus Kottlaender <markus@intevation.de>
parents:
2701
diff
changeset
|
161 this.$store.commit("gauges/dateTo", date); |
f393fabfdd35
client: waterlevel diagram: chart extent based on selected dates instead of data
Markus Kottlaender <markus@intevation.de>
parents:
2701
diff
changeset
|
162 } |
2829
4a1211727d5f
client: spuc8: implemented year controls
Markus Kottlaender <markus@intevation.de>
parents:
2813
diff
changeset
|
163 }, |
4a1211727d5f
client: spuc8: implemented year controls
Markus Kottlaender <markus@intevation.de>
parents:
2813
diff
changeset
|
164 yearCompare: { |
4a1211727d5f
client: spuc8: implemented year controls
Markus Kottlaender <markus@intevation.de>
parents:
2813
diff
changeset
|
165 get() { |
4a1211727d5f
client: spuc8: implemented year controls
Markus Kottlaender <markus@intevation.de>
parents:
2813
diff
changeset
|
166 return this.$store.state.gauges.yearCompare; |
4a1211727d5f
client: spuc8: implemented year controls
Markus Kottlaender <markus@intevation.de>
parents:
2813
diff
changeset
|
167 }, |
4a1211727d5f
client: spuc8: implemented year controls
Markus Kottlaender <markus@intevation.de>
parents:
2813
diff
changeset
|
168 set(year) { |
4a1211727d5f
client: spuc8: implemented year controls
Markus Kottlaender <markus@intevation.de>
parents:
2813
diff
changeset
|
169 this.$store.commit("gauges/yearCompare", year); |
4a1211727d5f
client: spuc8: implemented year controls
Markus Kottlaender <markus@intevation.de>
parents:
2813
diff
changeset
|
170 } |
2598
5fa1ad39e1bc
client: added missing files for Gauges dialog
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
171 } |
5fa1ad39e1bc
client: added missing files for Gauges dialog
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
172 }, |
2696
cc3eee8b5d71
client: waterlevel diagram: update diagram immediately when selectedGauge changes
Markus Kottlaender <markus@intevation.de>
parents:
2644
diff
changeset
|
173 watch: { |
3146
b6cc4838d2c0
client: implemented pane mechanic for diagrams
Markus Kottlaender <markus@intevation.de>
parents:
3054
diff
changeset
|
174 selectedGaugeISRS(gauge) { |
b6cc4838d2c0
client: implemented pane mechanic for diagrams
Markus Kottlaender <markus@intevation.de>
parents:
3054
diff
changeset
|
175 if (gauge) { |
b6cc4838d2c0
client: implemented pane mechanic for diagrams
Markus Kottlaender <markus@intevation.de>
parents:
3054
diff
changeset
|
176 let coordinates = this.selectedGauge.geometry.coordinates; |
b6cc4838d2c0
client: implemented pane mechanic for diagrams
Markus Kottlaender <markus@intevation.de>
parents:
3054
diff
changeset
|
177 this.$store.dispatch("map/moveMap", { |
b6cc4838d2c0
client: implemented pane mechanic for diagrams
Markus Kottlaender <markus@intevation.de>
parents:
3054
diff
changeset
|
178 coordinates, |
3151
47453337c698
client: gauges: set zoom level after selecting a gauge
Markus Kottlaender <markus@intevation.de>
parents:
3146
diff
changeset
|
179 zoom: 15, |
3146
b6cc4838d2c0
client: implemented pane mechanic for diagrams
Markus Kottlaender <markus@intevation.de>
parents:
3054
diff
changeset
|
180 preventZoomOut: true |
b6cc4838d2c0
client: implemented pane mechanic for diagrams
Markus Kottlaender <markus@intevation.de>
parents:
3054
diff
changeset
|
181 }); |
b6cc4838d2c0
client: implemented pane mechanic for diagrams
Markus Kottlaender <markus@intevation.de>
parents:
3054
diff
changeset
|
182 } else { |
b6cc4838d2c0
client: implemented pane mechanic for diagrams
Markus Kottlaender <markus@intevation.de>
parents:
3054
diff
changeset
|
183 this.$store.commit("application/paneSetup", "DEFAULT"); |
2761
71e7237110ba
client: spuc8: prepared diagram
Markus Kottlaender <markus@intevation.de>
parents:
2754
diff
changeset
|
184 } |
2696
cc3eee8b5d71
client: waterlevel diagram: update diagram immediately when selectedGauge changes
Markus Kottlaender <markus@intevation.de>
parents:
2644
diff
changeset
|
185 } |
cc3eee8b5d71
client: waterlevel diagram: update diagram immediately when selectedGauge changes
Markus Kottlaender <markus@intevation.de>
parents:
2644
diff
changeset
|
186 }, |
2598
5fa1ad39e1bc
client: added missing files for Gauges dialog
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
187 methods: { |
5fa1ad39e1bc
client: added missing files for Gauges dialog
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
188 close() { |
5fa1ad39e1bc
client: added missing files for Gauges dialog
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
189 this.$store.commit("application/showGauges", false); |
5fa1ad39e1bc
client: added missing files for Gauges dialog
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
190 }, |
5fa1ad39e1bc
client: added missing files for Gauges dialog
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
191 showWaterlevelDiagram() { |
5fa1ad39e1bc
client: added missing files for Gauges dialog
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
192 this.loading = true; |
2751
5da81634bdc4
client: waterlevel diagram: implemented nash-sutcliffe
Markus Kottlaender <markus@intevation.de>
parents:
2740
diff
changeset
|
193 Promise.all([ |
5da81634bdc4
client: waterlevel diagram: implemented nash-sutcliffe
Markus Kottlaender <markus@intevation.de>
parents:
2740
diff
changeset
|
194 this.$store.dispatch("gauges/loadWaterlevels"), |
5da81634bdc4
client: waterlevel diagram: implemented nash-sutcliffe
Markus Kottlaender <markus@intevation.de>
parents:
2740
diff
changeset
|
195 this.$store.dispatch("gauges/loadNashSutcliffe") |
5da81634bdc4
client: waterlevel diagram: implemented nash-sutcliffe
Markus Kottlaender <markus@intevation.de>
parents:
2740
diff
changeset
|
196 ]) |
2701
e622689d73bd
client: waterlevel diagram: use endpoint
Markus Kottlaender <markus@intevation.de>
parents:
2696
diff
changeset
|
197 .catch(error => { |
e622689d73bd
client: waterlevel diagram: use endpoint
Markus Kottlaender <markus@intevation.de>
parents:
2696
diff
changeset
|
198 const { status, data } = error.response; |
e622689d73bd
client: waterlevel diagram: use endpoint
Markus Kottlaender <markus@intevation.de>
parents:
2696
diff
changeset
|
199 displayError({ |
e622689d73bd
client: waterlevel diagram: use endpoint
Markus Kottlaender <markus@intevation.de>
parents:
2696
diff
changeset
|
200 title: "Backend Error", |
e622689d73bd
client: waterlevel diagram: use endpoint
Markus Kottlaender <markus@intevation.de>
parents:
2696
diff
changeset
|
201 message: `${status}: ${data.message || data}` |
e622689d73bd
client: waterlevel diagram: use endpoint
Markus Kottlaender <markus@intevation.de>
parents:
2696
diff
changeset
|
202 }); |
e622689d73bd
client: waterlevel diagram: use endpoint
Markus Kottlaender <markus@intevation.de>
parents:
2696
diff
changeset
|
203 }) |
e622689d73bd
client: waterlevel diagram: use endpoint
Markus Kottlaender <markus@intevation.de>
parents:
2696
diff
changeset
|
204 .finally(() => { |
3146
b6cc4838d2c0
client: implemented pane mechanic for diagrams
Markus Kottlaender <markus@intevation.de>
parents:
3054
diff
changeset
|
205 this.$store.commit( |
b6cc4838d2c0
client: implemented pane mechanic for diagrams
Markus Kottlaender <markus@intevation.de>
parents:
3054
diff
changeset
|
206 "application/paneSetup", |
b6cc4838d2c0
client: implemented pane mechanic for diagrams
Markus Kottlaender <markus@intevation.de>
parents:
3054
diff
changeset
|
207 [ |
b6cc4838d2c0
client: implemented pane mechanic for diagrams
Markus Kottlaender <markus@intevation.de>
parents:
3054
diff
changeset
|
208 "GAUGE_HYDROLOGICALCONDITIONS", |
b6cc4838d2c0
client: implemented pane mechanic for diagrams
Markus Kottlaender <markus@intevation.de>
parents:
3054
diff
changeset
|
209 "GAUGE_WATERLEVEL_HYDROLOGICALCONDITIONS" |
b6cc4838d2c0
client: implemented pane mechanic for diagrams
Markus Kottlaender <markus@intevation.de>
parents:
3054
diff
changeset
|
210 ].includes(this.paneSetup) |
b6cc4838d2c0
client: implemented pane mechanic for diagrams
Markus Kottlaender <markus@intevation.de>
parents:
3054
diff
changeset
|
211 ? "GAUGE_WATERLEVEL_HYDROLOGICALCONDITIONS" |
b6cc4838d2c0
client: implemented pane mechanic for diagrams
Markus Kottlaender <markus@intevation.de>
parents:
3054
diff
changeset
|
212 : "GAUGE_WATERLEVEL" |
b6cc4838d2c0
client: implemented pane mechanic for diagrams
Markus Kottlaender <markus@intevation.de>
parents:
3054
diff
changeset
|
213 ); |
2598
5fa1ad39e1bc
client: added missing files for Gauges dialog
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
214 this.loading = false; |
5fa1ad39e1bc
client: added missing files for Gauges dialog
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
215 }); |
2643
27933e66e848
client: gauges: use isrs_code as unique id for gauges
Markus Kottlaender <markus@intevation.de>
parents:
2642
diff
changeset
|
216 }, |
2761
71e7237110ba
client: spuc8: prepared diagram
Markus Kottlaender <markus@intevation.de>
parents:
2754
diff
changeset
|
217 showHydrologicalConditionsDiagram() { |
71e7237110ba
client: spuc8: prepared diagram
Markus Kottlaender <markus@intevation.de>
parents:
2754
diff
changeset
|
218 this.loading = true; |
71e7237110ba
client: spuc8: prepared diagram
Markus Kottlaender <markus@intevation.de>
parents:
2754
diff
changeset
|
219 |
2813
49c1570919ae
client: spuc8: use new endpoints to fetch year based and longterm waterlevel data
Markus Kottlaender <markus@intevation.de>
parents:
2791
diff
changeset
|
220 Promise.all([ |
49c1570919ae
client: spuc8: use new endpoints to fetch year based and longterm waterlevel data
Markus Kottlaender <markus@intevation.de>
parents:
2791
diff
changeset
|
221 this.$store.dispatch("gauges/loadLongtermWaterlevels"), |
2829
4a1211727d5f
client: spuc8: implemented year controls
Markus Kottlaender <markus@intevation.de>
parents:
2813
diff
changeset
|
222 this.$store.dispatch("gauges/loadYearWaterlevels") |
2813
49c1570919ae
client: spuc8: use new endpoints to fetch year based and longterm waterlevel data
Markus Kottlaender <markus@intevation.de>
parents:
2791
diff
changeset
|
223 ]) |
2761
71e7237110ba
client: spuc8: prepared diagram
Markus Kottlaender <markus@intevation.de>
parents:
2754
diff
changeset
|
224 .catch(error => { |
71e7237110ba
client: spuc8: prepared diagram
Markus Kottlaender <markus@intevation.de>
parents:
2754
diff
changeset
|
225 const { status, data } = error.response; |
71e7237110ba
client: spuc8: prepared diagram
Markus Kottlaender <markus@intevation.de>
parents:
2754
diff
changeset
|
226 displayError({ |
71e7237110ba
client: spuc8: prepared diagram
Markus Kottlaender <markus@intevation.de>
parents:
2754
diff
changeset
|
227 title: "Backend Error", |
71e7237110ba
client: spuc8: prepared diagram
Markus Kottlaender <markus@intevation.de>
parents:
2754
diff
changeset
|
228 message: `${status}: ${data.message || data}` |
71e7237110ba
client: spuc8: prepared diagram
Markus Kottlaender <markus@intevation.de>
parents:
2754
diff
changeset
|
229 }); |
71e7237110ba
client: spuc8: prepared diagram
Markus Kottlaender <markus@intevation.de>
parents:
2754
diff
changeset
|
230 }) |
71e7237110ba
client: spuc8: prepared diagram
Markus Kottlaender <markus@intevation.de>
parents:
2754
diff
changeset
|
231 .finally(() => { |
3146
b6cc4838d2c0
client: implemented pane mechanic for diagrams
Markus Kottlaender <markus@intevation.de>
parents:
3054
diff
changeset
|
232 this.$store.commit( |
b6cc4838d2c0
client: implemented pane mechanic for diagrams
Markus Kottlaender <markus@intevation.de>
parents:
3054
diff
changeset
|
233 "application/paneSetup", |
b6cc4838d2c0
client: implemented pane mechanic for diagrams
Markus Kottlaender <markus@intevation.de>
parents:
3054
diff
changeset
|
234 [ |
b6cc4838d2c0
client: implemented pane mechanic for diagrams
Markus Kottlaender <markus@intevation.de>
parents:
3054
diff
changeset
|
235 "GAUGE_WATERLEVEL", |
b6cc4838d2c0
client: implemented pane mechanic for diagrams
Markus Kottlaender <markus@intevation.de>
parents:
3054
diff
changeset
|
236 "GAUGE_WATERLEVEL_HYDROLOGICALCONDITIONS" |
b6cc4838d2c0
client: implemented pane mechanic for diagrams
Markus Kottlaender <markus@intevation.de>
parents:
3054
diff
changeset
|
237 ].includes(this.paneSetup) |
b6cc4838d2c0
client: implemented pane mechanic for diagrams
Markus Kottlaender <markus@intevation.de>
parents:
3054
diff
changeset
|
238 ? "GAUGE_WATERLEVEL_HYDROLOGICALCONDITIONS" |
b6cc4838d2c0
client: implemented pane mechanic for diagrams
Markus Kottlaender <markus@intevation.de>
parents:
3054
diff
changeset
|
239 : "GAUGE_HYDROLOGICALCONDITIONS" |
b6cc4838d2c0
client: implemented pane mechanic for diagrams
Markus Kottlaender <markus@intevation.de>
parents:
3054
diff
changeset
|
240 ); |
2761
71e7237110ba
client: spuc8: prepared diagram
Markus Kottlaender <markus@intevation.de>
parents:
2754
diff
changeset
|
241 this.loading = false; |
71e7237110ba
client: spuc8: prepared diagram
Markus Kottlaender <markus@intevation.de>
parents:
2754
diff
changeset
|
242 }); |
71e7237110ba
client: spuc8: prepared diagram
Markus Kottlaender <markus@intevation.de>
parents:
2754
diff
changeset
|
243 }, |
2643
27933e66e848
client: gauges: use isrs_code as unique id for gauges
Markus Kottlaender <markus@intevation.de>
parents:
2642
diff
changeset
|
244 gaugeLabel(gauge) { |
2712
0ac077897ce5
client: Gauges dialog: ordered gauge list by country code
Markus Kottlaender <markus@intevation.de>
parents:
2710
diff
changeset
|
245 return `${gauge.properties.objname} (${this.isrsInfo(gauge).orc})`; |
0ac077897ce5
client: Gauges dialog: ordered gauge list by country code
Markus Kottlaender <markus@intevation.de>
parents:
2710
diff
changeset
|
246 }, |
0ac077897ce5
client: Gauges dialog: ordered gauge list by country code
Markus Kottlaender <markus@intevation.de>
parents:
2710
diff
changeset
|
247 isrsInfo(gauge) { |
0ac077897ce5
client: Gauges dialog: ordered gauge list by country code
Markus Kottlaender <markus@intevation.de>
parents:
2710
diff
changeset
|
248 let isrsInfo = gauge.id |
2643
27933e66e848
client: gauges: use isrs_code as unique id for gauges
Markus Kottlaender <markus@intevation.de>
parents:
2642
diff
changeset
|
249 .split(".")[1] |
27933e66e848
client: gauges: use isrs_code as unique id for gauges
Markus Kottlaender <markus@intevation.de>
parents:
2642
diff
changeset
|
250 .replace(/[()]/g, "") |
27933e66e848
client: gauges: use isrs_code as unique id for gauges
Markus Kottlaender <markus@intevation.de>
parents:
2642
diff
changeset
|
251 .split(","); |
2712
0ac077897ce5
client: Gauges dialog: ordered gauge list by country code
Markus Kottlaender <markus@intevation.de>
parents:
2710
diff
changeset
|
252 |
0ac077897ce5
client: Gauges dialog: ordered gauge list by country code
Markus Kottlaender <markus@intevation.de>
parents:
2710
diff
changeset
|
253 return { |
0ac077897ce5
client: Gauges dialog: ordered gauge list by country code
Markus Kottlaender <markus@intevation.de>
parents:
2710
diff
changeset
|
254 countryCode: isrsInfo[0], |
0ac077897ce5
client: Gauges dialog: ordered gauge list by country code
Markus Kottlaender <markus@intevation.de>
parents:
2710
diff
changeset
|
255 loCode: isrsInfo[1], |
0ac077897ce5
client: Gauges dialog: ordered gauge list by country code
Markus Kottlaender <markus@intevation.de>
parents:
2710
diff
changeset
|
256 fairwaySection: isrsInfo[2], |
0ac077897ce5
client: Gauges dialog: ordered gauge list by country code
Markus Kottlaender <markus@intevation.de>
parents:
2710
diff
changeset
|
257 orc: isrsInfo[3], |
0ac077897ce5
client: Gauges dialog: ordered gauge list by country code
Markus Kottlaender <markus@intevation.de>
parents:
2710
diff
changeset
|
258 hectometre: isrsInfo[4] |
0ac077897ce5
client: Gauges dialog: ordered gauge list by country code
Markus Kottlaender <markus@intevation.de>
parents:
2710
diff
changeset
|
259 }; |
2598
5fa1ad39e1bc
client: added missing files for Gauges dialog
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
260 } |
5fa1ad39e1bc
client: added missing files for Gauges dialog
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
261 }, |
5fa1ad39e1bc
client: added missing files for Gauges dialog
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
262 mounted() { |
5fa1ad39e1bc
client: added missing files for Gauges dialog
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
263 this.$store.dispatch("gauges/loadGauges"); |
5fa1ad39e1bc
client: added missing files for Gauges dialog
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
264 } |
5fa1ad39e1bc
client: added missing files for Gauges dialog
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
265 }; |
5fa1ad39e1bc
client: added missing files for Gauges dialog
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
266 </script> |