Mercurial > gemma
annotate client/src/components/Search.vue @ 5437:eeee1c411576 marking-single-beam
Pdf-Template: Use survey-date for {date-minor} when bottleneck survey is visible.
author | Thomas Junk <thomas.junk@intevation.de> |
---|---|
date | Tue, 13 Jul 2021 12:24:29 +0200 |
parents | 19715261750e |
children | 62caee603217 |
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; | |
4981
9f0830a1845d
squashed the total layout to enable display of long fm importnames
Thomas Junk <thomas.junk@intevation.de>
parents:
4869
diff
changeset
|
88 width: 860px; |
1449 | 89 } |
90 | |
91 .searchcontainer .searchbar { | |
92 border-top-left-radius: 0 !important; | |
93 border-bottom-left-radius: 0 !important; | |
94 } | |
95 | |
96 .searchgroup { | |
4981
9f0830a1845d
squashed the total layout to enable display of long fm importnames
Thomas Junk <thomas.junk@intevation.de>
parents:
4869
diff
changeset
|
97 width: 827px; |
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 */ |
4463
1cdd246860ae
remove lodash.debounce
Thomas Junk <thomas.junk@intevation.de>
parents:
3779
diff
changeset
|
169 import debounce from "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", |
5132
8d5e3ce27d20
client: Time based search
Fadi Abbud <fadi.abbud@intevation.de>
parents:
4981
diff
changeset
|
191 "contextBoxContent", |
8d5e3ce27d20
client: Time based search
Fadi Abbud <fadi.abbud@intevation.de>
parents:
4981
diff
changeset
|
192 "showTimeSlider", |
8d5e3ce27d20
client: Time based search
Fadi Abbud <fadi.abbud@intevation.de>
parents:
4981
diff
changeset
|
193 "currentVisibleTime" |
1282
a7dd8a3356fc
fixed contextBox animations
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
194 ]), |
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
|
195 ...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
|
196 ...mapGetters("imports", ["filters"]), |
3749
f20bd1aee549
client: search: zoom to bounding box if feature has one
Markus Kottlaender <markus@intevation.de>
parents:
3584
diff
changeset
|
197 ...mapGetters("map", ["openLayersMap"]), |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
198 searchQuery: { |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
199 get() { |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
200 return this.$store.state.application.searchQuery; |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
201 }, |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
202 set(value) { |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
203 this.$store.commit("application/searchQuery", value); |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
204 } |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
205 }, |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
206 searchIndicator: function() { |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
207 if (this.isSearching) { |
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 if (this.searchQueryIsDirty) { |
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 } else { |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
212 return "✓"; |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
213 } |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
214 }, |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
215 searchbarContainerStyle() { |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
216 return [ |
3074
85f7f8981a71
client: search: fixed rounded corners
Markus Kottlaender <markus@intevation.de>
parents:
3044
diff
changeset
|
217 "input-group searchcontainer shadow-xs rounded", |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
218 { |
1282
a7dd8a3356fc
fixed contextBox animations
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
219 "d-flex": this.contextBoxContent !== "imports", |
2283
1169f18a0f11
make room for searchbar
Thomas Junk <thomas.junk@intevation.de>
parents:
2136
diff
changeset
|
220 "d-none": this.contextBoxContent === "imports" && this.showContextBox, |
1169f18a0f11
make room for searchbar
Thomas Junk <thomas.junk@intevation.de>
parents:
2136
diff
changeset
|
221 smallbox: !this.showSearchbar |
1272
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 ]; |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
224 }, |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
225 searchInputStyle() { |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
226 return [ |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
227 "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
|
228 { "rounded-top-right": this.showContextBox || this.searchResults } |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
229 ]; |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
230 }, |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
231 searchButtonStyle() { |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
232 return [ |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
233 "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
|
234 { |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
235 rounded: !this.showSearchbar, |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
236 "rounded-left": this.showSearchbar, |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
237 "rounded-top-left": |
1282
a7dd8a3356fc
fixed contextBox animations
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
238 this.showSearchbar && (this.showContextBox || this.searchResults) |
1272
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 } |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
242 }, |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
243 watch: { |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
244 searchQuery: function() { |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
245 this.searchQueryIsDirty = true; |
2750
6446bf6d2a89
search: use global search only in global context
Thomas Junk <thomas.junk@intevation.de>
parents:
2464
diff
changeset
|
246 if (!this.showContextBox) this.triggerSearch(); |
5132
8d5e3ce27d20
client: Time based search
Fadi Abbud <fadi.abbud@intevation.de>
parents:
4981
diff
changeset
|
247 }, |
8d5e3ce27d20
client: Time based search
Fadi Abbud <fadi.abbud@intevation.de>
parents:
4981
diff
changeset
|
248 currentVisibleTime() { |
8d5e3ce27d20
client: Time based search
Fadi Abbud <fadi.abbud@intevation.de>
parents:
4981
diff
changeset
|
249 this.doSearch(); |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
250 } |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
251 }, |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
252 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
|
253 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
|
254 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
|
255 .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
|
256 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
|
257 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
|
258 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
|
259 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
|
260 }) |
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 .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
|
262 .catch(error => { |
4869
6b054b91d9b2
backend not reachable as error message etd. Login adjusted
Thomas Junk <thomas.junk@intevation.de>
parents:
4868
diff
changeset
|
263 let message = "Backend not reachable"; |
4868
008bc1ae8897
exception handling
Thomas Junk <thomas.junk@intevation.de>
parents:
4774
diff
changeset
|
264 if (error.response) { |
008bc1ae8897
exception handling
Thomas Junk <thomas.junk@intevation.de>
parents:
4774
diff
changeset
|
265 const { status, data } = error.response; |
008bc1ae8897
exception handling
Thomas Junk <thomas.junk@intevation.de>
parents:
4774
diff
changeset
|
266 message = `${status}: ${data.message || data}`; |
008bc1ae8897
exception handling
Thomas Junk <thomas.junk@intevation.de>
parents:
4774
diff
changeset
|
267 } |
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
|
268 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
|
269 title: this.$gettext("Backend Error"), |
4868
008bc1ae8897
exception handling
Thomas Junk <thomas.junk@intevation.de>
parents:
4774
diff
changeset
|
270 message: message |
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
|
271 }); |
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
|
272 }); |
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
|
273 }, |
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
|
274 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
|
275 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
|
276 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
|
277 } |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
278 if (!this.searchResults || this.searchResults.length != 1) return; |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
279 this.moveToSearchResult(this.searchResults[0]); |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
280 }, |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
281 triggerSearch: debounce(function() { |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
282 this.doSearch(); |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
283 }, 500), |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
284 doSearch() { |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
285 this.isCalculating = true; |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
286 this.searchResults = null; |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
287 |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
288 if (this.searchQuery == "") { |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
289 return; |
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 HTTP.post( |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
293 "/search", |
5132
8d5e3ce27d20
client: Time based search
Fadi Abbud <fadi.abbud@intevation.de>
parents:
4981
diff
changeset
|
294 this.showTimeSlider |
8d5e3ce27d20
client: Time based search
Fadi Abbud <fadi.abbud@intevation.de>
parents:
4981
diff
changeset
|
295 ? { |
8d5e3ce27d20
client: Time based search
Fadi Abbud <fadi.abbud@intevation.de>
parents:
4981
diff
changeset
|
296 string: this.searchQuery, |
8d5e3ce27d20
client: Time based search
Fadi Abbud <fadi.abbud@intevation.de>
parents:
4981
diff
changeset
|
297 time: this.currentVisibleTime.toISOString() |
8d5e3ce27d20
client: Time based search
Fadi Abbud <fadi.abbud@intevation.de>
parents:
4981
diff
changeset
|
298 } |
8d5e3ce27d20
client: Time based search
Fadi Abbud <fadi.abbud@intevation.de>
parents:
4981
diff
changeset
|
299 : { string: this.searchQuery }, |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
300 { |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
301 headers: { |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
302 "X-Gemma-Auth": localStorage.getItem("token"), |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
303 "Content-type": "text/xml; charset=UTF-8" |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
304 } |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
305 } |
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 .then(response => { |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
308 this.searchResults = response.data; |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
309 }) |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
310 .catch(error => { |
4869
6b054b91d9b2
backend not reachable as error message etd. Login adjusted
Thomas Junk <thomas.junk@intevation.de>
parents:
4868
diff
changeset
|
311 let message = "Backend not reachable"; |
4868
008bc1ae8897
exception handling
Thomas Junk <thomas.junk@intevation.de>
parents:
4774
diff
changeset
|
312 if (error.response) { |
008bc1ae8897
exception handling
Thomas Junk <thomas.junk@intevation.de>
parents:
4774
diff
changeset
|
313 const { status, data } = error.response; |
008bc1ae8897
exception handling
Thomas Junk <thomas.junk@intevation.de>
parents:
4774
diff
changeset
|
314 message = `${status}: ${data.message || data}`; |
008bc1ae8897
exception handling
Thomas Junk <thomas.junk@intevation.de>
parents:
4774
diff
changeset
|
315 } |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
316 displayError({ |
1441
a4554e942954
Client: add a set of marked translations
Fadi Abbud <fadi.abbud@intevation.de>
parents:
1425
diff
changeset
|
317 title: this.$gettext("Backend Error"), |
4868
008bc1ae8897
exception handling
Thomas Junk <thomas.junk@intevation.de>
parents:
4774
diff
changeset
|
318 message: message |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
319 }); |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
320 }); |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
321 |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
322 this.isCalculating = false; |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
323 this.searchQueryIsDirty = false; |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
324 }, |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
325 moveToSearchResult(resultEntry) { |
3749
f20bd1aee549
client: search: zoom to bounding box if feature has one
Markus Kottlaender <markus@intevation.de>
parents:
3584
diff
changeset
|
326 let zoom = 16; |
f20bd1aee549
client: search: zoom to bounding box if feature has one
Markus Kottlaender <markus@intevation.de>
parents:
3584
diff
changeset
|
327 if (resultEntry.type === "bottleneck") { |
f20bd1aee549
client: search: zoom to bounding box if feature has one
Markus Kottlaender <markus@intevation.de>
parents:
3584
diff
changeset
|
328 this.openLayersMap() |
f20bd1aee549
client: search: zoom to bounding box if feature has one
Markus Kottlaender <markus@intevation.de>
parents:
3584
diff
changeset
|
329 .getLayer("BOTTLENECKS") |
f20bd1aee549
client: search: zoom to bounding box if feature has one
Markus Kottlaender <markus@intevation.de>
parents:
3584
diff
changeset
|
330 .setVisible(true); |
5263
19715261750e
client: set bottleneck for pdf-export from search and Map popup
Fadi Abbud <fadi.abbud@intevation.de>
parents:
5132
diff
changeset
|
331 this.$store.commit( |
19715261750e
client: set bottleneck for pdf-export from search and Map popup
Fadi Abbud <fadi.abbud@intevation.de>
parents:
5132
diff
changeset
|
332 "bottlenecks/setBottleneckForPrint", |
19715261750e
client: set bottleneck for pdf-export from search and Map popup
Fadi Abbud <fadi.abbud@intevation.de>
parents:
5132
diff
changeset
|
333 resultEntry.name |
19715261750e
client: set bottleneck for pdf-export from search and Map popup
Fadi Abbud <fadi.abbud@intevation.de>
parents:
5132
diff
changeset
|
334 ); |
3749
f20bd1aee549
client: search: zoom to bounding box if feature has one
Markus Kottlaender <markus@intevation.de>
parents:
3584
diff
changeset
|
335 } |
f20bd1aee549
client: search: zoom to bounding box if feature has one
Markus Kottlaender <markus@intevation.de>
parents:
3584
diff
changeset
|
336 if (resultEntry.type === "rhm") { |
f20bd1aee549
client: search: zoom to bounding box if feature has one
Markus Kottlaender <markus@intevation.de>
parents:
3584
diff
changeset
|
337 this.openLayersMap() |
f20bd1aee549
client: search: zoom to bounding box if feature has one
Markus Kottlaender <markus@intevation.de>
parents:
3584
diff
changeset
|
338 .getLayer("DISTANCEMARKSAXIS") |
f20bd1aee549
client: search: zoom to bounding box if feature has one
Markus Kottlaender <markus@intevation.de>
parents:
3584
diff
changeset
|
339 .setVisible(true); |
f20bd1aee549
client: search: zoom to bounding box if feature has one
Markus Kottlaender <markus@intevation.de>
parents:
3584
diff
changeset
|
340 } |
f20bd1aee549
client: search: zoom to bounding box if feature has one
Markus Kottlaender <markus@intevation.de>
parents:
3584
diff
changeset
|
341 if (resultEntry.type === "gauge") { |
f20bd1aee549
client: search: zoom to bounding box if feature has one
Markus Kottlaender <markus@intevation.de>
parents:
3584
diff
changeset
|
342 this.openLayersMap() |
f20bd1aee549
client: search: zoom to bounding box if feature has one
Markus Kottlaender <markus@intevation.de>
parents:
3584
diff
changeset
|
343 .getLayer("GAUGES") |
f20bd1aee549
client: search: zoom to bounding box if feature has one
Markus Kottlaender <markus@intevation.de>
parents:
3584
diff
changeset
|
344 .setVisible(true); |
f20bd1aee549
client: search: zoom to bounding box if feature has one
Markus Kottlaender <markus@intevation.de>
parents:
3584
diff
changeset
|
345 } |
f20bd1aee549
client: search: zoom to bounding box if feature has one
Markus Kottlaender <markus@intevation.de>
parents:
3584
diff
changeset
|
346 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
|
347 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
|
348 "imports/selectedStretchId", |
78ba9b2574ff
search: include id in search result to mark sections/stretches as selected
Markus Kottlaender <markus@intevation.de>
parents:
3749
diff
changeset
|
349 "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
|
350 ); |
3749
f20bd1aee549
client: search: zoom to bounding box if feature has one
Markus Kottlaender <markus@intevation.de>
parents:
3584
diff
changeset
|
351 this.openLayersMap() |
f20bd1aee549
client: search: zoom to bounding box if feature has one
Markus Kottlaender <markus@intevation.de>
parents:
3584
diff
changeset
|
352 .getLayer("STRETCHES") |
f20bd1aee549
client: search: zoom to bounding box if feature has one
Markus Kottlaender <markus@intevation.de>
parents:
3584
diff
changeset
|
353 .setVisible(true); |
f20bd1aee549
client: search: zoom to bounding box if feature has one
Markus Kottlaender <markus@intevation.de>
parents:
3584
diff
changeset
|
354 } |
f20bd1aee549
client: search: zoom to bounding box if feature has one
Markus Kottlaender <markus@intevation.de>
parents:
3584
diff
changeset
|
355 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
|
356 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
|
357 "imports/selectedSectionId", |
78ba9b2574ff
search: include id in search result to mark sections/stretches as selected
Markus Kottlaender <markus@intevation.de>
parents:
3749
diff
changeset
|
358 "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
|
359 ); |
3749
f20bd1aee549
client: search: zoom to bounding box if feature has one
Markus Kottlaender <markus@intevation.de>
parents:
3584
diff
changeset
|
360 this.openLayersMap() |
f20bd1aee549
client: search: zoom to bounding box if feature has one
Markus Kottlaender <markus@intevation.de>
parents:
3584
diff
changeset
|
361 .getLayer("SECTIONS") |
f20bd1aee549
client: search: zoom to bounding box if feature has one
Markus Kottlaender <markus@intevation.de>
parents:
3584
diff
changeset
|
362 .setVisible(true); |
f20bd1aee549
client: search: zoom to bounding box if feature has one
Markus Kottlaender <markus@intevation.de>
parents:
3584
diff
changeset
|
363 } |
f20bd1aee549
client: search: zoom to bounding box if feature has one
Markus Kottlaender <markus@intevation.de>
parents:
3584
diff
changeset
|
364 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
|
365 |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
366 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
|
367 this.$store.dispatch("map/moveMap", { |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
368 coordinates: resultEntry.geom.coordinates, |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
369 zoom, |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
370 preventZoomOut: true |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
371 }); |
3749
f20bd1aee549
client: search: zoom to bounding box if feature has one
Markus Kottlaender <markus@intevation.de>
parents:
3584
diff
changeset
|
372 } 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
|
373 const boundingBox = [ |
f20bd1aee549
client: search: zoom to bounding box if feature has one
Markus Kottlaender <markus@intevation.de>
parents:
3584
diff
changeset
|
374 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
|
375 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
|
376 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
|
377 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
|
378 ]; |
f20bd1aee549
client: search: zoom to bounding box if feature has one
Markus Kottlaender <markus@intevation.de>
parents:
3584
diff
changeset
|
379 this.$store.dispatch("map/moveToBoundingBox", { boundingBox, zoom }); |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
380 } |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
381 // this.searchQuery = ""; // clear search query again |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
382 this.toggleSearchbar(); |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
383 }, |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
384 toggleSearchbar() { |
1282
a7dd8a3356fc
fixed contextBox animations
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
385 if (!this.showContextBox) { |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
386 if (!this.showSearchbar) { |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
387 setTimeout(setFocus, 300); |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
388 } |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
389 this.$store.commit("application/showSearchbar", !this.showSearchbar); |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
390 } |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
391 } |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
392 } |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
393 }; |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
394 </script> |