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