annotate client/src/components/gauge/Gauges.vue @ 5065:385cb52d32ee time-sliding

client: enhanced time-slider behavior on updating selected time after reloads
author Fadi Abbud <fadi.abbud@intevation.de>
date Tue, 10 Mar 2020 12:49:16 +0100
parents b5028b98e7c4
children 84d01a536bec
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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 >
4981
9f0830a1845d squashed the total layout to enable display of long fm importnames
Thomas Junk <thomas.junk@intevation.de>
parents: 4869
diff changeset
8 <div style="width: 17rem">
2598
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" />
4478
51dc4811a0e6 Gauges: Instead of dynamically scroll use crosshairs button
Thomas Junk <thomas.junk@intevation.de>
parents: 4456
diff changeset
16 <div class="d-flex">
51dc4811a0e6 Gauges: Instead of dynamically scroll use crosshairs button
Thomas Junk <thomas.junk@intevation.de>
parents: 4456
diff changeset
17 <select
51dc4811a0e6 Gauges: Instead of dynamically scroll use crosshairs button
Thomas Junk <thomas.junk@intevation.de>
parents: 4456
diff changeset
18 v-model="selectedGaugeISRS"
4982
b5028b98e7c4 fix layout of selecting BN, G, AFD for firefox
Thomas Junk <thomas.junk@intevation.de>
parents: 4981
diff changeset
19 class="w-90 form-control font-weight-bold"
2598
5fa1ad39e1bc client: added missing files for Gauges dialog
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
20 >
4478
51dc4811a0e6 Gauges: Instead of dynamically scroll use crosshairs button
Thomas Junk <thomas.junk@intevation.de>
parents: 4456
diff changeset
21 <option :value="null">
51dc4811a0e6 Gauges: Instead of dynamically scroll use crosshairs button
Thomas Junk <thomas.junk@intevation.de>
parents: 4456
diff changeset
22 <translate>Select Gauge</translate>
51dc4811a0e6 Gauges: Instead of dynamically scroll use crosshairs button
Thomas Junk <thomas.junk@intevation.de>
parents: 4456
diff changeset
23 </option>
51dc4811a0e6 Gauges: Instead of dynamically scroll use crosshairs button
Thomas Junk <thomas.junk@intevation.de>
parents: 4456
diff changeset
24 <optgroup
51dc4811a0e6 Gauges: Instead of dynamically scroll use crosshairs button
Thomas Junk <thomas.junk@intevation.de>
parents: 4456
diff changeset
25 v-for="(gaugesForCountry, cc) in orderedGauges"
51dc4811a0e6 Gauges: Instead of dynamically scroll use crosshairs button
Thomas Junk <thomas.junk@intevation.de>
parents: 4456
diff changeset
26 :key="cc"
51dc4811a0e6 Gauges: Instead of dynamically scroll use crosshairs button
Thomas Junk <thomas.junk@intevation.de>
parents: 4456
diff changeset
27 :label="cc"
2712
0ac077897ce5 client: Gauges dialog: ordered gauge list by country code
Markus Kottlaender <markus@intevation.de>
parents: 2710
diff changeset
28 >
4478
51dc4811a0e6 Gauges: Instead of dynamically scroll use crosshairs button
Thomas Junk <thomas.junk@intevation.de>
parents: 4456
diff changeset
29 <option
51dc4811a0e6 Gauges: Instead of dynamically scroll use crosshairs button
Thomas Junk <thomas.junk@intevation.de>
parents: 4456
diff changeset
30 v-for="g in gaugesForCountry"
51dc4811a0e6 Gauges: Instead of dynamically scroll use crosshairs button
Thomas Junk <thomas.junk@intevation.de>
parents: 4456
diff changeset
31 :key="g.properties.isrs_code"
51dc4811a0e6 Gauges: Instead of dynamically scroll use crosshairs button
Thomas Junk <thomas.junk@intevation.de>
parents: 4456
diff changeset
32 :value="g.properties.isrs_code"
51dc4811a0e6 Gauges: Instead of dynamically scroll use crosshairs button
Thomas Junk <thomas.junk@intevation.de>
parents: 4456
diff changeset
33 >
51dc4811a0e6 Gauges: Instead of dynamically scroll use crosshairs button
Thomas Junk <thomas.junk@intevation.de>
parents: 4456
diff changeset
34 {{ gaugeLabel(g) }}
51dc4811a0e6 Gauges: Instead of dynamically scroll use crosshairs button
Thomas Junk <thomas.junk@intevation.de>
parents: 4456
diff changeset
35 </option>
51dc4811a0e6 Gauges: Instead of dynamically scroll use crosshairs button
Thomas Junk <thomas.junk@intevation.de>
parents: 4456
diff changeset
36 </optgroup>
51dc4811a0e6 Gauges: Instead of dynamically scroll use crosshairs button
Thomas Junk <thomas.junk@intevation.de>
parents: 4456
diff changeset
37 </select>
51dc4811a0e6 Gauges: Instead of dynamically scroll use crosshairs button
Thomas Junk <thomas.junk@intevation.de>
parents: 4456
diff changeset
38 <button @click="takeMeThere" class="btn btn-sm btn-info">
51dc4811a0e6 Gauges: Instead of dynamically scroll use crosshairs button
Thomas Junk <thomas.junk@intevation.de>
parents: 4456
diff changeset
39 <font-awesome-icon icon="crosshairs" />
51dc4811a0e6 Gauges: Instead of dynamically scroll use crosshairs button
Thomas Junk <thomas.junk@intevation.de>
parents: 4456
diff changeset
40 </button>
51dc4811a0e6 Gauges: Instead of dynamically scroll use crosshairs button
Thomas Junk <thomas.junk@intevation.de>
parents: 4456
diff changeset
41 </div>
2643
27933e66e848 client: gauges: use isrs_code as unique id for gauges
Markus Kottlaender <markus@intevation.de>
parents: 2642
diff changeset
42 <div v-if="selectedGaugeISRS" class="mt-2">
2598
5fa1ad39e1bc client: added missing files for Gauges dialog
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
43 <hr class="mb-1" />
2701
e622689d73bd client: waterlevel diagram: use endpoint
Markus Kottlaender <markus@intevation.de>
parents: 2696
diff changeset
44 <div class="row no-gutters mb-2">
e622689d73bd client: waterlevel diagram: use endpoint
Markus Kottlaender <markus@intevation.de>
parents: 2696
diff changeset
45 <div class="col-6 pr-1">
e622689d73bd client: waterlevel diagram: use endpoint
Markus Kottlaender <markus@intevation.de>
parents: 2696
diff changeset
46 <small class="text-muted"><translate>From</translate>:</small>
e622689d73bd client: waterlevel diagram: use endpoint
Markus Kottlaender <markus@intevation.de>
parents: 2696
diff changeset
47 <input
e622689d73bd client: waterlevel diagram: use endpoint
Markus Kottlaender <markus@intevation.de>
parents: 2696
diff changeset
48 type="date"
e622689d73bd client: waterlevel diagram: use endpoint
Markus Kottlaender <markus@intevation.de>
parents: 2696
diff changeset
49 class="form-control form-control-sm small"
e622689d73bd client: waterlevel diagram: use endpoint
Markus Kottlaender <markus@intevation.de>
parents: 2696
diff changeset
50 :value="dateFrom && dateFrom.toISOString().split('T')[0]"
e622689d73bd client: waterlevel diagram: use endpoint
Markus Kottlaender <markus@intevation.de>
parents: 2696
diff changeset
51 @input="dateFrom = $event.target.valueAsDate"
e622689d73bd client: waterlevel diagram: use endpoint
Markus Kottlaender <markus@intevation.de>
parents: 2696
diff changeset
52 />
e622689d73bd client: waterlevel diagram: use endpoint
Markus Kottlaender <markus@intevation.de>
parents: 2696
diff changeset
53 </div>
e622689d73bd client: waterlevel diagram: use endpoint
Markus Kottlaender <markus@intevation.de>
parents: 2696
diff changeset
54 <div class="col-6 pl-1">
e622689d73bd client: waterlevel diagram: use endpoint
Markus Kottlaender <markus@intevation.de>
parents: 2696
diff changeset
55 <small class="text-muted"><translate>To</translate>:</small>
e622689d73bd client: waterlevel diagram: use endpoint
Markus Kottlaender <markus@intevation.de>
parents: 2696
diff changeset
56 <input
e622689d73bd client: waterlevel diagram: use endpoint
Markus Kottlaender <markus@intevation.de>
parents: 2696
diff changeset
57 type="date"
e622689d73bd client: waterlevel diagram: use endpoint
Markus Kottlaender <markus@intevation.de>
parents: 2696
diff changeset
58 class="form-control form-control-sm small"
e622689d73bd client: waterlevel diagram: use endpoint
Markus Kottlaender <markus@intevation.de>
parents: 2696
diff changeset
59 :value="dateTo && dateTo.toISOString().split('T')[0]"
e622689d73bd client: waterlevel diagram: use endpoint
Markus Kottlaender <markus@intevation.de>
parents: 2696
diff changeset
60 @input="dateTo = $event.target.valueAsDate"
e622689d73bd client: waterlevel diagram: use endpoint
Markus Kottlaender <markus@intevation.de>
parents: 2696
diff changeset
61 />
e622689d73bd client: waterlevel diagram: use endpoint
Markus Kottlaender <markus@intevation.de>
parents: 2696
diff changeset
62 </div>
e622689d73bd client: waterlevel diagram: use endpoint
Markus Kottlaender <markus@intevation.de>
parents: 2696
diff changeset
63 </div>
2598
5fa1ad39e1bc client: added missing files for Gauges dialog
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
64 <button
5fa1ad39e1bc client: added missing files for Gauges dialog
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
65 @click="showWaterlevelDiagram()"
5fa1ad39e1bc client: added missing files for Gauges dialog
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
66 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
67 >
5fa1ad39e1bc client: added missing files for Gauges dialog
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
68 <translate>Show Waterlevels</translate>
5fa1ad39e1bc client: added missing files for Gauges dialog
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
69 </button>
2829
4a1211727d5f client: spuc8: implemented year controls
Markus Kottlaender <markus@intevation.de>
parents: 2813
diff changeset
70 <hr class="mb-1" />
4a1211727d5f client: spuc8: implemented year controls
Markus Kottlaender <markus@intevation.de>
parents: 2813
diff changeset
71 <div class="row no-gutters mb-2">
4a1211727d5f client: spuc8: implemented year controls
Markus Kottlaender <markus@intevation.de>
parents: 2813
diff changeset
72 <small class="text-muted">
4a1211727d5f client: spuc8: implemented year controls
Markus Kottlaender <markus@intevation.de>
parents: 2813
diff changeset
73 <translate>Compare to</translate>:
4a1211727d5f client: spuc8: implemented year controls
Markus Kottlaender <markus@intevation.de>
parents: 2813
diff changeset
74 </small>
4a1211727d5f client: spuc8: implemented year controls
Markus Kottlaender <markus@intevation.de>
parents: 2813
diff changeset
75 <input
4a1211727d5f client: spuc8: implemented year controls
Markus Kottlaender <markus@intevation.de>
parents: 2813
diff changeset
76 type="number"
4a1211727d5f client: spuc8: implemented year controls
Markus Kottlaender <markus@intevation.de>
parents: 2813
diff changeset
77 step="1"
4a1211727d5f client: spuc8: implemented year controls
Markus Kottlaender <markus@intevation.de>
parents: 2813
diff changeset
78 min="1900"
4a1211727d5f client: spuc8: implemented year controls
Markus Kottlaender <markus@intevation.de>
parents: 2813
diff changeset
79 :max="new Date().getFullYear()"
4a1211727d5f client: spuc8: implemented year controls
Markus Kottlaender <markus@intevation.de>
parents: 2813
diff changeset
80 class="form-control form-control-sm small"
4a1211727d5f client: spuc8: implemented year controls
Markus Kottlaender <markus@intevation.de>
parents: 2813
diff changeset
81 v-model="yearCompare"
4a1211727d5f client: spuc8: implemented year controls
Markus Kottlaender <markus@intevation.de>
parents: 2813
diff changeset
82 />
4a1211727d5f client: spuc8: implemented year controls
Markus Kottlaender <markus@intevation.de>
parents: 2813
diff changeset
83 </div>
2761
71e7237110ba client: spuc8: prepared diagram
Markus Kottlaender <markus@intevation.de>
parents: 2754
diff changeset
84 <button
71e7237110ba client: spuc8: prepared diagram
Markus Kottlaender <markus@intevation.de>
parents: 2754
diff changeset
85 @click="showHydrologicalConditionsDiagram()"
71e7237110ba client: spuc8: prepared diagram
Markus Kottlaender <markus@intevation.de>
parents: 2754
diff changeset
86 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
87 >
2598
5fa1ad39e1bc client: added missing files for Gauges dialog
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
88 <translate>Show Hydrological Conditions</translate>
5fa1ad39e1bc client: added missing files for Gauges dialog
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
89 </button>
5fa1ad39e1bc client: added missing files for Gauges dialog
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
90 </div>
5fa1ad39e1bc client: added missing files for Gauges dialog
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
91 </div>
5fa1ad39e1bc client: added missing files for Gauges dialog
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
92 </div>
5fa1ad39e1bc client: added missing files for Gauges dialog
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
93 </div>
5fa1ad39e1bc client: added missing files for Gauges dialog
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
94 </template>
5fa1ad39e1bc client: added missing files for Gauges dialog
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
95
3200
f7d7fdc58cad dialogs: styling
Thomas Junk <thomas.junk@intevation.de>
parents: 3157
diff changeset
96 <style lang="scss" scoped>
f7d7fdc58cad dialogs: styling
Thomas Junk <thomas.junk@intevation.de>
parents: 3157
diff changeset
97 input,
f7d7fdc58cad dialogs: styling
Thomas Junk <thomas.junk@intevation.de>
parents: 3157
diff changeset
98 select {
f7d7fdc58cad dialogs: styling
Thomas Junk <thomas.junk@intevation.de>
parents: 3157
diff changeset
99 font-size: 0.8em;
f7d7fdc58cad dialogs: styling
Thomas Junk <thomas.junk@intevation.de>
parents: 3157
diff changeset
100 }
f7d7fdc58cad dialogs: styling
Thomas Junk <thomas.junk@intevation.de>
parents: 3157
diff changeset
101 </style>
f7d7fdc58cad dialogs: styling
Thomas Junk <thomas.junk@intevation.de>
parents: 3157
diff changeset
102
2598
5fa1ad39e1bc client: added missing files for Gauges dialog
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
103 <script>
5fa1ad39e1bc client: added missing files for Gauges dialog
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
104 /* 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
105 * 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
106 *
5fa1ad39e1bc client: added missing files for Gauges dialog
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
107 * SPDX-License-Identifier: AGPL-3.0-or-later
5fa1ad39e1bc client: added missing files for Gauges dialog
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
108 * License-Filename: LICENSES/AGPL-3.0.txt
5fa1ad39e1bc client: added missing files for Gauges dialog
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
109 *
5fa1ad39e1bc client: added missing files for Gauges dialog
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
110 * Copyright (C) 2018 by via donau
5fa1ad39e1bc client: added missing files for Gauges dialog
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
111 * – Österreichische Wasserstraßen-Gesellschaft mbH
5fa1ad39e1bc client: added missing files for Gauges dialog
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
112 * Software engineering by Intevation GmbH
5fa1ad39e1bc client: added missing files for Gauges dialog
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
113 *
5fa1ad39e1bc client: added missing files for Gauges dialog
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
114 * Author(s):
5fa1ad39e1bc client: added missing files for Gauges dialog
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
115 * Markus Kottländer <markus.kottlaender@intevation.de>
5fa1ad39e1bc client: added missing files for Gauges dialog
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
116 */
4456
acb21e7362ce client: pdf-gen: fix diagram title for pdf (waterlevels, hydrologicalconditions)
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4371
diff changeset
117
2604
85f9bf4a6eba client: gauge waterlevel diagram: draw reference waterlevels
Markus Kottlaender <markus@intevation.de>
parents: 2598
diff changeset
118 import { mapState, mapGetters } from "vuex";
2985
1b8bb4f89227 client: removed .js and .vue extention from imports
Markus Kottlaender <markus@intevation.de>
parents: 2894
diff changeset
119 import { displayError } from "@/lib/errors";
4456
acb21e7362ce client: pdf-gen: fix diagram title for pdf (waterlevels, hydrologicalconditions)
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4371
diff changeset
120 import { pdfgen } from "@/lib/mixins";
2598
5fa1ad39e1bc client: added missing files for Gauges dialog
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
121
5fa1ad39e1bc client: added missing files for Gauges dialog
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
122 export default {
4456
acb21e7362ce client: pdf-gen: fix diagram title for pdf (waterlevels, hydrologicalconditions)
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4371
diff changeset
123 mixins: [pdfgen],
2598
5fa1ad39e1bc client: added missing files for Gauges dialog
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
124 data() {
5fa1ad39e1bc client: added missing files for Gauges dialog
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
125 return {
2710
f393fabfdd35 client: waterlevel diagram: chart extent based on selected dates instead of data
Markus Kottlaender <markus@intevation.de>
parents: 2701
diff changeset
126 loading: false
2598
5fa1ad39e1bc client: added missing files for Gauges dialog
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
127 };
5fa1ad39e1bc client: added missing files for Gauges dialog
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
128 },
5fa1ad39e1bc client: added missing files for Gauges dialog
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
129 computed: {
3146
b6cc4838d2c0 client: implemented pane mechanic for diagrams
Markus Kottlaender <markus@intevation.de>
parents: 3054
diff changeset
130 ...mapState("application", ["showGauges", "paneSetup"]),
2830
0632d543a427 client: spuc7/8: show time periods in diagram titles
Markus Kottlaender <markus@intevation.de>
parents: 2829
diff changeset
131 ...mapState("gauges", ["gauges", "longtermInterval"]),
2604
85f9bf4a6eba client: gauge waterlevel diagram: draw reference waterlevels
Markus Kottlaender <markus@intevation.de>
parents: 2598
diff changeset
132 ...mapGetters("gauges", ["selectedGauge"]),
2754
d0f6c222f4f9 client:correct a set of strings marking
Fadi Abbud <fadi.abbud@intevation.de>
parents: 2751
diff changeset
133 gaugesLabel() {
d0f6c222f4f9 client:correct a set of strings marking
Fadi Abbud <fadi.abbud@intevation.de>
parents: 2751
diff changeset
134 return this.$gettext("Gauges");
d0f6c222f4f9 client:correct a set of strings marking
Fadi Abbud <fadi.abbud@intevation.de>
parents: 2751
diff changeset
135 },
2712
0ac077897ce5 client: Gauges dialog: ordered gauge list by country code
Markus Kottlaender <markus@intevation.de>
parents: 2710
diff changeset
136 orderedGauges() {
0ac077897ce5 client: Gauges dialog: ordered gauge list by country code
Markus Kottlaender <markus@intevation.de>
parents: 2710
diff changeset
137 let orderedGauges = {};
0ac077897ce5 client: Gauges dialog: ordered gauge list by country code
Markus Kottlaender <markus@intevation.de>
parents: 2710
diff changeset
138 this.gauges.forEach(g => {
0ac077897ce5 client: Gauges dialog: ordered gauge list by country code
Markus Kottlaender <markus@intevation.de>
parents: 2710
diff changeset
139 let isrsInfo = this.isrsInfo(g);
0ac077897ce5 client: Gauges dialog: ordered gauge list by country code
Markus Kottlaender <markus@intevation.de>
parents: 2710
diff changeset
140 if (orderedGauges.hasOwnProperty(isrsInfo.countryCode)) {
0ac077897ce5 client: Gauges dialog: ordered gauge list by country code
Markus Kottlaender <markus@intevation.de>
parents: 2710
diff changeset
141 orderedGauges[isrsInfo.countryCode].push(g);
0ac077897ce5 client: Gauges dialog: ordered gauge list by country code
Markus Kottlaender <markus@intevation.de>
parents: 2710
diff changeset
142 } else {
0ac077897ce5 client: Gauges dialog: ordered gauge list by country code
Markus Kottlaender <markus@intevation.de>
parents: 2710
diff changeset
143 orderedGauges[isrsInfo.countryCode] = [g];
0ac077897ce5 client: Gauges dialog: ordered gauge list by country code
Markus Kottlaender <markus@intevation.de>
parents: 2710
diff changeset
144 }
0ac077897ce5 client: Gauges dialog: ordered gauge list by country code
Markus Kottlaender <markus@intevation.de>
parents: 2710
diff changeset
145 });
0ac077897ce5 client: Gauges dialog: ordered gauge list by country code
Markus Kottlaender <markus@intevation.de>
parents: 2710
diff changeset
146 return orderedGauges;
0ac077897ce5 client: Gauges dialog: ordered gauge list by country code
Markus Kottlaender <markus@intevation.de>
parents: 2710
diff changeset
147 },
2643
27933e66e848 client: gauges: use isrs_code as unique id for gauges
Markus Kottlaender <markus@intevation.de>
parents: 2642
diff changeset
148 selectedGaugeISRS: {
2598
5fa1ad39e1bc client: added missing files for Gauges dialog
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
149 get() {
2643
27933e66e848 client: gauges: use isrs_code as unique id for gauges
Markus Kottlaender <markus@intevation.de>
parents: 2642
diff changeset
150 return this.$store.state.gauges.selectedGaugeISRS;
2598
5fa1ad39e1bc client: added missing files for Gauges dialog
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
151 },
2643
27933e66e848 client: gauges: use isrs_code as unique id for gauges
Markus Kottlaender <markus@intevation.de>
parents: 2642
diff changeset
152 set(isrs) {
4478
51dc4811a0e6 Gauges: Instead of dynamically scroll use crosshairs button
Thomas Junk <thomas.junk@intevation.de>
parents: 4456
diff changeset
153 this.$store.dispatch("gauges/setSelectedGaugeISRS", isrs);
2598
5fa1ad39e1bc client: added missing files for Gauges dialog
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
154 }
2710
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 dateFrom: {
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.dateFrom;
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/dateFrom", date);
f393fabfdd35 client: waterlevel diagram: chart extent based on selected dates instead of data
Markus Kottlaender <markus@intevation.de>
parents: 2701
diff changeset
162 }
f393fabfdd35 client: waterlevel diagram: chart extent based on selected dates instead of data
Markus Kottlaender <markus@intevation.de>
parents: 2701
diff changeset
163 },
f393fabfdd35 client: waterlevel diagram: chart extent based on selected dates instead of data
Markus Kottlaender <markus@intevation.de>
parents: 2701
diff changeset
164 dateTo: {
f393fabfdd35 client: waterlevel diagram: chart extent based on selected dates instead of data
Markus Kottlaender <markus@intevation.de>
parents: 2701
diff changeset
165 get() {
f393fabfdd35 client: waterlevel diagram: chart extent based on selected dates instead of data
Markus Kottlaender <markus@intevation.de>
parents: 2701
diff changeset
166 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
167 },
f393fabfdd35 client: waterlevel diagram: chart extent based on selected dates instead of data
Markus Kottlaender <markus@intevation.de>
parents: 2701
diff changeset
168 set(date) {
f393fabfdd35 client: waterlevel diagram: chart extent based on selected dates instead of data
Markus Kottlaender <markus@intevation.de>
parents: 2701
diff changeset
169 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
170 }
2829
4a1211727d5f client: spuc8: implemented year controls
Markus Kottlaender <markus@intevation.de>
parents: 2813
diff changeset
171 },
4a1211727d5f client: spuc8: implemented year controls
Markus Kottlaender <markus@intevation.de>
parents: 2813
diff changeset
172 yearCompare: {
4a1211727d5f client: spuc8: implemented year controls
Markus Kottlaender <markus@intevation.de>
parents: 2813
diff changeset
173 get() {
4a1211727d5f client: spuc8: implemented year controls
Markus Kottlaender <markus@intevation.de>
parents: 2813
diff changeset
174 return this.$store.state.gauges.yearCompare;
4a1211727d5f client: spuc8: implemented year controls
Markus Kottlaender <markus@intevation.de>
parents: 2813
diff changeset
175 },
4a1211727d5f client: spuc8: implemented year controls
Markus Kottlaender <markus@intevation.de>
parents: 2813
diff changeset
176 set(year) {
4a1211727d5f client: spuc8: implemented year controls
Markus Kottlaender <markus@intevation.de>
parents: 2813
diff changeset
177 this.$store.commit("gauges/yearCompare", year);
4a1211727d5f client: spuc8: implemented year controls
Markus Kottlaender <markus@intevation.de>
parents: 2813
diff changeset
178 }
2598
5fa1ad39e1bc client: added missing files for Gauges dialog
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
179 }
5fa1ad39e1bc client: added missing files for Gauges dialog
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
180 },
2696
cc3eee8b5d71 client: waterlevel diagram: update diagram immediately when selectedGauge changes
Markus Kottlaender <markus@intevation.de>
parents: 2644
diff changeset
181 watch: {
3146
b6cc4838d2c0 client: implemented pane mechanic for diagrams
Markus Kottlaender <markus@intevation.de>
parents: 3054
diff changeset
182 selectedGaugeISRS(gauge) {
4478
51dc4811a0e6 Gauges: Instead of dynamically scroll use crosshairs button
Thomas Junk <thomas.junk@intevation.de>
parents: 4456
diff changeset
183 if (!gauge) {
3146
b6cc4838d2c0 client: implemented pane mechanic for diagrams
Markus Kottlaender <markus@intevation.de>
parents: 3054
diff changeset
184 this.$store.commit("application/paneSetup", "DEFAULT");
2761
71e7237110ba client: spuc8: prepared diagram
Markus Kottlaender <markus@intevation.de>
parents: 2754
diff changeset
185 }
2696
cc3eee8b5d71 client: waterlevel diagram: update diagram immediately when selectedGauge changes
Markus Kottlaender <markus@intevation.de>
parents: 2644
diff changeset
186 }
cc3eee8b5d71 client: waterlevel diagram: update diagram immediately when selectedGauge changes
Markus Kottlaender <markus@intevation.de>
parents: 2644
diff changeset
187 },
2598
5fa1ad39e1bc client: added missing files for Gauges dialog
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
188 methods: {
4478
51dc4811a0e6 Gauges: Instead of dynamically scroll use crosshairs button
Thomas Junk <thomas.junk@intevation.de>
parents: 4456
diff changeset
189 takeMeThere() {
51dc4811a0e6 Gauges: Instead of dynamically scroll use crosshairs button
Thomas Junk <thomas.junk@intevation.de>
parents: 4456
diff changeset
190 let coordinates = this.selectedGauge.geometry.coordinates;
51dc4811a0e6 Gauges: Instead of dynamically scroll use crosshairs button
Thomas Junk <thomas.junk@intevation.de>
parents: 4456
diff changeset
191 this.$store.dispatch("map/moveMap", {
51dc4811a0e6 Gauges: Instead of dynamically scroll use crosshairs button
Thomas Junk <thomas.junk@intevation.de>
parents: 4456
diff changeset
192 coordinates,
51dc4811a0e6 Gauges: Instead of dynamically scroll use crosshairs button
Thomas Junk <thomas.junk@intevation.de>
parents: 4456
diff changeset
193 zoom: 15,
51dc4811a0e6 Gauges: Instead of dynamically scroll use crosshairs button
Thomas Junk <thomas.junk@intevation.de>
parents: 4456
diff changeset
194 preventZoomOut: true
51dc4811a0e6 Gauges: Instead of dynamically scroll use crosshairs button
Thomas Junk <thomas.junk@intevation.de>
parents: 4456
diff changeset
195 });
51dc4811a0e6 Gauges: Instead of dynamically scroll use crosshairs button
Thomas Junk <thomas.junk@intevation.de>
parents: 4456
diff changeset
196 },
2598
5fa1ad39e1bc client: added missing files for Gauges dialog
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
197 close() {
5fa1ad39e1bc client: added missing files for Gauges dialog
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
198 this.$store.commit("application/showGauges", false);
5fa1ad39e1bc client: added missing files for Gauges dialog
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
199 },
5fa1ad39e1bc client: added missing files for Gauges dialog
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
200 showWaterlevelDiagram() {
5fa1ad39e1bc client: added missing files for Gauges dialog
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
201 this.loading = true;
2751
5da81634bdc4 client: waterlevel diagram: implemented nash-sutcliffe
Markus Kottlaender <markus@intevation.de>
parents: 2740
diff changeset
202 Promise.all([
5da81634bdc4 client: waterlevel diagram: implemented nash-sutcliffe
Markus Kottlaender <markus@intevation.de>
parents: 2740
diff changeset
203 this.$store.dispatch("gauges/loadWaterlevels"),
5da81634bdc4 client: waterlevel diagram: implemented nash-sutcliffe
Markus Kottlaender <markus@intevation.de>
parents: 2740
diff changeset
204 this.$store.dispatch("gauges/loadNashSutcliffe")
5da81634bdc4 client: waterlevel diagram: implemented nash-sutcliffe
Markus Kottlaender <markus@intevation.de>
parents: 2740
diff changeset
205 ])
2701
e622689d73bd client: waterlevel diagram: use endpoint
Markus Kottlaender <markus@intevation.de>
parents: 2696
diff changeset
206 .catch(error => {
4869
6b054b91d9b2 backend not reachable as error message etd. Login adjusted
Thomas Junk <thomas.junk@intevation.de>
parents: 4868
diff changeset
207 let message = "Backend not reachable";
4868
008bc1ae8897 exception handling
Thomas Junk <thomas.junk@intevation.de>
parents: 4478
diff changeset
208 if (error.response) {
008bc1ae8897 exception handling
Thomas Junk <thomas.junk@intevation.de>
parents: 4478
diff changeset
209 const { status, data } = error.response;
008bc1ae8897 exception handling
Thomas Junk <thomas.junk@intevation.de>
parents: 4478
diff changeset
210 message = `${status}: ${data.message || data}`;
008bc1ae8897 exception handling
Thomas Junk <thomas.junk@intevation.de>
parents: 4478
diff changeset
211 }
2701
e622689d73bd client: waterlevel diagram: use endpoint
Markus Kottlaender <markus@intevation.de>
parents: 2696
diff changeset
212 displayError({
4868
008bc1ae8897 exception handling
Thomas Junk <thomas.junk@intevation.de>
parents: 4478
diff changeset
213 title: this.$gettext("Backend Error"),
008bc1ae8897 exception handling
Thomas Junk <thomas.junk@intevation.de>
parents: 4478
diff changeset
214 message: message
2701
e622689d73bd client: waterlevel diagram: use endpoint
Markus Kottlaender <markus@intevation.de>
parents: 2696
diff changeset
215 });
e622689d73bd client: waterlevel diagram: use endpoint
Markus Kottlaender <markus@intevation.de>
parents: 2696
diff changeset
216 })
e622689d73bd client: waterlevel diagram: use endpoint
Markus Kottlaender <markus@intevation.de>
parents: 2696
diff changeset
217 .finally(() => {
3146
b6cc4838d2c0 client: implemented pane mechanic for diagrams
Markus Kottlaender <markus@intevation.de>
parents: 3054
diff changeset
218 this.$store.commit(
b6cc4838d2c0 client: implemented pane mechanic for diagrams
Markus Kottlaender <markus@intevation.de>
parents: 3054
diff changeset
219 "application/paneSetup",
b6cc4838d2c0 client: implemented pane mechanic for diagrams
Markus Kottlaender <markus@intevation.de>
parents: 3054
diff changeset
220 [
b6cc4838d2c0 client: implemented pane mechanic for diagrams
Markus Kottlaender <markus@intevation.de>
parents: 3054
diff changeset
221 "GAUGE_HYDROLOGICALCONDITIONS",
b6cc4838d2c0 client: implemented pane mechanic for diagrams
Markus Kottlaender <markus@intevation.de>
parents: 3054
diff changeset
222 "GAUGE_WATERLEVEL_HYDROLOGICALCONDITIONS"
b6cc4838d2c0 client: implemented pane mechanic for diagrams
Markus Kottlaender <markus@intevation.de>
parents: 3054
diff changeset
223 ].includes(this.paneSetup)
b6cc4838d2c0 client: implemented pane mechanic for diagrams
Markus Kottlaender <markus@intevation.de>
parents: 3054
diff changeset
224 ? "GAUGE_WATERLEVEL_HYDROLOGICALCONDITIONS"
b6cc4838d2c0 client: implemented pane mechanic for diagrams
Markus Kottlaender <markus@intevation.de>
parents: 3054
diff changeset
225 : "GAUGE_WATERLEVEL"
b6cc4838d2c0 client: implemented pane mechanic for diagrams
Markus Kottlaender <markus@intevation.de>
parents: 3054
diff changeset
226 );
2598
5fa1ad39e1bc client: added missing files for Gauges dialog
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
227 this.loading = false;
5fa1ad39e1bc client: added missing files for Gauges dialog
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
228 });
2643
27933e66e848 client: gauges: use isrs_code as unique id for gauges
Markus Kottlaender <markus@intevation.de>
parents: 2642
diff changeset
229 },
2761
71e7237110ba client: spuc8: prepared diagram
Markus Kottlaender <markus@intevation.de>
parents: 2754
diff changeset
230 showHydrologicalConditionsDiagram() {
71e7237110ba client: spuc8: prepared diagram
Markus Kottlaender <markus@intevation.de>
parents: 2754
diff changeset
231 this.loading = true;
71e7237110ba client: spuc8: prepared diagram
Markus Kottlaender <markus@intevation.de>
parents: 2754
diff changeset
232
2813
49c1570919ae client: spuc8: use new endpoints to fetch year based and longterm waterlevel data
Markus Kottlaender <markus@intevation.de>
parents: 2791
diff changeset
233 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
234 this.$store.dispatch("gauges/loadLongtermWaterlevels"),
2829
4a1211727d5f client: spuc8: implemented year controls
Markus Kottlaender <markus@intevation.de>
parents: 2813
diff changeset
235 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
236 ])
2761
71e7237110ba client: spuc8: prepared diagram
Markus Kottlaender <markus@intevation.de>
parents: 2754
diff changeset
237 .catch(error => {
4869
6b054b91d9b2 backend not reachable as error message etd. Login adjusted
Thomas Junk <thomas.junk@intevation.de>
parents: 4868
diff changeset
238 let message = "Backend not reachable";
4868
008bc1ae8897 exception handling
Thomas Junk <thomas.junk@intevation.de>
parents: 4478
diff changeset
239 if (error.response) {
008bc1ae8897 exception handling
Thomas Junk <thomas.junk@intevation.de>
parents: 4478
diff changeset
240 const { status, data } = error.response;
008bc1ae8897 exception handling
Thomas Junk <thomas.junk@intevation.de>
parents: 4478
diff changeset
241 message = `${status}: ${data.message || data}`;
008bc1ae8897 exception handling
Thomas Junk <thomas.junk@intevation.de>
parents: 4478
diff changeset
242 }
2761
71e7237110ba client: spuc8: prepared diagram
Markus Kottlaender <markus@intevation.de>
parents: 2754
diff changeset
243 displayError({
4868
008bc1ae8897 exception handling
Thomas Junk <thomas.junk@intevation.de>
parents: 4478
diff changeset
244 title: this.$gettext("Backend Error"),
008bc1ae8897 exception handling
Thomas Junk <thomas.junk@intevation.de>
parents: 4478
diff changeset
245 message: message
2761
71e7237110ba client: spuc8: prepared diagram
Markus Kottlaender <markus@intevation.de>
parents: 2754
diff changeset
246 });
71e7237110ba client: spuc8: prepared diagram
Markus Kottlaender <markus@intevation.de>
parents: 2754
diff changeset
247 })
71e7237110ba client: spuc8: prepared diagram
Markus Kottlaender <markus@intevation.de>
parents: 2754
diff changeset
248 .finally(() => {
3146
b6cc4838d2c0 client: implemented pane mechanic for diagrams
Markus Kottlaender <markus@intevation.de>
parents: 3054
diff changeset
249 this.$store.commit(
b6cc4838d2c0 client: implemented pane mechanic for diagrams
Markus Kottlaender <markus@intevation.de>
parents: 3054
diff changeset
250 "application/paneSetup",
b6cc4838d2c0 client: implemented pane mechanic for diagrams
Markus Kottlaender <markus@intevation.de>
parents: 3054
diff changeset
251 [
b6cc4838d2c0 client: implemented pane mechanic for diagrams
Markus Kottlaender <markus@intevation.de>
parents: 3054
diff changeset
252 "GAUGE_WATERLEVEL",
b6cc4838d2c0 client: implemented pane mechanic for diagrams
Markus Kottlaender <markus@intevation.de>
parents: 3054
diff changeset
253 "GAUGE_WATERLEVEL_HYDROLOGICALCONDITIONS"
b6cc4838d2c0 client: implemented pane mechanic for diagrams
Markus Kottlaender <markus@intevation.de>
parents: 3054
diff changeset
254 ].includes(this.paneSetup)
b6cc4838d2c0 client: implemented pane mechanic for diagrams
Markus Kottlaender <markus@intevation.de>
parents: 3054
diff changeset
255 ? "GAUGE_WATERLEVEL_HYDROLOGICALCONDITIONS"
b6cc4838d2c0 client: implemented pane mechanic for diagrams
Markus Kottlaender <markus@intevation.de>
parents: 3054
diff changeset
256 : "GAUGE_HYDROLOGICALCONDITIONS"
b6cc4838d2c0 client: implemented pane mechanic for diagrams
Markus Kottlaender <markus@intevation.de>
parents: 3054
diff changeset
257 );
2761
71e7237110ba client: spuc8: prepared diagram
Markus Kottlaender <markus@intevation.de>
parents: 2754
diff changeset
258 this.loading = false;
71e7237110ba client: spuc8: prepared diagram
Markus Kottlaender <markus@intevation.de>
parents: 2754
diff changeset
259 });
71e7237110ba client: spuc8: prepared diagram
Markus Kottlaender <markus@intevation.de>
parents: 2754
diff changeset
260 },
2643
27933e66e848 client: gauges: use isrs_code as unique id for gauges
Markus Kottlaender <markus@intevation.de>
parents: 2642
diff changeset
261 gaugeLabel(gauge) {
2712
0ac077897ce5 client: Gauges dialog: ordered gauge list by country code
Markus Kottlaender <markus@intevation.de>
parents: 2710
diff changeset
262 return `${gauge.properties.objname} (${this.isrsInfo(gauge).orc})`;
2598
5fa1ad39e1bc client: added missing files for Gauges dialog
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
263 }
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 mounted() {
5fa1ad39e1bc client: added missing files for Gauges dialog
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
266 this.$store.dispatch("gauges/loadGauges");
5fa1ad39e1bc client: added missing files for Gauges dialog
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
267 }
5fa1ad39e1bc client: added missing files for Gauges dialog
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
268 };
5fa1ad39e1bc client: added missing files for Gauges dialog
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
269 </script>