Mercurial > gemma
annotate client/src/application/Topbar.vue @ 783:ab9604a46075
client: add move after clicking search result
* Move openLayersMap to mapstore.
* Add code to move the center to the point of a clicked search result,
with animation.
author | Bernhard Reiter <bernhard@intevation.de> |
---|---|
date | Wed, 26 Sep 2018 15:29:17 +0200 |
parents | f6a6ce90a1b5 |
children | afe62d1ce01c |
rev | line source |
---|---|
585
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
1 <template> |
668
3e2eeb215d0e
feat: searchbar collapsible
Thomas Junk <thomas.junk@intevation.de>
parents:
649
diff
changeset
|
2 <div class="topbar d-flex flex-row"> |
638
c2f040dba57f
feat: collapsible layer selection
Thomas Junk <thomas.junk@intevation.de>
parents:
632
diff
changeset
|
3 <div @click="toggleSidebar"> |
c2f040dba57f
feat: collapsible layer selection
Thomas Junk <thomas.junk@intevation.de>
parents:
632
diff
changeset
|
4 <i class="ui-element menubutton fa fa-bars"></i> |
621
b17a4482d07d
feat: UI adaptation of 4 slots
Thomas Junk <thomas.junk@intevation.de>
parents:
593
diff
changeset
|
5 </div> |
713
badbc0207418
feat: systeminformation feature added
Thomas Junk <thomas.junk@intevation.de>
parents:
668
diff
changeset
|
6 <div v-if="routeName == 'mainview'" :class="searchbarContainerStyle"> |
621
b17a4482d07d
feat: UI adaptation of 4 slots
Thomas Junk <thomas.junk@intevation.de>
parents:
593
diff
changeset
|
7 <div class="input-group-prepend shadow"> |
668
3e2eeb215d0e
feat: searchbar collapsible
Thomas Junk <thomas.junk@intevation.de>
parents:
649
diff
changeset
|
8 <span @click="toggleSearchbar" class="ui-element input-group-text searchlabel" for="search"> |
621
b17a4482d07d
feat: UI adaptation of 4 slots
Thomas Junk <thomas.junk@intevation.de>
parents:
593
diff
changeset
|
9 <i class="fa fa-search"></i> |
b17a4482d07d
feat: UI adaptation of 4 slots
Thomas Junk <thomas.junk@intevation.de>
parents:
593
diff
changeset
|
10 </span> |
b17a4482d07d
feat: UI adaptation of 4 slots
Thomas Junk <thomas.junk@intevation.de>
parents:
593
diff
changeset
|
11 </div> |
773
22c3acea700d
client: add to search processing
Bernhard Reiter <bernhard@intevation.de>
parents:
770
diff
changeset
|
12 <input v-if="!searchbarCollapsed" id="search" v-model="searchQuery" type="text" class="form-control ui-element search searchbar"> |
779
8ba1be486833
client: improve search
Bernhard Reiter <bernhard@intevation.de>
parents:
776
diff
changeset
|
13 <ul v-if="!searchbarCollapsed && searchResults !== null " class="list-group"> |
8ba1be486833
client: improve search
Bernhard Reiter <bernhard@intevation.de>
parents:
776
diff
changeset
|
14 <li v-for="entry of searchResults" :key="entry.name" |
8ba1be486833
client: improve search
Bernhard Reiter <bernhard@intevation.de>
parents:
776
diff
changeset
|
15 class="list-group-item"> |
781
f6a6ce90a1b5
client: improve search
Bernhard Reiter <bernhard@intevation.de>
parents:
779
diff
changeset
|
16 <a href="#" @click.prevent="moveToSearchResult(entry)" |
f6a6ce90a1b5
client: improve search
Bernhard Reiter <bernhard@intevation.de>
parents:
779
diff
changeset
|
17 >{{entry.name}}</a> |
779
8ba1be486833
client: improve search
Bernhard Reiter <bernhard@intevation.de>
parents:
776
diff
changeset
|
18 </li> |
8ba1be486833
client: improve search
Bernhard Reiter <bernhard@intevation.de>
parents:
776
diff
changeset
|
19 </ul> |
621
b17a4482d07d
feat: UI adaptation of 4 slots
Thomas Junk <thomas.junk@intevation.de>
parents:
593
diff
changeset
|
20 </div> |
713
badbc0207418
feat: systeminformation feature added
Thomas Junk <thomas.junk@intevation.de>
parents:
668
diff
changeset
|
21 <div v-if="routeName == 'mainview'" class="splitbutton"> |
621
b17a4482d07d
feat: UI adaptation of 4 slots
Thomas Junk <thomas.junk@intevation.de>
parents:
593
diff
changeset
|
22 <i @click="splitScreen" class="ui-element splitscreen fa fa-window-restore shadow"></i> |
b17a4482d07d
feat: UI adaptation of 4 slots
Thomas Junk <thomas.junk@intevation.de>
parents:
593
diff
changeset
|
23 </div> |
668
3e2eeb215d0e
feat: searchbar collapsible
Thomas Junk <thomas.junk@intevation.de>
parents:
649
diff
changeset
|
24 <div class=""> |
713
badbc0207418
feat: systeminformation feature added
Thomas Junk <thomas.junk@intevation.de>
parents:
668
diff
changeset
|
25 <Layers v-if="routeName == 'mainview'"></Layers> |
668
3e2eeb215d0e
feat: searchbar collapsible
Thomas Junk <thomas.junk@intevation.de>
parents:
649
diff
changeset
|
26 </div> |
770
c12ec7fde3f2
client: add simple identify top area box
Bernhard Reiter <bernhard@intevation.de>
parents:
713
diff
changeset
|
27 <div class=""> |
c12ec7fde3f2
client: add simple identify top area box
Bernhard Reiter <bernhard@intevation.de>
parents:
713
diff
changeset
|
28 <Identify v-if="routeName == 'mainview'"></Identify> |
c12ec7fde3f2
client: add simple identify top area box
Bernhard Reiter <bernhard@intevation.de>
parents:
713
diff
changeset
|
29 </div> |
585
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
30 </div> |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
31 </template> |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
32 |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
33 <style lang="scss"> |
668
3e2eeb215d0e
feat: searchbar collapsible
Thomas Junk <thomas.junk@intevation.de>
parents:
649
diff
changeset
|
34 .splitbutton { |
3e2eeb215d0e
feat: searchbar collapsible
Thomas Junk <thomas.junk@intevation.de>
parents:
649
diff
changeset
|
35 height: $icon-height; |
3e2eeb215d0e
feat: searchbar collapsible
Thomas Junk <thomas.junk@intevation.de>
parents:
649
diff
changeset
|
36 } |
781
f6a6ce90a1b5
client: improve search
Bernhard Reiter <bernhard@intevation.de>
parents:
779
diff
changeset
|
37 .list-group { |
f6a6ce90a1b5
client: improve search
Bernhard Reiter <bernhard@intevation.de>
parents:
779
diff
changeset
|
38 pointer-events: auto; |
f6a6ce90a1b5
client: improve search
Bernhard Reiter <bernhard@intevation.de>
parents:
779
diff
changeset
|
39 } |
593
c4a4dc612191
feat: Toggleable fairway profile
Thomas Junk <thomas.junk@intevation.de>
parents:
587
diff
changeset
|
40 .splitscreen { |
c4a4dc612191
feat: Toggleable fairway profile
Thomas Junk <thomas.junk@intevation.de>
parents:
587
diff
changeset
|
41 background-color: white; |
632
f2097d2aa048
fix: adjusted icon sizes
Thomas Junk <thomas.junk@intevation.de>
parents:
630
diff
changeset
|
42 padding: $small-offset; |
638
c2f040dba57f
feat: collapsible layer selection
Thomas Junk <thomas.junk@intevation.de>
parents:
632
diff
changeset
|
43 margin-right: $small-offset; |
c2f040dba57f
feat: collapsible layer selection
Thomas Junk <thomas.junk@intevation.de>
parents:
632
diff
changeset
|
44 margin-left: $offset; |
c2f040dba57f
feat: collapsible layer selection
Thomas Junk <thomas.junk@intevation.de>
parents:
632
diff
changeset
|
45 border-radius: $border-radius; |
668
3e2eeb215d0e
feat: searchbar collapsible
Thomas Junk <thomas.junk@intevation.de>
parents:
649
diff
changeset
|
46 height: $icon-height; |
3e2eeb215d0e
feat: searchbar collapsible
Thomas Junk <thomas.junk@intevation.de>
parents:
649
diff
changeset
|
47 width: $icon-width; |
593
c4a4dc612191
feat: Toggleable fairway profile
Thomas Junk <thomas.junk@intevation.de>
parents:
587
diff
changeset
|
48 } |
c4a4dc612191
feat: Toggleable fairway profile
Thomas Junk <thomas.junk@intevation.de>
parents:
587
diff
changeset
|
49 |
585
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
50 .menubutton { |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
51 background-color: white; |
632
f2097d2aa048
fix: adjusted icon sizes
Thomas Junk <thomas.junk@intevation.de>
parents:
630
diff
changeset
|
52 padding: $small-offset; |
638
c2f040dba57f
feat: collapsible layer selection
Thomas Junk <thomas.junk@intevation.de>
parents:
632
diff
changeset
|
53 border-radius: $border-radius; |
c2f040dba57f
feat: collapsible layer selection
Thomas Junk <thomas.junk@intevation.de>
parents:
632
diff
changeset
|
54 margin-left: $offset; |
668
3e2eeb215d0e
feat: searchbar collapsible
Thomas Junk <thomas.junk@intevation.de>
parents:
649
diff
changeset
|
55 height: $icon-height; |
3e2eeb215d0e
feat: searchbar collapsible
Thomas Junk <thomas.junk@intevation.de>
parents:
649
diff
changeset
|
56 width: $icon-width; |
585
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
57 } |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
58 |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
59 .searchcontainer { |
668
3e2eeb215d0e
feat: searchbar collapsible
Thomas Junk <thomas.junk@intevation.de>
parents:
649
diff
changeset
|
60 height: $icon-height; |
3e2eeb215d0e
feat: searchbar collapsible
Thomas Junk <thomas.junk@intevation.de>
parents:
649
diff
changeset
|
61 border-radius: 0.25rem; |
3e2eeb215d0e
feat: searchbar collapsible
Thomas Junk <thomas.junk@intevation.de>
parents:
649
diff
changeset
|
62 } |
3e2eeb215d0e
feat: searchbar collapsible
Thomas Junk <thomas.junk@intevation.de>
parents:
649
diff
changeset
|
63 |
3e2eeb215d0e
feat: searchbar collapsible
Thomas Junk <thomas.junk@intevation.de>
parents:
649
diff
changeset
|
64 .searchbar-expanded { |
3e2eeb215d0e
feat: searchbar collapsible
Thomas Junk <thomas.junk@intevation.de>
parents:
649
diff
changeset
|
65 margin-left: 22vw; |
585
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
66 margin-right: auto; |
668
3e2eeb215d0e
feat: searchbar collapsible
Thomas Junk <thomas.junk@intevation.de>
parents:
649
diff
changeset
|
67 width: $searchbar-width !important; |
3e2eeb215d0e
feat: searchbar collapsible
Thomas Junk <thomas.junk@intevation.de>
parents:
649
diff
changeset
|
68 } |
3e2eeb215d0e
feat: searchbar collapsible
Thomas Junk <thomas.junk@intevation.de>
parents:
649
diff
changeset
|
69 |
3e2eeb215d0e
feat: searchbar collapsible
Thomas Junk <thomas.junk@intevation.de>
parents:
649
diff
changeset
|
70 .searchbar-collapsed { |
3e2eeb215d0e
feat: searchbar collapsible
Thomas Junk <thomas.junk@intevation.de>
parents:
649
diff
changeset
|
71 margin-left: auto; |
3e2eeb215d0e
feat: searchbar collapsible
Thomas Junk <thomas.junk@intevation.de>
parents:
649
diff
changeset
|
72 margin-right: $small-offset; |
3e2eeb215d0e
feat: searchbar collapsible
Thomas Junk <thomas.junk@intevation.de>
parents:
649
diff
changeset
|
73 width: $icon-width !important; |
3e2eeb215d0e
feat: searchbar collapsible
Thomas Junk <thomas.junk@intevation.de>
parents:
649
diff
changeset
|
74 transition: $transition-fast; |
585
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
75 } |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
76 |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
77 .searchbar { |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
78 margin-left: auto; |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
79 margin-right: auto; |
668
3e2eeb215d0e
feat: searchbar collapsible
Thomas Junk <thomas.junk@intevation.de>
parents:
649
diff
changeset
|
80 height: $icon-height !important; |
3e2eeb215d0e
feat: searchbar collapsible
Thomas Junk <thomas.junk@intevation.de>
parents:
649
diff
changeset
|
81 } |
3e2eeb215d0e
feat: searchbar collapsible
Thomas Junk <thomas.junk@intevation.de>
parents:
649
diff
changeset
|
82 |
3e2eeb215d0e
feat: searchbar collapsible
Thomas Junk <thomas.junk@intevation.de>
parents:
649
diff
changeset
|
83 .searchlabel { |
3e2eeb215d0e
feat: searchbar collapsible
Thomas Junk <thomas.junk@intevation.de>
parents:
649
diff
changeset
|
84 background-color: white !important; |
585
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
85 } |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
86 |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
87 .topbar { |
638
c2f040dba57f
feat: collapsible layer selection
Thomas Junk <thomas.junk@intevation.de>
parents:
632
diff
changeset
|
88 padding-top: $offset; |
c2f040dba57f
feat: collapsible layer selection
Thomas Junk <thomas.junk@intevation.de>
parents:
632
diff
changeset
|
89 margin-right: $offset; |
585
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
90 } |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
91 |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
92 .logout { |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
93 font-size: x-large; |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
94 } |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
95 </style> |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
96 |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
97 |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
98 <script> |
776
bb3558142b18
client: add backendrequest to search
Bernhard Reiter <bernhard@intevation.de>
parents:
773
diff
changeset
|
99 import debounce from "lodash.debounce"; |
783
ab9604a46075
client: add move after clicking search result
Bernhard Reiter <bernhard@intevation.de>
parents:
781
diff
changeset
|
100 import { fromLonLat } from "ol/proj"; |
ab9604a46075
client: add move after clicking search result
Bernhard Reiter <bernhard@intevation.de>
parents:
781
diff
changeset
|
101 import { mapState } from "vuex"; |
773
22c3acea700d
client: add to search processing
Bernhard Reiter <bernhard@intevation.de>
parents:
770
diff
changeset
|
102 |
776
bb3558142b18
client: add backendrequest to search
Bernhard Reiter <bernhard@intevation.de>
parents:
773
diff
changeset
|
103 import { displayError } from "../application/lib/errors.js"; |
bb3558142b18
client: add backendrequest to search
Bernhard Reiter <bernhard@intevation.de>
parents:
773
diff
changeset
|
104 import { HTTP } from "../application/lib/http"; |
bb3558142b18
client: add backendrequest to search
Bernhard Reiter <bernhard@intevation.de>
parents:
773
diff
changeset
|
105 import Identify from "../layers/Identify"; |
585
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
106 import Layers from "../layers/Layers"; |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
107 |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
108 export default { |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
109 name: "topbar", |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
110 components: { |
770
c12ec7fde3f2
client: add simple identify top area box
Bernhard Reiter <bernhard@intevation.de>
parents:
713
diff
changeset
|
111 Identify: Identify, |
585
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
112 Layers: Layers |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
113 }, |
668
3e2eeb215d0e
feat: searchbar collapsible
Thomas Junk <thomas.junk@intevation.de>
parents:
649
diff
changeset
|
114 data() { |
3e2eeb215d0e
feat: searchbar collapsible
Thomas Junk <thomas.junk@intevation.de>
parents:
649
diff
changeset
|
115 return { |
773
22c3acea700d
client: add to search processing
Bernhard Reiter <bernhard@intevation.de>
parents:
770
diff
changeset
|
116 searchbarCollapsed: true, |
22c3acea700d
client: add to search processing
Bernhard Reiter <bernhard@intevation.de>
parents:
770
diff
changeset
|
117 searchQuery: "", |
22c3acea700d
client: add to search processing
Bernhard Reiter <bernhard@intevation.de>
parents:
770
diff
changeset
|
118 searchQueryIsDirty: false, |
779
8ba1be486833
client: improve search
Bernhard Reiter <bernhard@intevation.de>
parents:
776
diff
changeset
|
119 searchResults: null, |
773
22c3acea700d
client: add to search processing
Bernhard Reiter <bernhard@intevation.de>
parents:
770
diff
changeset
|
120 isSearching: false |
668
3e2eeb215d0e
feat: searchbar collapsible
Thomas Junk <thomas.junk@intevation.de>
parents:
649
diff
changeset
|
121 }; |
3e2eeb215d0e
feat: searchbar collapsible
Thomas Junk <thomas.junk@intevation.de>
parents:
649
diff
changeset
|
122 }, |
3e2eeb215d0e
feat: searchbar collapsible
Thomas Junk <thomas.junk@intevation.de>
parents:
649
diff
changeset
|
123 computed: { |
783
ab9604a46075
client: add move after clicking search result
Bernhard Reiter <bernhard@intevation.de>
parents:
781
diff
changeset
|
124 ...mapState("mapstore", ["openLayersMap"]), |
776
bb3558142b18
client: add backendrequest to search
Bernhard Reiter <bernhard@intevation.de>
parents:
773
diff
changeset
|
125 searchIndicator: function() { |
773
22c3acea700d
client: add to search processing
Bernhard Reiter <bernhard@intevation.de>
parents:
770
diff
changeset
|
126 if (this.isSearching) { |
776
bb3558142b18
client: add backendrequest to search
Bernhard Reiter <bernhard@intevation.de>
parents:
773
diff
changeset
|
127 return "⟳"; |
773
22c3acea700d
client: add to search processing
Bernhard Reiter <bernhard@intevation.de>
parents:
770
diff
changeset
|
128 } else if (this.searchQueryIsDirty) { |
776
bb3558142b18
client: add backendrequest to search
Bernhard Reiter <bernhard@intevation.de>
parents:
773
diff
changeset
|
129 return ""; |
773
22c3acea700d
client: add to search processing
Bernhard Reiter <bernhard@intevation.de>
parents:
770
diff
changeset
|
130 } else { |
776
bb3558142b18
client: add backendrequest to search
Bernhard Reiter <bernhard@intevation.de>
parents:
773
diff
changeset
|
131 return "✓"; |
773
22c3acea700d
client: add to search processing
Bernhard Reiter <bernhard@intevation.de>
parents:
770
diff
changeset
|
132 } |
22c3acea700d
client: add to search processing
Bernhard Reiter <bernhard@intevation.de>
parents:
770
diff
changeset
|
133 }, |
668
3e2eeb215d0e
feat: searchbar collapsible
Thomas Junk <thomas.junk@intevation.de>
parents:
649
diff
changeset
|
134 searchbarContainerStyle() { |
3e2eeb215d0e
feat: searchbar collapsible
Thomas Junk <thomas.junk@intevation.de>
parents:
649
diff
changeset
|
135 return { |
3e2eeb215d0e
feat: searchbar collapsible
Thomas Junk <thomas.junk@intevation.de>
parents:
649
diff
changeset
|
136 "input-group": true, |
3e2eeb215d0e
feat: searchbar collapsible
Thomas Junk <thomas.junk@intevation.de>
parents:
649
diff
changeset
|
137 searchcontainer: true, |
3e2eeb215d0e
feat: searchbar collapsible
Thomas Junk <thomas.junk@intevation.de>
parents:
649
diff
changeset
|
138 "searchbar-collapsed": this.searchbarCollapsed, |
3e2eeb215d0e
feat: searchbar collapsible
Thomas Junk <thomas.junk@intevation.de>
parents:
649
diff
changeset
|
139 "searchbar-expanded": !this.searchbarCollapsed |
3e2eeb215d0e
feat: searchbar collapsible
Thomas Junk <thomas.junk@intevation.de>
parents:
649
diff
changeset
|
140 }; |
3e2eeb215d0e
feat: searchbar collapsible
Thomas Junk <thomas.junk@intevation.de>
parents:
649
diff
changeset
|
141 } |
3e2eeb215d0e
feat: searchbar collapsible
Thomas Junk <thomas.junk@intevation.de>
parents:
649
diff
changeset
|
142 }, |
649
83081ba6c9c1
feat: Linetool added
Thomas Junk <thomas.junk@intevation.de>
parents:
638
diff
changeset
|
143 props: ["routeName"], |
773
22c3acea700d
client: add to search processing
Bernhard Reiter <bernhard@intevation.de>
parents:
770
diff
changeset
|
144 watch: { |
22c3acea700d
client: add to search processing
Bernhard Reiter <bernhard@intevation.de>
parents:
770
diff
changeset
|
145 searchQuery: function() { |
22c3acea700d
client: add to search processing
Bernhard Reiter <bernhard@intevation.de>
parents:
770
diff
changeset
|
146 this.searchQueryIsDirty = true; |
776
bb3558142b18
client: add backendrequest to search
Bernhard Reiter <bernhard@intevation.de>
parents:
773
diff
changeset
|
147 this.triggerSearch(); |
773
22c3acea700d
client: add to search processing
Bernhard Reiter <bernhard@intevation.de>
parents:
770
diff
changeset
|
148 } |
22c3acea700d
client: add to search processing
Bernhard Reiter <bernhard@intevation.de>
parents:
770
diff
changeset
|
149 }, |
585
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
150 methods: { |
781
f6a6ce90a1b5
client: improve search
Bernhard Reiter <bernhard@intevation.de>
parents:
779
diff
changeset
|
151 triggerSearch: debounce(function() { |
f6a6ce90a1b5
client: improve search
Bernhard Reiter <bernhard@intevation.de>
parents:
779
diff
changeset
|
152 this.doSearch(); |
f6a6ce90a1b5
client: improve search
Bernhard Reiter <bernhard@intevation.de>
parents:
779
diff
changeset
|
153 }, 500), |
776
bb3558142b18
client: add backendrequest to search
Bernhard Reiter <bernhard@intevation.de>
parents:
773
diff
changeset
|
154 doSearch() { |
773
22c3acea700d
client: add to search processing
Bernhard Reiter <bernhard@intevation.de>
parents:
770
diff
changeset
|
155 this.isCalculating = true; |
779
8ba1be486833
client: improve search
Bernhard Reiter <bernhard@intevation.de>
parents:
776
diff
changeset
|
156 this.searchResults = null; |
8ba1be486833
client: improve search
Bernhard Reiter <bernhard@intevation.de>
parents:
776
diff
changeset
|
157 |
8ba1be486833
client: improve search
Bernhard Reiter <bernhard@intevation.de>
parents:
776
diff
changeset
|
158 if (this.searchQuery == "") { |
8ba1be486833
client: improve search
Bernhard Reiter <bernhard@intevation.de>
parents:
776
diff
changeset
|
159 return; |
8ba1be486833
client: improve search
Bernhard Reiter <bernhard@intevation.de>
parents:
776
diff
changeset
|
160 } |
776
bb3558142b18
client: add backendrequest to search
Bernhard Reiter <bernhard@intevation.de>
parents:
773
diff
changeset
|
161 |
bb3558142b18
client: add backendrequest to search
Bernhard Reiter <bernhard@intevation.de>
parents:
773
diff
changeset
|
162 HTTP.post( |
bb3558142b18
client: add backendrequest to search
Bernhard Reiter <bernhard@intevation.de>
parents:
773
diff
changeset
|
163 "/search", |
bb3558142b18
client: add backendrequest to search
Bernhard Reiter <bernhard@intevation.de>
parents:
773
diff
changeset
|
164 { string: this.searchQuery }, |
bb3558142b18
client: add backendrequest to search
Bernhard Reiter <bernhard@intevation.de>
parents:
773
diff
changeset
|
165 { |
bb3558142b18
client: add backendrequest to search
Bernhard Reiter <bernhard@intevation.de>
parents:
773
diff
changeset
|
166 headers: { |
bb3558142b18
client: add backendrequest to search
Bernhard Reiter <bernhard@intevation.de>
parents:
773
diff
changeset
|
167 "X-Gemma-Auth": localStorage.getItem("token"), |
bb3558142b18
client: add backendrequest to search
Bernhard Reiter <bernhard@intevation.de>
parents:
773
diff
changeset
|
168 "Content-type": "text/xml; charset=UTF-8" |
bb3558142b18
client: add backendrequest to search
Bernhard Reiter <bernhard@intevation.de>
parents:
773
diff
changeset
|
169 } |
bb3558142b18
client: add backendrequest to search
Bernhard Reiter <bernhard@intevation.de>
parents:
773
diff
changeset
|
170 } |
bb3558142b18
client: add backendrequest to search
Bernhard Reiter <bernhard@intevation.de>
parents:
773
diff
changeset
|
171 ) |
bb3558142b18
client: add backendrequest to search
Bernhard Reiter <bernhard@intevation.de>
parents:
773
diff
changeset
|
172 .then(response => { |
779
8ba1be486833
client: improve search
Bernhard Reiter <bernhard@intevation.de>
parents:
776
diff
changeset
|
173 // console.log("got:", response.data); |
8ba1be486833
client: improve search
Bernhard Reiter <bernhard@intevation.de>
parents:
776
diff
changeset
|
174 this.searchResults = response.data; |
776
bb3558142b18
client: add backendrequest to search
Bernhard Reiter <bernhard@intevation.de>
parents:
773
diff
changeset
|
175 }) |
bb3558142b18
client: add backendrequest to search
Bernhard Reiter <bernhard@intevation.de>
parents:
773
diff
changeset
|
176 .catch(error => { |
bb3558142b18
client: add backendrequest to search
Bernhard Reiter <bernhard@intevation.de>
parents:
773
diff
changeset
|
177 const { status, data } = error.response; |
bb3558142b18
client: add backendrequest to search
Bernhard Reiter <bernhard@intevation.de>
parents:
773
diff
changeset
|
178 displayError({ |
bb3558142b18
client: add backendrequest to search
Bernhard Reiter <bernhard@intevation.de>
parents:
773
diff
changeset
|
179 title: "Backend Error", |
bb3558142b18
client: add backendrequest to search
Bernhard Reiter <bernhard@intevation.de>
parents:
773
diff
changeset
|
180 message: `${status}: ${data.message || data}` |
bb3558142b18
client: add backendrequest to search
Bernhard Reiter <bernhard@intevation.de>
parents:
773
diff
changeset
|
181 }); |
bb3558142b18
client: add backendrequest to search
Bernhard Reiter <bernhard@intevation.de>
parents:
773
diff
changeset
|
182 }); |
bb3558142b18
client: add backendrequest to search
Bernhard Reiter <bernhard@intevation.de>
parents:
773
diff
changeset
|
183 |
773
22c3acea700d
client: add to search processing
Bernhard Reiter <bernhard@intevation.de>
parents:
770
diff
changeset
|
184 this.isCalculating = false; |
22c3acea700d
client: add to search processing
Bernhard Reiter <bernhard@intevation.de>
parents:
770
diff
changeset
|
185 this.searchQueryIsDirty = false; |
776
bb3558142b18
client: add backendrequest to search
Bernhard Reiter <bernhard@intevation.de>
parents:
773
diff
changeset
|
186 }, |
781
f6a6ce90a1b5
client: improve search
Bernhard Reiter <bernhard@intevation.de>
parents:
779
diff
changeset
|
187 moveToSearchResult(resultEntry) { |
783
ab9604a46075
client: add move after clicking search result
Bernhard Reiter <bernhard@intevation.de>
parents:
781
diff
changeset
|
188 // DEBUG console.log("Moving to", resultEntry); |
ab9604a46075
client: add move after clicking search result
Bernhard Reiter <bernhard@intevation.de>
parents:
781
diff
changeset
|
189 if (resultEntry.geom.type == "Point") { |
ab9604a46075
client: add move after clicking search result
Bernhard Reiter <bernhard@intevation.de>
parents:
781
diff
changeset
|
190 let view = this.openLayersMap.getView(); |
ab9604a46075
client: add move after clicking search result
Bernhard Reiter <bernhard@intevation.de>
parents:
781
diff
changeset
|
191 view.animate( |
ab9604a46075
client: add move after clicking search result
Bernhard Reiter <bernhard@intevation.de>
parents:
781
diff
changeset
|
192 { |
ab9604a46075
client: add move after clicking search result
Bernhard Reiter <bernhard@intevation.de>
parents:
781
diff
changeset
|
193 center: fromLonLat( |
ab9604a46075
client: add move after clicking search result
Bernhard Reiter <bernhard@intevation.de>
parents:
781
diff
changeset
|
194 resultEntry.geom.coordinates, |
ab9604a46075
client: add move after clicking search result
Bernhard Reiter <bernhard@intevation.de>
parents:
781
diff
changeset
|
195 view.getProjection() |
ab9604a46075
client: add move after clicking search result
Bernhard Reiter <bernhard@intevation.de>
parents:
781
diff
changeset
|
196 ) |
ab9604a46075
client: add move after clicking search result
Bernhard Reiter <bernhard@intevation.de>
parents:
781
diff
changeset
|
197 }, |
ab9604a46075
client: add move after clicking search result
Bernhard Reiter <bernhard@intevation.de>
parents:
781
diff
changeset
|
198 700 |
ab9604a46075
client: add move after clicking search result
Bernhard Reiter <bernhard@intevation.de>
parents:
781
diff
changeset
|
199 ); |
781
f6a6ce90a1b5
client: improve search
Bernhard Reiter <bernhard@intevation.de>
parents:
779
diff
changeset
|
200 } |
783
ab9604a46075
client: add move after clicking search result
Bernhard Reiter <bernhard@intevation.de>
parents:
781
diff
changeset
|
201 // this.searchQuery = ""; // clear search query again |
ab9604a46075
client: add move after clicking search result
Bernhard Reiter <bernhard@intevation.de>
parents:
781
diff
changeset
|
202 this.toggleSearchbar(); |
781
f6a6ce90a1b5
client: improve search
Bernhard Reiter <bernhard@intevation.de>
parents:
779
diff
changeset
|
203 }, |
668
3e2eeb215d0e
feat: searchbar collapsible
Thomas Junk <thomas.junk@intevation.de>
parents:
649
diff
changeset
|
204 toggleSearchbar() { |
3e2eeb215d0e
feat: searchbar collapsible
Thomas Junk <thomas.junk@intevation.de>
parents:
649
diff
changeset
|
205 this.searchbarCollapsed = !this.searchbarCollapsed; |
3e2eeb215d0e
feat: searchbar collapsible
Thomas Junk <thomas.junk@intevation.de>
parents:
649
diff
changeset
|
206 }, |
585
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
207 toggleSidebar() { |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
208 this.$store.commit("application/toggleSidebar"); |
593
c4a4dc612191
feat: Toggleable fairway profile
Thomas Junk <thomas.junk@intevation.de>
parents:
587
diff
changeset
|
209 }, |
c4a4dc612191
feat: Toggleable fairway profile
Thomas Junk <thomas.junk@intevation.de>
parents:
587
diff
changeset
|
210 splitScreen() { |
c4a4dc612191
feat: Toggleable fairway profile
Thomas Junk <thomas.junk@intevation.de>
parents:
587
diff
changeset
|
211 this.$store.commit("application/toggleSplitScreen"); |
781
f6a6ce90a1b5
client: improve search
Bernhard Reiter <bernhard@intevation.de>
parents:
779
diff
changeset
|
212 } |
585
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
213 } |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
214 }; |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
215 </script> |