annotate client/src/components/fairway/AvailableFairwayDepthDialogue.vue @ 3237:86e108358216

available_fairway_depth: bug fix for loading bottlenecks and stretches
author Thomas Junk <thomas.junk@intevation.de>
date Fri, 10 May 2019 11:43:58 +0200
parents 5914d615f703
children 94e966ebef35
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3159
4f4905b57fcf toolbar: added statistics dialog component
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
1 <template>
4f4905b57fcf toolbar: added statistics dialog component
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
2 <div
4f4905b57fcf toolbar: added statistics dialog component
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
3 :class="[
4f4905b57fcf toolbar: added statistics dialog component
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
4 'box ui-element rounded bg-white text-nowrap',
3231
2dab20bed284 show_statistics: refac to fairwayavailability
Thomas Junk <thomas.junk@intevation.de>
parents: 3214
diff changeset
5 { expanded: showFairwayDepth }
3159
4f4905b57fcf toolbar: added statistics dialog component
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
6 ]"
4f4905b57fcf toolbar: added statistics dialog component
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
7 >
4f4905b57fcf toolbar: added statistics dialog component
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
8 <div style="width: 18rem">
4f4905b57fcf toolbar: added statistics dialog component
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
9 <UIBoxHeader icon="chart-line" :title="label" :closeCallback="close" />
4f4905b57fcf toolbar: added statistics dialog component
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
10 <div class="box-body">
4f4905b57fcf toolbar: added statistics dialog component
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
11 <UISpinnerOverlay v-if="loading" />
3199
25a26f666ee8 statistics: layout
Thomas Junk <thomas.junk@intevation.de>
parents: 3198
diff changeset
12 <div
25a26f666ee8 statistics: layout
Thomas Junk <thomas.junk@intevation.de>
parents: 3198
diff changeset
13 class="mb-3 d-flex flex-row justify-content-between align-items-center"
25a26f666ee8 statistics: layout
Thomas Junk <thomas.junk@intevation.de>
parents: 3198
diff changeset
14 >
3172
975efa874acf statistic: choice between bottlenecks and stretches implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 3159
diff changeset
15 <div>
975efa874acf statistic: choice between bottlenecks and stretches implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 3159
diff changeset
16 <input :value="$options.BOTTLENECKS" type="radio" v-model="type" />
975efa874acf statistic: choice between bottlenecks and stretches implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 3159
diff changeset
17 <small class="ml-1 text-muted">
975efa874acf statistic: choice between bottlenecks and stretches implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 3159
diff changeset
18 <translate>Bottlenecks</translate>
975efa874acf statistic: choice between bottlenecks and stretches implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 3159
diff changeset
19 </small>
975efa874acf statistic: choice between bottlenecks and stretches implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 3159
diff changeset
20 </div>
975efa874acf statistic: choice between bottlenecks and stretches implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 3159
diff changeset
21 <div>
975efa874acf statistic: choice between bottlenecks and stretches implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 3159
diff changeset
22 <input :value="$options.STRETCHES" type="radio" v-model="type" />
975efa874acf statistic: choice between bottlenecks and stretches implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 3159
diff changeset
23 <small class="ml-1 text-muted">
975efa874acf statistic: choice between bottlenecks and stretches implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 3159
diff changeset
24 <translate>Stretches</translate>
975efa874acf statistic: choice between bottlenecks and stretches implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 3159
diff changeset
25 </small>
975efa874acf statistic: choice between bottlenecks and stretches implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 3159
diff changeset
26 </div>
975efa874acf statistic: choice between bottlenecks and stretches implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 3159
diff changeset
27 <div>
975efa874acf statistic: choice between bottlenecks and stretches implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 3159
diff changeset
28 <input :value="$options.SECTIONS" type="radio" v-model="type" />
975efa874acf statistic: choice between bottlenecks and stretches implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 3159
diff changeset
29 <small class="ml-1 text-muted">
975efa874acf statistic: choice between bottlenecks and stretches implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 3159
diff changeset
30 <translate>Sections</translate>
975efa874acf statistic: choice between bottlenecks and stretches implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 3159
diff changeset
31 </small>
975efa874acf statistic: choice between bottlenecks and stretches implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 3159
diff changeset
32 </div>
975efa874acf statistic: choice between bottlenecks and stretches implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 3159
diff changeset
33 </div>
3159
4f4905b57fcf toolbar: added statistics dialog component
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
34 <div class="d-flex flex-column">
3172
975efa874acf statistic: choice between bottlenecks and stretches implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 3159
diff changeset
35 <select
3236
5914d615f703 available_fairway_depth: use the store luke
Thomas Junk <thomas.junk@intevation.de>
parents: 3233
diff changeset
36 :key="1"
5914d615f703 available_fairway_depth: use the store luke
Thomas Junk <thomas.junk@intevation.de>
parents: 3233
diff changeset
37 v-if="type === $options.BOTTLENECKS"
5914d615f703 available_fairway_depth: use the store luke
Thomas Junk <thomas.junk@intevation.de>
parents: 3233
diff changeset
38 @change="entrySelected"
5914d615f703 available_fairway_depth: use the store luke
Thomas Junk <thomas.junk@intevation.de>
parents: 3233
diff changeset
39 class="form-control form-control-sm font-weight-bold"
5914d615f703 available_fairway_depth: use the store luke
Thomas Junk <thomas.junk@intevation.de>
parents: 3233
diff changeset
40 v-model="selectedEntry"
5914d615f703 available_fairway_depth: use the store luke
Thomas Junk <thomas.junk@intevation.de>
parents: 3233
diff changeset
41 >
5914d615f703 available_fairway_depth: use the store luke
Thomas Junk <thomas.junk@intevation.de>
parents: 3233
diff changeset
42 <option :value="null">{{ empty }}</option>
5914d615f703 available_fairway_depth: use the store luke
Thomas Junk <thomas.junk@intevation.de>
parents: 3233
diff changeset
43 <optgroup
5914d615f703 available_fairway_depth: use the store luke
Thomas Junk <thomas.junk@intevation.de>
parents: 3233
diff changeset
44 v-for="(bottlenecksForCountry, cc) in orderedBottlenecks"
5914d615f703 available_fairway_depth: use the store luke
Thomas Junk <thomas.junk@intevation.de>
parents: 3233
diff changeset
45 :key="cc"
5914d615f703 available_fairway_depth: use the store luke
Thomas Junk <thomas.junk@intevation.de>
parents: 3233
diff changeset
46 :label="cc"
5914d615f703 available_fairway_depth: use the store luke
Thomas Junk <thomas.junk@intevation.de>
parents: 3233
diff changeset
47 >
5914d615f703 available_fairway_depth: use the store luke
Thomas Junk <thomas.junk@intevation.de>
parents: 3233
diff changeset
48 <option
5914d615f703 available_fairway_depth: use the store luke
Thomas Junk <thomas.junk@intevation.de>
parents: 3233
diff changeset
49 v-for="bn in bottlenecksForCountry"
5914d615f703 available_fairway_depth: use the store luke
Thomas Junk <thomas.junk@intevation.de>
parents: 3233
diff changeset
50 :key="bn.properties.name"
5914d615f703 available_fairway_depth: use the store luke
Thomas Junk <thomas.junk@intevation.de>
parents: 3233
diff changeset
51 :value="bn"
5914d615f703 available_fairway_depth: use the store luke
Thomas Junk <thomas.junk@intevation.de>
parents: 3233
diff changeset
52 >
5914d615f703 available_fairway_depth: use the store luke
Thomas Junk <thomas.junk@intevation.de>
parents: 3233
diff changeset
53 {{ bn.properties.name }}
5914d615f703 available_fairway_depth: use the store luke
Thomas Junk <thomas.junk@intevation.de>
parents: 3233
diff changeset
54 </option>
5914d615f703 available_fairway_depth: use the store luke
Thomas Junk <thomas.junk@intevation.de>
parents: 3233
diff changeset
55 </optgroup>
5914d615f703 available_fairway_depth: use the store luke
Thomas Junk <thomas.junk@intevation.de>
parents: 3233
diff changeset
56 </select>
5914d615f703 available_fairway_depth: use the store luke
Thomas Junk <thomas.junk@intevation.de>
parents: 3233
diff changeset
57 <select
5914d615f703 available_fairway_depth: use the store luke
Thomas Junk <thomas.junk@intevation.de>
parents: 3233
diff changeset
58 :key="2"
5914d615f703 available_fairway_depth: use the store luke
Thomas Junk <thomas.junk@intevation.de>
parents: 3233
diff changeset
59 v-else
3172
975efa874acf statistic: choice between bottlenecks and stretches implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 3159
diff changeset
60 @change="entrySelected"
3199
25a26f666ee8 statistics: layout
Thomas Junk <thomas.junk@intevation.de>
parents: 3198
diff changeset
61 class="form-control form-control-sm font-weight-bold"
3172
975efa874acf statistic: choice between bottlenecks and stretches implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 3159
diff changeset
62 v-model="selectedEntry"
975efa874acf statistic: choice between bottlenecks and stretches implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 3159
diff changeset
63 >
975efa874acf statistic: choice between bottlenecks and stretches implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 3159
diff changeset
64 <option :value="null">{{ empty }}</option>
975efa874acf statistic: choice between bottlenecks and stretches implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 3159
diff changeset
65 <option
975efa874acf statistic: choice between bottlenecks and stretches implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 3159
diff changeset
66 v-for="(entry, index) in entries"
3173
1287b031424c statistics: sprinkled fairy dust on to bottleneck selection
Thomas Junk <thomas.junk@intevation.de>
parents: 3172
diff changeset
67 :value="entry"
3172
975efa874acf statistic: choice between bottlenecks and stretches implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 3159
diff changeset
68 :key="index"
975efa874acf statistic: choice between bottlenecks and stretches implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 3159
diff changeset
69 >{{ entry.properties.name }}</option
975efa874acf statistic: choice between bottlenecks and stretches implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 3159
diff changeset
70 >
3159
4f4905b57fcf toolbar: added statistics dialog component
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
71 </select>
4f4905b57fcf toolbar: added statistics dialog component
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
72 </div>
3185
505414dfe3e7 available_fairway_depth: move statistic dialog to store
Thomas Junk <thomas.junk@intevation.de>
parents: 3184
diff changeset
73 <div class="d-flex flex-column mt-3">
3199
25a26f666ee8 statistics: layout
Thomas Junk <thomas.junk@intevation.de>
parents: 3198
diff changeset
74 <div class="d-flex flex-row w-100">
25a26f666ee8 statistics: layout
Thomas Junk <thomas.junk@intevation.de>
parents: 3198
diff changeset
75 <div class="d-flex flex-column mb-3 w-50 mr-1">
25a26f666ee8 statistics: layout
Thomas Junk <thomas.junk@intevation.de>
parents: 3198
diff changeset
76 <small class="my-auto text-muted"
25a26f666ee8 statistics: layout
Thomas Junk <thomas.junk@intevation.de>
parents: 3198
diff changeset
77 ><translate>Type</translate></small
25a26f666ee8 statistics: layout
Thomas Junk <thomas.junk@intevation.de>
parents: 3198
diff changeset
78 >
25a26f666ee8 statistics: layout
Thomas Junk <thomas.junk@intevation.de>
parents: 3198
diff changeset
79 <select
25a26f666ee8 statistics: layout
Thomas Junk <thomas.junk@intevation.de>
parents: 3198
diff changeset
80 v-model="selectedFrequency"
25a26f666ee8 statistics: layout
Thomas Junk <thomas.junk@intevation.de>
parents: 3198
diff changeset
81 class="form-control form-control-sm"
3191
c0cd5dfec153 statistics: persist fields to vuex
Thomas Junk <thomas.junk@intevation.de>
parents: 3185
diff changeset
82 >
3199
25a26f666ee8 statistics: layout
Thomas Junk <thomas.junk@intevation.de>
parents: 3198
diff changeset
83 <option
25a26f666ee8 statistics: layout
Thomas Junk <thomas.junk@intevation.de>
parents: 3198
diff changeset
84 v-for="(option, index) in $options.FREQUENCIES"
25a26f666ee8 statistics: layout
Thomas Junk <thomas.junk@intevation.de>
parents: 3198
diff changeset
85 :value="option"
25a26f666ee8 statistics: layout
Thomas Junk <thomas.junk@intevation.de>
parents: 3198
diff changeset
86 :key="index"
25a26f666ee8 statistics: layout
Thomas Junk <thomas.junk@intevation.de>
parents: 3198
diff changeset
87 ><translate>{{ option }}</translate></option
25a26f666ee8 statistics: layout
Thomas Junk <thomas.junk@intevation.de>
parents: 3198
diff changeset
88 >
25a26f666ee8 statistics: layout
Thomas Junk <thomas.junk@intevation.de>
parents: 3198
diff changeset
89 </select>
25a26f666ee8 statistics: layout
Thomas Junk <thomas.junk@intevation.de>
parents: 3198
diff changeset
90 </div>
25a26f666ee8 statistics: layout
Thomas Junk <thomas.junk@intevation.de>
parents: 3198
diff changeset
91 <div class="d-flex flex-column mb-3 w-50 ml-1">
25a26f666ee8 statistics: layout
Thomas Junk <thomas.junk@intevation.de>
parents: 3198
diff changeset
92 <small class="my-auto text-muted"
25a26f666ee8 statistics: layout
Thomas Junk <thomas.junk@intevation.de>
parents: 3198
diff changeset
93 ><translate>LOS</translate></small
25a26f666ee8 statistics: layout
Thomas Junk <thomas.junk@intevation.de>
parents: 3198
diff changeset
94 >
25a26f666ee8 statistics: layout
Thomas Junk <thomas.junk@intevation.de>
parents: 3198
diff changeset
95 <select v-model="los" class="form-control form-control-sm">
25a26f666ee8 statistics: layout
Thomas Junk <thomas.junk@intevation.de>
parents: 3198
diff changeset
96 <option value="1">1</option>
25a26f666ee8 statistics: layout
Thomas Junk <thomas.junk@intevation.de>
parents: 3198
diff changeset
97 <option value="2">2</option>
25a26f666ee8 statistics: layout
Thomas Junk <thomas.junk@intevation.de>
parents: 3198
diff changeset
98 <option value="3">3</option>
25a26f666ee8 statistics: layout
Thomas Junk <thomas.junk@intevation.de>
parents: 3198
diff changeset
99 </select>
25a26f666ee8 statistics: layout
Thomas Junk <thomas.junk@intevation.de>
parents: 3198
diff changeset
100 </div>
3185
505414dfe3e7 available_fairway_depth: move statistic dialog to store
Thomas Junk <thomas.junk@intevation.de>
parents: 3184
diff changeset
101 </div>
3199
25a26f666ee8 statistics: layout
Thomas Junk <thomas.junk@intevation.de>
parents: 3198
diff changeset
102 <div class="d-flex flex-row w-100">
25a26f666ee8 statistics: layout
Thomas Junk <thomas.junk@intevation.de>
parents: 3198
diff changeset
103 <div class="d-flex flex-column w-50 mr-1">
25a26f666ee8 statistics: layout
Thomas Junk <thomas.junk@intevation.de>
parents: 3198
diff changeset
104 <small for="from" class="my-auto text-muted"
25a26f666ee8 statistics: layout
Thomas Junk <thomas.junk@intevation.de>
parents: 3198
diff changeset
105 ><translate>Date from</translate></small
25a26f666ee8 statistics: layout
Thomas Junk <thomas.junk@intevation.de>
parents: 3198
diff changeset
106 ><input
25a26f666ee8 statistics: layout
Thomas Junk <thomas.junk@intevation.de>
parents: 3198
diff changeset
107 id="from"
25a26f666ee8 statistics: layout
Thomas Junk <thomas.junk@intevation.de>
parents: 3198
diff changeset
108 v-model="fromDate"
25a26f666ee8 statistics: layout
Thomas Junk <thomas.junk@intevation.de>
parents: 3198
diff changeset
109 class="form-control form-control-sm"
25a26f666ee8 statistics: layout
Thomas Junk <thomas.junk@intevation.de>
parents: 3198
diff changeset
110 type="date"
25a26f666ee8 statistics: layout
Thomas Junk <thomas.junk@intevation.de>
parents: 3198
diff changeset
111 />
25a26f666ee8 statistics: layout
Thomas Junk <thomas.junk@intevation.de>
parents: 3198
diff changeset
112 </div>
25a26f666ee8 statistics: layout
Thomas Junk <thomas.junk@intevation.de>
parents: 3198
diff changeset
113 <div class="d-flex flex-column w-50 ml-1">
25a26f666ee8 statistics: layout
Thomas Junk <thomas.junk@intevation.de>
parents: 3198
diff changeset
114 <small for="to" class="my-auto text-muted"
25a26f666ee8 statistics: layout
Thomas Junk <thomas.junk@intevation.de>
parents: 3198
diff changeset
115 ><translate>Date to</translate></small
25a26f666ee8 statistics: layout
Thomas Junk <thomas.junk@intevation.de>
parents: 3198
diff changeset
116 ><input
25a26f666ee8 statistics: layout
Thomas Junk <thomas.junk@intevation.de>
parents: 3198
diff changeset
117 id="to"
25a26f666ee8 statistics: layout
Thomas Junk <thomas.junk@intevation.de>
parents: 3198
diff changeset
118 v-model="toDate"
25a26f666ee8 statistics: layout
Thomas Junk <thomas.junk@intevation.de>
parents: 3198
diff changeset
119 class="form-control form-control-sm"
25a26f666ee8 statistics: layout
Thomas Junk <thomas.junk@intevation.de>
parents: 3198
diff changeset
120 type="date"
25a26f666ee8 statistics: layout
Thomas Junk <thomas.junk@intevation.de>
parents: 3198
diff changeset
121 />
25a26f666ee8 statistics: layout
Thomas Junk <thomas.junk@intevation.de>
parents: 3198
diff changeset
122 </div>
3185
505414dfe3e7 available_fairway_depth: move statistic dialog to store
Thomas Junk <thomas.junk@intevation.de>
parents: 3184
diff changeset
123 </div>
505414dfe3e7 available_fairway_depth: move statistic dialog to store
Thomas Junk <thomas.junk@intevation.de>
parents: 3184
diff changeset
124 </div>
3172
975efa874acf statistic: choice between bottlenecks and stretches implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 3159
diff changeset
125 <div class="mt-3">
3173
1287b031424c statistics: sprinkled fairy dust on to bottleneck selection
Thomas Junk <thomas.junk@intevation.de>
parents: 3172
diff changeset
126 <button
3178
5ec34e08b01d available_fairway_depth: display mock
Thomas Junk <thomas.junk@intevation.de>
parents: 3175
diff changeset
127 @click="openFairwaydepth"
3191
c0cd5dfec153 statistics: persist fields to vuex
Thomas Junk <thomas.junk@intevation.de>
parents: 3185
diff changeset
128 :disabled="isComplete"
3173
1287b031424c statistics: sprinkled fairy dust on to bottleneck selection
Thomas Junk <thomas.junk@intevation.de>
parents: 3172
diff changeset
129 class="btn btn-info btn-sm w-100"
1287b031424c statistics: sprinkled fairy dust on to bottleneck selection
Thomas Junk <thomas.junk@intevation.de>
parents: 3172
diff changeset
130 >
3172
975efa874acf statistic: choice between bottlenecks and stretches implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 3159
diff changeset
131 <translate>Available Fairway Depth</translate>
975efa874acf statistic: choice between bottlenecks and stretches implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 3159
diff changeset
132 </button>
975efa874acf statistic: choice between bottlenecks and stretches implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 3159
diff changeset
133 </div>
3159
4f4905b57fcf toolbar: added statistics dialog component
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
134 </div>
4f4905b57fcf toolbar: added statistics dialog component
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
135 </div>
4f4905b57fcf toolbar: added statistics dialog component
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
136 </div>
4f4905b57fcf toolbar: added statistics dialog component
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
137 </template>
4f4905b57fcf toolbar: added statistics dialog component
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
138
3199
25a26f666ee8 statistics: layout
Thomas Junk <thomas.junk@intevation.de>
parents: 3198
diff changeset
139 <style lang="scss" scoped>
25a26f666ee8 statistics: layout
Thomas Junk <thomas.junk@intevation.de>
parents: 3198
diff changeset
140 input,
25a26f666ee8 statistics: layout
Thomas Junk <thomas.junk@intevation.de>
parents: 3198
diff changeset
141 select {
25a26f666ee8 statistics: layout
Thomas Junk <thomas.junk@intevation.de>
parents: 3198
diff changeset
142 font-size: 0.8em;
25a26f666ee8 statistics: layout
Thomas Junk <thomas.junk@intevation.de>
parents: 3198
diff changeset
143 }
25a26f666ee8 statistics: layout
Thomas Junk <thomas.junk@intevation.de>
parents: 3198
diff changeset
144 </style>
25a26f666ee8 statistics: layout
Thomas Junk <thomas.junk@intevation.de>
parents: 3198
diff changeset
145
3159
4f4905b57fcf toolbar: added statistics dialog component
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
146 <script>
4f4905b57fcf toolbar: added statistics dialog component
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
147 /* This is Free Software under GNU Affero General Public License v >= 3.0
4f4905b57fcf toolbar: added statistics dialog component
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
148 * without warranty, see README.md and license for details.
4f4905b57fcf toolbar: added statistics dialog component
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
149 *
4f4905b57fcf toolbar: added statistics dialog component
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
150 * SPDX-License-Identifier: AGPL-3.0-or-later
4f4905b57fcf toolbar: added statistics dialog component
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
151 * License-Filename: LICENSES/AGPL-3.0.txt
4f4905b57fcf toolbar: added statistics dialog component
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
152 *
4f4905b57fcf toolbar: added statistics dialog component
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
153 * Copyright (C) 2018 by via donau
4f4905b57fcf toolbar: added statistics dialog component
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
154 * – Österreichische Wasserstraßen-Gesellschaft mbH
4f4905b57fcf toolbar: added statistics dialog component
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
155 * Software engineering by Intevation GmbH
4f4905b57fcf toolbar: added statistics dialog component
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
156 *
4f4905b57fcf toolbar: added statistics dialog component
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
157 * Author(s):
4f4905b57fcf toolbar: added statistics dialog component
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
158 * Markus Kottländer <markus.kottlaender@intevation.de>
4f4905b57fcf toolbar: added statistics dialog component
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
159 * Thomas Junk <thomas.junk@intevation.de>
4f4905b57fcf toolbar: added statistics dialog component
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
160 */
4f4905b57fcf toolbar: added statistics dialog component
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
161
4f4905b57fcf toolbar: added statistics dialog component
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
162 import app from "@/main";
3191
c0cd5dfec153 statistics: persist fields to vuex
Thomas Junk <thomas.junk@intevation.de>
parents: 3185
diff changeset
163 import { displayError } from "@/lib/errors";
3172
975efa874acf statistic: choice between bottlenecks and stretches implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 3159
diff changeset
164 import { mapState, mapGetters } from "vuex";
3159
4f4905b57fcf toolbar: added statistics dialog component
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
165
4f4905b57fcf toolbar: added statistics dialog component
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
166 export default {
4f4905b57fcf toolbar: added statistics dialog component
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
167 data() {
4f4905b57fcf toolbar: added statistics dialog component
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
168 return {
4f4905b57fcf toolbar: added statistics dialog component
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
169 loading: false
4f4905b57fcf toolbar: added statistics dialog component
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
170 };
4f4905b57fcf toolbar: added statistics dialog component
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
171 },
4f4905b57fcf toolbar: added statistics dialog component
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
172 methods: {
3178
5ec34e08b01d available_fairway_depth: display mock
Thomas Junk <thomas.junk@intevation.de>
parents: 3175
diff changeset
173 openFairwaydepth() {
3191
c0cd5dfec153 statistics: persist fields to vuex
Thomas Junk <thomas.junk@intevation.de>
parents: 3185
diff changeset
174 this.loading = true;
c0cd5dfec153 statistics: persist fields to vuex
Thomas Junk <thomas.junk@intevation.de>
parents: 3185
diff changeset
175 this.$store
3207
ba7bc3740fb3 client: renamed store modules to better reflect their context
Markus Kottlaender <markus@intevation.de>
parents: 3205
diff changeset
176 .dispatch("fairwayavailability/loadAvailableFairwayDepth", {
3191
c0cd5dfec153 statistics: persist fields to vuex
Thomas Junk <thomas.junk@intevation.de>
parents: 3185
diff changeset
177 feature: this.selectedFairwayAvailabilityFeature,
c0cd5dfec153 statistics: persist fields to vuex
Thomas Junk <thomas.junk@intevation.de>
parents: 3185
diff changeset
178 from: this.from,
c0cd5dfec153 statistics: persist fields to vuex
Thomas Junk <thomas.junk@intevation.de>
parents: 3185
diff changeset
179 to: this.to,
3198
b0328646e34f statistics: include los selection
Thomas Junk <thomas.junk@intevation.de>
parents: 3191
diff changeset
180 frequency: this.frequency,
b0328646e34f statistics: include los selection
Thomas Junk <thomas.junk@intevation.de>
parents: 3191
diff changeset
181 LOS: this.los
3191
c0cd5dfec153 statistics: persist fields to vuex
Thomas Junk <thomas.junk@intevation.de>
parents: 3185
diff changeset
182 })
c0cd5dfec153 statistics: persist fields to vuex
Thomas Junk <thomas.junk@intevation.de>
parents: 3185
diff changeset
183 .then(() => {
c0cd5dfec153 statistics: persist fields to vuex
Thomas Junk <thomas.junk@intevation.de>
parents: 3185
diff changeset
184 this.loading = false;
c0cd5dfec153 statistics: persist fields to vuex
Thomas Junk <thomas.junk@intevation.de>
parents: 3185
diff changeset
185 this.$store.commit("application/paneSetup", "AVAILABLEFAIRWAYDEPTH");
c0cd5dfec153 statistics: persist fields to vuex
Thomas Junk <thomas.junk@intevation.de>
parents: 3185
diff changeset
186 })
c0cd5dfec153 statistics: persist fields to vuex
Thomas Junk <thomas.junk@intevation.de>
parents: 3185
diff changeset
187 .catch(error => {
c0cd5dfec153 statistics: persist fields to vuex
Thomas Junk <thomas.junk@intevation.de>
parents: 3185
diff changeset
188 console.log(error);
c0cd5dfec153 statistics: persist fields to vuex
Thomas Junk <thomas.junk@intevation.de>
parents: 3185
diff changeset
189 const { status, data } = error.response;
c0cd5dfec153 statistics: persist fields to vuex
Thomas Junk <thomas.junk@intevation.de>
parents: 3185
diff changeset
190 displayError({
c0cd5dfec153 statistics: persist fields to vuex
Thomas Junk <thomas.junk@intevation.de>
parents: 3185
diff changeset
191 title: this.$gettext("Backend Error"),
c0cd5dfec153 statistics: persist fields to vuex
Thomas Junk <thomas.junk@intevation.de>
parents: 3185
diff changeset
192 message: `${status}: ${data.message || data}`
c0cd5dfec153 statistics: persist fields to vuex
Thomas Junk <thomas.junk@intevation.de>
parents: 3185
diff changeset
193 });
c0cd5dfec153 statistics: persist fields to vuex
Thomas Junk <thomas.junk@intevation.de>
parents: 3185
diff changeset
194 });
3178
5ec34e08b01d available_fairway_depth: display mock
Thomas Junk <thomas.junk@intevation.de>
parents: 3175
diff changeset
195 },
3159
4f4905b57fcf toolbar: added statistics dialog component
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
196 close() {
3231
2dab20bed284 show_statistics: refac to fairwayavailability
Thomas Junk <thomas.junk@intevation.de>
parents: 3214
diff changeset
197 this.$store.commit("application/showFairwayDepth", false);
3172
975efa874acf statistic: choice between bottlenecks and stretches implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 3159
diff changeset
198 },
975efa874acf statistic: choice between bottlenecks and stretches implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 3159
diff changeset
199 entrySelected() {
975efa874acf statistic: choice between bottlenecks and stretches implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 3159
diff changeset
200 if (this.type === this.$options.BOTTLENECKS) {
975efa874acf statistic: choice between bottlenecks and stretches implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 3159
diff changeset
201 this.openLayersMap()
975efa874acf statistic: choice between bottlenecks and stretches implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 3159
diff changeset
202 .getLayer("BOTTLENECKS")
975efa874acf statistic: choice between bottlenecks and stretches implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 3159
diff changeset
203 .setVisible(true);
3178
5ec34e08b01d available_fairway_depth: display mock
Thomas Junk <thomas.junk@intevation.de>
parents: 3175
diff changeset
204 if (this.showProfiles) {
5ec34e08b01d available_fairway_depth: display mock
Thomas Junk <thomas.junk@intevation.de>
parents: 3175
diff changeset
205 this.$store.dispatch(
5ec34e08b01d available_fairway_depth: display mock
Thomas Junk <thomas.junk@intevation.de>
parents: 3175
diff changeset
206 "bottlenecks/setSelectedBottleneck",
3183
f64cc98746a1 statistics: put selected feature in fairwaystore
Thomas Junk <thomas.junk@intevation.de>
parents: 3178
diff changeset
207 this.selectedFairwayAvailabilityFeature.properties.name
3178
5ec34e08b01d available_fairway_depth: display mock
Thomas Junk <thomas.junk@intevation.de>
parents: 3175
diff changeset
208 );
5ec34e08b01d available_fairway_depth: display mock
Thomas Junk <thomas.junk@intevation.de>
parents: 3175
diff changeset
209 }
3172
975efa874acf statistic: choice between bottlenecks and stretches implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 3159
diff changeset
210 }
975efa874acf statistic: choice between bottlenecks and stretches implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 3159
diff changeset
211 if (this.type === this.$options.STRETCHES) {
975efa874acf statistic: choice between bottlenecks and stretches implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 3159
diff changeset
212 this.openLayersMap()
975efa874acf statistic: choice between bottlenecks and stretches implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 3159
diff changeset
213 .getLayer("STRETCHES")
975efa874acf statistic: choice between bottlenecks and stretches implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 3159
diff changeset
214 .setVisible(true);
975efa874acf statistic: choice between bottlenecks and stretches implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 3159
diff changeset
215 }
3183
f64cc98746a1 statistics: put selected feature in fairwaystore
Thomas Junk <thomas.junk@intevation.de>
parents: 3178
diff changeset
216 if (this.selectedFairwayAvailabilityFeature) {
3172
975efa874acf statistic: choice between bottlenecks and stretches implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 3159
diff changeset
217 this.$store.dispatch("map/moveToFeauture", {
3183
f64cc98746a1 statistics: put selected feature in fairwaystore
Thomas Junk <thomas.junk@intevation.de>
parents: 3178
diff changeset
218 feature: this.selectedFairwayAvailabilityFeature,
3172
975efa874acf statistic: choice between bottlenecks and stretches implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 3159
diff changeset
219 zoom: 17,
975efa874acf statistic: choice between bottlenecks and stretches implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 3159
diff changeset
220 preventZoomOut: true
975efa874acf statistic: choice between bottlenecks and stretches implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 3159
diff changeset
221 });
975efa874acf statistic: choice between bottlenecks and stretches implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 3159
diff changeset
222 }
3173
1287b031424c statistics: sprinkled fairy dust on to bottleneck selection
Thomas Junk <thomas.junk@intevation.de>
parents: 3172
diff changeset
223 },
1287b031424c statistics: sprinkled fairy dust on to bottleneck selection
Thomas Junk <thomas.junk@intevation.de>
parents: 3172
diff changeset
224 setSelectedBottleneck() {
1287b031424c statistics: sprinkled fairy dust on to bottleneck selection
Thomas Junk <thomas.junk@intevation.de>
parents: 3172
diff changeset
225 const bn = this.bottlenecksList.filter(
1287b031424c statistics: sprinkled fairy dust on to bottleneck selection
Thomas Junk <thomas.junk@intevation.de>
parents: 3172
diff changeset
226 x => x.properties.name === this.selectedBottleneck
1287b031424c statistics: sprinkled fairy dust on to bottleneck selection
Thomas Junk <thomas.junk@intevation.de>
parents: 3172
diff changeset
227 )[0];
3207
ba7bc3740fb3 client: renamed store modules to better reflect their context
Markus Kottlaender <markus@intevation.de>
parents: 3205
diff changeset
228 this.$store.commit(
ba7bc3740fb3 client: renamed store modules to better reflect their context
Markus Kottlaender <markus@intevation.de>
parents: 3205
diff changeset
229 "fairwayavailability/setSelectedFairwayAvailability",
ba7bc3740fb3 client: renamed store modules to better reflect their context
Markus Kottlaender <markus@intevation.de>
parents: 3205
diff changeset
230 bn
ba7bc3740fb3 client: renamed store modules to better reflect their context
Markus Kottlaender <markus@intevation.de>
parents: 3205
diff changeset
231 );
3159
4f4905b57fcf toolbar: added statistics dialog component
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
232 }
4f4905b57fcf toolbar: added statistics dialog component
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
233 },
4f4905b57fcf toolbar: added statistics dialog component
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
234 computed: {
3231
2dab20bed284 show_statistics: refac to fairwayavailability
Thomas Junk <thomas.junk@intevation.de>
parents: 3214
diff changeset
235 ...mapState("application", [
2dab20bed284 show_statistics: refac to fairwayavailability
Thomas Junk <thomas.junk@intevation.de>
parents: 3214
diff changeset
236 "showFairwayDepth",
2dab20bed284 show_statistics: refac to fairwayavailability
Thomas Junk <thomas.junk@intevation.de>
parents: 3214
diff changeset
237 "paneSetup",
2dab20bed284 show_statistics: refac to fairwayavailability
Thomas Junk <thomas.junk@intevation.de>
parents: 3214
diff changeset
238 "showProfiles"
2dab20bed284 show_statistics: refac to fairwayavailability
Thomas Junk <thomas.junk@intevation.de>
parents: 3214
diff changeset
239 ]),
3207
ba7bc3740fb3 client: renamed store modules to better reflect their context
Markus Kottlaender <markus@intevation.de>
parents: 3205
diff changeset
240 ...mapState("fairwayavailability", [
3191
c0cd5dfec153 statistics: persist fields to vuex
Thomas Junk <thomas.junk@intevation.de>
parents: 3185
diff changeset
241 "selectedFairwayAvailabilityFeature",
c0cd5dfec153 statistics: persist fields to vuex
Thomas Junk <thomas.junk@intevation.de>
parents: 3185
diff changeset
242 "from",
c0cd5dfec153 statistics: persist fields to vuex
Thomas Junk <thomas.junk@intevation.de>
parents: 3185
diff changeset
243 "to",
3198
b0328646e34f statistics: include los selection
Thomas Junk <thomas.junk@intevation.de>
parents: 3191
diff changeset
244 "frequency",
b0328646e34f statistics: include los selection
Thomas Junk <thomas.junk@intevation.de>
parents: 3191
diff changeset
245 "LOS"
3191
c0cd5dfec153 statistics: persist fields to vuex
Thomas Junk <thomas.junk@intevation.de>
parents: 3185
diff changeset
246 ]),
3172
975efa874acf statistic: choice between bottlenecks and stretches implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 3159
diff changeset
247 ...mapState("imports", ["stretches"]),
3173
1287b031424c statistics: sprinkled fairy dust on to bottleneck selection
Thomas Junk <thomas.junk@intevation.de>
parents: 3172
diff changeset
248 ...mapState("bottlenecks", ["bottlenecksList", "selectedBottleneck"]),
3172
975efa874acf statistic: choice between bottlenecks and stretches implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 3159
diff changeset
249 ...mapGetters("map", ["openLayersMap"]),
3236
5914d615f703 available_fairway_depth: use the store luke
Thomas Junk <thomas.junk@intevation.de>
parents: 3233
diff changeset
250 ...mapGetters("bottlenecks", ["orderedBottlenecks"]),
3191
c0cd5dfec153 statistics: persist fields to vuex
Thomas Junk <thomas.junk@intevation.de>
parents: 3185
diff changeset
251 isComplete() {
c0cd5dfec153 statistics: persist fields to vuex
Thomas Junk <thomas.junk@intevation.de>
parents: 3185
diff changeset
252 return (
c0cd5dfec153 statistics: persist fields to vuex
Thomas Junk <thomas.junk@intevation.de>
parents: 3185
diff changeset
253 this.from == null ||
c0cd5dfec153 statistics: persist fields to vuex
Thomas Junk <thomas.junk@intevation.de>
parents: 3185
diff changeset
254 this.to == null ||
c0cd5dfec153 statistics: persist fields to vuex
Thomas Junk <thomas.junk@intevation.de>
parents: 3185
diff changeset
255 this.frequency == null ||
3214
861329d535b2 statistics: guarg for los
Thomas Junk <thomas.junk@intevation.de>
parents: 3207
diff changeset
256 this.los == null ||
3191
c0cd5dfec153 statistics: persist fields to vuex
Thomas Junk <thomas.junk@intevation.de>
parents: 3185
diff changeset
257 this.selectedFairwayAvailabilityFeature == null
c0cd5dfec153 statistics: persist fields to vuex
Thomas Junk <thomas.junk@intevation.de>
parents: 3185
diff changeset
258 );
c0cd5dfec153 statistics: persist fields to vuex
Thomas Junk <thomas.junk@intevation.de>
parents: 3185
diff changeset
259 },
3205
bf571429515f client: fairway availability: moved component's type property to store to manipulate it from outside
Markus Kottlaender <markus@intevation.de>
parents: 3199
diff changeset
260 type: {
bf571429515f client: fairway availability: moved component's type property to store to manipulate it from outside
Markus Kottlaender <markus@intevation.de>
parents: 3199
diff changeset
261 get() {
3207
ba7bc3740fb3 client: renamed store modules to better reflect their context
Markus Kottlaender <markus@intevation.de>
parents: 3205
diff changeset
262 return this.$store.state.fairwayavailability.type;
3205
bf571429515f client: fairway availability: moved component's type property to store to manipulate it from outside
Markus Kottlaender <markus@intevation.de>
parents: 3199
diff changeset
263 },
bf571429515f client: fairway availability: moved component's type property to store to manipulate it from outside
Markus Kottlaender <markus@intevation.de>
parents: 3199
diff changeset
264 set(type) {
3207
ba7bc3740fb3 client: renamed store modules to better reflect their context
Markus Kottlaender <markus@intevation.de>
parents: 3205
diff changeset
265 this.$store.commit("fairwayavailability/type", type);
3205
bf571429515f client: fairway availability: moved component's type property to store to manipulate it from outside
Markus Kottlaender <markus@intevation.de>
parents: 3199
diff changeset
266 }
bf571429515f client: fairway availability: moved component's type property to store to manipulate it from outside
Markus Kottlaender <markus@intevation.de>
parents: 3199
diff changeset
267 },
3198
b0328646e34f statistics: include los selection
Thomas Junk <thomas.junk@intevation.de>
parents: 3191
diff changeset
268 los: {
b0328646e34f statistics: include los selection
Thomas Junk <thomas.junk@intevation.de>
parents: 3191
diff changeset
269 get() {
b0328646e34f statistics: include los selection
Thomas Junk <thomas.junk@intevation.de>
parents: 3191
diff changeset
270 return this.LOS;
b0328646e34f statistics: include los selection
Thomas Junk <thomas.junk@intevation.de>
parents: 3191
diff changeset
271 },
b0328646e34f statistics: include los selection
Thomas Junk <thomas.junk@intevation.de>
parents: 3191
diff changeset
272 set(value) {
3207
ba7bc3740fb3 client: renamed store modules to better reflect their context
Markus Kottlaender <markus@intevation.de>
parents: 3205
diff changeset
273 this.$store.commit("fairwayavailability/setLOS", value);
3198
b0328646e34f statistics: include los selection
Thomas Junk <thomas.junk@intevation.de>
parents: 3191
diff changeset
274 }
b0328646e34f statistics: include los selection
Thomas Junk <thomas.junk@intevation.de>
parents: 3191
diff changeset
275 },
3191
c0cd5dfec153 statistics: persist fields to vuex
Thomas Junk <thomas.junk@intevation.de>
parents: 3185
diff changeset
276 fromDate: {
c0cd5dfec153 statistics: persist fields to vuex
Thomas Junk <thomas.junk@intevation.de>
parents: 3185
diff changeset
277 get() {
c0cd5dfec153 statistics: persist fields to vuex
Thomas Junk <thomas.junk@intevation.de>
parents: 3185
diff changeset
278 return this.from;
c0cd5dfec153 statistics: persist fields to vuex
Thomas Junk <thomas.junk@intevation.de>
parents: 3185
diff changeset
279 },
c0cd5dfec153 statistics: persist fields to vuex
Thomas Junk <thomas.junk@intevation.de>
parents: 3185
diff changeset
280 set(value) {
3207
ba7bc3740fb3 client: renamed store modules to better reflect their context
Markus Kottlaender <markus@intevation.de>
parents: 3205
diff changeset
281 this.$store.commit("fairwayavailability/setFrom", value);
3191
c0cd5dfec153 statistics: persist fields to vuex
Thomas Junk <thomas.junk@intevation.de>
parents: 3185
diff changeset
282 }
c0cd5dfec153 statistics: persist fields to vuex
Thomas Junk <thomas.junk@intevation.de>
parents: 3185
diff changeset
283 },
c0cd5dfec153 statistics: persist fields to vuex
Thomas Junk <thomas.junk@intevation.de>
parents: 3185
diff changeset
284 toDate: {
c0cd5dfec153 statistics: persist fields to vuex
Thomas Junk <thomas.junk@intevation.de>
parents: 3185
diff changeset
285 get() {
c0cd5dfec153 statistics: persist fields to vuex
Thomas Junk <thomas.junk@intevation.de>
parents: 3185
diff changeset
286 return this.to;
c0cd5dfec153 statistics: persist fields to vuex
Thomas Junk <thomas.junk@intevation.de>
parents: 3185
diff changeset
287 },
c0cd5dfec153 statistics: persist fields to vuex
Thomas Junk <thomas.junk@intevation.de>
parents: 3185
diff changeset
288 set(value) {
3207
ba7bc3740fb3 client: renamed store modules to better reflect their context
Markus Kottlaender <markus@intevation.de>
parents: 3205
diff changeset
289 this.$store.commit("fairwayavailability/setTo", value);
3191
c0cd5dfec153 statistics: persist fields to vuex
Thomas Junk <thomas.junk@intevation.de>
parents: 3185
diff changeset
290 }
c0cd5dfec153 statistics: persist fields to vuex
Thomas Junk <thomas.junk@intevation.de>
parents: 3185
diff changeset
291 },
c0cd5dfec153 statistics: persist fields to vuex
Thomas Junk <thomas.junk@intevation.de>
parents: 3185
diff changeset
292 selectedFrequency: {
c0cd5dfec153 statistics: persist fields to vuex
Thomas Junk <thomas.junk@intevation.de>
parents: 3185
diff changeset
293 get() {
c0cd5dfec153 statistics: persist fields to vuex
Thomas Junk <thomas.junk@intevation.de>
parents: 3185
diff changeset
294 return this.frequency;
c0cd5dfec153 statistics: persist fields to vuex
Thomas Junk <thomas.junk@intevation.de>
parents: 3185
diff changeset
295 },
c0cd5dfec153 statistics: persist fields to vuex
Thomas Junk <thomas.junk@intevation.de>
parents: 3185
diff changeset
296 set(value) {
3207
ba7bc3740fb3 client: renamed store modules to better reflect their context
Markus Kottlaender <markus@intevation.de>
parents: 3205
diff changeset
297 this.$store.commit("fairwayavailability/setFrequency", value);
3191
c0cd5dfec153 statistics: persist fields to vuex
Thomas Junk <thomas.junk@intevation.de>
parents: 3185
diff changeset
298 }
c0cd5dfec153 statistics: persist fields to vuex
Thomas Junk <thomas.junk@intevation.de>
parents: 3185
diff changeset
299 },
3183
f64cc98746a1 statistics: put selected feature in fairwaystore
Thomas Junk <thomas.junk@intevation.de>
parents: 3178
diff changeset
300 selectedEntry: {
f64cc98746a1 statistics: put selected feature in fairwaystore
Thomas Junk <thomas.junk@intevation.de>
parents: 3178
diff changeset
301 get() {
f64cc98746a1 statistics: put selected feature in fairwaystore
Thomas Junk <thomas.junk@intevation.de>
parents: 3178
diff changeset
302 return this.selectedFairwayAvailabilityFeature;
f64cc98746a1 statistics: put selected feature in fairwaystore
Thomas Junk <thomas.junk@intevation.de>
parents: 3178
diff changeset
303 },
f64cc98746a1 statistics: put selected feature in fairwaystore
Thomas Junk <thomas.junk@intevation.de>
parents: 3178
diff changeset
304 set(feature) {
3207
ba7bc3740fb3 client: renamed store modules to better reflect their context
Markus Kottlaender <markus@intevation.de>
parents: 3205
diff changeset
305 this.$store.commit(
ba7bc3740fb3 client: renamed store modules to better reflect their context
Markus Kottlaender <markus@intevation.de>
parents: 3205
diff changeset
306 "fairwayavailability/setSelectedFairwayAvailability",
ba7bc3740fb3 client: renamed store modules to better reflect their context
Markus Kottlaender <markus@intevation.de>
parents: 3205
diff changeset
307 feature
ba7bc3740fb3 client: renamed store modules to better reflect their context
Markus Kottlaender <markus@intevation.de>
parents: 3205
diff changeset
308 );
3183
f64cc98746a1 statistics: put selected feature in fairwaystore
Thomas Junk <thomas.junk@intevation.de>
parents: 3178
diff changeset
309 }
f64cc98746a1 statistics: put selected feature in fairwaystore
Thomas Junk <thomas.junk@intevation.de>
parents: 3178
diff changeset
310 },
3172
975efa874acf statistic: choice between bottlenecks and stretches implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 3159
diff changeset
311 entries() {
975efa874acf statistic: choice between bottlenecks and stretches implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 3159
diff changeset
312 if (this.type === this.$options.BOTTLENECKS) return this.bottlenecksList;
975efa874acf statistic: choice between bottlenecks and stretches implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 3159
diff changeset
313 if (this.type === this.$options.STRETCHES) return this.stretches;
975efa874acf statistic: choice between bottlenecks and stretches implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 3159
diff changeset
314 return [];
975efa874acf statistic: choice between bottlenecks and stretches implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 3159
diff changeset
315 },
3159
4f4905b57fcf toolbar: added statistics dialog component
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
316 label() {
4f4905b57fcf toolbar: added statistics dialog component
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
317 return this.$gettext("Statistics");
3172
975efa874acf statistic: choice between bottlenecks and stretches implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 3159
diff changeset
318 },
975efa874acf statistic: choice between bottlenecks and stretches implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 3159
diff changeset
319 empty() {
975efa874acf statistic: choice between bottlenecks and stretches implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 3159
diff changeset
320 if (this.type === this.$options.BOTTLENECKS)
3173
1287b031424c statistics: sprinkled fairy dust on to bottleneck selection
Thomas Junk <thomas.junk@intevation.de>
parents: 3172
diff changeset
321 return this.$gettext("Select bottleneck");
3172
975efa874acf statistic: choice between bottlenecks and stretches implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 3159
diff changeset
322 if (this.type === this.$options.STRETCHES)
3173
1287b031424c statistics: sprinkled fairy dust on to bottleneck selection
Thomas Junk <thomas.junk@intevation.de>
parents: 3172
diff changeset
323 return this.$gettext("Select strectch");
1287b031424c statistics: sprinkled fairy dust on to bottleneck selection
Thomas Junk <thomas.junk@intevation.de>
parents: 3172
diff changeset
324 return this.$gettext("Select section");
3159
4f4905b57fcf toolbar: added statistics dialog component
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
325 }
4f4905b57fcf toolbar: added statistics dialog component
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
326 },
3172
975efa874acf statistic: choice between bottlenecks and stretches implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 3159
diff changeset
327 watch: {
3173
1287b031424c statistics: sprinkled fairy dust on to bottleneck selection
Thomas Junk <thomas.junk@intevation.de>
parents: 3172
diff changeset
328 selectedBottleneck() {
3174
aeb9d6fc640a statistics: sprinkled more fairy dust on to bottleneck selection
Thomas Junk <thomas.junk@intevation.de>
parents: 3173
diff changeset
329 this.type = this.$options.BOTTLENECKS;
3173
1287b031424c statistics: sprinkled fairy dust on to bottleneck selection
Thomas Junk <thomas.junk@intevation.de>
parents: 3172
diff changeset
330 this.setSelectedBottleneck();
1287b031424c statistics: sprinkled fairy dust on to bottleneck selection
Thomas Junk <thomas.junk@intevation.de>
parents: 3172
diff changeset
331 },
3172
975efa874acf statistic: choice between bottlenecks and stretches implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 3159
diff changeset
332 type() {
3175
296392d4539c client: statistics dialog: fix resetting selectedEntry
Markus Kottlaender <markus@intevation.de>
parents: 3174
diff changeset
333 if (this.type === this.$options.BOTTLENECKS && this.selectedBottleneck) {
3173
1287b031424c statistics: sprinkled fairy dust on to bottleneck selection
Thomas Junk <thomas.junk@intevation.de>
parents: 3172
diff changeset
334 this.setSelectedBottleneck();
1287b031424c statistics: sprinkled fairy dust on to bottleneck selection
Thomas Junk <thomas.junk@intevation.de>
parents: 3172
diff changeset
335 } else {
3207
ba7bc3740fb3 client: renamed store modules to better reflect their context
Markus Kottlaender <markus@intevation.de>
parents: 3205
diff changeset
336 this.$store.commit(
ba7bc3740fb3 client: renamed store modules to better reflect their context
Markus Kottlaender <markus@intevation.de>
parents: 3205
diff changeset
337 "fairwayavailability/setSelectedFairwayAvailability",
ba7bc3740fb3 client: renamed store modules to better reflect their context
Markus Kottlaender <markus@intevation.de>
parents: 3205
diff changeset
338 null
ba7bc3740fb3 client: renamed store modules to better reflect their context
Markus Kottlaender <markus@intevation.de>
parents: 3205
diff changeset
339 );
3173
1287b031424c statistics: sprinkled fairy dust on to bottleneck selection
Thomas Junk <thomas.junk@intevation.de>
parents: 3172
diff changeset
340 }
3172
975efa874acf statistic: choice between bottlenecks and stretches implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 3159
diff changeset
341 this.openLayersMap()
975efa874acf statistic: choice between bottlenecks and stretches implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 3159
diff changeset
342 .getLayer("STRETCHES")
975efa874acf statistic: choice between bottlenecks and stretches implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 3159
diff changeset
343 .setVisible(true);
975efa874acf statistic: choice between bottlenecks and stretches implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 3159
diff changeset
344 },
3237
86e108358216 available_fairway_depth: bug fix for loading bottlenecks and stretches
Thomas Junk <thomas.junk@intevation.de>
parents: 3236
diff changeset
345 showFairwayDepth() {
86e108358216 available_fairway_depth: bug fix for loading bottlenecks and stretches
Thomas Junk <thomas.junk@intevation.de>
parents: 3236
diff changeset
346 if (this.showFairwayDepth) {
3172
975efa874acf statistic: choice between bottlenecks and stretches implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 3159
diff changeset
347 this.loading = true;
975efa874acf statistic: choice between bottlenecks and stretches implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 3159
diff changeset
348 this.$store.dispatch("bottlenecks/loadBottlenecksList").then(() => {
975efa874acf statistic: choice between bottlenecks and stretches implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 3159
diff changeset
349 this.$store.dispatch("imports/loadStretches").then(() => {
975efa874acf statistic: choice between bottlenecks and stretches implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 3159
diff changeset
350 this.loading = false;
3173
1287b031424c statistics: sprinkled fairy dust on to bottleneck selection
Thomas Junk <thomas.junk@intevation.de>
parents: 3172
diff changeset
351 if (this.selectedBottleneck) this.setSelectedBottleneck();
3172
975efa874acf statistic: choice between bottlenecks and stretches implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 3159
diff changeset
352 });
975efa874acf statistic: choice between bottlenecks and stretches implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 3159
diff changeset
353 });
975efa874acf statistic: choice between bottlenecks and stretches implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 3159
diff changeset
354 }
975efa874acf statistic: choice between bottlenecks and stretches implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 3159
diff changeset
355 }
975efa874acf statistic: choice between bottlenecks and stretches implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 3159
diff changeset
356 },
975efa874acf statistic: choice between bottlenecks and stretches implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 3159
diff changeset
357 BOTTLENECKS: "bottlenecks",
975efa874acf statistic: choice between bottlenecks and stretches implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 3159
diff changeset
358 SECTIONS: "sections",
975efa874acf statistic: choice between bottlenecks and stretches implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 3159
diff changeset
359 STRETCHES: "stretches",
3191
c0cd5dfec153 statistics: persist fields to vuex
Thomas Junk <thomas.junk@intevation.de>
parents: 3185
diff changeset
360 AVAILABLEFAIRWAYDEPTH: app.$gettext("Available Fairway Depth"),
c0cd5dfec153 statistics: persist fields to vuex
Thomas Junk <thomas.junk@intevation.de>
parents: 3185
diff changeset
361 FREQUENCIES: {
c0cd5dfec153 statistics: persist fields to vuex
Thomas Junk <thomas.junk@intevation.de>
parents: 3185
diff changeset
362 MONTHLY: "monthly",
c0cd5dfec153 statistics: persist fields to vuex
Thomas Junk <thomas.junk@intevation.de>
parents: 3185
diff changeset
363 QUARTERLY: "quarterly",
c0cd5dfec153 statistics: persist fields to vuex
Thomas Junk <thomas.junk@intevation.de>
parents: 3185
diff changeset
364 YEARLY: "yearly"
c0cd5dfec153 statistics: persist fields to vuex
Thomas Junk <thomas.junk@intevation.de>
parents: 3185
diff changeset
365 }
3159
4f4905b57fcf toolbar: added statistics dialog component
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
366 };
4f4905b57fcf toolbar: added statistics dialog component
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
367 </script>