annotate client/src/components/Search.vue @ 5450:62caee603217 uiimprovements

Make BN-Overview smaller.
author Thomas Junk <thomas.junk@intevation.de>
date Wed, 14 Jul 2021 12:07:31 +0200
parents 19715261750e
children 1cf9b043dca1
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
bb47531bdd22 sass to scss
Thomas Junk <thomas.junk@intevation.de>
parents: 1441
diff changeset
8 <div
1480
9b81ac91a43e fix: linting
Thomas Junk <thomas.junk@intevation.de>
parents: 1449
diff changeset
9 :class="[
9b81ac91a43e fix: linting
Thomas Junk <thomas.junk@intevation.de>
parents: 1449
diff changeset
10 'searchgroup',
9b81ac91a43e fix: linting
Thomas Junk <thomas.junk@intevation.de>
parents: 1449
diff changeset
11 {
5450
62caee603217 Make BN-Overview smaller.
Thomas Junk <thomas.junk@intevation.de>
parents: 5263
diff changeset
12 searchgroupwidthbottlenecks:
62caee603217 Make BN-Overview smaller.
Thomas Junk <thomas.junk@intevation.de>
parents: 5263
diff changeset
13 this.showSearchbar && this.contextBoxContent === 'bottlenecks',
62caee603217 Make BN-Overview smaller.
Thomas Junk <thomas.junk@intevation.de>
parents: 5263
diff changeset
14 sgnobottlenecks:
62caee603217 Make BN-Overview smaller.
Thomas Junk <thomas.junk@intevation.de>
parents: 5263
diff changeset
15 this.showSearchbar && this.contextBoxContent !== 'bottlenecks',
1480
9b81ac91a43e fix: linting
Thomas Junk <thomas.junk@intevation.de>
parents: 1449
diff changeset
16 'searchgroup-collapsed': !showSearchbar,
9b81ac91a43e fix: linting
Thomas Junk <thomas.junk@intevation.de>
parents: 1449
diff changeset
17 big:
9b81ac91a43e fix: linting
Thomas Junk <thomas.junk@intevation.de>
parents: 1449
diff changeset
18 showContextBox &&
1797
67340ceecc5f feat: define sections and stretches etd
Thomas Junk <thomas.junk@intevation.de>
parents: 1670
diff changeset
19 ['bottlenecks', 'staging', 'stretches'].indexOf(
67340ceecc5f feat: define sections and stretches etd
Thomas Junk <thomas.junk@intevation.de>
parents: 1670
diff changeset
20 contextBoxContent
67340ceecc5f feat: define sections and stretches etd
Thomas Junk <thomas.junk@intevation.de>
parents: 1670
diff changeset
21 ) !== -1
1480
9b81ac91a43e fix: linting
Thomas Junk <thomas.junk@intevation.de>
parents: 1449
diff changeset
22 }
9b81ac91a43e fix: linting
Thomas Junk <thomas.junk@intevation.de>
parents: 1449
diff changeset
23 ]"
1449
bb47531bdd22 sass to scss
Thomas Junk <thomas.junk@intevation.de>
parents: 1441
diff changeset
24 >
1361
ea3a89a1813a remove trailing whitespace, add headers for Makefile, add the missed authors
Fadi Abbud <fadi.abbud@intevation.de>
parents: 1299
diff changeset
25 <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
26 @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
27 id="search"
ea3a89a1813a remove trailing whitespace, add headers for Makefile, add the missed authors
Fadi Abbud <fadi.abbud@intevation.de>
parents: 1299
diff changeset
28 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
29 type="text"
ea3a89a1813a remove trailing whitespace, add headers for Makefile, add the missed authors
Fadi Abbud <fadi.abbud@intevation.de>
parents: 1299
diff changeset
30 :class="searchInputStyle"
1480
9b81ac91a43e fix: linting
Thomas Junk <thomas.junk@intevation.de>
parents: 1449
diff changeset
31 />
1361
ea3a89a1813a remove trailing whitespace, add headers for Makefile, add the missed authors
Fadi Abbud <fadi.abbud@intevation.de>
parents: 1299
diff changeset
32 </div>
ea3a89a1813a remove trailing whitespace, add headers for Makefile, add the missed authors
Fadi Abbud <fadi.abbud@intevation.de>
parents: 1299
diff changeset
33 <div
ea3a89a1813a remove trailing whitespace, add headers for Makefile, add the missed authors
Fadi Abbud <fadi.abbud@intevation.de>
parents: 1299
diff changeset
34 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
35 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
36 >
1480
9b81ac91a43e fix: linting
Thomas Junk <thomas.junk@intevation.de>
parents: 1449
diff changeset
37 <div
3575
818cc2deff98 search: fix index issue
Thomas Junk <thomas.junk@intevation.de>
parents: 3391
diff changeset
38 v-for="(entry, index) of searchResults"
818cc2deff98 search: fix index issue
Thomas Junk <thomas.junk@intevation.de>
parents: 3391
diff changeset
39 :key="index"
1480
9b81ac91a43e fix: linting
Thomas Junk <thomas.junk@intevation.de>
parents: 1449
diff changeset
40 class="border-top text-left"
9b81ac91a43e fix: linting
Thomas Junk <thomas.junk@intevation.de>
parents: 1449
diff changeset
41 >
9b81ac91a43e fix: linting
Thomas Junk <thomas.junk@intevation.de>
parents: 1449
diff changeset
42 <a
9b81ac91a43e fix: linting
Thomas Junk <thomas.junk@intevation.de>
parents: 1449
diff changeset
43 href="#"
9b81ac91a43e fix: linting
Thomas Junk <thomas.junk@intevation.de>
parents: 1449
diff changeset
44 @click.prevent="moveToSearchResult(entry)"
9b81ac91a43e fix: linting
Thomas Junk <thomas.junk@intevation.de>
parents: 1449
diff changeset
45 class="p-2 d-block text-nowrap"
9b81ac91a43e fix: linting
Thomas Junk <thomas.junk@intevation.de>
parents: 1449
diff changeset
46 >
1441
a4554e942954 Client: add a set of marked translations
Fadi Abbud <fadi.abbud@intevation.de>
parents: 1425
diff changeset
47 <font-awesome-icon
a4554e942954 Client: add a set of marked translations
Fadi Abbud <fadi.abbud@intevation.de>
parents: 1425
diff changeset
48 icon="ship"
a4554e942954 Client: add a set of marked translations
Fadi Abbud <fadi.abbud@intevation.de>
parents: 1425
diff changeset
49 v-if="entry.type === 'bottleneck'"
a4554e942954 Client: add a set of marked translations
Fadi Abbud <fadi.abbud@intevation.de>
parents: 1425
diff changeset
50 class="mr-1"
a4554e942954 Client: add a set of marked translations
Fadi Abbud <fadi.abbud@intevation.de>
parents: 1425
diff changeset
51 fixed-width
a4554e942954 Client: add a set of marked translations
Fadi Abbud <fadi.abbud@intevation.de>
parents: 1425
diff changeset
52 />
1480
9b81ac91a43e fix: linting
Thomas Junk <thomas.junk@intevation.de>
parents: 1449
diff changeset
53 <font-awesome-icon
9b81ac91a43e fix: linting
Thomas Junk <thomas.junk@intevation.de>
parents: 1449
diff changeset
54 icon="water"
9b81ac91a43e fix: linting
Thomas Junk <thomas.junk@intevation.de>
parents: 1449
diff changeset
55 v-if="entry.type === 'rhm'"
9b81ac91a43e fix: linting
Thomas Junk <thomas.junk@intevation.de>
parents: 1449
diff changeset
56 class="mr-1"
9b81ac91a43e fix: linting
Thomas Junk <thomas.junk@intevation.de>
parents: 1449
diff changeset
57 fixed-width
9b81ac91a43e fix: linting
Thomas Junk <thomas.junk@intevation.de>
parents: 1449
diff changeset
58 />
9b81ac91a43e fix: linting
Thomas Junk <thomas.junk@intevation.de>
parents: 1449
diff changeset
59 <font-awesome-icon
9b81ac91a43e fix: linting
Thomas Junk <thomas.junk@intevation.de>
parents: 1449
diff changeset
60 icon="city"
9b81ac91a43e fix: linting
Thomas Junk <thomas.junk@intevation.de>
parents: 1449
diff changeset
61 v-if="entry.type === 'city'"
9b81ac91a43e fix: linting
Thomas Junk <thomas.junk@intevation.de>
parents: 1449
diff changeset
62 class="mr-1"
9b81ac91a43e fix: linting
Thomas Junk <thomas.junk@intevation.de>
parents: 1449
diff changeset
63 fixed-width
9b81ac91a43e fix: linting
Thomas Junk <thomas.junk@intevation.de>
parents: 1449
diff changeset
64 />
2454
219c5b57ef5b Added icon to gouges in search result.
Sascha Wilde <wilde@intevation.de>
parents: 2440
diff changeset
65 <font-awesome-icon
2464
bc0f1771497a Use better suited icon for gauges in search results.
Sascha Wilde <wilde@intevation.de>
parents: 2454
diff changeset
66 icon="ruler-vertical"
2454
219c5b57ef5b Added icon to gouges in search result.
Sascha Wilde <wilde@intevation.de>
parents: 2440
diff changeset
67 v-if="entry.type === 'gauge'"
219c5b57ef5b Added icon to gouges in search result.
Sascha Wilde <wilde@intevation.de>
parents: 2440
diff changeset
68 class="mr-1"
219c5b57ef5b Added icon to gouges in search result.
Sascha Wilde <wilde@intevation.de>
parents: 2440
diff changeset
69 fixed-width
219c5b57ef5b Added icon to gouges in search result.
Sascha Wilde <wilde@intevation.de>
parents: 2440
diff changeset
70 />
3391
11379474a1b1 Added preliminary icon for sections in search.
Sascha Wilde <wilde@intevation.de>
parents: 3074
diff changeset
71 <font-awesome-icon
3760
aea53775a3a7 client: search: set item from sidebar for sections/stretches
Markus Kottlaender <markus@intevation.de>
parents: 3753
diff changeset
72 icon="road"
aea53775a3a7 client: search: set item from sidebar for sections/stretches
Markus Kottlaender <markus@intevation.de>
parents: 3753
diff changeset
73 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
74 class="mr-1"
11379474a1b1 Added preliminary icon for sections in search.
Sascha Wilde <wilde@intevation.de>
parents: 3074
diff changeset
75 fixed-width
11379474a1b1 Added preliminary icon for sections in search.
Sascha Wilde <wilde@intevation.de>
parents: 3074
diff changeset
76 />
3779
33180c25bd87 Added extra information to search results (wwname, ISRS code)
Sascha Wilde <wilde@intevation.de>
parents: 3760
diff changeset
77 {{ entry.name }}
33180c25bd87 Added extra information to search results (wwname, ISRS code)
Sascha Wilde <wilde@intevation.de>
parents: 3760
diff changeset
78 <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
79 >({{ entry.location
33180c25bd87 Added extra information to search results (wwname, ISRS code)
Sascha Wilde <wilde@intevation.de>
parents: 3760
diff changeset
80 }}<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
81 >{{ entry.locationcode }})</span
33180c25bd87 Added extra information to search results (wwname, ISRS code)
Sascha Wilde <wilde@intevation.de>
parents: 3760
diff changeset
82 >
1399
8e2c9e518440 improved search style
Markus Kottlaender <markus@intevation.de>
parents: 1398
diff changeset
83 </a>
1361
ea3a89a1813a remove trailing whitespace, add headers for Makefile, add the missed authors
Fadi Abbud <fadi.abbud@intevation.de>
parents: 1299
diff changeset
84 </div>
ea3a89a1813a remove trailing whitespace, add headers for Makefile, add the missed authors
Fadi Abbud <fadi.abbud@intevation.de>
parents: 1299
diff changeset
85 </div>
ea3a89a1813a remove trailing whitespace, add headers for Makefile, add the missed authors
Fadi Abbud <fadi.abbud@intevation.de>
parents: 1299
diff changeset
86 </div>
1272
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
87 </template>
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
88
1449
bb47531bdd22 sass to scss
Thomas Junk <thomas.junk@intevation.de>
parents: 1441
diff changeset
89 <style lang="scss" scoped>
bb47531bdd22 sass to scss
Thomas Junk <thomas.junk@intevation.de>
parents: 1441
diff changeset
90 .searchcontainer {
bb47531bdd22 sass to scss
Thomas Junk <thomas.junk@intevation.de>
parents: 1441
diff changeset
91 opacity: 0.96;
5450
62caee603217 Make BN-Overview smaller.
Thomas Junk <thomas.junk@intevation.de>
parents: 5263
diff changeset
92 }
62caee603217 Make BN-Overview smaller.
Thomas Junk <thomas.junk@intevation.de>
parents: 5263
diff changeset
93
62caee603217 Make BN-Overview smaller.
Thomas Junk <thomas.junk@intevation.de>
parents: 5263
diff changeset
94 .searchcontainerwitdh {
4981
9f0830a1845d squashed the total layout to enable display of long fm importnames
Thomas Junk <thomas.junk@intevation.de>
parents: 4869
diff changeset
95 width: 860px;
5450
62caee603217 Make BN-Overview smaller.
Thomas Junk <thomas.junk@intevation.de>
parents: 5263
diff changeset
96 transition: 0.1s;
62caee603217 Make BN-Overview smaller.
Thomas Junk <thomas.junk@intevation.de>
parents: 5263
diff changeset
97 transition-timing-function: ease;
62caee603217 Make BN-Overview smaller.
Thomas Junk <thomas.junk@intevation.de>
parents: 5263
diff changeset
98 }
62caee603217 Make BN-Overview smaller.
Thomas Junk <thomas.junk@intevation.de>
parents: 5263
diff changeset
99
62caee603217 Make BN-Overview smaller.
Thomas Junk <thomas.junk@intevation.de>
parents: 5263
diff changeset
100 .searchcontainerwitdhbottlenecks {
62caee603217 Make BN-Overview smaller.
Thomas Junk <thomas.junk@intevation.de>
parents: 5263
diff changeset
101 width: 650px;
62caee603217 Make BN-Overview smaller.
Thomas Junk <thomas.junk@intevation.de>
parents: 5263
diff changeset
102 transition: 0.1s;
62caee603217 Make BN-Overview smaller.
Thomas Junk <thomas.junk@intevation.de>
parents: 5263
diff changeset
103 transition-timing-function: ease;
62caee603217 Make BN-Overview smaller.
Thomas Junk <thomas.junk@intevation.de>
parents: 5263
diff changeset
104 }
62caee603217 Make BN-Overview smaller.
Thomas Junk <thomas.junk@intevation.de>
parents: 5263
diff changeset
105
62caee603217 Make BN-Overview smaller.
Thomas Junk <thomas.junk@intevation.de>
parents: 5263
diff changeset
106 .searchgroupwidth {
62caee603217 Make BN-Overview smaller.
Thomas Junk <thomas.junk@intevation.de>
parents: 5263
diff changeset
107 max-width: 860px;
62caee603217 Make BN-Overview smaller.
Thomas Junk <thomas.junk@intevation.de>
parents: 5263
diff changeset
108 transition: 0.1s;
62caee603217 Make BN-Overview smaller.
Thomas Junk <thomas.junk@intevation.de>
parents: 5263
diff changeset
109 transition-timing-function: ease;
62caee603217 Make BN-Overview smaller.
Thomas Junk <thomas.junk@intevation.de>
parents: 5263
diff changeset
110 }
62caee603217 Make BN-Overview smaller.
Thomas Junk <thomas.junk@intevation.de>
parents: 5263
diff changeset
111
62caee603217 Make BN-Overview smaller.
Thomas Junk <thomas.junk@intevation.de>
parents: 5263
diff changeset
112 .sgnobottlenecks {
62caee603217 Make BN-Overview smaller.
Thomas Junk <thomas.junk@intevation.de>
parents: 5263
diff changeset
113 width: 817px;
62caee603217 Make BN-Overview smaller.
Thomas Junk <thomas.junk@intevation.de>
parents: 5263
diff changeset
114 transition: 0.1s;
62caee603217 Make BN-Overview smaller.
Thomas Junk <thomas.junk@intevation.de>
parents: 5263
diff changeset
115 transition-timing-function: ease;
62caee603217 Make BN-Overview smaller.
Thomas Junk <thomas.junk@intevation.de>
parents: 5263
diff changeset
116 }
62caee603217 Make BN-Overview smaller.
Thomas Junk <thomas.junk@intevation.de>
parents: 5263
diff changeset
117
62caee603217 Make BN-Overview smaller.
Thomas Junk <thomas.junk@intevation.de>
parents: 5263
diff changeset
118 .searchgroupwidthbottlenecks {
62caee603217 Make BN-Overview smaller.
Thomas Junk <thomas.junk@intevation.de>
parents: 5263
diff changeset
119 width: 617px;
62caee603217 Make BN-Overview smaller.
Thomas Junk <thomas.junk@intevation.de>
parents: 5263
diff changeset
120 transition: 0.1s;
62caee603217 Make BN-Overview smaller.
Thomas Junk <thomas.junk@intevation.de>
parents: 5263
diff changeset
121 transition-timing-function: ease;
1449
bb47531bdd22 sass to scss
Thomas Junk <thomas.junk@intevation.de>
parents: 1441
diff changeset
122 }
bb47531bdd22 sass to scss
Thomas Junk <thomas.junk@intevation.de>
parents: 1441
diff changeset
123
bb47531bdd22 sass to scss
Thomas Junk <thomas.junk@intevation.de>
parents: 1441
diff changeset
124 .searchcontainer .searchbar {
bb47531bdd22 sass to scss
Thomas Junk <thomas.junk@intevation.de>
parents: 1441
diff changeset
125 border-top-left-radius: 0 !important;
bb47531bdd22 sass to scss
Thomas Junk <thomas.junk@intevation.de>
parents: 1441
diff changeset
126 border-bottom-left-radius: 0 !important;
bb47531bdd22 sass to scss
Thomas Junk <thomas.junk@intevation.de>
parents: 1441
diff changeset
127 }
bb47531bdd22 sass to scss
Thomas Junk <thomas.junk@intevation.de>
parents: 1441
diff changeset
128
bb47531bdd22 sass to scss
Thomas Junk <thomas.junk@intevation.de>
parents: 1441
diff changeset
129 .searchgroup {
bb47531bdd22 sass to scss
Thomas Junk <thomas.junk@intevation.de>
parents: 1441
diff changeset
130 overflow: hidden;
bb47531bdd22 sass to scss
Thomas Junk <thomas.junk@intevation.de>
parents: 1441
diff changeset
131 }
1272
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
132
1449
bb47531bdd22 sass to scss
Thomas Junk <thomas.junk@intevation.de>
parents: 1441
diff changeset
133 .searchgroup-collapsed {
bb47531bdd22 sass to scss
Thomas Junk <thomas.junk@intevation.de>
parents: 1441
diff changeset
134 width: 0;
bb47531bdd22 sass to scss
Thomas Junk <thomas.junk@intevation.de>
parents: 1441
diff changeset
135 }
1286
ac6edfb83cf1 improved contextBox animations
Markus Kottlaender <markus@intevation.de>
parents: 1282
diff changeset
136
1449
bb47531bdd22 sass to scss
Thomas Junk <thomas.junk@intevation.de>
parents: 1441
diff changeset
137 .searchbar {
bb47531bdd22 sass to scss
Thomas Junk <thomas.junk@intevation.de>
parents: 1441
diff changeset
138 height: 2rem !important;
bb47531bdd22 sass to scss
Thomas Junk <thomas.junk@intevation.de>
parents: 1441
diff changeset
139 box-shadow: none !important;
bb47531bdd22 sass to scss
Thomas Junk <thomas.junk@intevation.de>
parents: 1441
diff changeset
140 }
1272
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
141
1449
bb47531bdd22 sass to scss
Thomas Junk <thomas.junk@intevation.de>
parents: 1441
diff changeset
142 .searchbar.rounded-top-right {
bb47531bdd22 sass to scss
Thomas Junk <thomas.junk@intevation.de>
parents: 1441
diff changeset
143 border-radius: 0 !important;
bb47531bdd22 sass to scss
Thomas Junk <thomas.junk@intevation.de>
parents: 1441
diff changeset
144 border-top-right-radius: 0.25rem !important;
bb47531bdd22 sass to scss
Thomas Junk <thomas.junk@intevation.de>
parents: 1441
diff changeset
145 }
1272
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
146
1449
bb47531bdd22 sass to scss
Thomas Junk <thomas.junk@intevation.de>
parents: 1441
diff changeset
147 .searchlabel.rounded-top-left {
bb47531bdd22 sass to scss
Thomas Junk <thomas.junk@intevation.de>
parents: 1441
diff changeset
148 border-radius: 0 !important;
bb47531bdd22 sass to scss
Thomas Junk <thomas.junk@intevation.de>
parents: 1441
diff changeset
149 border-top-left-radius: 0.25rem !important;
bb47531bdd22 sass to scss
Thomas Junk <thomas.junk@intevation.de>
parents: 1441
diff changeset
150 }
1272
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
151
1449
bb47531bdd22 sass to scss
Thomas Junk <thomas.junk@intevation.de>
parents: 1441
diff changeset
152 .input-group-text {
bb47531bdd22 sass to scss
Thomas Junk <thomas.junk@intevation.de>
parents: 1441
diff changeset
153 height: 2rem;
bb47531bdd22 sass to scss
Thomas Junk <thomas.junk@intevation.de>
parents: 1441
diff changeset
154 width: 2rem;
bb47531bdd22 sass to scss
Thomas Junk <thomas.junk@intevation.de>
parents: 1441
diff changeset
155 }
1272
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
156
1449
bb47531bdd22 sass to scss
Thomas Junk <thomas.junk@intevation.de>
parents: 1441
diff changeset
157 .input-group-prepend svg path {
bb47531bdd22 sass to scss
Thomas Junk <thomas.junk@intevation.de>
parents: 1441
diff changeset
158 fill: #666;
bb47531bdd22 sass to scss
Thomas Junk <thomas.junk@intevation.de>
parents: 1441
diff changeset
159 }
1272
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
160
1449
bb47531bdd22 sass to scss
Thomas Junk <thomas.junk@intevation.de>
parents: 1441
diff changeset
161 .searchresults {
bb47531bdd22 sass to scss
Thomas Junk <thomas.junk@intevation.de>
parents: 1441
diff changeset
162 box-shadow: 0 0.1rem 0.5rem rgba(0, 0, 0, 0.2);
bb47531bdd22 sass to scss
Thomas Junk <thomas.junk@intevation.de>
parents: 1441
diff changeset
163 top: 2rem;
bb47531bdd22 sass to scss
Thomas Junk <thomas.junk@intevation.de>
parents: 1441
diff changeset
164 left: 0;
bb47531bdd22 sass to scss
Thomas Junk <thomas.junk@intevation.de>
parents: 1441
diff changeset
165 right: 0;
bb47531bdd22 sass to scss
Thomas Junk <thomas.junk@intevation.de>
parents: 1441
diff changeset
166 max-height: 24rem;
bb47531bdd22 sass to scss
Thomas Junk <thomas.junk@intevation.de>
parents: 1441
diff changeset
167 overflow: auto;
bb47531bdd22 sass to scss
Thomas Junk <thomas.junk@intevation.de>
parents: 1441
diff changeset
168 }
bb47531bdd22 sass to scss
Thomas Junk <thomas.junk@intevation.de>
parents: 1441
diff changeset
169
bb47531bdd22 sass to scss
Thomas Junk <thomas.junk@intevation.de>
parents: 1441
diff changeset
170 .searchresults > div:first-child {
bb47531bdd22 sass to scss
Thomas Junk <thomas.junk@intevation.de>
parents: 1441
diff changeset
171 border-top: 0 !important;
bb47531bdd22 sass to scss
Thomas Junk <thomas.junk@intevation.de>
parents: 1441
diff changeset
172 }
bb47531bdd22 sass to scss
Thomas Junk <thomas.junk@intevation.de>
parents: 1441
diff changeset
173
bb47531bdd22 sass to scss
Thomas Junk <thomas.junk@intevation.de>
parents: 1441
diff changeset
174 .searchresults a {
bb47531bdd22 sass to scss
Thomas Junk <thomas.junk@intevation.de>
parents: 1441
diff changeset
175 text-decoration: none;
bb47531bdd22 sass to scss
Thomas Junk <thomas.junk@intevation.de>
parents: 1441
diff changeset
176 }
bb47531bdd22 sass to scss
Thomas Junk <thomas.junk@intevation.de>
parents: 1441
diff changeset
177
bb47531bdd22 sass to scss
Thomas Junk <thomas.junk@intevation.de>
parents: 1441
diff changeset
178 .searchresults a:hover {
bb47531bdd22 sass to scss
Thomas Junk <thomas.junk@intevation.de>
parents: 1441
diff changeset
179 background: #f8f8f8;
bb47531bdd22 sass to scss
Thomas Junk <thomas.junk@intevation.de>
parents: 1441
diff changeset
180 }
2283
1169f18a0f11 make room for searchbar
Thomas Junk <thomas.junk@intevation.de>
parents: 2136
diff changeset
181
1169f18a0f11 make room for searchbar
Thomas Junk <thomas.junk@intevation.de>
parents: 2136
diff changeset
182 .smallbox {
1169f18a0f11 make room for searchbar
Thomas Junk <thomas.junk@intevation.de>
parents: 2136
diff changeset
183 width: 2rem;
1169f18a0f11 make room for searchbar
Thomas Junk <thomas.junk@intevation.de>
parents: 2136
diff changeset
184 }
1272
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
185 </style>
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 <script>
1362
ca33ad696594 remove the first empyty lines
Fadi Abbud <fadi.abbud@intevation.de>
parents: 1361
diff changeset
188 /* 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
189 * 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
190 *
1272
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
191 * SPDX-License-Identifier: AGPL-3.0-or-later
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
192 * 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
193 *
1272
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
194 * Copyright (C) 2018 by via donau
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
195 * – Österreichische Wasserstraßen-Gesellschaft mbH
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
196 * 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
197 *
1272
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
198 * Author(s):
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
199 * Markus Kottländer <markus.kottlaender@intevation.de>
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
200 */
4463
1cdd246860ae remove lodash.debounce
Thomas Junk <thomas.junk@intevation.de>
parents: 3779
diff changeset
201 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
202 import { mapState, mapGetters } from "vuex";
1272
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
203
2985
1b8bb4f89227 client: removed .js and .vue extention from imports
Markus Kottlaender <markus@intevation.de>
parents: 2919
diff changeset
204 import { displayError } from "@/lib/errors";
1613
f2d24dceecc7 refac: cleanup import paths
Thomas Junk <thomas.junk@intevation.de>
parents: 1558
diff changeset
205 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
206 import { format } from "date-fns";
1272
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
207
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
208 const setFocus = () => document.querySelector("#search").focus();
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
209
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
210 export default {
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
211 name: "search",
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
212 data() {
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
213 return {
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
214 searchQueryIsDirty: false,
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
215 searchResults: null,
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
216 isSearching: false
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
217 };
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
218 },
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
219 computed: {
1282
a7dd8a3356fc fixed contextBox animations
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
220 ...mapState("application", [
a7dd8a3356fc fixed contextBox animations
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
221 "showSearchbar",
a7dd8a3356fc fixed contextBox animations
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
222 "showContextBox",
5132
8d5e3ce27d20 client: Time based search
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4981
diff changeset
223 "contextBoxContent",
8d5e3ce27d20 client: Time based search
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4981
diff changeset
224 "showTimeSlider",
8d5e3ce27d20 client: Time based search
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4981
diff changeset
225 "currentVisibleTime"
1282
a7dd8a3356fc fixed contextBox animations
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
226 ]),
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
227 ...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
228 ...mapGetters("imports", ["filters"]),
3749
f20bd1aee549 client: search: zoom to bounding box if feature has one
Markus Kottlaender <markus@intevation.de>
parents: 3584
diff changeset
229 ...mapGetters("map", ["openLayersMap"]),
1272
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
230 searchQuery: {
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
231 get() {
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
232 return this.$store.state.application.searchQuery;
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
233 },
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
234 set(value) {
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
235 this.$store.commit("application/searchQuery", value);
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
236 }
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 searchIndicator: function() {
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
239 if (this.isSearching) {
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
240 return "⟳";
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
241 } else if (this.searchQueryIsDirty) {
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
242 return "";
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
243 } else {
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
244 return "✓";
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 searchbarContainerStyle() {
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
248 return [
3074
85f7f8981a71 client: search: fixed rounded corners
Markus Kottlaender <markus@intevation.de>
parents: 3044
diff changeset
249 "input-group searchcontainer shadow-xs rounded",
1272
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
250 {
1282
a7dd8a3356fc fixed contextBox animations
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
251 "d-flex": this.contextBoxContent !== "imports",
2283
1169f18a0f11 make room for searchbar
Thomas Junk <thomas.junk@intevation.de>
parents: 2136
diff changeset
252 "d-none": this.contextBoxContent === "imports" && this.showContextBox,
5450
62caee603217 Make BN-Overview smaller.
Thomas Junk <thomas.junk@intevation.de>
parents: 5263
diff changeset
253 smallbox: !this.showSearchbar,
62caee603217 Make BN-Overview smaller.
Thomas Junk <thomas.junk@intevation.de>
parents: 5263
diff changeset
254 searchcontainerwidth:
62caee603217 Make BN-Overview smaller.
Thomas Junk <thomas.junk@intevation.de>
parents: 5263
diff changeset
255 this.showSearchbar && this.contextBoxContent !== "bottlenecks",
62caee603217 Make BN-Overview smaller.
Thomas Junk <thomas.junk@intevation.de>
parents: 5263
diff changeset
256 searchgroupwidth:
62caee603217 Make BN-Overview smaller.
Thomas Junk <thomas.junk@intevation.de>
parents: 5263
diff changeset
257 this.showSearchbar && this.contextBoxContent !== "bottlenecks",
62caee603217 Make BN-Overview smaller.
Thomas Junk <thomas.junk@intevation.de>
parents: 5263
diff changeset
258 searchcontainerwidthbottlenecks:
62caee603217 Make BN-Overview smaller.
Thomas Junk <thomas.junk@intevation.de>
parents: 5263
diff changeset
259 this.showSearchbar && this.contextBoxContent === "bottlenecks",
62caee603217 Make BN-Overview smaller.
Thomas Junk <thomas.junk@intevation.de>
parents: 5263
diff changeset
260 searchgroupwidthbottleneks:
62caee603217 Make BN-Overview smaller.
Thomas Junk <thomas.junk@intevation.de>
parents: 5263
diff changeset
261 this.showSearchbar && this.contextBoxContent === "bottlenecks"
1272
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
262 }
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
263 ];
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
264 },
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
265 searchInputStyle() {
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
266 return [
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
267 "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
268 { "rounded-top-right": this.showContextBox || this.searchResults }
1272
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
269 ];
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
270 },
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
271 searchButtonStyle() {
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
272 return [
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
273 "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
274 {
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
275 rounded: !this.showSearchbar,
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
276 "rounded-left": this.showSearchbar,
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
277 "rounded-top-left":
1282
a7dd8a3356fc fixed contextBox animations
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
278 this.showSearchbar && (this.showContextBox || this.searchResults)
1272
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
279 }
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 }
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 watch: {
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
284 searchQuery: function() {
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
285 this.searchQueryIsDirty = true;
2750
6446bf6d2a89 search: use global search only in global context
Thomas Junk <thomas.junk@intevation.de>
parents: 2464
diff changeset
286 if (!this.showContextBox) this.triggerSearch();
5132
8d5e3ce27d20 client: Time based search
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4981
diff changeset
287 },
8d5e3ce27d20 client: Time based search
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4981
diff changeset
288 currentVisibleTime() {
8d5e3ce27d20 client: Time based search
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4981
diff changeset
289 this.doSearch();
1272
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 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
293 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
294 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
295 .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
296 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
297 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
298 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
299 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
300 })
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
301 .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
302 .catch(error => {
4869
6b054b91d9b2 backend not reachable as error message etd. Login adjusted
Thomas Junk <thomas.junk@intevation.de>
parents: 4868
diff changeset
303 let message = "Backend not reachable";
4868
008bc1ae8897 exception handling
Thomas Junk <thomas.junk@intevation.de>
parents: 4774
diff changeset
304 if (error.response) {
008bc1ae8897 exception handling
Thomas Junk <thomas.junk@intevation.de>
parents: 4774
diff changeset
305 const { status, data } = error.response;
008bc1ae8897 exception handling
Thomas Junk <thomas.junk@intevation.de>
parents: 4774
diff changeset
306 message = `${status}: ${data.message || data}`;
008bc1ae8897 exception handling
Thomas Junk <thomas.junk@intevation.de>
parents: 4774
diff changeset
307 }
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
308 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
309 title: this.$gettext("Backend Error"),
4868
008bc1ae8897 exception handling
Thomas Junk <thomas.junk@intevation.de>
parents: 4774
diff changeset
310 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
311 });
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
312 });
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
313 },
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
314 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
315 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
316 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
317 }
1272
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
318 if (!this.searchResults || this.searchResults.length != 1) return;
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
319 this.moveToSearchResult(this.searchResults[0]);
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 triggerSearch: debounce(function() {
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
322 this.doSearch();
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
323 }, 500),
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
324 doSearch() {
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
325 this.isCalculating = true;
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
326 this.searchResults = null;
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
327
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
328 if (this.searchQuery == "") {
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
329 return;
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
330 }
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
331
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
332 HTTP.post(
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
333 "/search",
5132
8d5e3ce27d20 client: Time based search
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4981
diff changeset
334 this.showTimeSlider
8d5e3ce27d20 client: Time based search
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4981
diff changeset
335 ? {
8d5e3ce27d20 client: Time based search
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4981
diff changeset
336 string: this.searchQuery,
8d5e3ce27d20 client: Time based search
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4981
diff changeset
337 time: this.currentVisibleTime.toISOString()
8d5e3ce27d20 client: Time based search
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4981
diff changeset
338 }
8d5e3ce27d20 client: Time based search
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4981
diff changeset
339 : { string: this.searchQuery },
1272
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
340 {
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
341 headers: {
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
342 "X-Gemma-Auth": localStorage.getItem("token"),
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
343 "Content-type": "text/xml; charset=UTF-8"
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
344 }
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
345 }
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
346 )
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
347 .then(response => {
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
348 this.searchResults = response.data;
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
349 })
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
350 .catch(error => {
4869
6b054b91d9b2 backend not reachable as error message etd. Login adjusted
Thomas Junk <thomas.junk@intevation.de>
parents: 4868
diff changeset
351 let message = "Backend not reachable";
4868
008bc1ae8897 exception handling
Thomas Junk <thomas.junk@intevation.de>
parents: 4774
diff changeset
352 if (error.response) {
008bc1ae8897 exception handling
Thomas Junk <thomas.junk@intevation.de>
parents: 4774
diff changeset
353 const { status, data } = error.response;
008bc1ae8897 exception handling
Thomas Junk <thomas.junk@intevation.de>
parents: 4774
diff changeset
354 message = `${status}: ${data.message || data}`;
008bc1ae8897 exception handling
Thomas Junk <thomas.junk@intevation.de>
parents: 4774
diff changeset
355 }
1272
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
356 displayError({
1441
a4554e942954 Client: add a set of marked translations
Fadi Abbud <fadi.abbud@intevation.de>
parents: 1425
diff changeset
357 title: this.$gettext("Backend Error"),
4868
008bc1ae8897 exception handling
Thomas Junk <thomas.junk@intevation.de>
parents: 4774
diff changeset
358 message: message
1272
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
359 });
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
360 });
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 this.isCalculating = false;
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
363 this.searchQueryIsDirty = false;
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
364 },
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
365 moveToSearchResult(resultEntry) {
3749
f20bd1aee549 client: search: zoom to bounding box if feature has one
Markus Kottlaender <markus@intevation.de>
parents: 3584
diff changeset
366 let zoom = 16;
f20bd1aee549 client: search: zoom to bounding box if feature has one
Markus Kottlaender <markus@intevation.de>
parents: 3584
diff changeset
367 if (resultEntry.type === "bottleneck") {
f20bd1aee549 client: search: zoom to bounding box if feature has one
Markus Kottlaender <markus@intevation.de>
parents: 3584
diff changeset
368 this.openLayersMap()
f20bd1aee549 client: search: zoom to bounding box if feature has one
Markus Kottlaender <markus@intevation.de>
parents: 3584
diff changeset
369 .getLayer("BOTTLENECKS")
f20bd1aee549 client: search: zoom to bounding box if feature has one
Markus Kottlaender <markus@intevation.de>
parents: 3584
diff changeset
370 .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
371 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
372 "bottlenecks/setBottleneckForPrint",
19715261750e client: set bottleneck for pdf-export from search and Map popup
Fadi Abbud <fadi.abbud@intevation.de>
parents: 5132
diff changeset
373 resultEntry.name
19715261750e client: set bottleneck for pdf-export from search and Map popup
Fadi Abbud <fadi.abbud@intevation.de>
parents: 5132
diff changeset
374 );
3749
f20bd1aee549 client: search: zoom to bounding box if feature has one
Markus Kottlaender <markus@intevation.de>
parents: 3584
diff changeset
375 }
f20bd1aee549 client: search: zoom to bounding box if feature has one
Markus Kottlaender <markus@intevation.de>
parents: 3584
diff changeset
376 if (resultEntry.type === "rhm") {
f20bd1aee549 client: search: zoom to bounding box if feature has one
Markus Kottlaender <markus@intevation.de>
parents: 3584
diff changeset
377 this.openLayersMap()
f20bd1aee549 client: search: zoom to bounding box if feature has one
Markus Kottlaender <markus@intevation.de>
parents: 3584
diff changeset
378 .getLayer("DISTANCEMARKSAXIS")
f20bd1aee549 client: search: zoom to bounding box if feature has one
Markus Kottlaender <markus@intevation.de>
parents: 3584
diff changeset
379 .setVisible(true);
f20bd1aee549 client: search: zoom to bounding box if feature has one
Markus Kottlaender <markus@intevation.de>
parents: 3584
diff changeset
380 }
f20bd1aee549 client: search: zoom to bounding box if feature has one
Markus Kottlaender <markus@intevation.de>
parents: 3584
diff changeset
381 if (resultEntry.type === "gauge") {
f20bd1aee549 client: search: zoom to bounding box if feature has one
Markus Kottlaender <markus@intevation.de>
parents: 3584
diff changeset
382 this.openLayersMap()
f20bd1aee549 client: search: zoom to bounding box if feature has one
Markus Kottlaender <markus@intevation.de>
parents: 3584
diff changeset
383 .getLayer("GAUGES")
f20bd1aee549 client: search: zoom to bounding box if feature has one
Markus Kottlaender <markus@intevation.de>
parents: 3584
diff changeset
384 .setVisible(true);
f20bd1aee549 client: search: zoom to bounding box if feature has one
Markus Kottlaender <markus@intevation.de>
parents: 3584
diff changeset
385 }
f20bd1aee549 client: search: zoom to bounding box if feature has one
Markus Kottlaender <markus@intevation.de>
parents: 3584
diff changeset
386 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
387 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
388 "imports/selectedStretchId",
78ba9b2574ff search: include id in search result to mark sections/stretches as selected
Markus Kottlaender <markus@intevation.de>
parents: 3749
diff changeset
389 "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
390 );
3749
f20bd1aee549 client: search: zoom to bounding box if feature has one
Markus Kottlaender <markus@intevation.de>
parents: 3584
diff changeset
391 this.openLayersMap()
f20bd1aee549 client: search: zoom to bounding box if feature has one
Markus Kottlaender <markus@intevation.de>
parents: 3584
diff changeset
392 .getLayer("STRETCHES")
f20bd1aee549 client: search: zoom to bounding box if feature has one
Markus Kottlaender <markus@intevation.de>
parents: 3584
diff changeset
393 .setVisible(true);
f20bd1aee549 client: search: zoom to bounding box if feature has one
Markus Kottlaender <markus@intevation.de>
parents: 3584
diff changeset
394 }
f20bd1aee549 client: search: zoom to bounding box if feature has one
Markus Kottlaender <markus@intevation.de>
parents: 3584
diff changeset
395 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
396 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
397 "imports/selectedSectionId",
78ba9b2574ff search: include id in search result to mark sections/stretches as selected
Markus Kottlaender <markus@intevation.de>
parents: 3749
diff changeset
398 "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
399 );
3749
f20bd1aee549 client: search: zoom to bounding box if feature has one
Markus Kottlaender <markus@intevation.de>
parents: 3584
diff changeset
400 this.openLayersMap()
f20bd1aee549 client: search: zoom to bounding box if feature has one
Markus Kottlaender <markus@intevation.de>
parents: 3584
diff changeset
401 .getLayer("SECTIONS")
f20bd1aee549 client: search: zoom to bounding box if feature has one
Markus Kottlaender <markus@intevation.de>
parents: 3584
diff changeset
402 .setVisible(true);
f20bd1aee549 client: search: zoom to bounding box if feature has one
Markus Kottlaender <markus@intevation.de>
parents: 3584
diff changeset
403 }
f20bd1aee549 client: search: zoom to bounding box if feature has one
Markus Kottlaender <markus@intevation.de>
parents: 3584
diff changeset
404 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
405
1272
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
406 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
407 this.$store.dispatch("map/moveMap", {
1272
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
408 coordinates: resultEntry.geom.coordinates,
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
409 zoom,
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
410 preventZoomOut: true
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
411 });
3749
f20bd1aee549 client: search: zoom to bounding box if feature has one
Markus Kottlaender <markus@intevation.de>
parents: 3584
diff changeset
412 } 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
413 const boundingBox = [
f20bd1aee549 client: search: zoom to bounding box if feature has one
Markus Kottlaender <markus@intevation.de>
parents: 3584
diff changeset
414 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
415 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
416 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
417 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
418 ];
f20bd1aee549 client: search: zoom to bounding box if feature has one
Markus Kottlaender <markus@intevation.de>
parents: 3584
diff changeset
419 this.$store.dispatch("map/moveToBoundingBox", { boundingBox, zoom });
1272
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
420 }
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
421 // this.searchQuery = ""; // clear search query again
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
422 this.toggleSearchbar();
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
423 },
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
424 toggleSearchbar() {
1282
a7dd8a3356fc fixed contextBox animations
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
425 if (!this.showContextBox) {
1272
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
426 if (!this.showSearchbar) {
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
427 setTimeout(setFocus, 300);
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
428 }
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
429 this.$store.commit("application/showSearchbar", !this.showSearchbar);
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
430 }
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
431 }
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
432 }
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
433 };
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
434 </script>