Mercurial > gemma
annotate client/src/bottlenecks/Bottlenecks.vue @ 1055:1ff8c072df18
WIP: Bottleneck list/table
author | Markus Kottlaender <markus@intevation.de> |
---|---|
date | Thu, 25 Oct 2018 15:05:20 +0200 |
parents | |
children | c9badb264d16 |
rev | line source |
---|---|
1055
1ff8c072df18
WIP: Bottleneck list/table
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
1 <template> |
1ff8c072df18
WIP: Bottleneck list/table
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
2 <div :class="bottlenecksStyle"> |
1ff8c072df18
WIP: Bottleneck list/table
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
3 <div @click="$store.commit('application/toggleBottlenecks');" class="ui-element close-bottlenecks"> |
1ff8c072df18
WIP: Bottleneck list/table
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
4 <i class="fa fa-close"></i> |
1ff8c072df18
WIP: Bottleneck list/table
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
5 </div> |
1ff8c072df18
WIP: Bottleneck list/table
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
6 |
1ff8c072df18
WIP: Bottleneck list/table
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
7 <div v-if="!this.bottlenecksCollapsed"> |
1ff8c072df18
WIP: Bottleneck list/table
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
8 <h4>Bottlenecks</h4> |
1ff8c072df18
WIP: Bottleneck list/table
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
9 <hr class="mb-0"> |
1ff8c072df18
WIP: Bottleneck list/table
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
10 <div style="max-height: 500px; overflow-y: scroll"> |
1ff8c072df18
WIP: Bottleneck list/table
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
11 <table class="table text-left mb-0" style="margin-top: -1px;"> |
1ff8c072df18
WIP: Bottleneck list/table
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
12 <tr v-for="(bottleneck, index) in bottlenecks"> |
1ff8c072df18
WIP: Bottleneck list/table
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
13 <td> |
1ff8c072df18
WIP: Bottleneck list/table
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
14 <a href="#" class="d-block" @click="moveToBottleneck(bottleneck)"> |
1ff8c072df18
WIP: Bottleneck list/table
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
15 {{ bottleneck.name }} |
1ff8c072df18
WIP: Bottleneck list/table
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
16 </a> |
1ff8c072df18
WIP: Bottleneck list/table
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
17 </td> |
1ff8c072df18
WIP: Bottleneck list/table
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
18 </tr> |
1ff8c072df18
WIP: Bottleneck list/table
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
19 </table> |
1ff8c072df18
WIP: Bottleneck list/table
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
20 </div> |
1ff8c072df18
WIP: Bottleneck list/table
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
21 </div> |
1ff8c072df18
WIP: Bottleneck list/table
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
22 </div> |
1ff8c072df18
WIP: Bottleneck list/table
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
23 </template> |
1ff8c072df18
WIP: Bottleneck list/table
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
24 |
1ff8c072df18
WIP: Bottleneck list/table
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
25 <script> |
1ff8c072df18
WIP: Bottleneck list/table
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
26 /* |
1ff8c072df18
WIP: Bottleneck list/table
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
27 * This is Free Software under GNU Affero General Public License v >= 3.0 |
1ff8c072df18
WIP: Bottleneck list/table
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
28 * without warranty, see README.md and license for details. |
1ff8c072df18
WIP: Bottleneck list/table
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
29 * |
1ff8c072df18
WIP: Bottleneck list/table
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
30 * SPDX-License-Identifier: AGPL-3.0-or-later |
1ff8c072df18
WIP: Bottleneck list/table
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
31 * License-Filename: LICENSES/AGPL-3.0.txt |
1ff8c072df18
WIP: Bottleneck list/table
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
32 * |
1ff8c072df18
WIP: Bottleneck list/table
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
33 * Copyright (C) 2018 by via donau |
1ff8c072df18
WIP: Bottleneck list/table
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
34 * – Österreichische Wasserstraßen-Gesellschaft mbH |
1ff8c072df18
WIP: Bottleneck list/table
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
35 * Software engineering by Intevation GmbH |
1ff8c072df18
WIP: Bottleneck list/table
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
36 * |
1ff8c072df18
WIP: Bottleneck list/table
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
37 * Author(s): |
1ff8c072df18
WIP: Bottleneck list/table
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
38 * Markus Kottländer <markus.kottlaender@intevation.de> |
1ff8c072df18
WIP: Bottleneck list/table
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
39 */ |
1ff8c072df18
WIP: Bottleneck list/table
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
40 import { mapState } from "vuex"; |
1ff8c072df18
WIP: Bottleneck list/table
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
41 import { fromLonLat } from "ol/proj"; |
1ff8c072df18
WIP: Bottleneck list/table
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
42 |
1ff8c072df18
WIP: Bottleneck list/table
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
43 export default { |
1ff8c072df18
WIP: Bottleneck list/table
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
44 name: "bottlenecks", |
1ff8c072df18
WIP: Bottleneck list/table
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
45 computed: { |
1ff8c072df18
WIP: Bottleneck list/table
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
46 ...mapState("application", ["bottlenecksCollapsed"]), |
1ff8c072df18
WIP: Bottleneck list/table
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
47 ...mapState("bottlenecks", ["bottlenecks"]), |
1ff8c072df18
WIP: Bottleneck list/table
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
48 ...mapState("mapstore", ["openLayersMap"]), |
1ff8c072df18
WIP: Bottleneck list/table
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
49 bottlenecksStyle() { |
1ff8c072df18
WIP: Bottleneck list/table
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
50 return { |
1ff8c072df18
WIP: Bottleneck list/table
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
51 "ui-element": true, |
1ff8c072df18
WIP: Bottleneck list/table
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
52 bottlenecks: true, |
1ff8c072df18
WIP: Bottleneck list/table
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
53 overlay: true, |
1ff8c072df18
WIP: Bottleneck list/table
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
54 bottleneckscollapsed: this.bottlenecksCollapsed, |
1ff8c072df18
WIP: Bottleneck list/table
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
55 bottlenecksextended: !this.bottlenecksCollapsed, |
1ff8c072df18
WIP: Bottleneck list/table
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
56 shadow: true |
1ff8c072df18
WIP: Bottleneck list/table
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
57 }; |
1ff8c072df18
WIP: Bottleneck list/table
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
58 } |
1ff8c072df18
WIP: Bottleneck list/table
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
59 }, |
1ff8c072df18
WIP: Bottleneck list/table
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
60 methods: { |
1ff8c072df18
WIP: Bottleneck list/table
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
61 // TODO: make this central, duplicates code from application/Topbar.vue |
1ff8c072df18
WIP: Bottleneck list/table
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
62 moveToBottleneck(bottleneck) { |
1ff8c072df18
WIP: Bottleneck list/table
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
63 if (bottleneck.geom.type == "Point") { |
1ff8c072df18
WIP: Bottleneck list/table
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
64 let view = this.openLayersMap.getView(); |
1ff8c072df18
WIP: Bottleneck list/table
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
65 const currentZoom = view.getZoom(); |
1ff8c072df18
WIP: Bottleneck list/table
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
66 const newZoom = Math.max(17, currentZoom); |
1ff8c072df18
WIP: Bottleneck list/table
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
67 view.animate( |
1ff8c072df18
WIP: Bottleneck list/table
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
68 { |
1ff8c072df18
WIP: Bottleneck list/table
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
69 zoom: newZoom, |
1ff8c072df18
WIP: Bottleneck list/table
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
70 center: fromLonLat( |
1ff8c072df18
WIP: Bottleneck list/table
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
71 bottleneck.geom.coordinates, |
1ff8c072df18
WIP: Bottleneck list/table
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
72 view.getProjection() |
1ff8c072df18
WIP: Bottleneck list/table
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
73 ) |
1ff8c072df18
WIP: Bottleneck list/table
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
74 }, |
1ff8c072df18
WIP: Bottleneck list/table
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
75 700 |
1ff8c072df18
WIP: Bottleneck list/table
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
76 ); |
1ff8c072df18
WIP: Bottleneck list/table
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
77 } |
1ff8c072df18
WIP: Bottleneck list/table
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
78 this.$store.commit("application/toggleBottlenecks"); |
1ff8c072df18
WIP: Bottleneck list/table
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
79 } |
1ff8c072df18
WIP: Bottleneck list/table
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
80 }, |
1ff8c072df18
WIP: Bottleneck list/table
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
81 mounted() { |
1ff8c072df18
WIP: Bottleneck list/table
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
82 this.$store.dispatch("bottlenecks/loadBottlenecks"); |
1ff8c072df18
WIP: Bottleneck list/table
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
83 } |
1ff8c072df18
WIP: Bottleneck list/table
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
84 }; |
1ff8c072df18
WIP: Bottleneck list/table
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
85 </script> |
1ff8c072df18
WIP: Bottleneck list/table
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
86 |
1ff8c072df18
WIP: Bottleneck list/table
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
87 <style lang="scss"> |
1ff8c072df18
WIP: Bottleneck list/table
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
88 .bottlenecks { |
1ff8c072df18
WIP: Bottleneck list/table
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
89 position: absolute; |
1ff8c072df18
WIP: Bottleneck list/table
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
90 z-index: -2; |
1ff8c072df18
WIP: Bottleneck list/table
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
91 top: $offset; |
1ff8c072df18
WIP: Bottleneck list/table
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
92 left: 64px; |
1ff8c072df18
WIP: Bottleneck list/table
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
93 background-color: #ffffff; |
1ff8c072df18
WIP: Bottleneck list/table
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
94 padding-top: $offset; |
1ff8c072df18
WIP: Bottleneck list/table
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
95 opacity: $slight-transparent; |
1ff8c072df18
WIP: Bottleneck list/table
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
96 border-radius: $border-radius; |
1ff8c072df18
WIP: Bottleneck list/table
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
97 } |
1ff8c072df18
WIP: Bottleneck list/table
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
98 |
1ff8c072df18
WIP: Bottleneck list/table
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
99 .bottleneckscollapsed { |
1ff8c072df18
WIP: Bottleneck list/table
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
100 width: 0; |
1ff8c072df18
WIP: Bottleneck list/table
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
101 height: 0; |
1ff8c072df18
WIP: Bottleneck list/table
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
102 transition: $transition-fast; |
1ff8c072df18
WIP: Bottleneck list/table
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
103 } |
1ff8c072df18
WIP: Bottleneck list/table
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
104 |
1ff8c072df18
WIP: Bottleneck list/table
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
105 .bottlenecksextended { |
1ff8c072df18
WIP: Bottleneck list/table
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
106 min-height: $sidebar-height; |
1ff8c072df18
WIP: Bottleneck list/table
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
107 width: 500px |
1ff8c072df18
WIP: Bottleneck list/table
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
108 } |
1ff8c072df18
WIP: Bottleneck list/table
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
109 |
1ff8c072df18
WIP: Bottleneck list/table
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
110 .close-bottlenecks { |
1ff8c072df18
WIP: Bottleneck list/table
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
111 position: absolute; |
1ff8c072df18
WIP: Bottleneck list/table
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
112 z-index: 2; |
1ff8c072df18
WIP: Bottleneck list/table
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
113 right: 0; |
1ff8c072df18
WIP: Bottleneck list/table
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
114 top: 7px; |
1ff8c072df18
WIP: Bottleneck list/table
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
115 border-radius: $border-radius; |
1ff8c072df18
WIP: Bottleneck list/table
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
116 height: $icon-width; |
1ff8c072df18
WIP: Bottleneck list/table
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
117 width: $icon-height; |
1ff8c072df18
WIP: Bottleneck list/table
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
118 display: none; |
1ff8c072df18
WIP: Bottleneck list/table
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
119 } |
1ff8c072df18
WIP: Bottleneck list/table
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
120 |
1ff8c072df18
WIP: Bottleneck list/table
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
121 .bottlenecksextended .close-bottlenecks { |
1ff8c072df18
WIP: Bottleneck list/table
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
122 display: block; |
1ff8c072df18
WIP: Bottleneck list/table
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
123 } |
1ff8c072df18
WIP: Bottleneck list/table
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
124 |
1ff8c072df18
WIP: Bottleneck list/table
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
125 </style> |