Mercurial > gemma
annotate client/src/components/Search.vue @ 4231:6f31a99cd92d
clinet: fix translations process and update source strings
* move strings for translations from *.po files to the component itself to let gettext() mark only the strings without the html elements.
(make makemessages complains to have html elements in the .po files and stops the process).
author | Fadi Abbud <fadi.abbud@intevation.de> |
---|---|
date | Wed, 21 Aug 2019 11:13:12 +0200 |
parents | 33180c25bd87 |
children | 1cdd246860ae |
rev | line source |
---|---|
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
1 <template> |
1361
ea3a89a1813a
remove trailing whitespace, add headers for Makefile, add the missed authors
Fadi Abbud <fadi.abbud@intevation.de>
parents:
1299
diff
changeset
|
2 <div :class="searchbarContainerStyle"> |
ea3a89a1813a
remove trailing whitespace, add headers for Makefile, add the missed authors
Fadi Abbud <fadi.abbud@intevation.de>
parents:
1299
diff
changeset
|
3 <div class="input-group-prepend m-0 d-print-none"> |
ea3a89a1813a
remove trailing whitespace, add headers for Makefile, add the missed authors
Fadi Abbud <fadi.abbud@intevation.de>
parents:
1299
diff
changeset
|
4 <span @click="toggleSearchbar" :class="searchButtonStyle" for="search"> |
2919
6c5364ff0abb
client: removed a lot of unnecessary closing tags
Markus Kottlaender <markus@intevation.de>
parents:
2871
diff
changeset
|
5 <font-awesome-icon icon="search" /> |
1361
ea3a89a1813a
remove trailing whitespace, add headers for Makefile, add the missed authors
Fadi Abbud <fadi.abbud@intevation.de>
parents:
1299
diff
changeset
|
6 </span> |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
7 </div> |
1449 | 8 <div |
1480 | 9 :class="[ |
10 'searchgroup', | |
11 { | |
12 'searchgroup-collapsed': !showSearchbar, | |
13 big: | |
14 showContextBox && | |
1797
67340ceecc5f
feat: define sections and stretches etd
Thomas Junk <thomas.junk@intevation.de>
parents:
1670
diff
changeset
|
15 ['bottlenecks', 'staging', 'stretches'].indexOf( |
67340ceecc5f
feat: define sections and stretches etd
Thomas Junk <thomas.junk@intevation.de>
parents:
1670
diff
changeset
|
16 contextBoxContent |
67340ceecc5f
feat: define sections and stretches etd
Thomas Junk <thomas.junk@intevation.de>
parents:
1670
diff
changeset
|
17 ) !== -1 |
1480 | 18 } |
19 ]" | |
1449 | 20 > |
1361
ea3a89a1813a
remove trailing whitespace, add headers for Makefile, add the missed authors
Fadi Abbud <fadi.abbud@intevation.de>
parents:
1299
diff
changeset
|
21 <input |
2753
2aa1620ffd9e
search: in context of importoverview pressing enter triggers a request for and updated dataset
Thomas Junk <thomas.junk@intevation.de>
parents:
2750
diff
changeset
|
22 @keyup.enter="triggerEnter" |
1361
ea3a89a1813a
remove trailing whitespace, add headers for Makefile, add the missed authors
Fadi Abbud <fadi.abbud@intevation.de>
parents:
1299
diff
changeset
|
23 id="search" |
ea3a89a1813a
remove trailing whitespace, add headers for Makefile, add the missed authors
Fadi Abbud <fadi.abbud@intevation.de>
parents:
1299
diff
changeset
|
24 v-model="searchQuery" |
ea3a89a1813a
remove trailing whitespace, add headers for Makefile, add the missed authors
Fadi Abbud <fadi.abbud@intevation.de>
parents:
1299
diff
changeset
|
25 type="text" |
ea3a89a1813a
remove trailing whitespace, add headers for Makefile, add the missed authors
Fadi Abbud <fadi.abbud@intevation.de>
parents:
1299
diff
changeset
|
26 :class="searchInputStyle" |
1480 | 27 /> |
1361
ea3a89a1813a
remove trailing whitespace, add headers for Makefile, add the missed authors
Fadi Abbud <fadi.abbud@intevation.de>
parents:
1299
diff
changeset
|
28 </div> |
ea3a89a1813a
remove trailing whitespace, add headers for Makefile, add the missed authors
Fadi Abbud <fadi.abbud@intevation.de>
parents:
1299
diff
changeset
|
29 <div |
ea3a89a1813a
remove trailing whitespace, add headers for Makefile, add the missed authors
Fadi Abbud <fadi.abbud@intevation.de>
parents:
1299
diff
changeset
|
30 v-if="showSearchbar && searchResults !== null && !showContextBox" |
ea3a89a1813a
remove trailing whitespace, add headers for Makefile, add the missed authors
Fadi Abbud <fadi.abbud@intevation.de>
parents:
1299
diff
changeset
|
31 class="searchresults border-top ui-element bg-white rounded-bottom d-print-none position-absolute" |
ea3a89a1813a
remove trailing whitespace, add headers for Makefile, add the missed authors
Fadi Abbud <fadi.abbud@intevation.de>
parents:
1299
diff
changeset
|
32 > |
1480 | 33 <div |
3575
818cc2deff98
search: fix index issue
Thomas Junk <thomas.junk@intevation.de>
parents:
3391
diff
changeset
|
34 v-for="(entry, index) of searchResults" |
818cc2deff98
search: fix index issue
Thomas Junk <thomas.junk@intevation.de>
parents:
3391
diff
changeset
|
35 :key="index" |
1480 | 36 class="border-top text-left" |
37 > | |
38 <a | |
39 href="#" | |
40 @click.prevent="moveToSearchResult(entry)" | |
41 class="p-2 d-block text-nowrap" | |
42 > | |
1441
a4554e942954
Client: add a set of marked translations
Fadi Abbud <fadi.abbud@intevation.de>
parents:
1425
diff
changeset
|
43 <font-awesome-icon |
a4554e942954
Client: add a set of marked translations
Fadi Abbud <fadi.abbud@intevation.de>
parents:
1425
diff
changeset
|
44 icon="ship" |
a4554e942954
Client: add a set of marked translations
Fadi Abbud <fadi.abbud@intevation.de>
parents:
1425
diff
changeset
|
45 v-if="entry.type === 'bottleneck'" |
a4554e942954
Client: add a set of marked translations
Fadi Abbud <fadi.abbud@intevation.de>
parents:
1425
diff
changeset
|
46 class="mr-1" |
a4554e942954
Client: add a set of marked translations
Fadi Abbud <fadi.abbud@intevation.de>
parents:
1425
diff
changeset
|
47 fixed-width |
a4554e942954
Client: add a set of marked translations
Fadi Abbud <fadi.abbud@intevation.de>
parents:
1425
diff
changeset
|
48 /> |
1480 | 49 <font-awesome-icon |
50 icon="water" | |
51 v-if="entry.type === 'rhm'" | |
52 class="mr-1" | |
53 fixed-width | |
54 /> | |
55 <font-awesome-icon | |
56 icon="city" | |
57 v-if="entry.type === 'city'" | |
58 class="mr-1" | |
59 fixed-width | |
60 /> | |
2454
219c5b57ef5b
Added icon to gouges in search result.
Sascha Wilde <wilde@intevation.de>
parents:
2440
diff
changeset
|
61 <font-awesome-icon |
2464
bc0f1771497a
Use better suited icon for gauges in search results.
Sascha Wilde <wilde@intevation.de>
parents:
2454
diff
changeset
|
62 icon="ruler-vertical" |
2454
219c5b57ef5b
Added icon to gouges in search result.
Sascha Wilde <wilde@intevation.de>
parents:
2440
diff
changeset
|
63 v-if="entry.type === 'gauge'" |
219c5b57ef5b
Added icon to gouges in search result.
Sascha Wilde <wilde@intevation.de>
parents:
2440
diff
changeset
|
64 class="mr-1" |
219c5b57ef5b
Added icon to gouges in search result.
Sascha Wilde <wilde@intevation.de>
parents:
2440
diff
changeset
|
65 fixed-width |
219c5b57ef5b
Added icon to gouges in search result.
Sascha Wilde <wilde@intevation.de>
parents:
2440
diff
changeset
|
66 /> |
3391
11379474a1b1
Added preliminary icon for sections in search.
Sascha Wilde <wilde@intevation.de>
parents:
3074
diff
changeset
|
67 <font-awesome-icon |
3760
aea53775a3a7
client: search: set item from sidebar for sections/stretches
Markus Kottlaender <markus@intevation.de>
parents:
3753
diff
changeset
|
68 icon="road" |
aea53775a3a7
client: search: set item from sidebar for sections/stretches
Markus Kottlaender <markus@intevation.de>
parents:
3753
diff
changeset
|
69 v-if="['stretch', 'section'].includes(entry.type)" |
3391
11379474a1b1
Added preliminary icon for sections in search.
Sascha Wilde <wilde@intevation.de>
parents:
3074
diff
changeset
|
70 class="mr-1" |
11379474a1b1
Added preliminary icon for sections in search.
Sascha Wilde <wilde@intevation.de>
parents:
3074
diff
changeset
|
71 fixed-width |
11379474a1b1
Added preliminary icon for sections in search.
Sascha Wilde <wilde@intevation.de>
parents:
3074
diff
changeset
|
72 /> |
3779
33180c25bd87
Added extra information to search results (wwname, ISRS code)
Sascha Wilde <wilde@intevation.de>
parents:
3760
diff
changeset
|
73 {{ entry.name }} |
33180c25bd87
Added extra information to search results (wwname, ISRS code)
Sascha Wilde <wilde@intevation.de>
parents:
3760
diff
changeset
|
74 <span v-if="entry.location || entry.locationcode" |
33180c25bd87
Added extra information to search results (wwname, ISRS code)
Sascha Wilde <wilde@intevation.de>
parents:
3760
diff
changeset
|
75 >({{ entry.location |
33180c25bd87
Added extra information to search results (wwname, ISRS code)
Sascha Wilde <wilde@intevation.de>
parents:
3760
diff
changeset
|
76 }}<span v-if="entry.location && entry.locationcode">, </span |
33180c25bd87
Added extra information to search results (wwname, ISRS code)
Sascha Wilde <wilde@intevation.de>
parents:
3760
diff
changeset
|
77 >{{ entry.locationcode }})</span |
33180c25bd87
Added extra information to search results (wwname, ISRS code)
Sascha Wilde <wilde@intevation.de>
parents:
3760
diff
changeset
|
78 > |
1399
8e2c9e518440
improved search style
Markus Kottlaender <markus@intevation.de>
parents:
1398
diff
changeset
|
79 </a> |
1361
ea3a89a1813a
remove trailing whitespace, add headers for Makefile, add the missed authors
Fadi Abbud <fadi.abbud@intevation.de>
parents:
1299
diff
changeset
|
80 </div> |
ea3a89a1813a
remove trailing whitespace, add headers for Makefile, add the missed authors
Fadi Abbud <fadi.abbud@intevation.de>
parents:
1299
diff
changeset
|
81 </div> |
ea3a89a1813a
remove trailing whitespace, add headers for Makefile, add the missed authors
Fadi Abbud <fadi.abbud@intevation.de>
parents:
1299
diff
changeset
|
82 </div> |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
83 </template> |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
84 |
1449 | 85 <style lang="scss" scoped> |
86 .searchcontainer { | |
87 opacity: 0.96; | |
3012
802fcb50c484
search, contextbox: increased available area
Thomas Junk <thomas.junk@intevation.de>
parents:
2985
diff
changeset
|
88 width: 668px; |
1449 | 89 } |
90 | |
91 .searchcontainer .searchbar { | |
92 border-top-left-radius: 0 !important; | |
93 border-bottom-left-radius: 0 !important; | |
94 } | |
95 | |
96 .searchgroup { | |
3012
802fcb50c484
search, contextbox: increased available area
Thomas Junk <thomas.junk@intevation.de>
parents:
2985
diff
changeset
|
97 width: 635px; |
1449 | 98 overflow: hidden; |
99 } | |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
100 |
1449 | 101 .searchgroup-collapsed { |
102 width: 0; | |
103 } | |
1286
ac6edfb83cf1
improved contextBox animations
Markus Kottlaender <markus@intevation.de>
parents:
1282
diff
changeset
|
104 |
1449 | 105 .searchbar { |
106 height: 2rem !important; | |
107 box-shadow: none !important; | |
108 } | |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
109 |
1449 | 110 .searchbar.rounded-top-right { |
111 border-radius: 0 !important; | |
112 border-top-right-radius: 0.25rem !important; | |
113 } | |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
114 |
1449 | 115 .searchlabel.rounded-top-left { |
116 border-radius: 0 !important; | |
117 border-top-left-radius: 0.25rem !important; | |
118 } | |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
119 |
1449 | 120 .input-group-text { |
121 height: 2rem; | |
122 width: 2rem; | |
123 } | |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
124 |
1449 | 125 .input-group-prepend svg path { |
126 fill: #666; | |
127 } | |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
128 |
1449 | 129 .searchresults { |
130 box-shadow: 0 0.1rem 0.5rem rgba(0, 0, 0, 0.2); | |
131 top: 2rem; | |
132 left: 0; | |
133 right: 0; | |
134 max-height: 24rem; | |
135 overflow: auto; | |
136 } | |
137 | |
138 .searchresults > div:first-child { | |
139 border-top: 0 !important; | |
140 } | |
141 | |
142 .searchresults a { | |
143 text-decoration: none; | |
144 } | |
145 | |
146 .searchresults a:hover { | |
147 background: #f8f8f8; | |
148 } | |
2283
1169f18a0f11
make room for searchbar
Thomas Junk <thomas.junk@intevation.de>
parents:
2136
diff
changeset
|
149 |
1169f18a0f11
make room for searchbar
Thomas Junk <thomas.junk@intevation.de>
parents:
2136
diff
changeset
|
150 .smallbox { |
1169f18a0f11
make room for searchbar
Thomas Junk <thomas.junk@intevation.de>
parents:
2136
diff
changeset
|
151 width: 2rem; |
1169f18a0f11
make room for searchbar
Thomas Junk <thomas.junk@intevation.de>
parents:
2136
diff
changeset
|
152 } |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
153 </style> |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
154 |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
155 <script> |
1362
ca33ad696594
remove the first empyty lines
Fadi Abbud <fadi.abbud@intevation.de>
parents:
1361
diff
changeset
|
156 /* This is Free Software under GNU Affero General Public License v >= 3.0 |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
157 * without warranty, see README.md and license for details. |
1361
ea3a89a1813a
remove trailing whitespace, add headers for Makefile, add the missed authors
Fadi Abbud <fadi.abbud@intevation.de>
parents:
1299
diff
changeset
|
158 * |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
159 * SPDX-License-Identifier: AGPL-3.0-or-later |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
160 * License-Filename: LICENSES/AGPL-3.0.txt |
1361
ea3a89a1813a
remove trailing whitespace, add headers for Makefile, add the missed authors
Fadi Abbud <fadi.abbud@intevation.de>
parents:
1299
diff
changeset
|
161 * |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
162 * Copyright (C) 2018 by via donau |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
163 * – Österreichische Wasserstraßen-Gesellschaft mbH |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
164 * Software engineering by Intevation GmbH |
1361
ea3a89a1813a
remove trailing whitespace, add headers for Makefile, add the missed authors
Fadi Abbud <fadi.abbud@intevation.de>
parents:
1299
diff
changeset
|
165 * |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
166 * Author(s): |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
167 * Markus Kottländer <markus.kottlaender@intevation.de> |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
168 */ |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
169 import debounce from "lodash.debounce"; |
2753
2aa1620ffd9e
search: in context of importoverview pressing enter triggers a request for and updated dataset
Thomas Junk <thomas.junk@intevation.de>
parents:
2750
diff
changeset
|
170 import { mapState, mapGetters } from "vuex"; |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
171 |
2985
1b8bb4f89227
client: removed .js and .vue extention from imports
Markus Kottlaender <markus@intevation.de>
parents:
2919
diff
changeset
|
172 import { displayError } from "@/lib/errors"; |
1613
f2d24dceecc7
refac: cleanup import paths
Thomas Junk <thomas.junk@intevation.de>
parents:
1558
diff
changeset
|
173 import { HTTP } from "@/lib/http"; |
2753
2aa1620ffd9e
search: in context of importoverview pressing enter triggers a request for and updated dataset
Thomas Junk <thomas.junk@intevation.de>
parents:
2750
diff
changeset
|
174 import { format } from "date-fns"; |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
175 |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
176 const setFocus = () => document.querySelector("#search").focus(); |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
177 |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
178 export default { |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
179 name: "search", |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
180 data() { |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
181 return { |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
182 searchQueryIsDirty: false, |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
183 searchResults: null, |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
184 isSearching: false |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
185 }; |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
186 }, |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
187 computed: { |
1282
a7dd8a3356fc
fixed contextBox animations
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
188 ...mapState("application", [ |
a7dd8a3356fc
fixed contextBox animations
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
189 "showSearchbar", |
a7dd8a3356fc
fixed contextBox animations
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
190 "showContextBox", |
a7dd8a3356fc
fixed contextBox animations
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
191 "contextBoxContent" |
a7dd8a3356fc
fixed contextBox animations
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
192 ]), |
2753
2aa1620ffd9e
search: in context of importoverview pressing enter triggers a request for and updated dataset
Thomas Junk <thomas.junk@intevation.de>
parents:
2750
diff
changeset
|
193 ...mapState("imports", ["startDate", "endDate"]), |
2aa1620ffd9e
search: in context of importoverview pressing enter triggers a request for and updated dataset
Thomas Junk <thomas.junk@intevation.de>
parents:
2750
diff
changeset
|
194 ...mapGetters("imports", ["filters"]), |
3749
f20bd1aee549
client: search: zoom to bounding box if feature has one
Markus Kottlaender <markus@intevation.de>
parents:
3584
diff
changeset
|
195 ...mapGetters("map", ["openLayersMap"]), |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
196 searchQuery: { |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
197 get() { |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
198 return this.$store.state.application.searchQuery; |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
199 }, |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
200 set(value) { |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
201 this.$store.commit("application/searchQuery", value); |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
202 } |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
203 }, |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
204 searchIndicator: function() { |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
205 if (this.isSearching) { |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
206 return "⟳"; |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
207 } else if (this.searchQueryIsDirty) { |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
208 return ""; |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
209 } else { |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
210 return "✓"; |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
211 } |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
212 }, |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
213 searchbarContainerStyle() { |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
214 return [ |
3074
85f7f8981a71
client: search: fixed rounded corners
Markus Kottlaender <markus@intevation.de>
parents:
3044
diff
changeset
|
215 "input-group searchcontainer shadow-xs rounded", |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
216 { |
1282
a7dd8a3356fc
fixed contextBox animations
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
217 "d-flex": this.contextBoxContent !== "imports", |
2283
1169f18a0f11
make room for searchbar
Thomas Junk <thomas.junk@intevation.de>
parents:
2136
diff
changeset
|
218 "d-none": this.contextBoxContent === "imports" && this.showContextBox, |
1169f18a0f11
make room for searchbar
Thomas Junk <thomas.junk@intevation.de>
parents:
2136
diff
changeset
|
219 smallbox: !this.showSearchbar |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
220 } |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
221 ]; |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
222 }, |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
223 searchInputStyle() { |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
224 return [ |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
225 "form-control ui-element search searchbar d-print-none border-0", |
1282
a7dd8a3356fc
fixed contextBox animations
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
226 { "rounded-top-right": this.showContextBox || this.searchResults } |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
227 ]; |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
228 }, |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
229 searchButtonStyle() { |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
230 return [ |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
231 "ui-element input-group-text p-0 d-flex border-0 justify-content-center searchlabel bg-white d-print-none", |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
232 { |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
233 rounded: !this.showSearchbar, |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
234 "rounded-left": this.showSearchbar, |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
235 "rounded-top-left": |
1282
a7dd8a3356fc
fixed contextBox animations
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
236 this.showSearchbar && (this.showContextBox || this.searchResults) |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
237 } |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
238 ]; |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
239 } |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
240 }, |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
241 watch: { |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
242 searchQuery: function() { |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
243 this.searchQueryIsDirty = true; |
2750
6446bf6d2a89
search: use global search only in global context
Thomas Junk <thomas.junk@intevation.de>
parents:
2464
diff
changeset
|
244 if (!this.showContextBox) this.triggerSearch(); |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
245 } |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
246 }, |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
247 methods: { |
2753
2aa1620ffd9e
search: in context of importoverview pressing enter triggers a request for and updated dataset
Thomas Junk <thomas.junk@intevation.de>
parents:
2750
diff
changeset
|
248 loadLogs() { |
2aa1620ffd9e
search: in context of importoverview pressing enter triggers a request for and updated dataset
Thomas Junk <thomas.junk@intevation.de>
parents:
2750
diff
changeset
|
249 this.$store |
2aa1620ffd9e
search: in context of importoverview pressing enter triggers a request for and updated dataset
Thomas Junk <thomas.junk@intevation.de>
parents:
2750
diff
changeset
|
250 .dispatch("imports/getImports", { |
2aa1620ffd9e
search: in context of importoverview pressing enter triggers a request for and updated dataset
Thomas Junk <thomas.junk@intevation.de>
parents:
2750
diff
changeset
|
251 filter: this.filters, |
2aa1620ffd9e
search: in context of importoverview pressing enter triggers a request for and updated dataset
Thomas Junk <thomas.junk@intevation.de>
parents:
2750
diff
changeset
|
252 from: format(this.startDate, "YYYY-MM-DDTHH:mm:ss.SSS"), |
2aa1620ffd9e
search: in context of importoverview pressing enter triggers a request for and updated dataset
Thomas Junk <thomas.junk@intevation.de>
parents:
2750
diff
changeset
|
253 to: format(this.endDate, "YYYY-MM-DDTHH:mm:ss.SSS"), |
2aa1620ffd9e
search: in context of importoverview pressing enter triggers a request for and updated dataset
Thomas Junk <thomas.junk@intevation.de>
parents:
2750
diff
changeset
|
254 query: this.searchQuery |
2aa1620ffd9e
search: in context of importoverview pressing enter triggers a request for and updated dataset
Thomas Junk <thomas.junk@intevation.de>
parents:
2750
diff
changeset
|
255 }) |
2aa1620ffd9e
search: in context of importoverview pressing enter triggers a request for and updated dataset
Thomas Junk <thomas.junk@intevation.de>
parents:
2750
diff
changeset
|
256 .then(() => {}) |
2aa1620ffd9e
search: in context of importoverview pressing enter triggers a request for and updated dataset
Thomas Junk <thomas.junk@intevation.de>
parents:
2750
diff
changeset
|
257 .catch(error => { |
2aa1620ffd9e
search: in context of importoverview pressing enter triggers a request for and updated dataset
Thomas Junk <thomas.junk@intevation.de>
parents:
2750
diff
changeset
|
258 const { status, data } = error.response; |
2aa1620ffd9e
search: in context of importoverview pressing enter triggers a request for and updated dataset
Thomas Junk <thomas.junk@intevation.de>
parents:
2750
diff
changeset
|
259 displayError({ |
2aa1620ffd9e
search: in context of importoverview pressing enter triggers a request for and updated dataset
Thomas Junk <thomas.junk@intevation.de>
parents:
2750
diff
changeset
|
260 title: this.$gettext("Backend Error"), |
2aa1620ffd9e
search: in context of importoverview pressing enter triggers a request for and updated dataset
Thomas Junk <thomas.junk@intevation.de>
parents:
2750
diff
changeset
|
261 message: `${status}: ${data.message || data}` |
2aa1620ffd9e
search: in context of importoverview pressing enter triggers a request for and updated dataset
Thomas Junk <thomas.junk@intevation.de>
parents:
2750
diff
changeset
|
262 }); |
2aa1620ffd9e
search: in context of importoverview pressing enter triggers a request for and updated dataset
Thomas Junk <thomas.junk@intevation.de>
parents:
2750
diff
changeset
|
263 }); |
2aa1620ffd9e
search: in context of importoverview pressing enter triggers a request for and updated dataset
Thomas Junk <thomas.junk@intevation.de>
parents:
2750
diff
changeset
|
264 }, |
2aa1620ffd9e
search: in context of importoverview pressing enter triggers a request for and updated dataset
Thomas Junk <thomas.junk@intevation.de>
parents:
2750
diff
changeset
|
265 triggerEnter() { |
2aa1620ffd9e
search: in context of importoverview pressing enter triggers a request for and updated dataset
Thomas Junk <thomas.junk@intevation.de>
parents:
2750
diff
changeset
|
266 if (this.showContextBox && this.contextBoxContent === "importoverview") { |
2aa1620ffd9e
search: in context of importoverview pressing enter triggers a request for and updated dataset
Thomas Junk <thomas.junk@intevation.de>
parents:
2750
diff
changeset
|
267 this.loadLogs(); |
2aa1620ffd9e
search: in context of importoverview pressing enter triggers a request for and updated dataset
Thomas Junk <thomas.junk@intevation.de>
parents:
2750
diff
changeset
|
268 } |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
269 if (!this.searchResults || this.searchResults.length != 1) return; |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
270 this.moveToSearchResult(this.searchResults[0]); |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
271 }, |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
272 triggerSearch: debounce(function() { |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
273 this.doSearch(); |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
274 }, 500), |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
275 doSearch() { |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
276 this.isCalculating = true; |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
277 this.searchResults = null; |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
278 |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
279 if (this.searchQuery == "") { |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
280 return; |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
281 } |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
282 |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
283 HTTP.post( |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
284 "/search", |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
285 { string: this.searchQuery }, |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
286 { |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
287 headers: { |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
288 "X-Gemma-Auth": localStorage.getItem("token"), |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
289 "Content-type": "text/xml; charset=UTF-8" |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
290 } |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
291 } |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
292 ) |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
293 .then(response => { |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
294 this.searchResults = response.data; |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
295 }) |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
296 .catch(error => { |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
297 const { status, data } = error.response; |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
298 displayError({ |
1441
a4554e942954
Client: add a set of marked translations
Fadi Abbud <fadi.abbud@intevation.de>
parents:
1425
diff
changeset
|
299 title: this.$gettext("Backend Error"), |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
300 message: `${status}: ${data.message || data}` |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
301 }); |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
302 }); |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
303 |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
304 this.isCalculating = false; |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
305 this.searchQueryIsDirty = false; |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
306 }, |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
307 moveToSearchResult(resultEntry) { |
3749
f20bd1aee549
client: search: zoom to bounding box if feature has one
Markus Kottlaender <markus@intevation.de>
parents:
3584
diff
changeset
|
308 let zoom = 16; |
f20bd1aee549
client: search: zoom to bounding box if feature has one
Markus Kottlaender <markus@intevation.de>
parents:
3584
diff
changeset
|
309 if (resultEntry.type === "bottleneck") { |
f20bd1aee549
client: search: zoom to bounding box if feature has one
Markus Kottlaender <markus@intevation.de>
parents:
3584
diff
changeset
|
310 this.openLayersMap() |
f20bd1aee549
client: search: zoom to bounding box if feature has one
Markus Kottlaender <markus@intevation.de>
parents:
3584
diff
changeset
|
311 .getLayer("BOTTLENECKS") |
f20bd1aee549
client: search: zoom to bounding box if feature has one
Markus Kottlaender <markus@intevation.de>
parents:
3584
diff
changeset
|
312 .setVisible(true); |
f20bd1aee549
client: search: zoom to bounding box if feature has one
Markus Kottlaender <markus@intevation.de>
parents:
3584
diff
changeset
|
313 } |
f20bd1aee549
client: search: zoom to bounding box if feature has one
Markus Kottlaender <markus@intevation.de>
parents:
3584
diff
changeset
|
314 if (resultEntry.type === "rhm") { |
f20bd1aee549
client: search: zoom to bounding box if feature has one
Markus Kottlaender <markus@intevation.de>
parents:
3584
diff
changeset
|
315 this.openLayersMap() |
f20bd1aee549
client: search: zoom to bounding box if feature has one
Markus Kottlaender <markus@intevation.de>
parents:
3584
diff
changeset
|
316 .getLayer("DISTANCEMARKSAXIS") |
f20bd1aee549
client: search: zoom to bounding box if feature has one
Markus Kottlaender <markus@intevation.de>
parents:
3584
diff
changeset
|
317 .setVisible(true); |
f20bd1aee549
client: search: zoom to bounding box if feature has one
Markus Kottlaender <markus@intevation.de>
parents:
3584
diff
changeset
|
318 } |
f20bd1aee549
client: search: zoom to bounding box if feature has one
Markus Kottlaender <markus@intevation.de>
parents:
3584
diff
changeset
|
319 if (resultEntry.type === "gauge") { |
f20bd1aee549
client: search: zoom to bounding box if feature has one
Markus Kottlaender <markus@intevation.de>
parents:
3584
diff
changeset
|
320 this.openLayersMap() |
f20bd1aee549
client: search: zoom to bounding box if feature has one
Markus Kottlaender <markus@intevation.de>
parents:
3584
diff
changeset
|
321 .getLayer("GAUGES") |
f20bd1aee549
client: search: zoom to bounding box if feature has one
Markus Kottlaender <markus@intevation.de>
parents:
3584
diff
changeset
|
322 .setVisible(true); |
f20bd1aee549
client: search: zoom to bounding box if feature has one
Markus Kottlaender <markus@intevation.de>
parents:
3584
diff
changeset
|
323 } |
f20bd1aee549
client: search: zoom to bounding box if feature has one
Markus Kottlaender <markus@intevation.de>
parents:
3584
diff
changeset
|
324 if (resultEntry.type === "stretch") { |
3753
78ba9b2574ff
search: include id in search result to mark sections/stretches as selected
Markus Kottlaender <markus@intevation.de>
parents:
3749
diff
changeset
|
325 this.$store.commit( |
78ba9b2574ff
search: include id in search result to mark sections/stretches as selected
Markus Kottlaender <markus@intevation.de>
parents:
3749
diff
changeset
|
326 "imports/selectedStretchId", |
78ba9b2574ff
search: include id in search result to mark sections/stretches as selected
Markus Kottlaender <markus@intevation.de>
parents:
3749
diff
changeset
|
327 "stretches_geoserver." + resultEntry.id |
78ba9b2574ff
search: include id in search result to mark sections/stretches as selected
Markus Kottlaender <markus@intevation.de>
parents:
3749
diff
changeset
|
328 ); |
3749
f20bd1aee549
client: search: zoom to bounding box if feature has one
Markus Kottlaender <markus@intevation.de>
parents:
3584
diff
changeset
|
329 this.openLayersMap() |
f20bd1aee549
client: search: zoom to bounding box if feature has one
Markus Kottlaender <markus@intevation.de>
parents:
3584
diff
changeset
|
330 .getLayer("STRETCHES") |
f20bd1aee549
client: search: zoom to bounding box if feature has one
Markus Kottlaender <markus@intevation.de>
parents:
3584
diff
changeset
|
331 .setVisible(true); |
f20bd1aee549
client: search: zoom to bounding box if feature has one
Markus Kottlaender <markus@intevation.de>
parents:
3584
diff
changeset
|
332 } |
f20bd1aee549
client: search: zoom to bounding box if feature has one
Markus Kottlaender <markus@intevation.de>
parents:
3584
diff
changeset
|
333 if (resultEntry.type === "section") { |
3753
78ba9b2574ff
search: include id in search result to mark sections/stretches as selected
Markus Kottlaender <markus@intevation.de>
parents:
3749
diff
changeset
|
334 this.$store.commit( |
78ba9b2574ff
search: include id in search result to mark sections/stretches as selected
Markus Kottlaender <markus@intevation.de>
parents:
3749
diff
changeset
|
335 "imports/selectedSectionId", |
78ba9b2574ff
search: include id in search result to mark sections/stretches as selected
Markus Kottlaender <markus@intevation.de>
parents:
3749
diff
changeset
|
336 "sections_geoserver." + resultEntry.id |
78ba9b2574ff
search: include id in search result to mark sections/stretches as selected
Markus Kottlaender <markus@intevation.de>
parents:
3749
diff
changeset
|
337 ); |
3749
f20bd1aee549
client: search: zoom to bounding box if feature has one
Markus Kottlaender <markus@intevation.de>
parents:
3584
diff
changeset
|
338 this.openLayersMap() |
f20bd1aee549
client: search: zoom to bounding box if feature has one
Markus Kottlaender <markus@intevation.de>
parents:
3584
diff
changeset
|
339 .getLayer("SECTIONS") |
f20bd1aee549
client: search: zoom to bounding box if feature has one
Markus Kottlaender <markus@intevation.de>
parents:
3584
diff
changeset
|
340 .setVisible(true); |
f20bd1aee549
client: search: zoom to bounding box if feature has one
Markus Kottlaender <markus@intevation.de>
parents:
3584
diff
changeset
|
341 } |
f20bd1aee549
client: search: zoom to bounding box if feature has one
Markus Kottlaender <markus@intevation.de>
parents:
3584
diff
changeset
|
342 if (resultEntry.type === "city") zoom = 13; |
f20bd1aee549
client: search: zoom to bounding box if feature has one
Markus Kottlaender <markus@intevation.de>
parents:
3584
diff
changeset
|
343 |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
344 if (resultEntry.geom.type == "Point") { |
3044
c71373594719
client: map: prepared store to hold multiple map objects
Markus Kottlaender <markus@intevation.de>
parents:
3012
diff
changeset
|
345 this.$store.dispatch("map/moveMap", { |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
346 coordinates: resultEntry.geom.coordinates, |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
347 zoom, |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
348 preventZoomOut: true |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
349 }); |
3749
f20bd1aee549
client: search: zoom to bounding box if feature has one
Markus Kottlaender <markus@intevation.de>
parents:
3584
diff
changeset
|
350 } else if (resultEntry.geom.type == "Polygon") { |
f20bd1aee549
client: search: zoom to bounding box if feature has one
Markus Kottlaender <markus@intevation.de>
parents:
3584
diff
changeset
|
351 const boundingBox = [ |
f20bd1aee549
client: search: zoom to bounding box if feature has one
Markus Kottlaender <markus@intevation.de>
parents:
3584
diff
changeset
|
352 Math.min(...resultEntry.geom.coordinates[0].map(c => c[0])), |
f20bd1aee549
client: search: zoom to bounding box if feature has one
Markus Kottlaender <markus@intevation.de>
parents:
3584
diff
changeset
|
353 Math.min(...resultEntry.geom.coordinates[0].map(c => c[1])), |
f20bd1aee549
client: search: zoom to bounding box if feature has one
Markus Kottlaender <markus@intevation.de>
parents:
3584
diff
changeset
|
354 Math.max(...resultEntry.geom.coordinates[0].map(c => c[0])), |
f20bd1aee549
client: search: zoom to bounding box if feature has one
Markus Kottlaender <markus@intevation.de>
parents:
3584
diff
changeset
|
355 Math.max(...resultEntry.geom.coordinates[0].map(c => c[1])) |
f20bd1aee549
client: search: zoom to bounding box if feature has one
Markus Kottlaender <markus@intevation.de>
parents:
3584
diff
changeset
|
356 ]; |
f20bd1aee549
client: search: zoom to bounding box if feature has one
Markus Kottlaender <markus@intevation.de>
parents:
3584
diff
changeset
|
357 this.$store.dispatch("map/moveToBoundingBox", { boundingBox, zoom }); |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
358 } |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
359 // this.searchQuery = ""; // clear search query again |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
360 this.toggleSearchbar(); |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
361 }, |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
362 toggleSearchbar() { |
1282
a7dd8a3356fc
fixed contextBox animations
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
363 if (!this.showContextBox) { |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
364 if (!this.showSearchbar) { |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
365 setTimeout(setFocus, 300); |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
366 } |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
367 this.$store.commit("application/showSearchbar", !this.showSearchbar); |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
368 } |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
369 } |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
370 } |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
371 }; |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
372 </script> |